diff --git a/.documentation/SchemaUpdates.md b/.documentation/SchemaUpdates.md index b4e4e71b..eabe7fb2 100644 --- a/.documentation/SchemaUpdates.md +++ b/.documentation/SchemaUpdates.md @@ -1,21 +1,18 @@ these are the files you must change from the duc repo: -on the typescript side: -@duc/packages/ducjs/src/types/index.ts -@duc/packages/ducjs/src/restore/restoreDataState.ts (and other potential restore files related) -@duc/packages/ducjs/src/parse.ts -@duc/packages/ducjs/src/serialize.ts - on the rust side: @duc/packages/ducrs/src/types.rs @duc/packages/ducrs/src/parse.rs @duc/packages/ducrs/src/serialize.rs +on the typescript side: +@duc/packages/ducjs/src/types/index.ts +@duc/packages/ducjs/src/restore/restoreDataState.ts (and other potential restore files related) + + on the python side: @duc/packages/ducpy/src/ducpy/classes/DataStateClass.py -@duc/packages/ducpy/src/ducpy/parse.py -@duc/packages/ducpy/src/ducpy/serialize.py And then run the build (or test commands if available) for each from @duc/package.json -and in case you need to check the fbs schema or what changed (changes may be git staged): @duc/schema/duc.fbs \ No newline at end of file +and in case you need to check the fbs schema or what changed (changes may be git staged): @duc/schema/duc.sql \ No newline at end of file diff --git a/.github/workflows/deploy-ducpy-docs.yml b/.github/workflows/deploy-ducpy-docs.yml new file mode 100644 index 00000000..7f17ab72 --- /dev/null +++ b/.github/workflows/deploy-ducpy-docs.yml @@ -0,0 +1,69 @@ +name: Deploy Python Docs & Package Index + +on: + workflow_dispatch: + repository_dispatch: + types: [trigger-ducpy-docs-deployment] + push: + branches: + - main + paths: + - 'packages/ducpy/docs/**' + - 'packages/ducpy/src/ducpy/**' + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install Sphinx dependencies + run: pip install sphinx furo sphinx-autoapi + + - name: Build Sphinx documentation + run: sphinx-build -M html . _build + working-directory: packages/ducpy/docs + + - name: Stage site root + run: | + mkdir -p _site/reference/python + cp -r packages/ducpy/docs/_build/html/. _site/reference/python/ + + - name: Build PEP 503 Simple Package Index + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # simple/ lands at _site/simple/ → ducflair.github.io/duc/simple/ + run: python3 scripts/build-ducpy-simple-index.py _site + + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: _site + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/release-ducjs.yml b/.github/workflows/release-ducjs.yml index 887c20af..4df95099 100644 --- a/.github/workflows/release-ducjs.yml +++ b/.github/workflows/release-ducjs.yml @@ -38,6 +38,20 @@ jobs: uses: oven-sh/setup-bun@v2 with: bun-version: "latest" + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-unknown-unknown + + - name: Install native toolchain for wasm build + run: | + sudo apt-get update + sudo apt-get install -y clang + + - name: Install wasm-pack (pinned 0.14.x) + run: cargo install wasm-pack --version 0.14.0 --locked --force + # npm 11.5.1 or later must be installed for OIDC to work - name: Update npm run: npm install -g npm@latest diff --git a/.github/workflows/release-ducpdf.yml b/.github/workflows/release-ducpdf.yml index 601be7cb..148b686a 100644 --- a/.github/workflows/release-ducpdf.yml +++ b/.github/workflows/release-ducpdf.yml @@ -38,6 +38,20 @@ jobs: uses: oven-sh/setup-bun@v2 with: bun-version: "latest" + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-unknown-unknown + + - name: Install native toolchain for wasm build + run: | + sudo apt-get update + sudo apt-get install -y clang + + - name: Install wasm-pack + run: cargo install wasm-pack --locked + # npm 11.5.1 or later must be installed for OIDC to work - name: Update npm run: npm install -g npm@latest diff --git a/.github/workflows/release-ducpy.yml b/.github/workflows/release-ducpy.yml index 039fd247..7ded6306 100644 --- a/.github/workflows/release-ducpy.yml +++ b/.github/workflows/release-ducpy.yml @@ -73,6 +73,29 @@ jobs: exit 1 fi working-directory: ./packages/ducpy + + - name: Upload wheels to GitHub release + if: steps.release.outputs.status == 'success' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Get the tag created by semantic-release + TAG=$(git describe --tags --abbrev=0) + echo "Uploading wheels from dist/ to release $TAG" + + # Upload all wheels and source distributions + find packages/ducpy/dist -name "*.whl" -o -name "*.tar.gz" | while read file; do + echo "Uploading: $file" + gh release upload "$TAG" "$file" --clobber + done + + - name: Deploy Python documentation + if: steps.release.outputs.status == 'success' + uses: peter-evans/repository-dispatch@v3 + with: + event-type: trigger-ducpy-docs-deployment + token: ${{ secrets.GITHUB_TOKEN }} + - name: Notify web deployment if: steps.release.outputs.status == 'success' uses: peter-evans/repository-dispatch@v3 diff --git a/.github/workflows/release-ducsvg.yml b/.github/workflows/release-ducsvg.yml index 918bb736..bfcd629b 100644 --- a/.github/workflows/release-ducsvg.yml +++ b/.github/workflows/release-ducsvg.yml @@ -42,6 +42,18 @@ jobs: - name: Update npm run: npm install -g npm@latest + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-unknown-unknown + + - name: Install native toolchain for wasm build + run: | + sudo apt-get update + sudo apt-get install -y clang + + - name: Install wasm-pack + run: cargo install wasm-pack --locked - name: Install deps run: bun install diff --git a/.gitignore b/.gitignore index d20ddbbc..9abb70b1 100644 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,6 @@ sst.pyi # opennext .open-next -# flatc build_logs .claude diff --git a/.vscode/extensions.json b/.vscode/extensions.json index fd85cfe0..42173263 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,7 +2,6 @@ "recommendations": [ "rust-lang.rust-analyzer", "streetsidesoftware.code-spell-checker", - "gaborv.flatbuffers", "PKief.material-icon-theme", "bradlc.vscode-tailwindcss", "ducflair.duc", diff --git a/Cargo.lock b/Cargo.lock index 7ca6c26f..4a3ddde3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,18 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "accessory" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28e416a3ab45838bac2ab2d81b1088d738d7b2d2c5272a54d39366565a29bd80" +dependencies = [ + "macroific", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "adler2" version = "2.0.1" @@ -290,6 +302,20 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" +[[package]] +name = "delegate-display" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9926686c832494164c33a36bf65118f4bd6e704000b58c94681bf62e9ad67a74" +dependencies = [ + "impartial-ord", + "itoa", + "macroific", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "deranged" version = "0.5.4" @@ -299,6 +325,28 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn", + "unicode-xid", +] + [[package]] name = "digest" version = "0.10.7" @@ -315,13 +363,18 @@ version = "0.0.0-development" dependencies = [ "base64 0.21.7", "env_logger", - "flatbuffers", "flate2", "lazy_static", "log", "percent-encoding", + "rusqlite", "serde", + "serde_bytes", "serde_json", + "serde_repr", + "sqlite-wasm-vfs", + "thiserror", + "wasm-bindgen", ] [[package]] @@ -343,6 +396,29 @@ dependencies = [ "web-sys", ] +[[package]] +name = "ducjs-wasm" +version = "0.0.0-development" +dependencies = [ + "duc", + "js-sys", + "serde", + "serde-wasm-bindgen", + "serde_json", + "wasm-bindgen", +] + +[[package]] +name = "ducpy-native" +version = "0.0.0" +dependencies = [ + "duc", + "pyo3", + "pythonize", + "serde", + "serde_json", +] + [[package]] name = "ecb" version = "0.1.2" @@ -395,6 +471,30 @@ dependencies = [ "num-traits", ] +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + +[[package]] +name = "fancy_constructor" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28a27643a5d05f3a22f5afd6e0d0e6e354f92d37907006f97b84b9cb79082198" +dependencies = [ + "macroific", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "fastrand" version = "2.3.0" @@ -416,16 +516,6 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" -[[package]] -name = "flatbuffers" -version = "25.9.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b6620799e7340ebd9968d2e0708eb82cf1971e9a16821e2091b6d6e475eed5" -dependencies = [ - "bitflags 2.10.0", - "rustc_version", -] - [[package]] name = "flate2" version = "1.1.4" @@ -442,6 +532,12 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "font-types" version = "0.10.0" @@ -510,9 +606,21 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashlink" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea0b22561a9c04a7cb1a302c013e0259cd3b4bb619f145b32f72b8b4bcbed230" +dependencies = [ + "hashbrown", +] [[package]] name = "hayro" @@ -584,6 +692,12 @@ dependencies = [ "zune-jpeg", ] +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.5.2" @@ -666,6 +780,51 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edcd27d72f2f071c64249075f42e205ff93c9a4c5f6c6da53e79ed9f9832c285" +[[package]] +name = "impartial-ord" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab604ee7085efba6efc65e4ebca0e9533e3aff6cb501d7d77b211e3a781c6d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "indexed_db_futures" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69ff41758cbd104e91033bb53bc449bec7eea65652960c81eddf3fc146ecea19" +dependencies = [ + "accessory", + "cfg-if", + "delegate-display", + "derive_more", + "fancy_constructor", + "indexed_db_futures_macros_internal", + "js-sys", + "sealed", + "smallvec", + "thiserror", + "tokio", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "indexed_db_futures_macros_internal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caeba94923b68f254abef921cea7e7698bf4675fdd89d7c58bf1ed885b49a27d" +dependencies = [ + "macroific", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "indexmap" version = "2.12.0" @@ -676,6 +835,15 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "indoc" +version = "2.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706" +dependencies = [ + "rustversion", +] + [[package]] name = "inout" version = "0.1.4" @@ -812,6 +980,17 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "libsqlite3-sys" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b4103cffefa72eb8428cb6b47d6627161e51c2739fc5e3b734584157bc642a" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linebender_resource_handle" version = "0.1.1" @@ -856,6 +1035,54 @@ dependencies = [ "weezl", ] +[[package]] +name = "macroific" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89f276537b4b8f981bf1c13d79470980f71134b7bdcc5e6e911e910e556b0285" +dependencies = [ + "macroific_attr_parse", + "macroific_core", + "macroific_macro", +] + +[[package]] +name = "macroific_attr_parse" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad4023761b45fcd36abed8fb7ae6a80456b0a38102d55e89a57d9a594a236be9" +dependencies = [ + "proc-macro2", + "quote", + "sealed", + "syn", +] + +[[package]] +name = "macroific_core" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a7594d3c14916fa55bef7e9d18c5daa9ed410dd37504251e4b75bbdeec33e3" +dependencies = [ + "proc-macro2", + "quote", + "sealed", + "syn", +] + +[[package]] +name = "macroific_macro" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4da6f2ed796261b0a74e2b52b42c693bb6dee1effba3a482c49592659f824b3b" +dependencies = [ + "macroific_attr_parse", + "macroific_core", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "md-5" version = "0.10.6" @@ -881,6 +1108,15 @@ dependencies = [ "libc", ] +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -1033,6 +1269,18 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + [[package]] name = "png" version = "0.17.16" @@ -1107,6 +1355,79 @@ dependencies = [ "num-traits", ] +[[package]] +name = "pyo3" +version = "0.23.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7778bffd85cf38175ac1f545509665d0b9b92a198ca7941f131f85f7a4f9a872" +dependencies = [ + "cfg-if", + "indoc", + "libc", + "memoffset", + "once_cell", + "portable-atomic", + "pyo3-build-config", + "pyo3-ffi", + "pyo3-macros", + "unindent", +] + +[[package]] +name = "pyo3-build-config" +version = "0.23.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94f6cbe86ef3bf18998d9df6e0f3fc1050a8c5efa409bf712e661a4366e010fb" +dependencies = [ + "once_cell", + "target-lexicon", +] + +[[package]] +name = "pyo3-ffi" +version = "0.23.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f1b4c431c0bb1c8fb0a338709859eed0d030ff6daa34368d3b152a63dfdd8d" +dependencies = [ + "libc", + "pyo3-build-config", +] + +[[package]] +name = "pyo3-macros" +version = "0.23.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc2201328f63c4710f68abdf653c89d8dbc2858b88c5d88b0ff38a75288a9da" +dependencies = [ + "proc-macro2", + "pyo3-macros-backend", + "quote", + "syn", +] + +[[package]] +name = "pyo3-macros-backend" +version = "0.23.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fca6726ad0f3da9c9de093d6f116a93c1a38e417ed73bf138472cf4064f72028" +dependencies = [ + "heck", + "proc-macro2", + "pyo3-build-config", + "quote", + "syn", +] + +[[package]] +name = "pythonize" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91a6ee7a084f913f98d70cdc3ebec07e852b735ae3059a1500db2661265da9ff" +dependencies = [ + "pyo3", + "serde", +] + [[package]] name = "quick-error" version = "2.0.1" @@ -1254,6 +1575,31 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" +[[package]] +name = "rsqlite-vfs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8a1f2315036ef6b1fbacd1972e8ee7688030b0a2121edfc2a6550febd41574d" +dependencies = [ + "hashbrown", + "thiserror", +] + +[[package]] +name = "rusqlite" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1c93dd1c9683b438c392c492109cb702b8090b2bfc8fed6f6e4eb4523f17af3" +dependencies = [ + "bitflags 2.10.0", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", + "sqlite-wasm-rs", +] + [[package]] name = "rustc-hash" version = "2.1.1" @@ -1299,6 +1645,17 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +[[package]] +name = "sealed" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f968c5ea23d555e670b449c1c5e7b2fc399fdaec1d304a17cd48e288abc107" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "semver" version = "1.0.27" @@ -1315,6 +1672,27 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-wasm-bindgen" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + +[[package]] +name = "serde_bytes" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" +dependencies = [ + "serde", + "serde_core", +] + [[package]] name = "serde_core" version = "1.0.228" @@ -1348,6 +1726,17 @@ dependencies = [ "serde_core", ] +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sha2" version = "0.10.9" @@ -1417,6 +1806,34 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +[[package]] +name = "sqlite-wasm-rs" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4206ed3a67690b9c29b77d728f6acc3ce78f16bf846d83c94f76400320181b" +dependencies = [ + "cc", + "js-sys", + "rsqlite-vfs", + "wasm-bindgen", +] + +[[package]] +name = "sqlite-wasm-vfs" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7a5c9ac229421d577bb5a9bb59048838509958b218dd4e0b3c1214a87c361e" +dependencies = [ + "indexed_db_futures", + "js-sys", + "rsqlite-vfs", + "thiserror", + "tokio", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -1517,6 +1934,12 @@ dependencies = [ "syn", ] +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + [[package]] name = "termcolor" version = "1.4.1" @@ -1618,6 +2041,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tokio" +version = "1.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "ttf-parser" version = "0.20.0" @@ -1690,6 +2122,18 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "unindent" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3" + [[package]] name = "usvg" version = "0.45.1" @@ -1717,6 +2161,12 @@ dependencies = [ "xmlwriter", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" @@ -1759,6 +2209,19 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e038d41e478cc73bae0ff9b36c60cff1c98b8f38f8d7e8061e79ee63608ac5c" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.104" diff --git a/Cargo.toml b/Cargo.toml index 3021e5da..7a1efe48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,8 @@ resolver = "2" members = [ "packages/ducrs", + "packages/ducjs/crate", + "packages/ducpy/crate", "packages/ducpdf/src/duc2pdf", "packages/ducsvg/src/pdf2svg", ] diff --git a/README.md b/README.md index 7a2f1e53..6f2262b4 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Rust - + Python @@ -58,6 +58,11 @@ Join our growing community to discuss, collaborate, and share insights about the ## Commit Message Guidelines To assure semantic release works, follow [these guidelines](https://semantic-release.gitbook.io/semantic-release#how-does-it-work). +Notes: + +- Package names are inferred from the configured semantic-release `paths` (for example, `packages/ducpy` -> `ducpy`). +- Use lowercase package names to keep it consistent. + --- > The duc format and libraries are constantly evolving, with the aim to set new standards in the 2D CAD industry. Be a part of this change and help shape the future of design technology! diff --git a/apps/web/content/docs/python/api.mdx b/apps/web/content/docs/python/api.mdx index a59ba943..c1771133 100644 --- a/apps/web/content/docs/python/api.mdx +++ b/apps/web/content/docs/python/api.mdx @@ -6,6 +6,6 @@ authors: [jorgedanisc] For a complete and detailed API reference, please visit our: -# [ducpy API Documentation](https://python.duc.ducflair.com/) +# [ducpy API Documentation](https://ducflair.github.io/duc/reference/python/) > The documentation is automatically generated from the source code using Sphinx diff --git a/apps/web/content/docs/python/classes.mdx b/apps/web/content/docs/python/classes.mdx deleted file mode 100644 index 5bf1877c..00000000 --- a/apps/web/content/docs/python/classes.mdx +++ /dev/null @@ -1,131 +0,0 @@ ---- -title: "Classes" -date: 2024-04-22 -authors: [jorgedanisc] ---- - - -## Overview - -The classes module in `ducpy` provides Python class definitions that represent the various components of a duc file. These classes define the structure and properties of elements, application state, and binary files in a duc document. - -## Main Classes - -### DucElement - -The `DucElement` class is the base class for all elements in a duc file: - -```python -from ducpy.classes import DucElementClass - -# Access the DucElement class -element = DucElementClass.DucElement() - -# Set properties -element.id = "unique_id" -element.type = "text" -element.x_v3 = 100.0 -element.y_v3 = 200.0 -element.width_v3 = 300.0 -element.height_v3 = 150.0 -``` - -The `DucElementUnion` is a type union that can represent any specific element type (text, line, image, etc.). - -### AppState - -The `AppState` class represents the state of the application when the duc file was saved: - -```python -from ducpy.classes import AppStateClass - -# Create an AppState object -app_state = AppStateClass.AppState() - -# Set properties -app_state.zoom = 1.0 -app_state.scroll_x = 0.0 -app_state.scroll_y = 0.0 -app_state.view_background_color = "#ffffff" -``` - -### DucExternalFiles - -The `DucExternalFiles` class stores binary data (such as images) embedded in the duc file: - -```python -from ducpy.classes import BinaryFilesClass - -# Create a DucExternalFiles object -files = BinaryFilesClass.DucExternalFiles() - -# Add a binary file -file_data = BinaryFilesClass.DucExternalFileData() -file_data.id = "file_id" -file_data.mime_type = "image/png" -file_data.data = b'...' # Binary data -files.entries[file_data.id] = file_data -``` - -## Element Types - -The duc format supports several element types, each represented by specific classes: - -### Text Element - -Text elements represent text objects in the duc document: - -```python -# Create a text element -text_element = DucElementClass.DucElement() -text_element.id = "text1" -text_element.type = "text" -text_element.text = "Hello, World!" -text_element.font_family = "Arial" -text_element.font_size_v3 = 16.0 -``` - -### Line Element - -Line elements represent vector lines: - -```python -# Create a line element -line_element = DucElementClass.DucElement() -line_element.id = "line1" -line_element.type = "line" - -# Add points to the line -point1 = DucElementClass.Point() -point1.x_v3 = 100.0 -point1.y_v3 = 100.0 - -point2 = DucElementClass.Point() -point2.x_v3 = 200.0 -point2.y_v3 = 200.0 - -line_element.points = [point1, point2] -``` - -### Image Element - -Image elements represent embedded images: - -```python -# Create an image element -image_element = DucElementClass.DucElement() -image_element.id = "image1" -image_element.type = "image" -image_element.file_id = "file_id" # Reference to a binary file -``` - -## Relationships Between Classes - -The duc file structure has hierarchical relationships between its components: - -- A duc file contains elements, app state, and binary files -- Elements can be grouped and have parent-child relationships -- Elements can reference binary files for content -- App state contains information about the view and selected elements - -Understanding these relationships is crucial for effective manipulation of duc files. \ No newline at end of file diff --git a/apps/web/content/docs/python/examples.mdx b/apps/web/content/docs/python/examples.mdx deleted file mode 100644 index 31fdb40c..00000000 --- a/apps/web/content/docs/python/examples.mdx +++ /dev/null @@ -1,270 +0,0 @@ ---- -title: "Examples" -date: 2024-04-22 -authors: [jorgedanisc] ---- - - -## Common Use Cases - -This page demonstrates common use cases for the `ducpy` library with complete examples. - -### Create a New Duc File from Scratch - -```python -import ducpy as duc -from ducpy.classes import DucElementClass, AppStateClass, BinaryFilesClass - -# Create app state -app_state = AppStateClass.AppState() -app_state.zoom = 1.0 -app_state.scroll_x = 0 -app_state.scroll_y = 0 -app_state.view_background_color = "#ffffff" - -# Create elements -elements = [] - -# Add a text element -text = DucElementClass.DucElement() -text.id = "text1" -text.type = "text" -text.text = "Hello, Duc File Format!" -text.font_family = "Arial" -text.font_size_v3 = 24.0 -text.x_v3 = 100 -text.y_v3 = 100 -text.width_v3 = 300 -text.height_v3 = 50 -elements.append(text) - -# Add a rectangle -rect = DucElementClass.DucElement() -rect.id = "rect1" -rect.type = "line" -rect.x_v3 = 100 -rect.y_v3 = 200 -rect.width_v3 = 200 -rect.height_v3 = 100 - -# Create points for rectangle -p1 = DucElementClass.Point() -p1.x_v3, p1.y_v3 = 100, 200 -p2 = DucElementClass.Point() -p2.x_v3, p2.y_v3 = 300, 200 -p3 = DucElementClass.Point() -p3.x_v3, p3.y_v3 = 300, 300 -p4 = DucElementClass.Point() -p4.x_v3, p4.y_v3 = 100, 300 -p5 = DucElementClass.Point() -p5.x_v3, p5.y_v3 = 100, 200 -rect.points = [p1, p2, p3, p4, p5] -elements.append(rect) - -# Create binary files container -files = BinaryFilesClass.DucExternalFiles() - -# Save to file -with open("new_drawing.duc", "wb") as f: - duc.serialize.serialize_to_flatbuffers(elements, app_state, files, f) -``` - -### Read and Modify an Existing Duc File - -```python -import ducpy as duc - -# Open and parse an existing duc file -with open("example.duc", "rb") as f: - duc_data = duc.parse.parse_duc_flatbuffers(f) - -elements = duc_data["elements"] -app_state = duc_data["appState"] -files = duc_data["files"] - -# Find all text elements -text_elements = [elem for elem in elements if elem.type == "text"] - -# Modify text elements -for text_elem in text_elements: - # Make all text uppercase - text_elem.text = text_elem.text.upper() - # Increase font size by 2 - if hasattr(text_elem, "font_size_v3") and text_elem.font_size_v3: - text_elem.font_size_v3 += 2.0 - -# Save modified file -with open("modified_example.duc", "wb") as f: - duc.serialize.serialize_to_flatbuffers(elements, app_state, files, f) -``` - -### Extract and Process Images - -```python -import ducpy as duc -import os -from PIL import Image -import io - -# Open a duc file -with open("with_images.duc", "rb") as f: - duc_data = duc.parse.parse_duc_flatbuffers(f) - -elements = duc_data["elements"] -files = duc_data["files"] - -# Create output directory -os.makedirs("extracted_images", exist_ok=True) - -# Find all image elements -image_elements = [elem for elem in elements if elem.type == "image"] - -# Extract and process images -for img_elem in image_elements: - if hasattr(img_elem, "file_id") and img_elem.file_id in files.entries: - file_data = files.entries[img_elem.file_id] - - # Create a PIL image from binary data - img = Image.open(io.BytesIO(file_data.data)) - - # Apply some processing (e.g., grayscale conversion) - img_gray = img.convert('L') - - # Save processed image - img_gray.save(f"extracted_images/{img_elem.id}_gray.png") - - # Re-save to binary data - output = io.BytesIO() - img_gray.save(output, format='PNG') - - # Update binary data in the files storage - file_data.data = output.getvalue() - -# Save modified file with processed images -with open("processed_images.duc", "wb") as f: - duc.serialize.serialize_to_flatbuffers(elements, duc_data["appState"], files, f) -``` - -### Creating an Animation - -```python -import ducpy as duc -import copy -import math - -# Create a new duc file with animation frames -app_state = duc.classes.AppStateClass.AppState() -app_state.zoom = 1.0 -files = duc.classes.BinaryFilesClass.DucExternalFiles() - -# Create a circle element -def create_circle(x, y, radius): - circle = duc.classes.DucElementClass.DucElement() - circle.id = f"circle_{x}_{y}" - circle.type = "line" - circle.x_v3 = x - circle.y_v3 = y - - # Create points for a circle approximation - points = [] - for i in range(36): - angle = math.radians(i * 10) - point = duc.classes.DucElementClass.Point() - point.x_v3 = x + radius * math.cos(angle) - point.y_v3 = y + radius * math.sin(angle) - points.append(point) - - # Add closing point - closing_point = copy.deepcopy(points[0]) - points.append(closing_point) - - circle.points = points - return circle - -# Generate 10 animation frames -for frame in range(10): - elements = [] - - # Create a circle with increasing radius - radius = 50 + frame * 10 - circle = create_circle(300, 300, radius) - elements.append(circle) - - # Save each frame as a separate file - with open(f"animation_frame_{frame}.duc", "wb") as f: - duc.serialize.serialize_to_flatbuffers(elements, app_state, files, f) -``` - -## Integration with Other Libraries - -### Using ducpy with NumPy for Data Visualization - -```python -import ducpy as duc -import numpy as np - -# Create sample data -x = np.linspace(0, 10, 100) -y = np.sin(x) - -# Scale data to fit in the drawing -scale_x = 50 -scale_y = 50 -offset_x = 100 -offset_y = 200 - -# Create app state and files -app_state = duc.classes.AppStateClass.AppState() -app_state.zoom = 1.0 -files = duc.classes.BinaryFilesClass.DucExternalFiles() - -# Create elements list -elements = [] - -# Create a line chart from NumPy data -line = duc.classes.DucElementClass.DucElement() -line.id = "sin_curve" -line.type = "line" - -# Convert NumPy data to points -points = [] -for i in range(len(x)): - point = duc.classes.DucElementClass.Point() - point.x_v3 = offset_x + x[i] * scale_x - point.y_v3 = offset_y - y[i] * scale_y # Negative to flip Y axis - points.append(point) - -line.points = points -elements.append(line) - -# Add axes -x_axis = duc.classes.DucElementClass.DucElement() -x_axis.id = "x_axis" -x_axis.type = "line" -x_axis_p1 = duc.classes.DucElementClass.Point() -x_axis_p1.x_v3 = offset_x -x_axis_p1.y_v3 = offset_y -x_axis_p2 = duc.classes.DucElementClass.Point() -x_axis_p2.x_v3 = offset_x + 10 * scale_x -x_axis_p2.y_v3 = offset_y -x_axis.points = [x_axis_p1, x_axis_p2] -elements.append(x_axis) - -y_axis = duc.classes.DucElementClass.DucElement() -y_axis.id = "y_axis" -y_axis.type = "line" -y_axis_p1 = duc.classes.DucElementClass.Point() -y_axis_p1.x_v3 = offset_x -y_axis_p1.y_v3 = offset_y + scale_y -y_axis_p2 = duc.classes.DucElementClass.Point() -y_axis_p2.x_v3 = offset_x -y_axis_p2.y_v3 = offset_y - scale_y -y_axis.points = [y_axis_p1, y_axis_p2] -elements.append(y_axis) - -# Save the visualization -with open("numpy_visualization.duc", "wb") as f: - duc.serialize.serialize_to_flatbuffers(elements, app_state, files, f) -``` - -These examples demonstrate some of the common use cases and integration possibilities for the `ducpy` library. You can adapt and extend these examples to fit your specific needs. \ No newline at end of file diff --git a/apps/web/content/docs/python/overview.mdx b/apps/web/content/docs/python/overview.mdx index be2caef8..eddcdea3 100644 --- a/apps/web/content/docs/python/overview.mdx +++ b/apps/web/content/docs/python/overview.mdx @@ -1,50 +1,108 @@ --- title: "Overview" -date: 2024-04-22 +date: 2026-02-27 authors: [jorgedanisc] -description: "This Library is targeted to provide a set of tools to allow easier manipulation and readability, particularly for Data Related Programming." +description: "Python library for reading, writing and manipulating .duc CAD files — backed by SQLite." --- - ## Installation ```bash pip install ducpy ``` -or + +or + ```bash uv add ducpy ``` -## Basic Usage +## How it works + +A `.duc` file is a standard **SQLite database**. `ducpy` provides two complementary APIs +for working with these files: + +| API | Best for | +|-----|----------| +| **Builders** | Constructing elements programmatically with type-safe Python classes | +| **DucSQL** | Raw SQL access — batch inserts, complex queries, schema introspection | -The `ducpy` package provides Python types and utility functions to work with the `duc` CAD file format. Here's a quick overview of how to use it: +## Builders API + +Use the fluent builder DSL to create elements, then serialize to bytes or a `.duc` file. ```python -# Import the ducpy package import ducpy as duc -# Parse a duc file -with open('example.duc', 'rb') as f: - duc_data = duc.parse.parse_duc_flatbuffers(f) +# Build elements +rect = ( + duc.ElementBuilder() + .at_position(0, 0) + .with_size(100, 50) + .with_label("My Rectangle") + .with_styles(duc.create_fill_and_stroke_style( + fill_content=duc.create_solid_content("#4ECDC4"), + stroke_content=duc.create_solid_content("#2C3E50"), + stroke_width=2.0, + )) + .build_rectangle() + .build() +) + +# Serialize to bytes, then write to disk +data = duc.serialize_duc(name="my-drawing", elements=[rect]) +with open("output.duc", "wb") as f: + f.write(data) +``` + +## SQL Builder API -# Access elements, app state, and files -elements = duc_data['elements'] -app_state = duc_data['appState'] -files = duc_data['files'] +For direct, low-level access to the SQLite schema: -# Serialize a duc file -with open('output.duc', 'wb') as f: - duc.serialize.serialize_to_flatbuffers(elements, app_state, files, f) +```python +from ducpy.builders.sql_builder import DucSQL + +# Create a brand-new .duc file with the full schema bootstrapped +with DucSQL.new() as db: + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label) " + "VALUES (?,?,?,?,?,?,?)", + "r1", "rectangle", 0, 0, 200, 100, "SQL Rectangle", + ) + db.sql( + "INSERT INTO backgrounds (owner_type, owner_id, src, opacity) " + "VALUES (?,?,?,?)", + "element", "r1", "#FF6B6B", 1.0, + ) + db.save("output.duc") + +# Open and query an existing .duc file +with DucSQL("output.duc") as db: + rows = db.sql("SELECT id, label, element_type FROM elements") + for row in rows: + print(dict(row)) ``` -## Package Structure +## Parsing an existing file + +```python +import ducpy as duc -The `ducpy` package is organized into the following main modules: +with open("drawing.duc", "rb") as f: + data = duc.parse_duc(f) + +print(f"Elements: {len(data.elements)}") +print(f"Source: {data.source}") +``` -- **parse**: Functions for parsing duc files and converting to Python objects -- **serialize**: Functions for serializing Python objects back to duc format -- **classes**: Python class definitions for duc entities -- **utils**: Utility functions for working with duc files +## Package structure -Each module provides specific functionality for working with different aspects of the duc file format. +| Module | Purpose | +|--------|---------| +| `builders` | Fluent builders for elements, states, styles | +| `builders.sql_builder` | `DucSQL` — raw SQLite access | +| `classes` | Dataclass definitions for all duc entities | +| `enums` | Integer enum constants matching the schema | +| `parse` | `parse_duc()`, `parse_duc_lazy()`, `get_external_file()` | +| `serialize` | `serialize_duc()` | +| `utils` | Helper utilities | diff --git a/apps/web/content/docs/python/parsing.mdx b/apps/web/content/docs/python/parsing.mdx deleted file mode 100644 index 0c56914a..00000000 --- a/apps/web/content/docs/python/parsing.mdx +++ /dev/null @@ -1,90 +0,0 @@ ---- -title: "Parsing" -date: 2024-04-22 -authors: [jorgedanisc] ---- - - -## Overview - -The parsing module in `ducpy` provides functions to read and parse duc files into Python objects. These functions convert the FlatBuffers binary format into structured Python objects that you can easily work with in your code. - -## Main Functions - -### Parse Duc File - -The main function for parsing a complete duc file: - -```python -from ducpy import parse - -# Open a duc file -with open('example.duc', 'rb') as f: - # Parse the entire file - duc_data = parse.parse_duc_flatbuffers(f) - - # Access the parsed data - elements = duc_data['elements'] # List of DucElement objects - app_state = duc_data['appState'] # AppState object - files = duc_data['files'] # DucExternalFiles object - file_type = duc_data['type'] # File type string - version = duc_data['version'] # File version number - source = duc_data['source'] # Source string -``` - -### Parse Individual Components - -You can also parse individual components of a duc file: - -#### Parse Duc Elements - -```python -from ducpy.parse import parse_duc_element - -# Parse a single element from the file -element = parse_duc_element(data.Elements(0)) -``` - -#### Parse App State - -```python -from ducpy.parse import parse_app_state - -# Parse the application state -app_state = parse_app_state(data.AppState()) -``` - -#### Parse Binary Files - -```python -from ducpy.parse import parse_binary_files - -# Parse binary files included in the duc file -files = parse_binary_files(data.Files()) -``` - -## Returned Data Structure - -When parsing a duc file, you get a dictionary with the following keys: - -- `elements`: A list of `DucElementUnion` objects representing all elements in the file -- `appState`: An `AppState` object containing application state information -- `files`: A `DucExternalFiles` object containing any binary files embedded in the duc file -- `type`: The file type string -- `version`: The file version number -- `source`: The source of the file - -## Element Types - -The duc format supports several element types, each with specific properties: - -- Text elements -- Line elements -- Freedraw elements -- Image elements -- Frame elements -- Group elements -- Magic frame elements -- Iframe elements - -Each element type is parsed into a corresponding Python object with appropriate properties. \ No newline at end of file diff --git a/apps/web/content/docs/python/serializing.mdx b/apps/web/content/docs/python/serializing.mdx deleted file mode 100644 index 591894f4..00000000 --- a/apps/web/content/docs/python/serializing.mdx +++ /dev/null @@ -1,126 +0,0 @@ ---- -title: "Serializing" -date: 2024-04-22 -authors: [jorgedanisc] ---- - -## Overview - -The serializing module in `ducpy` provides functions to convert Python objects into the duc file format. These functions transform structured Python objects back into the FlatBuffers binary format for storage or transmission. - -## Main Functions - -### Serialize to Duc File - -The main function for serializing a complete duc file: - -```python -from ducpy import serialize - -# Prepare your data -elements = [...] # List of DucElement objects -app_state = ... # AppState object -files = ... # DucExternalFiles object - -# Serialize to a file -with open('output.duc', 'wb') as f: - serialize.serialize_to_flatbuffers(elements, app_state, files, f) -``` - -### Serialize Individual Components - -You can also serialize individual components of a duc file: - -#### Serialize Duc Elements - -```python -from ducpy.serialize import serialize_duc_element - -# Serialize a single element -builder = flatbuffers.Builder(0) -element_offset = serialize_duc_element(builder, element) -``` - -#### Serialize App State - -```python -from ducpy.serialize import serialize_app_state - -# Serialize the application state -builder = flatbuffers.Builder(0) -app_state_offset = serialize_app_state(builder, app_state) -``` - -#### Serialize Binary Files - -```python -from ducpy.serialize import serialize_binary_files - -# Serialize binary files -builder = flatbuffers.Builder(0) -files_offset = serialize_binary_files(builder, files) -``` - -## Input Data Structure - -When serializing a duc file, you need to provide: - -- `elements`: A list of `DucElementUnion` objects representing all elements in the file -- `app_state`: An `AppState` object containing application state information -- `files`: A `DucExternalFiles` object containing any binary files to embed in the duc file - -## Custom Serialization - -For advanced use cases, you can create a custom serialization process: - -```python -import flatbuffers -from ducpy.serialize import ( - serialize_duc_element, - serialize_app_state, - serialize_binary_files -) -from ducpy.Duc.ExportedDataState import ExportedDataStateStart, ExportedDataStateEnd -from ducpy.Duc.ExportedDataState import ExportedDataStateAddElements, ExportedDataStateAddAppState, ExportedDataStateAddFiles - -# Create a builder -builder = flatbuffers.Builder(0) - -# Serialize components -elements_vector = [] -for element in elements: - elements_vector.append(serialize_duc_element(builder, element)) - -elements_offset = builder.CreateVector(elements_vector) -app_state_offset = serialize_app_state(builder, app_state) -files_offset = serialize_binary_files(builder, files) - -# Start building the root object -ExportedDataStateStart(builder) -ExportedDataStateAddElements(builder, elements_offset) -ExportedDataStateAddAppState(builder, app_state_offset) -ExportedDataStateAddFiles(builder, files_offset) - -# Set additional properties if needed -if type_str: - type_offset = builder.CreateString(type_str) - ExportedDataStateAddType(builder, type_offset) - -if version: - ExportedDataStateAddVersion(builder, version) - -if source: - source_offset = builder.CreateString(source) - ExportedDataStateAddSource(builder, source_offset) - -# Finish building -data_offset = ExportedDataStateEnd(builder) -builder.Finish(data_offset) - -# Get the serialized data -buf = builder.Output() - -# Write to a file -with open('custom_output.duc', 'wb') as f: - f.write(buf) -``` \ No newline at end of file diff --git a/apps/web/content/docs/rust/overview.mdx b/apps/web/content/docs/rust/overview.mdx index 30471de1..75799ac3 100644 --- a/apps/web/content/docs/rust/overview.mdx +++ b/apps/web/content/docs/rust/overview.mdx @@ -1,8 +1,8 @@ --- title: "Overview" -date: 2025-04-20 +date: 2026-02-27 authors: [jorgedanisc] -description: "This Library is targeted to interface Rust with the duc format." +description: "Rust library for reading, writing and manipulating .duc CAD files — backed by SQLite." --- import { Callout } from 'fumadocs-ui/components/callout'; @@ -11,9 +11,29 @@ import { Callout } from 'fumadocs-ui/components/callout'; This page is subject to change as the project is still in development. +## How it works + +A `.duc` file is a standard **SQLite database**. `ducrs` wraps it with a typed, idiomatic Rust API. ## Installation -```bash +Add the crate to your `Cargo.toml`: + +```toml +[dependencies] +ducrs = "*" +``` + +## Basic Usage + +```rust +use ducrs::DucFile; +fn main() -> anyhow::Result<()> { + let doc = DucFile::open("drawing.duc")?; + for element in doc.elements()? { + println!("{:?}", element); + } + Ok(()) +} ``` \ No newline at end of file diff --git a/apps/web/content/docs/typescript/overview.mdx b/apps/web/content/docs/typescript/overview.mdx index e014cc20..afb1a80d 100644 --- a/apps/web/content/docs/typescript/overview.mdx +++ b/apps/web/content/docs/typescript/overview.mdx @@ -1,8 +1,8 @@ --- title: "Overview" -date: 2025-04-20 +date: 2026-02-27 authors: [jorgedanisc] -description: "This Library is targeted to interface TypeScript with the duc format." +description: "TypeScript / JavaScript library for reading, writing and manipulating .duc CAD files — backed by SQLite." --- import { Callout } from 'fumadocs-ui/components/callout'; @@ -11,9 +11,28 @@ import { Callout } from 'fumadocs-ui/components/callout'; This page is subject to change as the project is still in development. +## How it works + +A `.duc` file is a standard **SQLite database**. `ducjs` compiles to WebAssembly and uses +an embedded SQLite engine so it works in Node.js, Deno, Bun and the browser without any +native dependencies. ## Installation ```bash +npm install ducjs +# or +bun add ducjs + +# or any other JavaScript package manager +``` + +## Basic Usage + +```ts +import { DucFile } from 'ducjs'; +const doc = await DucFile.open('drawing.duc'); +const elements = await doc.elements(); +console.log(elements); ``` \ No newline at end of file diff --git a/assets/testing/duc-files/blocks_instances.duc b/assets/testing/duc-files/blocks_instances.duc index a2b107c2..f2d6de45 100644 Binary files a/assets/testing/duc-files/blocks_instances.duc and b/assets/testing/duc-files/blocks_instances.duc differ diff --git a/assets/testing/duc-files/complex_tables.duc b/assets/testing/duc-files/complex_tables.duc deleted file mode 100644 index 28abf036..00000000 Binary files a/assets/testing/duc-files/complex_tables.duc and /dev/null differ diff --git a/assets/testing/duc-files/hatching_patterns.duc b/assets/testing/duc-files/hatching_patterns.duc deleted file mode 100644 index 64048608..00000000 Binary files a/assets/testing/duc-files/hatching_patterns.duc and /dev/null differ diff --git a/assets/testing/duc-files/mixed_elements.duc b/assets/testing/duc-files/mixed_elements.duc deleted file mode 100644 index c9a13ee8..00000000 Binary files a/assets/testing/duc-files/mixed_elements.duc and /dev/null differ diff --git a/assets/testing/duc-files/multiple_blocks.duc b/assets/testing/duc-files/multiple_blocks.duc deleted file mode 100644 index 33b5b1bc..00000000 Binary files a/assets/testing/duc-files/multiple_blocks.duc and /dev/null differ diff --git a/assets/testing/duc-files/override_capabilities.duc b/assets/testing/duc-files/override_capabilities.duc deleted file mode 100644 index 0c2d5b66..00000000 Binary files a/assets/testing/duc-files/override_capabilities.duc and /dev/null differ diff --git a/assets/testing/duc-files/pdf_image_elements.duc b/assets/testing/duc-files/pdf_image_elements.duc deleted file mode 100644 index 989eef4d..00000000 Binary files a/assets/testing/duc-files/pdf_image_elements.duc and /dev/null differ diff --git a/assets/testing/duc-files/plot_elements.duc b/assets/testing/duc-files/plot_elements.duc deleted file mode 100644 index d6ce05ed..00000000 Binary files a/assets/testing/duc-files/plot_elements.duc and /dev/null differ diff --git a/assets/testing/duc-files/universal.duc b/assets/testing/duc-files/universal.duc index be9b3e03..67fed3f0 100644 Binary files a/assets/testing/duc-files/universal.duc and b/assets/testing/duc-files/universal.duc differ diff --git a/bun.lock b/bun.lock index 81cfaae5..39f587d5 100644 --- a/bun.lock +++ b/bun.lock @@ -1,6 +1,5 @@ { "lockfileVersion": 1, - "configVersion": 0, "workspaces": { "": { "name": "duc-monorepo", @@ -42,7 +41,7 @@ "postcss": "^8.5.6", "semantic-release": "^24.2.9", "tailwindcss": "^4.1.17", - "turbo": "^2.6.3", + "turbo": "^2.8.11", "typescript": "^5.9.3", }, }, @@ -64,7 +63,6 @@ "@braintree/sanitize-url": "6.0.2", "browser-fs-access": "0.35.0", "fflate": "^0.8.2", - "flatbuffers": "^24.12.23", "nanoid": "5.1.5", "perfect-freehand": "1.2.2", "tinycolor2": "1.6.0", @@ -531,7 +529,7 @@ "@types/acorn": ["@types/acorn@4.0.6", "", { "dependencies": { "@types/estree": "*" } }, ""], - "@types/bun": ["@types/bun@1.3.5", "", { "dependencies": { "bun-types": "1.3.5" } }, "sha512-RnygCqNrd3srIPEWBd5LFeUYG7plCoH2Yw9WaZGyNmdTEei+gWaHqydbaIRkIkcbXwhBT94q78QljxN0Sk838w=="], + "@types/bun": ["@types/bun@1.3.9", "", { "dependencies": { "bun-types": "1.3.9" } }, "sha512-KQ571yULOdWJiMH+RIWIOZ7B2RXQGpL1YQrBtLIV3FqDcCu6FsbFUBwhdKUlCKUpS3PJDsHlJ1QKlpxoVR+xtw=="], "@types/chai": ["@types/chai@5.2.2", "", { "dependencies": { "@types/deep-eql": "*" } }, "sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg=="], @@ -655,7 +653,7 @@ "buffer": ["buffer@4.9.2", "", { "dependencies": { "base64-js": "^1.0.2", "ieee754": "^1.1.4", "isarray": "^1.0.0" } }, "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg=="], - "bun-types": ["bun-types@1.3.5", "", { "dependencies": { "@types/node": "*" } }, "sha512-inmAYe2PFLs0SUbFOWSVD24sg1jFlMPxOjOSSCYqUgn4Hsc3rDc7dFvfVYjFPNHtov6kgUeulV4SxbuIV/stPw=="], + "bun-types": ["bun-types@1.3.9", "", { "dependencies": { "@types/node": "*" } }, "sha512-+UBWWOakIP4Tswh0Bt0QD0alpTY8cb5hvgiYeWCMet9YukHbzuruIEeXC2D7nMJPB12kbh8C7XJykSexEqGKJg=="], "bytes": ["bytes@3.1.2", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="], @@ -903,8 +901,6 @@ "find-versions": ["find-versions@6.0.0", "", { "dependencies": { "semver-regex": "^4.0.5", "super-regex": "^1.0.0" } }, ""], - "flatbuffers": ["flatbuffers@24.12.23", "", {}, "sha512-dLVCAISd5mhls514keQzmEG6QHmUUsNuWsb4tFafIUwvvgDjXhtfAYSKOzt5SWOy+qByV5pbsDZ+Vb7HUOBEdA=="], - "follow-redirects": ["follow-redirects@1.15.9", "", {}, "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ=="], "for-each": ["for-each@0.3.5", "", { "dependencies": { "is-callable": "^1.2.7" } }, "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg=="], @@ -1701,19 +1697,19 @@ "tunnel": ["tunnel@0.0.6", "", {}, "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="], - "turbo": ["turbo@2.6.3", "", { "optionalDependencies": { "turbo-darwin-64": "2.6.3", "turbo-darwin-arm64": "2.6.3", "turbo-linux-64": "2.6.3", "turbo-linux-arm64": "2.6.3", "turbo-windows-64": "2.6.3", "turbo-windows-arm64": "2.6.3" }, "bin": { "turbo": "bin/turbo" } }, "sha512-bf6YKUv11l5Xfcmg76PyWoy/e2vbkkxFNBGJSnfdSXQC33ZiUfutYh6IXidc5MhsnrFkWfdNNLyaRk+kHMLlwA=="], + "turbo": ["turbo@2.8.11", "", { "optionalDependencies": { "turbo-darwin-64": "2.8.11", "turbo-darwin-arm64": "2.8.11", "turbo-linux-64": "2.8.11", "turbo-linux-arm64": "2.8.11", "turbo-windows-64": "2.8.11", "turbo-windows-arm64": "2.8.11" }, "bin": { "turbo": "bin/turbo" } }, "sha512-H+rwSHHPLoyPOSoHdmI1zY0zy0GGj1Dmr7SeJW+nZiWLz2nex8EJ+fkdVabxXFMNEux+aywI4Sae8EqhmnOv4A=="], - "turbo-darwin-64": ["turbo-darwin-64@2.6.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-BlJJDc1CQ7SK5Y5qnl7AzpkvKSnpkfPmnA+HeU/sgny3oHZckPV2776ebO2M33CYDSor7+8HQwaodY++IINhYg=="], + "turbo-darwin-64": ["turbo-darwin-64@2.8.11", "", { "os": "darwin", "cpu": "x64" }, "sha512-XKaCWaz4OCt77oYYvGCIRpvYD4c/aNaKjRkUpv+e8rN3RZb+5Xsyew4yRO+gaHdMIUhQznXNXfHlhs+/p7lIhA=="], - "turbo-darwin-arm64": ["turbo-darwin-arm64@2.6.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-MwVt7rBKiOK7zdYerenfCRTypefw4kZCue35IJga9CH1+S50+KTiCkT6LBqo0hHeoH2iKuI0ldTF2a0aB72z3w=="], + "turbo-darwin-arm64": ["turbo-darwin-arm64@2.8.11", "", { "os": "darwin", "cpu": "arm64" }, "sha512-VvynLHGUNvQ9k7GZjRPSsRcK4VkioTfFb7O7liAk4nHKjEcMdls7GqxzjVWgJiKz3hWmQGaP9hRa9UUnhVWCxA=="], - "turbo-linux-64": ["turbo-linux-64@2.6.3", "", { "os": "linux", "cpu": "x64" }, "sha512-cqpcw+dXxbnPtNnzeeSyWprjmuFVpHJqKcs7Jym5oXlu/ZcovEASUIUZVN3OGEM6Y/OTyyw0z09tOHNt5yBAVg=="], + "turbo-linux-64": ["turbo-linux-64@2.8.11", "", { "os": "linux", "cpu": "x64" }, "sha512-cbSn37dcm+EmkQ7DD0euy7xV7o2el4GAOr1XujvkAyKjjNvQ+6QIUeDgQcwAx3D17zPpDvfDMJY2dLQadWnkmQ=="], - "turbo-linux-arm64": ["turbo-linux-arm64@2.6.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-MterpZQmjXyr4uM7zOgFSFL3oRdNKeflY7nsjxJb2TklsYqiu3Z9pQ4zRVFFH8n0mLGna7MbQMZuKoWqqHb45w=="], + "turbo-linux-arm64": ["turbo-linux-arm64@2.8.11", "", { "os": "linux", "cpu": "arm64" }, "sha512-+trymp2s2aBrhS04l6qFxcExzZ8ffndevuUB9c5RCeqsVpZeiWuGQlWNm5XjOmzoMayxRARZ5ma7yiWbGMiLqQ=="], - "turbo-windows-64": ["turbo-windows-64@2.6.3", "", { "os": "win32", "cpu": "x64" }, "sha512-biDU70v9dLwnBdLf+daoDlNJVvqOOP8YEjqNipBHzgclbQlXbsi6Gqqelp5er81Qo3BiRgmTNx79oaZQTPb07Q=="], + "turbo-windows-64": ["turbo-windows-64@2.8.11", "", { "os": "win32", "cpu": "x64" }, "sha512-3kJjFSM4yw1n9Uzmi+XkAUgCae19l/bH6RJ442xo7mnZm0tpOjo33F+FYHoSVpIWVMd0HG0LDccyafPSdylQbA=="], - "turbo-windows-arm64": ["turbo-windows-arm64@2.6.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-dDHVKpSeukah3VsI/xMEKeTnV9V9cjlpFSUs4bmsUiLu3Yv2ENlgVEZv65wxbeE0bh0jjpmElDT+P1KaCxArQQ=="], + "turbo-windows-arm64": ["turbo-windows-arm64@2.8.11", "", { "os": "win32", "cpu": "arm64" }, "sha512-JOM4uF2vuLsJUvibdR6X9QqdZr6BhC6Nhlrw4LKFPsXZZI/9HHLoqAiYRpE4MuzIwldCH/jVySnWXrI1SKto0g=="], "tw-animate-css": ["tw-animate-css@1.4.0", "", {}, "sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ=="], diff --git a/package.json b/package.json index bfa124ff..71ae96af 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "postcss": "^8.5.6", "semantic-release": "^24.2.9", "tailwindcss": "^4.1.17", - "turbo": "^2.6.3", + "turbo": "^2.8.11", "typescript": "^5.9.3" }, "dependencies": { @@ -50,13 +50,13 @@ "private": true, "scripts": { "build": "turbo build", - "build:packages": "turbo build --filter=ducjs --filter=ducpy --filter=ducrs --filter=ducsvg --filter=ducpdf", + "packages:build": "turbo build --filter=ducjs --filter=ducpy --filter=ducrs --filter=ducsvg --filter=ducpdf", + "packages:test": "turbo test --filter=ducjs --filter=ducpy --filter=ducrs --filter=ducsvg --filter=ducpdf", "sst:shell": "bash -c 'CMD=\"$1\"; shift; [ -n \"$1\" ] && [ \"$1\" != \"_\" ] && export SST_STAGE=\"$1\"; eval \"$CMD\"' _", - "flatc:gen": "bun run flatc:gen:duc", - "flatc:gen:duc": "cd schema && bash flatc-duc-generate.sh", "clean": "bun del-cli \"**/dist\" \".turbo\" \"**/node_modules\" \"**/package-lock.json\" \"**/tsconfig.tsbuildinfo\" \"**/tsconfig.node.tsbuildinfo\" \"**/vite.config.js\"", "docs:dev": "turbo dev --filter=@duc/docs", "docs:build": "turbo build --filter=@duc/docs", + "ducpy:docs:dev": "turbo run dev:docs --filter=ducpy", "ducpy:docs:build": "turbo run gen:docs --filter=ducpy", "ducpy:test": "turbo run test --filter=ducpy --force", "ducpy:build": "bun turbo run build --filter=ducpy -- ${1}", diff --git a/packages/ducdxf/README.md b/packages/ducdxf/README.md index 7390c10e..5e3f9185 100644 --- a/packages/ducdxf/README.md +++ b/packages/ducdxf/README.md @@ -15,7 +15,7 @@ This project is licensed under the MIT License - see the LICENSE file for detail ## Credits -- [ducpy](https://python.duc.ducflair.com/) - Python library for working with DUC files +- [ducpy](https://ducflair.github.io/duc/reference/python/) - Python library for working with DUC files - [ezdxf](https://ezdxf.readthedocs.io/) - Python library for working with DXF files diff --git a/packages/ducdxf/docs/conf.py b/packages/ducdxf/docs/conf.py index 3b103f21..3b7d8685 100644 --- a/packages/ducdxf/docs/conf.py +++ b/packages/ducdxf/docs/conf.py @@ -7,7 +7,7 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information project = 'ducxf' -copyright = '2025, Ducflair' +copyright = '2026, Ducflair' author = 'Ducflair' # -- General configuration --------------------------------------------------- diff --git a/packages/ducjs/README.md b/packages/ducjs/README.md index 2b989c75..ac3f8b03 100644 --- a/packages/ducjs/README.md +++ b/packages/ducjs/README.md @@ -13,7 +13,7 @@ # ducjs -The `ducjs` package offers comprehensive TypeScript types and helper functions to work effortlessly with the `duc` CAD file format. Built with Flatbuffers and optimized for performance, this package enables you to parse, validate, and manipulate `duc` files with ease. +The `ducjs` package offers comprehensive TypeScript types and helper functions to work effortlessly with the `duc` CAD file format. Built with SQLite and optimized for performance, this package enables you to parse, validate, and manipulate `duc` files with ease. ## Documentation @@ -39,4 +39,4 @@ To ensure smooth releases with semantic-release, please follow [these guidelines --- -*The duc format and libraries are constantly evolving, aiming to set new standards in the 2D CAD industry. Be a part of this transformation and help shape the future of design technology!* +*The duc format and libraries are constantly evolving, aiming to set new standards in the 2D CAD industry. Be a part of this transformation and help shape the future of design technology!* \ No newline at end of file diff --git a/packages/ducjs/crate/Cargo.toml b/packages/ducjs/crate/Cargo.toml new file mode 100644 index 00000000..63ea84fb --- /dev/null +++ b/packages/ducjs/crate/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "ducjs-wasm" +version = "0.0.0-development" +edition = "2021" +description = "WASM bindings for the duc file format (used by ducjs)" +publish = false + +[lib] +crate-type = ["cdylib"] + +[dependencies] +duc = { path = "../../ducrs" } +wasm-bindgen = "0.2" +serde-wasm-bindgen = "0.6" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +js-sys = "0.3" diff --git a/packages/ducjs/crate/src/lib.rs b/packages/ducjs/crate/src/lib.rs new file mode 100644 index 00000000..7c016d5d --- /dev/null +++ b/packages/ducjs/crate/src/lib.rs @@ -0,0 +1,187 @@ +use wasm_bindgen::prelude::*; +use serde::Serialize; + +/// Serialize a value to JsValue using serde-wasm-bindgen with +/// `serialize_maps_as_objects(true)` so that internally-tagged enums +/// and `#[serde(flatten)]` produce plain JS objects (not `Map`s). +fn to_js(value: &T) -> Result { + let serializer = serde_wasm_bindgen::Serializer::new() + .serialize_maps_as_objects(true); + value.serialize(&serializer) + .map_err(|e| JsError::new(&format!("{e}"))) +} + +// ── Parse / Serialize ────────────────────────────────────────────────────── + +/// Parse a `.duc` file (Uint8Array) into a JS object (ExportedDataState). +#[wasm_bindgen(js_name = "parseDuc")] +pub fn parse_duc(buf: &[u8]) -> Result { + let state = duc::parse::parse(buf) + .map_err(|e| JsError::new(&format!("{e}")))?; + to_js(&state) +} + +/// Parse a `.duc` file lazily — returns everything EXCEPT external file data blobs. +/// +/// Use `getExternalFile()` or `listExternalFiles()` for on-demand access. +#[wasm_bindgen(js_name = "parseDucLazy")] +pub fn parse_duc_lazy(buf: &[u8]) -> Result { + let state = duc::parse::parse_lazy(buf) + .map_err(|e| JsError::new(&format!("{e}")))?; + to_js(&state) +} + +/// Serialize a JS object (ExportedDataState) into `.duc` bytes (Uint8Array). +#[wasm_bindgen(js_name = "serializeDuc")] +pub fn serialize_duc(data: JsValue) -> Result, JsError> { + let state: duc::types::ExportedDataState = + serde_wasm_bindgen::from_value(data) + .map_err(|e| JsError::new(&format!("{e}")))?; + duc::serialize::serialize(&state) + .map_err(|e| JsError::new(&format!("{e}"))) +} + +/// Fetch a single external file from a `.duc` buffer by file ID. +/// +/// Returns the file entry as a JS object, or `undefined` if not found. +#[wasm_bindgen(js_name = "getExternalFile")] +pub fn get_external_file(buf: &[u8], file_id: &str) -> Result { + let entry = duc::parse::get_external_file(buf, file_id) + .map_err(|e| JsError::new(&format!("{e}")))?; + match entry { + Some(e) => to_js(&e), + None => Ok(JsValue::UNDEFINED), + } +} + +/// List metadata for all external files (without loading the heavy data blobs). +#[wasm_bindgen(js_name = "listExternalFiles")] +pub fn list_external_files(buf: &[u8]) -> Result { + let meta = duc::parse::list_external_files(buf) + .map_err(|e| JsError::new(&format!("{e}")))?; + to_js(&meta) +} + +// ── Version Control ──────────────────────────────────────────────────────── + +/// Returns the current version-control schema version defined in Rust. +/// +/// TypeScript should use this as the source of truth instead of hardcoding +/// its own constant. When this value is bumped in Rust, the version control +/// system will automatically handle migration bookkeeping (closing old chains, +/// recording migrations) the next time a checkpoint or delta is created. +#[wasm_bindgen(js_name = "getCurrentSchemaVersion")] +pub fn get_current_schema_version() -> i32 { + duc::api::version_control::CURRENT_SCHEMA_VERSION +} + +/// Restore the document state at `version_number` from a `.duc` file buffer. +/// +/// The `.duc` file is a SQLite database — this function opens it and queries +/// the `checkpoints` / `deltas` tables directly for version restoration. +/// +/// Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`. +#[wasm_bindgen(js_name = "restoreVersion")] +pub fn restore_version(duc_buf: &[u8], version_number: f64) -> Result { + let conn = duc::api::version_control::open_duc_bytes(duc_buf) + .map_err(|e| JsError::new(&format!("{e}")))?; + let vc = duc::api::version_control::VersionControl::from_connection(&conn); + let restored = vc + .restore_version(version_number as i64) + .map_err(|e| JsError::new(&format!("{e}")))?; + + to_restored_js(&restored) +} + +/// Restore a specific checkpoint by its ID from a `.duc` file buffer. +/// +/// Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`. +#[wasm_bindgen(js_name = "restoreCheckpoint")] +pub fn restore_checkpoint(duc_buf: &[u8], checkpoint_id: &str) -> Result { + let conn = duc::api::version_control::open_duc_bytes(duc_buf) + .map_err(|e| JsError::new(&format!("{e}")))?; + let vc = duc::api::version_control::VersionControl::from_connection(&conn); + let restored = vc + .restore_checkpoint(checkpoint_id) + .map_err(|e| JsError::new(&format!("{e}")))?; + + to_restored_js(&restored) +} + +/// List all versions (checkpoints + deltas) from a `.duc` file buffer. +/// +/// Returns a JS array of `VersionEntry` objects (no heavy data blobs). +#[wasm_bindgen(js_name = "listVersions")] +pub fn list_versions(duc_buf: &[u8]) -> Result { + let conn = duc::api::version_control::open_duc_bytes(duc_buf) + .map_err(|e| JsError::new(&format!("{e}")))?; + let vc = duc::api::version_control::VersionControl::from_connection(&conn); + let entries = vc + .list_versions() + .map_err(|e| JsError::new(&format!("{e}")))?; + + to_js(&entries) +} + +/// Read the full VersionGraph from a `.duc` file buffer. +/// +/// Returns a JS object matching the `VersionGraph` TypeScript interface, +/// or `undefined` if no version graph exists. +#[wasm_bindgen(js_name = "readVersionGraph")] +pub fn read_version_graph(duc_buf: &[u8]) -> Result { + let conn = duc::api::version_control::open_duc_bytes(duc_buf) + .map_err(|e| JsError::new(&format!("{e}")))?; + let vc = duc::api::version_control::VersionControl::from_connection(&conn); + let vg = vc + .read_version_graph() + .map_err(|e| JsError::new(&format!("{e}")))?; + + match vg { + Some(graph) => to_js(&graph), + None => Ok(JsValue::UNDEFINED), + } +} + +/// Revert the document to a specific version, removing all newer versions. +/// +/// Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`. +#[wasm_bindgen(js_name = "revertToVersion")] +pub fn revert_to_version(duc_buf: &[u8], target_version: f64) -> Result { + let conn = duc::api::version_control::open_duc_bytes(duc_buf) + .map_err(|e| JsError::new(&format!("{e}")))?; + let vc = duc::api::version_control::VersionControl::from_connection(&conn); + let restored = vc + .revert_to_version(target_version as i64) + .map_err(|e| JsError::new(&format!("{e}")))?; + + to_restored_js(&restored) +} + +/// Helper: convert a `RestoredVersion` to a JS value. +fn to_restored_js(r: &duc::api::version_control::RestoredVersion) -> Result { + let obj = js_sys::Object::new(); + js_sys::Reflect::set( + &obj, + &"versionNumber".into(), + &JsValue::from(r.version_number as f64), + ) + .map_err(|_| JsError::new("reflect set failed"))?; + js_sys::Reflect::set( + &obj, + &"schemaVersion".into(), + &JsValue::from(r.schema_version as f64), + ) + .map_err(|_| JsError::new("reflect set failed"))?; + js_sys::Reflect::set( + &obj, + &"fromCheckpoint".into(), + &JsValue::from(r.from_checkpoint), + ) + .map_err(|_| JsError::new("reflect set failed"))?; + + let data_array = js_sys::Uint8Array::from(r.data.as_slice()); + js_sys::Reflect::set(&obj, &"data".into(), &data_array.into()) + .map_err(|_| JsError::new("reflect set failed"))?; + + Ok(obj.into()) +} diff --git a/packages/ducjs/package.json b/packages/ducjs/package.json index be5c6145..ead5c65a 100644 --- a/packages/ducjs/package.json +++ b/packages/ducjs/package.json @@ -20,6 +20,7 @@ }, "scripts": { "build": "node scripts/build.js", + "test": "bun run check-types", "check-types": "tsc --noEmit", "semantic-release": "semantic-release" }, @@ -37,7 +38,6 @@ "@braintree/sanitize-url": "6.0.2", "browser-fs-access": "0.35.0", "fflate": "^0.8.2", - "flatbuffers": "^24.12.23", "nanoid": "5.1.5", "perfect-freehand": "1.2.2", "tinycolor2": "1.6.0" diff --git a/packages/ducjs/release.config.cjs b/packages/ducjs/release.config.cjs index f7872cca..f1047cb6 100644 --- a/packages/ducjs/release.config.cjs +++ b/packages/ducjs/release.config.cjs @@ -4,7 +4,10 @@ module.exports = { [ require.resolve("../../scripts/semrel-path-filter.cjs"), { - paths: ["packages/ducjs"], + paths: [ + "packages/ducjs", + "packages/ducrs" + ], analyzer: { preset: "conventionalcommits" }, notes: { preset: "conventionalcommits" }, }, diff --git a/packages/ducjs/scripts/build.js b/packages/ducjs/scripts/build.js index 2069c89b..bbff4f45 100644 --- a/packages/ducjs/scripts/build.js +++ b/packages/ducjs/scripts/build.js @@ -1,61 +1,255 @@ #!/usr/bin/env node +import { spawn, spawnSync } from 'child_process'; import fs from 'fs'; +import os from 'os'; import path from 'path'; -import { spawn } from 'child_process'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); -function getSchemaVersionFromFbs(fbsFilePath) { +const isWindows = process.platform === 'win32'; +const REQUIRED_WASM_PACK_MAJOR = 0; +const REQUIRED_WASM_PACK_MINOR = 14; +const WASM_PACK_EXECUTABLE = isWindows ? 'wasm-pack.exe' : 'wasm-pack'; + +function getWasmPackCandidates() { + const candidates = []; + if (process.env.WASM_PACK_BIN) { + candidates.push(process.env.WASM_PACK_BIN); + } + candidates.push(path.join(os.homedir(), '.cargo', 'bin', WASM_PACK_EXECUTABLE)); + candidates.push('wasm-pack'); + return candidates; +} + +function parseWasmPackVersion(output) { + const match = output.match(/(\d+)\.(\d+)\.(\d+)/); + if (!match) { + throw new Error(`Failed to parse wasm-pack version from: "${output}"`); + } + + return { + raw: output, + major: Number.parseInt(match[1], 10), + minor: Number.parseInt(match[2], 10), + patch: Number.parseInt(match[3], 10), + }; +} + +function resolveWasmPack() { + const errors = []; + for (const bin of getWasmPackCandidates()) { + const probe = spawnSync(bin, ['--version'], { encoding: 'utf8' }); + if (probe.status !== 0) { + const err = (probe.stderr || probe.stdout || '').trim(); + errors.push(`${bin}: ${err || `exit ${probe.status}`}`); + continue; + } + + try { + const output = (probe.stdout || '').trim(); + const version = parseWasmPackVersion(output); + return { bin, version }; + } catch (error) { + errors.push(`${bin}: ${error instanceof Error ? error.message : String(error)}`); + } + } + + throw new Error( + `wasm-pack is required but could not be resolved. Tried: ${errors.join(' | ')}`, + ); +} + +function ensurePinnedWasmPackVersion() { + const resolved = resolveWasmPack(); + const { bin, version } = resolved; + const pinned = + version.major === REQUIRED_WASM_PACK_MAJOR && + version.minor === REQUIRED_WASM_PACK_MINOR; + + if (!pinned) { + throw new Error( + `ducjs requires wasm-pack ${REQUIRED_WASM_PACK_MAJOR}.${REQUIRED_WASM_PACK_MINOR}.x, ` + + `but found ${version.raw} at ${bin}. Please install wasm-pack 0.14.x.`, + ); + } + + console.log(`Using pinned wasm-pack version: ${version.raw} (${bin})`); + return bin; +} + +function decodeUserVersionToSemver(userVersion) { + if (!Number.isInteger(userVersion) || userVersion < 0) { + return '0.0.0'; + } + + const major = Math.floor(userVersion / 1_000_000); + const minor = Math.floor((userVersion % 1_000_000) / 1_000); + const patch = userVersion % 1_000; + + return `${major}.${minor}.${patch}`; +} + +function getSchemaVersionInfoFromSql(sqlFilePath) { try { - const content = fs.readFileSync(fbsFilePath, 'utf8'); - const firstLine = content.split('\n')[0]; - const match = firstLine.match(/\/\/\s*SCHEMA_VERSION\s*=\s*([0-9.]+)/); - + const content = fs.readFileSync(sqlFilePath, 'utf8'); + const match = content.match(/PRAGMA\s+user_version\s*=\s*(\d+)\s*;/i); + if (match) { - return match[1]; + const userVersion = Number.parseInt(match[1], 10); + return { + userVersion, + semver: decodeUserVersionToSemver(userVersion), + }; } } catch (error) { - console.warn(`Warning: Could not parse schema version from ${fbsFilePath}: ${error.message}. Defaulting to 0.0.0.`); + console.warn(`Warning: Could not parse schema version from ${sqlFilePath}: ${error.message}. Defaulting to 0.0.0.`); } - return '0.0.0'; + return { + userVersion: 0, + semver: '0.0.0', + }; } -function main() { +function ensurePkgSchemaVersionShim(pkgJsPath, pkgDtsPath, userVersion) { + const jsExport = `\n/** Auto-generated fallback when wasm glue is stale. */\nexport function getCurrentSchemaVersion() {\n return ${userVersion};\n}\n`; + const dtsExport = 'export function getCurrentSchemaVersion(): number;'; + + if (fs.existsSync(pkgJsPath)) { + let js = fs.readFileSync(pkgJsPath, 'utf8'); + const hasExport = /export\s+function\s+getCurrentSchemaVersion\s*\(\s*\)\s*\{/.test(js); + + if (hasExport) { + js = js.replace( + /export\s+function\s+getCurrentSchemaVersion\s*\(\s*\)\s*\{[\s\S]*?\n\}/, + `export function getCurrentSchemaVersion() {\n return ${userVersion};\n}`, + ); + } else { + js += jsExport; + } + + fs.writeFileSync(pkgJsPath, js); + } + + if (fs.existsSync(pkgDtsPath)) { + let dts = fs.readFileSync(pkgDtsPath, 'utf8'); + if (!dts.includes(dtsExport)) { + if (dts.includes('export type InitInput')) { + dts = dts.replace('export type InitInput', `${dtsExport}\n\nexport type InitInput`); + } else { + dts += `\n${dtsExport}\n`; + } + } + fs.writeFileSync(pkgDtsPath, dts); + } +} + +// ── WASM build helpers (clang resolution matching ducpdf) ────────────────── + +function tryResolveCompiler(candidates) { + for (const candidate of candidates) { + if (!candidate) continue; + if (candidate.includes('/') || candidate.includes('\\')) { + if (!fs.existsSync(candidate)) continue; + const probe = spawnSync(candidate, ['--version'], { stdio: 'ignore' }); + if (probe.status === 0) return candidate; + continue; + } + const probe = spawnSync(candidate, ['--version'], { stdio: 'ignore' }); + if (probe.status === 0) return candidate; + } + return null; +} + +function buildWasm(cratePath, outDir, wasmPackBin) { + return new Promise((resolve, reject) => { + const hasCompilerOverride = + Boolean(process.env.CC_wasm32_unknown_unknown) || + Boolean(process.env['CC_wasm32-unknown-unknown']); + + const compilerCandidates = isWindows + ? ['clang-cl', 'clang'] + : [ + '/opt/homebrew/opt/llvm/bin/clang', + '/usr/local/opt/llvm/bin/clang', + '/usr/bin/clang', + 'clang', + ]; + + const resolvedCompiler = hasCompilerOverride + ? null + : tryResolveCompiler(compilerCandidates); + + const env = { ...process.env }; + if (!hasCompilerOverride && resolvedCompiler) { + env.CC_wasm32_unknown_unknown = resolvedCompiler; + env['CC_wasm32-unknown-unknown'] = resolvedCompiler; + } + + console.log('Building WASM...'); + const child = spawn( + wasmPackBin, + ['build', '--target', 'web', '--out-dir', outDir, '--release'], + { cwd: cratePath, env, stdio: 'inherit' }, + ); + + child.on('error', (error) => reject(error)); + child.on('close', (code) => { + if (code === 0) resolve(); + else reject(new Error(`wasm-pack exited with code ${code}`)); + }); + }); +} + +// ── Main ─────────────────────────────────────────────────────────────────── + +async function main() { const manifestDir = __dirname; - const fbsPath = path.join(manifestDir, '..', '..', '..', 'schema', 'duc.fbs'); - - const version = getSchemaVersionFromFbs(fbsPath); - - console.log(`Building with DUC_SCHEMA_VERSION: ${version}`); - - // Clean previous build artifacts - const distDir = path.join(manifestDir, '..', 'dist'); - + const packageRoot = path.join(manifestDir, '..'); + const schemaSqlPath = path.join(packageRoot, '..', '..', 'schema', 'duc.sql'); + const pkgDir = path.join(packageRoot, 'pkg'); + const pkgJsPath = path.join(pkgDir, 'ducjs_wasm.js'); + const pkgDtsPath = path.join(pkgDir, 'ducjs_wasm.d.ts'); + const cratePath = path.join(packageRoot, 'crate'); + + const { userVersion, semver } = getSchemaVersionInfoFromSql(schemaSqlPath); + console.log(`Building with DUC_SCHEMA_VERSION: ${semver} (${userVersion})`); + + const wasmPackBin = ensurePinnedWasmPackVersion(); + + // 1. Rebuild WASM from Rust crate (regenerates pkg/) + await buildWasm(cratePath, pkgDir, wasmPackBin); + + // 2. Patch pkg JS/DTS with schema version shim (idempotent) + ensurePkgSchemaVersionShim(pkgJsPath, pkgDtsPath, userVersion); + + // 3. Clean previous TS build artifacts + const distDir = path.join(packageRoot, 'dist'); try { fs.rmSync(distDir, { recursive: true, force: true }); } catch (error) { console.log('No dist directory to clean or error:', error.message); } - - // Set environment variable and run TypeScript compiler - const env = { ...process.env, DUC_SCHEMA_VERSION: version }; - - const tsc = spawn('npx', ['tsc'], { - env, - stdio: 'inherit' - }); - - tsc.on('close', (code) => { - process.exit(code); - }); - + + // 4. Run TypeScript compiler + const env = { + ...process.env, + DUC_SCHEMA_VERSION: semver, + DUC_SCHEMA_USER_VERSION: String(userVersion), + }; + + const tsc = spawn('npx', ['tsc'], { env, stdio: 'inherit' }); + + tsc.on('close', (code) => process.exit(code)); tsc.on('error', (error) => { console.error('Error running TypeScript compiler:', error); process.exit(1); }); } -main(); +main().catch((err) => { + console.error(err); + process.exit(1); +}); diff --git a/packages/ducjs/src/enums.ts b/packages/ducjs/src/enums.ts new file mode 100644 index 00000000..66f1016e --- /dev/null +++ b/packages/ducjs/src/enums.ts @@ -0,0 +1,155 @@ +/** + * Native enum definitions for DUC types. + * Source of truth: duc.sql + */ + +export enum VERTICAL_ALIGN { + TOP = 10, + MIDDLE = 11, + BOTTOM = 12, +} + +export enum TEXT_ALIGN { + LEFT = 10, + CENTER = 11, + RIGHT = 12, +} + +export enum LINE_SPACING_TYPE { + AT_LEAST = 10, + EXACTLY = 11, + MULTIPLE = 12, +} + +export enum STROKE_PLACEMENT { + INSIDE = 10, + CENTER = 11, + OUTSIDE = 12, +} + +export enum STROKE_PREFERENCE { + SOLID = 10, + DASHED = 11, + DOTTED = 12, + CUSTOM = 13, +} + +export enum STROKE_SIDE_PREFERENCE { + TOP = 10, + BOTTOM = 11, + LEFT = 12, + RIGHT = 13, + CUSTOM = 14, + ALL = 15, +} + +export enum STROKE_CAP { + BUTT = 10, + ROUND = 11, + SQUARE = 12, +} + +export enum STROKE_JOIN { + MITER = 10, + ROUND = 11, + BEVEL = 12, +} + +export enum LINE_HEAD { + ARROW = 10, + BAR = 11, + CIRCLE = 12, + CIRCLE_OUTLINED = 13, + TRIANGLE = 14, + TRIANGLE_OUTLINED = 15, + DIAMOND = 16, + DIAMOND_OUTLINED = 17, + CROSS = 18, + OPEN_ARROW = 19, + REVERSED_ARROW = 20, + REVERSED_TRIANGLE = 21, + REVERSED_TRIANGLE_OUTLINED = 22, + CONE = 23, + HALF_CONE = 24, +} + +export enum BEZIER_MIRRORING { + NONE = 10, + ANGLE = 11, + ANGLE_LENGTH = 12, +} + +export enum BLENDING { + MULTIPLY = 11, + SCREEN = 12, + OVERLAY = 13, + DARKEN = 14, + LIGHTEN = 15, + DIFFERENCE = 16, + EXCLUSION = 17, +} + +export enum ELEMENT_CONTENT_PREFERENCE { + SOLID = 12, + FILL = 14, + FIT = 15, + TILE = 16, + STRETCH = 17, + HATCH = 18, +} + +export enum HATCH_STYLE { + NORMAL = 10, + OUTER = 11, + IGNORE = 12, +} + +export enum IMAGE_STATUS { + PENDING = 10, + SAVED = 11, + ERROR = 12, +} + +export enum PRUNING_LEVEL { + CONSERVATIVE = 10, + BALANCED = 20, + AGGRESSIVE = 30, +} + +export enum BOOLEAN_OPERATION { + UNION = 10, + SUBTRACT = 11, + INTERSECT = 12, + EXCLUDE = 13, +} + +export enum YOUTUBE_STATES { + /** The YouTube player is unstarted. */ + UNSTARTED = -1, + /** The YouTube player has ended. */ + ENDED = 0, + /** The YouTube player is currently playing. */ + PLAYING = 1, + /** The YouTube player is paused. */ + PAUSED = 2, + /** The YouTube player is buffering. */ + BUFFERING = 3, + /** The YouTube player is cued. */ + CUED = 5 +} + +export enum HANDLE_TYPE { + HANDLE_IN = 10, + HANDLE_OUT = 11, +} + +export enum UNIT_SYSTEM { + METRIC = 10, + IMPERIAL = 11, +} + +export enum AXIS { + X = 10, + Y = 20, + Z = 30, +} diff --git a/packages/ducjs/src/flatbuffers/duc.ts b/packages/ducjs/src/flatbuffers/duc.ts deleted file mode 100644 index 29c2903b..00000000 --- a/packages/ducjs/src/flatbuffers/duc.ts +++ /dev/null @@ -1,238 +0,0 @@ -// 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 */ - -export { ANGULAR_UNITS_FORMAT } from './duc/angular-units-format'; -export { AXIS } from './duc/axis'; -export { AlternateUnits } from './duc/alternate-units'; -export { AngularUnitSystem } from './duc/angular-unit-system'; -export { BEZIER_MIRRORING } from './duc/bezier-mirroring'; -export { BLENDING } from './duc/blending'; -export { BLOCK_ATTACHMENT } from './duc/block-attachment'; -export { BOOLEAN_OPERATION } from './duc/boolean-operation'; -export { BoundElement } from './duc/bound-element'; -export { COLUMN_TYPE } from './duc/column-type'; -export { Checkpoint } from './duc/checkpoint'; -export { ColumnLayout } from './duc/column-layout'; -export { CustomHatchPattern } from './duc/custom-hatch-pattern'; -export { DATUM_BRACKET_STYLE } from './duc/datum-bracket-style'; -export { DATUM_TARGET_TYPE } from './duc/datum-target-type'; -export { DECIMAL_SEPARATOR } from './duc/decimal-separator'; -export { DIMENSION_FIT_RULE } from './duc/dimension-fit-rule'; -export { DIMENSION_TEXT_PLACEMENT } from './duc/dimension-text-placement'; -export { DIMENSION_TYPE } from './duc/dimension-type'; -export { DIMENSION_UNITS_FORMAT } from './duc/dimension-units-format'; -export { DOCUMENT_GRID_ALIGN_ITEMS } from './duc/document-grid-align-items'; -export { DatumReference } from './duc/datum-reference'; -export { Delta } from './duc/delta'; -export { DictionaryEntry } from './duc/dictionary-entry'; -export { DimensionBaselineData } from './duc/dimension-baseline-data'; -export { DimensionBindings } from './duc/dimension-bindings'; -export { DimensionContinueData } from './duc/dimension-continue-data'; -export { DimensionDefinitionPoints } from './duc/dimension-definition-points'; -export { DimensionExtLineStyle } from './duc/dimension-ext-line-style'; -export { DimensionFitStyle } from './duc/dimension-fit-style'; -export { DimensionLineStyle } from './duc/dimension-line-style'; -export { DimensionSymbolStyle } from './duc/dimension-symbol-style'; -export { DimensionToleranceStyle } from './duc/dimension-tolerance-style'; -export { DimensionValidationRules } from './duc/dimension-validation-rules'; -export { DocumentGridConfig } from './duc/document-grid-config'; -export { DucArrowElement } from './duc/duc-arrow-element'; -export { DucBlock } from './duc/duc-block'; -export { DucBlockAttributeDefinition } from './duc/duc-block-attribute-definition'; -export { DucBlockAttributeDefinitionEntry } from './duc/duc-block-attribute-definition-entry'; -export { DucBlockCollection } from './duc/duc-block-collection'; -export { DucBlockCollectionEntry } from './duc/duc-block-collection-entry'; -export { DucBlockDuplicationArray } from './duc/duc-block-duplication-array'; -export { DucBlockInstance } from './duc/duc-block-instance'; -export { DucBlockInstanceElement } from './duc/duc-block-instance-element'; -export { DucBlockMetadata } from './duc/duc-block-metadata'; -export { DucCommonStyle } from './duc/duc-common-style'; -export { DucDimensionElement } from './duc/duc-dimension-element'; -export { DucDimensionStyle } from './duc/duc-dimension-style'; -export { DucDocElement } from './duc/duc-doc-element'; -export { DucDocStyle } from './duc/duc-doc-style'; -export { DucEllipseElement } from './duc/duc-ellipse-element'; -export { DucEmbeddableElement } from './duc/duc-embeddable-element'; -export { DucExternalFileData } from './duc/duc-external-file-data'; -export { DucExternalFileEntry } from './duc/duc-external-file-entry'; -export { DucFeatureControlFrameElement } from './duc/duc-feature-control-frame-element'; -export { DucFeatureControlFrameStyle } from './duc/duc-feature-control-frame-style'; -export { DucFrameElement } from './duc/duc-frame-element'; -export { DucFreeDrawElement } from './duc/duc-free-draw-element'; -export { DucFreeDrawEnds } from './duc/duc-free-draw-ends'; -export { DucGlobalState } from './duc/duc-global-state'; -export { DucGroup } from './duc/duc-group'; -export { DucHatchStyle } from './duc/duc-hatch-style'; -export { DucHead } from './duc/duc-head'; -export { DucImageElement } from './duc/duc-image-element'; -export { DucImageFilter } from './duc/duc-image-filter'; -export { DucLayer } from './duc/duc-layer'; -export { DucLayerOverrides } from './duc/duc-layer-overrides'; -export { DucLeaderElement } from './duc/duc-leader-element'; -export { DucLeaderStyle } from './duc/duc-leader-style'; -export { DucLine } from './duc/duc-line'; -export { DucLineReference } from './duc/duc-line-reference'; -export { DucLinearElement } from './duc/duc-linear-element'; -export { DucLocalState } from './duc/duc-local-state'; -export { DucMermaidElement } from './duc/duc-mermaid-element'; -export { DucModelElement } from './duc/duc-model-element'; -export { DucParametricElement } from './duc/duc-parametric-element'; -export { DucPath } from './duc/duc-path'; -export { DucPdfElement } from './duc/duc-pdf-element'; -export { DucPlotElement } from './duc/duc-plot-element'; -export { DucPlotStyle } from './duc/duc-plot-style'; -export { DucPoint } from './duc/duc-point'; -export { DucPointBinding } from './duc/duc-point-binding'; -export { DucPolygonElement } from './duc/duc-polygon-element'; -export { DucRectangleElement } from './duc/duc-rectangle-element'; -export { DucRegion } from './duc/duc-region'; -export { DucStackLikeStyles } from './duc/duc-stack-like-styles'; -export { DucTableAutoSize } from './duc/duc-table-auto-size'; -export { DucTableCell } from './duc/duc-table-cell'; -export { DucTableCellEntry } from './duc/duc-table-cell-entry'; -export { DucTableCellSpan } from './duc/duc-table-cell-span'; -export { DucTableCellStyle } from './duc/duc-table-cell-style'; -export { DucTableColumn } from './duc/duc-table-column'; -export { DucTableColumnEntry } from './duc/duc-table-column-entry'; -export { DucTableElement } from './duc/duc-table-element'; -export { DucTableRow } from './duc/duc-table-row'; -export { DucTableRowEntry } from './duc/duc-table-row-entry'; -export { DucTableStyle } from './duc/duc-table-style'; -export { DucTextDynamicDictionarySource } from './duc/duc-text-dynamic-dictionary-source'; -export { DucTextDynamicElementSource } from './duc/duc-text-dynamic-element-source'; -export { DucTextDynamicPart } from './duc/duc-text-dynamic-part'; -export { DucTextDynamicSource } from './duc/duc-text-dynamic-source'; -export { DucTextDynamicSourceData } from './duc/duc-text-dynamic-source-data'; -export { DucTextElement } from './duc/duc-text-element'; -export { DucTextStyle } from './duc/duc-text-style'; -export { DucUcs } from './duc/duc-ucs'; -export { DucView } from './duc/duc-view'; -export { DucViewportElement } from './duc/duc-viewport-element'; -export { DucViewportStyle } from './duc/duc-viewport-style'; -export { DucXRayElement } from './duc/duc-xray-element'; -export { DucXRayStyle } from './duc/duc-xray-style'; -export { DynamicSnapSettings } from './duc/dynamic-snap-settings'; -export { ELEMENT_CONTENT_PREFERENCE } from './duc/element-content-preference'; -export { Element } from './duc/element'; -export { ElementBackground } from './duc/element-background'; -export { ElementContentBase } from './duc/element-content-base'; -export { ElementStroke } from './duc/element-stroke'; -export { ElementWrapper } from './duc/element-wrapper'; -export { ExportedDataState } from './duc/exported-data-state'; -export { FCFBetweenModifier } from './duc/fcfbetween-modifier'; -export { FCFDatumDefinition } from './duc/fcfdatum-definition'; -export { FCFDatumStyle } from './duc/fcfdatum-style'; -export { FCFFrameModifiers } from './duc/fcfframe-modifiers'; -export { FCFLayoutStyle } from './duc/fcflayout-style'; -export { FCFProjectedZoneModifier } from './duc/fcfprojected-zone-modifier'; -export { FCFSegmentRow } from './duc/fcfsegment-row'; -export { FCFSymbolStyle } from './duc/fcfsymbol-style'; -export { FEATURE_MODIFIER } from './duc/feature-modifier'; -export { FeatureControlFrameSegment } from './duc/feature-control-frame-segment'; -export { GDT_SYMBOL } from './duc/gdt-symbol'; -export { GRID_DISPLAY_TYPE } from './duc/grid-display-type'; -export { GRID_TYPE } from './duc/grid-type'; -export { GeometricPoint } from './duc/geometric-point'; -export { GridSettings } from './duc/grid-settings'; -export { GridStyle } from './duc/grid-style'; -export { HANDLE_TYPE } from './duc/handle-type'; -export { HATCH_STYLE } from './duc/hatch-style'; -export { HatchPatternLine } from './duc/hatch-pattern-line'; -export { IMAGE_STATUS } from './duc/image-status'; -export { IdentifiedCommonStyle } from './duc/identified-common-style'; -export { IdentifiedDimensionStyle } from './duc/identified-dimension-style'; -export { IdentifiedDocStyle } from './duc/identified-doc-style'; -export { IdentifiedFCFStyle } from './duc/identified-fcfstyle'; -export { IdentifiedGridSettings } from './duc/identified-grid-settings'; -export { IdentifiedHatchStyle } from './duc/identified-hatch-style'; -export { IdentifiedLeaderStyle } from './duc/identified-leader-style'; -export { IdentifiedSnapSettings } from './duc/identified-snap-settings'; -export { IdentifiedStackLikeStyle } from './duc/identified-stack-like-style'; -export { IdentifiedTableStyle } from './duc/identified-table-style'; -export { IdentifiedTextStyle } from './duc/identified-text-style'; -export { IdentifiedUcs } from './duc/identified-ucs'; -export { IdentifiedView } from './duc/identified-view'; -export { IdentifiedViewportStyle } from './duc/identified-viewport-style'; -export { IdentifiedXRayStyle } from './duc/identified-xray-style'; -export { Identifier } from './duc/identifier'; -export { ImageCrop } from './duc/image-crop'; -export { IsometricGridSettings } from './duc/isometric-grid-settings'; -export { JSONPatchOperation } from './duc/jsonpatch-operation'; -export { LEADER_CONTENT_TYPE } from './duc/leader-content-type'; -export { LINE_HEAD } from './duc/line-head'; -export { LINE_SPACING_TYPE } from './duc/line-spacing-type'; -export { LayerSnapFilters } from './duc/layer-snap-filters'; -export { LayerValidationRules } from './duc/layer-validation-rules'; -export { LeaderBlockContent } from './duc/leader-block-content'; -export { LeaderContent } from './duc/leader-content'; -export { LeaderContentData } from './duc/leader-content-data'; -export { LeaderTextBlockContent } from './duc/leader-text-block-content'; -export { LineSpacing } from './duc/line-spacing'; -export { LinearUnitSystem } from './duc/linear-unit-system'; -export { MARK_ELLIPSE_CENTER } from './duc/mark-ellipse-center'; -export { MATERIAL_CONDITION } from './duc/material-condition'; -export { Margins } from './duc/margins'; -export { OBJECT_SNAP_MODE } from './duc/object-snap-mode'; -export { PARAMETRIC_SOURCE_TYPE } from './duc/parametric-source-type'; -export { PRUNING_LEVEL } from './duc/pruning-level'; -export { ParagraphFormatting } from './duc/paragraph-formatting'; -export { ParametricSource } from './duc/parametric-source'; -export { PlotLayout } from './duc/plot-layout'; -export { PointBindingPoint } from './duc/point-binding-point'; -export { PolarGridSettings } from './duc/polar-grid-settings'; -export { PolarTrackingSettings } from './duc/polar-tracking-settings'; -export { PrimaryUnits } from './duc/primary-units'; -export { SNAP_MARKER_SHAPE } from './duc/snap-marker-shape'; -export { SNAP_MODE } from './duc/snap-mode'; -export { SNAP_OVERRIDE_BEHAVIOR } from './duc/snap-override-behavior'; -export { STACKED_TEXT_ALIGN } from './duc/stacked-text-align'; -export { STROKE_CAP } from './duc/stroke-cap'; -export { STROKE_JOIN } from './duc/stroke-join'; -export { STROKE_PLACEMENT } from './duc/stroke-placement'; -export { STROKE_PREFERENCE } from './duc/stroke-preference'; -export { STROKE_SIDE_PREFERENCE } from './duc/stroke-side-preference'; -export { STROKE_WIDTH } from './duc/stroke-width'; -export { SnapMarkerSettings } from './duc/snap-marker-settings'; -export { SnapMarkerStyle } from './duc/snap-marker-style'; -export { SnapMarkerStyleEntry } from './duc/snap-marker-style-entry'; -export { SnapOverride } from './duc/snap-override'; -export { SnapSettings } from './duc/snap-settings'; -export { StackFormat } from './duc/stack-format'; -export { StackFormatProperties } from './duc/stack-format-properties'; -export { Standard } from './duc/standard'; -export { StandardOverrides } from './duc/standard-overrides'; -export { StandardStyles } from './duc/standard-styles'; -export { StandardUnits } from './duc/standard-units'; -export { StandardValidation } from './duc/standard-validation'; -export { StandardViewSettings } from './duc/standard-view-settings'; -export { StringValueEntry } from './duc/string-value-entry'; -export { StrokeSides } from './duc/stroke-sides'; -export { StrokeStyle } from './duc/stroke-style'; -export { TABLE_CELL_ALIGNMENT } from './duc/table-cell-alignment'; -export { TABLE_FLOW_DIRECTION } from './duc/table-flow-direction'; -export { TEXT_ALIGN } from './duc/text-align'; -export { TEXT_FIELD_SOURCE_PROPERTY } from './duc/text-field-source-property'; -export { TEXT_FIELD_SOURCE_TYPE } from './duc/text-field-source-type'; -export { TEXT_FLOW_DIRECTION } from './duc/text-flow-direction'; -export { TOLERANCE_DISPLAY } from './duc/tolerance-display'; -export { TOLERANCE_TYPE } from './duc/tolerance-type'; -export { TOLERANCE_ZONE_TYPE } from './duc/tolerance-zone-type'; -export { TextColumn } from './duc/text-column'; -export { TilingProperties } from './duc/tiling-properties'; -export { ToleranceClause } from './duc/tolerance-clause'; -export { TrackingLineStyle } from './duc/tracking-line-style'; -export { UNIT_SYSTEM } from './duc/unit-system'; -export { UnitPrecision } from './duc/unit-precision'; -export { VERTICAL_ALIGN } from './duc/vertical-align'; -export { VIEWPORT_SHADE_PLOT } from './duc/viewport-shade-plot'; -export { VersionBase } from './duc/version-base'; -export { VersionGraph } from './duc/version-graph'; -export { VersionGraphMetadata } from './duc/version-graph-metadata'; -export { YOUTUBE_STATES } from './duc/youtube-states'; -export { _DucElementBase } from './duc/duc-element-base'; -export { _DucElementStylesBase } from './duc/duc-element-styles-base'; -export { _DucLinearElementBase } from './duc/duc-linear-element-base'; -export { _DucStackBase } from './duc/duc-stack-base'; -export { _DucStackElementBase } from './duc/duc-stack-element-base'; -export { _UnitSystemBase } from './duc/unit-system-base'; diff --git a/packages/ducjs/src/flatbuffers/duc/alternate-units.ts b/packages/ducjs/src/flatbuffers/duc/alternate-units.ts deleted file mode 100644 index af499602..00000000 --- a/packages/ducjs/src/flatbuffers/duc/alternate-units.ts +++ /dev/null @@ -1,83 +0,0 @@ -// 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 { DIMENSION_UNITS_FORMAT } from '../duc/dimension-units-format'; -import { _UnitSystemBase } from '../duc/unit-system-base'; - - -export class AlternateUnits { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):AlternateUnits { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsAlternateUnits(bb:flatbuffers.ByteBuffer, obj?:AlternateUnits):AlternateUnits { - return (obj || new AlternateUnits()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsAlternateUnits(bb:flatbuffers.ByteBuffer, obj?:AlternateUnits):AlternateUnits { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new AlternateUnits()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_UnitSystemBase):_UnitSystemBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _UnitSystemBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -format():DIMENSION_UNITS_FORMAT|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -isVisible():boolean { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -multiplier():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -static startAlternateUnits(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addFormat(builder:flatbuffers.Builder, format:DIMENSION_UNITS_FORMAT) { - builder.addFieldInt8(1, format, null); -} - -static addIsVisible(builder:flatbuffers.Builder, isVisible:boolean) { - builder.addFieldInt8(2, +isVisible, +false); -} - -static addMultiplier(builder:flatbuffers.Builder, multiplier:number) { - builder.addFieldFloat32(3, multiplier, 0.0); -} - -static endAlternateUnits(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createAlternateUnits(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset, format:DIMENSION_UNITS_FORMAT|null, isVisible:boolean, multiplier:number):flatbuffers.Offset { - AlternateUnits.startAlternateUnits(builder); - AlternateUnits.addBase(builder, baseOffset); - if (format !== null) - AlternateUnits.addFormat(builder, format); - AlternateUnits.addIsVisible(builder, isVisible); - AlternateUnits.addMultiplier(builder, multiplier); - return AlternateUnits.endAlternateUnits(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/angular-unit-system.ts b/packages/ducjs/src/flatbuffers/duc/angular-unit-system.ts deleted file mode 100644 index d159244c..00000000 --- a/packages/ducjs/src/flatbuffers/duc/angular-unit-system.ts +++ /dev/null @@ -1,63 +0,0 @@ -// 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 { ANGULAR_UNITS_FORMAT } from '../duc/angular-units-format'; -import { _UnitSystemBase } from '../duc/unit-system-base'; - - -export class AngularUnitSystem { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):AngularUnitSystem { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsAngularUnitSystem(bb:flatbuffers.ByteBuffer, obj?:AngularUnitSystem):AngularUnitSystem { - return (obj || new AngularUnitSystem()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsAngularUnitSystem(bb:flatbuffers.ByteBuffer, obj?:AngularUnitSystem):AngularUnitSystem { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new AngularUnitSystem()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_UnitSystemBase):_UnitSystemBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _UnitSystemBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -format():ANGULAR_UNITS_FORMAT|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startAngularUnitSystem(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addFormat(builder:flatbuffers.Builder, format:ANGULAR_UNITS_FORMAT) { - builder.addFieldInt8(1, format, null); -} - -static endAngularUnitSystem(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createAngularUnitSystem(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset, format:ANGULAR_UNITS_FORMAT|null):flatbuffers.Offset { - AngularUnitSystem.startAngularUnitSystem(builder); - AngularUnitSystem.addBase(builder, baseOffset); - if (format !== null) - AngularUnitSystem.addFormat(builder, format); - return AngularUnitSystem.endAngularUnitSystem(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/angular-units-format.ts b/packages/ducjs/src/flatbuffers/duc/angular-units-format.ts deleted file mode 100644 index 225481c3..00000000 --- a/packages/ducjs/src/flatbuffers/duc/angular-units-format.ts +++ /dev/null @@ -1,11 +0,0 @@ -// 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 */ - -export enum ANGULAR_UNITS_FORMAT { - DECIMAL_DEGREES = 10, - DEGREES_MINUTES_SECONDS = 11, - GRADS = 12, - RADIANS = 13, - SURVEYOR = 14 -} diff --git a/packages/ducjs/src/flatbuffers/duc/axis.ts b/packages/ducjs/src/flatbuffers/duc/axis.ts deleted file mode 100644 index dc600330..00000000 --- a/packages/ducjs/src/flatbuffers/duc/axis.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum AXIS { - X = 10, - Y = 20, - Z = 30 -} diff --git a/packages/ducjs/src/flatbuffers/duc/bezier-mirroring.ts b/packages/ducjs/src/flatbuffers/duc/bezier-mirroring.ts deleted file mode 100644 index cc3c4190..00000000 --- a/packages/ducjs/src/flatbuffers/duc/bezier-mirroring.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum BEZIER_MIRRORING { - NONE = 10, - ANGLE = 11, - ANGLE_LENGTH = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/blending.ts b/packages/ducjs/src/flatbuffers/duc/blending.ts deleted file mode 100644 index 1a40f8be..00000000 --- a/packages/ducjs/src/flatbuffers/duc/blending.ts +++ /dev/null @@ -1,13 +0,0 @@ -// 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 */ - -export enum BLENDING { - MULTIPLY = 11, - SCREEN = 12, - OVERLAY = 13, - DARKEN = 14, - LIGHTEN = 15, - DIFFERENCE = 16, - EXCLUSION = 17 -} diff --git a/packages/ducjs/src/flatbuffers/duc/block-attachment.ts b/packages/ducjs/src/flatbuffers/duc/block-attachment.ts deleted file mode 100644 index 5390ba83..00000000 --- a/packages/ducjs/src/flatbuffers/duc/block-attachment.ts +++ /dev/null @@ -1,8 +0,0 @@ -// 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 */ - -export enum BLOCK_ATTACHMENT { - CENTER_EXTENTS = 10, - INSERTION_POINT = 11 -} diff --git a/packages/ducjs/src/flatbuffers/duc/boolean-operation.ts b/packages/ducjs/src/flatbuffers/duc/boolean-operation.ts deleted file mode 100644 index e1094519..00000000 --- a/packages/ducjs/src/flatbuffers/duc/boolean-operation.ts +++ /dev/null @@ -1,10 +0,0 @@ -// 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 */ - -export enum BOOLEAN_OPERATION { - UNION = 10, - SUBTRACT = 11, - INTERSECT = 12, - EXCLUDE = 13 -} diff --git a/packages/ducjs/src/flatbuffers/duc/bound-element.ts b/packages/ducjs/src/flatbuffers/duc/bound-element.ts deleted file mode 100644 index 30b3ef78..00000000 --- a/packages/ducjs/src/flatbuffers/duc/bound-element.ts +++ /dev/null @@ -1,62 +0,0 @@ -// 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 BoundElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):BoundElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsBoundElement(bb:flatbuffers.ByteBuffer, obj?:BoundElement):BoundElement { - return (obj || new BoundElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsBoundElement(bb:flatbuffers.ByteBuffer, obj?:BoundElement):BoundElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new BoundElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -type():string|null -type(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -type(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startBoundElement(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addType(builder:flatbuffers.Builder, typeOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, typeOffset, 0); -} - -static endBoundElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createBoundElement(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, typeOffset:flatbuffers.Offset):flatbuffers.Offset { - BoundElement.startBoundElement(builder); - BoundElement.addId(builder, idOffset); - BoundElement.addType(builder, typeOffset); - return BoundElement.endBoundElement(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/checkpoint.ts b/packages/ducjs/src/flatbuffers/duc/checkpoint.ts deleted file mode 100644 index e8f9e1fd..00000000 --- a/packages/ducjs/src/flatbuffers/duc/checkpoint.ts +++ /dev/null @@ -1,93 +0,0 @@ -// 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 { VersionBase } from '../duc/version-base'; - - -export class Checkpoint { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):Checkpoint { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsCheckpoint(bb:flatbuffers.ByteBuffer, obj?:Checkpoint):Checkpoint { - return (obj || new Checkpoint()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsCheckpoint(bb:flatbuffers.ByteBuffer, obj?:Checkpoint):Checkpoint { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new Checkpoint()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:VersionBase):VersionBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new VersionBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -data(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; -} - -dataLength():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -dataArray():Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - 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; -} - -sizeBytes():bigint { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); -} - -static startCheckpoint(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addData(builder:flatbuffers.Builder, dataOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, dataOffset, 0); -} - -static createDataVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { - builder.startVector(1, data.length, 1); - for (let i = data.length - 1; i >= 0; i--) { - builder.addInt8(data[i]!); - } - return builder.endVector(); -} - -static startDataVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(1, numElems, 1); -} - -static addSizeBytes(builder:flatbuffers.Builder, sizeBytes:bigint) { - builder.addFieldInt64(2, sizeBytes, BigInt('0')); -} - -static endCheckpoint(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createCheckpoint(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset, dataOffset:flatbuffers.Offset, sizeBytes:bigint):flatbuffers.Offset { - Checkpoint.startCheckpoint(builder); - Checkpoint.addBase(builder, baseOffset); - Checkpoint.addData(builder, dataOffset); - Checkpoint.addSizeBytes(builder, sizeBytes); - return Checkpoint.endCheckpoint(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/column-layout.ts b/packages/ducjs/src/flatbuffers/duc/column-layout.ts deleted file mode 100644 index a7a9425a..00000000 --- a/packages/ducjs/src/flatbuffers/duc/column-layout.ts +++ /dev/null @@ -1,90 +0,0 @@ -// 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 { COLUMN_TYPE } from '../duc/column-type'; -import { TextColumn } from '../duc/text-column'; - - -export class ColumnLayout { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):ColumnLayout { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsColumnLayout(bb:flatbuffers.ByteBuffer, obj?:ColumnLayout):ColumnLayout { - return (obj || new ColumnLayout()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsColumnLayout(bb:flatbuffers.ByteBuffer, obj?:ColumnLayout):ColumnLayout { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new ColumnLayout()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -type():COLUMN_TYPE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -definitions(index: number, obj?:TextColumn):TextColumn|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new TextColumn()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -definitionsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -autoHeight():boolean { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startColumnLayout(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addType(builder:flatbuffers.Builder, type:COLUMN_TYPE) { - builder.addFieldInt8(0, type, null); -} - -static addDefinitions(builder:flatbuffers.Builder, definitionsOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, definitionsOffset, 0); -} - -static createDefinitionsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startDefinitionsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addAutoHeight(builder:flatbuffers.Builder, autoHeight:boolean) { - builder.addFieldInt8(2, +autoHeight, +false); -} - -static endColumnLayout(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createColumnLayout(builder:flatbuffers.Builder, type:COLUMN_TYPE|null, definitionsOffset:flatbuffers.Offset, autoHeight:boolean):flatbuffers.Offset { - ColumnLayout.startColumnLayout(builder); - if (type !== null) - ColumnLayout.addType(builder, type); - ColumnLayout.addDefinitions(builder, definitionsOffset); - ColumnLayout.addAutoHeight(builder, autoHeight); - return ColumnLayout.endColumnLayout(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/column-type.ts b/packages/ducjs/src/flatbuffers/duc/column-type.ts deleted file mode 100644 index 2e92ca14..00000000 --- a/packages/ducjs/src/flatbuffers/duc/column-type.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum COLUMN_TYPE { - NO_COLUMNS = 10, - STATIC_COLUMNS = 11, - DYNAMIC_COLUMNS = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/custom-hatch-pattern.ts b/packages/ducjs/src/flatbuffers/duc/custom-hatch-pattern.ts deleted file mode 100644 index 420c6f67..00000000 --- a/packages/ducjs/src/flatbuffers/duc/custom-hatch-pattern.ts +++ /dev/null @@ -1,92 +0,0 @@ -// 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 { HatchPatternLine } from '../duc/hatch-pattern-line'; - - -export class CustomHatchPattern { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):CustomHatchPattern { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsCustomHatchPattern(bb:flatbuffers.ByteBuffer, obj?:CustomHatchPattern):CustomHatchPattern { - return (obj || new CustomHatchPattern()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsCustomHatchPattern(bb:flatbuffers.ByteBuffer, obj?:CustomHatchPattern):CustomHatchPattern { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new CustomHatchPattern()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -name():string|null -name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -name(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -description():string|null -description(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -description(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -lines(index: number, obj?:HatchPatternLine):HatchPatternLine|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new HatchPatternLine()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -linesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -static startCustomHatchPattern(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, nameOffset, 0); -} - -static addDescription(builder:flatbuffers.Builder, descriptionOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, descriptionOffset, 0); -} - -static addLines(builder:flatbuffers.Builder, linesOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, linesOffset, 0); -} - -static createLinesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startLinesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static endCustomHatchPattern(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createCustomHatchPattern(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, descriptionOffset:flatbuffers.Offset, linesOffset:flatbuffers.Offset):flatbuffers.Offset { - CustomHatchPattern.startCustomHatchPattern(builder); - CustomHatchPattern.addName(builder, nameOffset); - CustomHatchPattern.addDescription(builder, descriptionOffset); - CustomHatchPattern.addLines(builder, linesOffset); - return CustomHatchPattern.endCustomHatchPattern(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/datum-bracket-style.ts b/packages/ducjs/src/flatbuffers/duc/datum-bracket-style.ts deleted file mode 100644 index 93d40915..00000000 --- a/packages/ducjs/src/flatbuffers/duc/datum-bracket-style.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum DATUM_BRACKET_STYLE { - SQUARE = 10, - ROUND = 11, - NONE = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/datum-reference.ts b/packages/ducjs/src/flatbuffers/duc/datum-reference.ts deleted file mode 100644 index cbf8894c..00000000 --- a/packages/ducjs/src/flatbuffers/duc/datum-reference.ts +++ /dev/null @@ -1,64 +0,0 @@ -// 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 { MATERIAL_CONDITION } from '../duc/material-condition'; - - -export class DatumReference { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DatumReference { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDatumReference(bb:flatbuffers.ByteBuffer, obj?:DatumReference):DatumReference { - return (obj || new DatumReference()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDatumReference(bb:flatbuffers.ByteBuffer, obj?:DatumReference):DatumReference { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DatumReference()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -letters():string|null -letters(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -letters(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -modifier():MATERIAL_CONDITION|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startDatumReference(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addLetters(builder:flatbuffers.Builder, lettersOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, lettersOffset, 0); -} - -static addModifier(builder:flatbuffers.Builder, modifier:MATERIAL_CONDITION) { - builder.addFieldInt8(1, modifier, null); -} - -static endDatumReference(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDatumReference(builder:flatbuffers.Builder, lettersOffset:flatbuffers.Offset, modifier:MATERIAL_CONDITION|null):flatbuffers.Offset { - DatumReference.startDatumReference(builder); - DatumReference.addLetters(builder, lettersOffset); - if (modifier !== null) - DatumReference.addModifier(builder, modifier); - return DatumReference.endDatumReference(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/datum-target-type.ts b/packages/ducjs/src/flatbuffers/duc/datum-target-type.ts deleted file mode 100644 index a6da04c2..00000000 --- a/packages/ducjs/src/flatbuffers/duc/datum-target-type.ts +++ /dev/null @@ -1,10 +0,0 @@ -// 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 */ - -export enum DATUM_TARGET_TYPE { - POINT = 10, - LINE = 11, - AREA = 12, - MOVABLE = 13 -} diff --git a/packages/ducjs/src/flatbuffers/duc/decimal-separator.ts b/packages/ducjs/src/flatbuffers/duc/decimal-separator.ts deleted file mode 100644 index 4fc9828d..00000000 --- a/packages/ducjs/src/flatbuffers/duc/decimal-separator.ts +++ /dev/null @@ -1,8 +0,0 @@ -// 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 */ - -export enum DECIMAL_SEPARATOR { - DOT = 10, - COMMA = 11 -} diff --git a/packages/ducjs/src/flatbuffers/duc/delta.ts b/packages/ducjs/src/flatbuffers/duc/delta.ts deleted file mode 100644 index 5f570b35..00000000 --- a/packages/ducjs/src/flatbuffers/duc/delta.ts +++ /dev/null @@ -1,93 +0,0 @@ -// 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 { VersionBase } from '../duc/version-base'; - - -export class Delta { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):Delta { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDelta(bb:flatbuffers.ByteBuffer, obj?:Delta):Delta { - return (obj || new Delta()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDelta(bb:flatbuffers.ByteBuffer, obj?:Delta):Delta { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new Delta()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:VersionBase):VersionBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new VersionBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -sizeBytes():bigint { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); -} - -patch(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; -} - -patchLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -patchArray():Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - 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; -} - -static startDelta(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addSizeBytes(builder:flatbuffers.Builder, sizeBytes:bigint) { - builder.addFieldInt64(2, sizeBytes, BigInt('0')); -} - -static addPatch(builder:flatbuffers.Builder, patchOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, patchOffset, 0); -} - -static createPatchVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { - builder.startVector(1, data.length, 1); - for (let i = data.length - 1; i >= 0; i--) { - builder.addInt8(data[i]!); - } - return builder.endVector(); -} - -static startPatchVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(1, numElems, 1); -} - -static endDelta(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDelta(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset, sizeBytes:bigint, patchOffset:flatbuffers.Offset):flatbuffers.Offset { - Delta.startDelta(builder); - Delta.addBase(builder, baseOffset); - Delta.addSizeBytes(builder, sizeBytes); - Delta.addPatch(builder, patchOffset); - return Delta.endDelta(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/dictionary-entry.ts b/packages/ducjs/src/flatbuffers/duc/dictionary-entry.ts deleted file mode 100644 index 712ad04e..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dictionary-entry.ts +++ /dev/null @@ -1,63 +0,0 @@ -// 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 DictionaryEntry { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DictionaryEntry { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDictionaryEntry(bb:flatbuffers.ByteBuffer, obj?:DictionaryEntry):DictionaryEntry { - return (obj || new DictionaryEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDictionaryEntry(bb:flatbuffers.ByteBuffer, obj?:DictionaryEntry):DictionaryEntry { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DictionaryEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -key():string|null -key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -key(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -value():string|null -value(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -value(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDictionaryEntry(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, keyOffset, 0); -} - -static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, valueOffset, 0); -} - -static endDictionaryEntry(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // key - return offset; -} - -static createDictionaryEntry(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset, valueOffset:flatbuffers.Offset):flatbuffers.Offset { - DictionaryEntry.startDictionaryEntry(builder); - DictionaryEntry.addKey(builder, keyOffset); - DictionaryEntry.addValue(builder, valueOffset); - return DictionaryEntry.endDictionaryEntry(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-baseline-data.ts b/packages/ducjs/src/flatbuffers/duc/dimension-baseline-data.ts deleted file mode 100644 index 615f2731..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-baseline-data.ts +++ /dev/null @@ -1,50 +0,0 @@ -// 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 DimensionBaselineData { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DimensionBaselineData { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDimensionBaselineData(bb:flatbuffers.ByteBuffer, obj?:DimensionBaselineData):DimensionBaselineData { - return (obj || new DimensionBaselineData()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDimensionBaselineData(bb:flatbuffers.ByteBuffer, obj?:DimensionBaselineData):DimensionBaselineData { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DimensionBaselineData()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -baseDimensionId():string|null -baseDimensionId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -baseDimensionId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDimensionBaselineData(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addBaseDimensionId(builder:flatbuffers.Builder, baseDimensionIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseDimensionIdOffset, 0); -} - -static endDimensionBaselineData(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDimensionBaselineData(builder:flatbuffers.Builder, baseDimensionIdOffset:flatbuffers.Offset):flatbuffers.Offset { - DimensionBaselineData.startDimensionBaselineData(builder); - DimensionBaselineData.addBaseDimensionId(builder, baseDimensionIdOffset); - return DimensionBaselineData.endDimensionBaselineData(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-bindings.ts b/packages/ducjs/src/flatbuffers/duc/dimension-bindings.ts deleted file mode 100644 index 4c1e345e..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-bindings.ts +++ /dev/null @@ -1,64 +0,0 @@ -// 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 { DucPointBinding } from '../duc/duc-point-binding'; - - -export class DimensionBindings { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DimensionBindings { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDimensionBindings(bb:flatbuffers.ByteBuffer, obj?:DimensionBindings):DimensionBindings { - return (obj || new DimensionBindings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDimensionBindings(bb:flatbuffers.ByteBuffer, obj?:DimensionBindings):DimensionBindings { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DimensionBindings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -origin1(obj?:DucPointBinding):DucPointBinding|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new DucPointBinding()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -origin2(obj?:DucPointBinding):DucPointBinding|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucPointBinding()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -center(obj?:DucPointBinding):DucPointBinding|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new DucPointBinding()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDimensionBindings(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addOrigin1(builder:flatbuffers.Builder, origin1Offset:flatbuffers.Offset) { - builder.addFieldOffset(0, origin1Offset, 0); -} - -static addOrigin2(builder:flatbuffers.Builder, origin2Offset:flatbuffers.Offset) { - builder.addFieldOffset(1, origin2Offset, 0); -} - -static addCenter(builder:flatbuffers.Builder, centerOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, centerOffset, 0); -} - -static endDimensionBindings(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-continue-data.ts b/packages/ducjs/src/flatbuffers/duc/dimension-continue-data.ts deleted file mode 100644 index b5808178..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-continue-data.ts +++ /dev/null @@ -1,50 +0,0 @@ -// 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 DimensionContinueData { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DimensionContinueData { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDimensionContinueData(bb:flatbuffers.ByteBuffer, obj?:DimensionContinueData):DimensionContinueData { - return (obj || new DimensionContinueData()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDimensionContinueData(bb:flatbuffers.ByteBuffer, obj?:DimensionContinueData):DimensionContinueData { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DimensionContinueData()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -continueFromDimensionId():string|null -continueFromDimensionId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -continueFromDimensionId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDimensionContinueData(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addContinueFromDimensionId(builder:flatbuffers.Builder, continueFromDimensionIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, continueFromDimensionIdOffset, 0); -} - -static endDimensionContinueData(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDimensionContinueData(builder:flatbuffers.Builder, continueFromDimensionIdOffset:flatbuffers.Offset):flatbuffers.Offset { - DimensionContinueData.startDimensionContinueData(builder); - DimensionContinueData.addContinueFromDimensionId(builder, continueFromDimensionIdOffset); - return DimensionContinueData.endDimensionContinueData(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-definition-points.ts b/packages/ducjs/src/flatbuffers/duc/dimension-definition-points.ts deleted file mode 100644 index 22875eab..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-definition-points.ts +++ /dev/null @@ -1,82 +0,0 @@ -// 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'; - - -export class DimensionDefinitionPoints { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DimensionDefinitionPoints { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDimensionDefinitionPoints(bb:flatbuffers.ByteBuffer, obj?:DimensionDefinitionPoints):DimensionDefinitionPoints { - return (obj || new DimensionDefinitionPoints()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDimensionDefinitionPoints(bb:flatbuffers.ByteBuffer, obj?:DimensionDefinitionPoints):DimensionDefinitionPoints { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DimensionDefinitionPoints()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -origin1(obj?:GeometricPoint):GeometricPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new GeometricPoint()).__init(this.bb_pos + offset, this.bb!) : null; -} - -origin2(obj?:GeometricPoint):GeometricPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new GeometricPoint()).__init(this.bb_pos + offset, this.bb!) : null; -} - -location(obj?:GeometricPoint):GeometricPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new GeometricPoint()).__init(this.bb_pos + offset, this.bb!) : null; -} - -center(obj?:GeometricPoint):GeometricPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new GeometricPoint()).__init(this.bb_pos + offset, this.bb!) : null; -} - -jog(obj?:GeometricPoint):GeometricPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new GeometricPoint()).__init(this.bb_pos + offset, this.bb!) : null; -} - -static startDimensionDefinitionPoints(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addOrigin1(builder:flatbuffers.Builder, origin1Offset:flatbuffers.Offset) { - builder.addFieldStruct(0, origin1Offset, 0); -} - -static addOrigin2(builder:flatbuffers.Builder, origin2Offset:flatbuffers.Offset) { - builder.addFieldStruct(1, origin2Offset, 0); -} - -static addLocation(builder:flatbuffers.Builder, locationOffset:flatbuffers.Offset) { - builder.addFieldStruct(2, locationOffset, 0); -} - -static addCenter(builder:flatbuffers.Builder, centerOffset:flatbuffers.Offset) { - builder.addFieldStruct(3, centerOffset, 0); -} - -static addJog(builder:flatbuffers.Builder, jogOffset:flatbuffers.Offset) { - builder.addFieldStruct(4, jogOffset, 0); -} - -static endDimensionDefinitionPoints(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-ext-line-style.ts b/packages/ducjs/src/flatbuffers/duc/dimension-ext-line-style.ts deleted file mode 100644 index 6a38f170..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-ext-line-style.ts +++ /dev/null @@ -1,71 +0,0 @@ -// 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 { ElementStroke } from '../duc/element-stroke'; - - -export class DimensionExtLineStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DimensionExtLineStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDimensionExtLineStyle(bb:flatbuffers.ByteBuffer, obj?:DimensionExtLineStyle):DimensionExtLineStyle { - return (obj || new DimensionExtLineStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDimensionExtLineStyle(bb:flatbuffers.ByteBuffer, obj?:DimensionExtLineStyle):DimensionExtLineStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DimensionExtLineStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -stroke(obj?:ElementStroke):ElementStroke|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new ElementStroke()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -overshoot():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -offset():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startDimensionExtLineStyle(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addStroke(builder:flatbuffers.Builder, strokeOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, strokeOffset, 0); -} - -static addOvershoot(builder:flatbuffers.Builder, overshoot:number) { - builder.addFieldFloat64(1, overshoot, 0.0); -} - -static addOffset(builder:flatbuffers.Builder, offset:number) { - builder.addFieldFloat64(2, offset, 0.0); -} - -static endDimensionExtLineStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDimensionExtLineStyle(builder:flatbuffers.Builder, strokeOffset:flatbuffers.Offset, overshoot:number, offset:number):flatbuffers.Offset { - DimensionExtLineStyle.startDimensionExtLineStyle(builder); - DimensionExtLineStyle.addStroke(builder, strokeOffset); - DimensionExtLineStyle.addOvershoot(builder, overshoot); - DimensionExtLineStyle.addOffset(builder, offset); - return DimensionExtLineStyle.endDimensionExtLineStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-fit-rule.ts b/packages/ducjs/src/flatbuffers/duc/dimension-fit-rule.ts deleted file mode 100644 index 5c208cbe..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-fit-rule.ts +++ /dev/null @@ -1,10 +0,0 @@ -// 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 */ - -export enum DIMENSION_FIT_RULE { - TEXT_AND_ARROWS = 10, - ARROWS_ONLY = 11, - TEXT_ONLY = 12, - BEST_FIT = 13 -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-fit-style.ts b/packages/ducjs/src/flatbuffers/duc/dimension-fit-style.ts deleted file mode 100644 index 74ea2648..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-fit-style.ts +++ /dev/null @@ -1,74 +0,0 @@ -// 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 { DIMENSION_FIT_RULE } from '../duc/dimension-fit-rule'; -import { DIMENSION_TEXT_PLACEMENT } from '../duc/dimension-text-placement'; - - -export class DimensionFitStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DimensionFitStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDimensionFitStyle(bb:flatbuffers.ByteBuffer, obj?:DimensionFitStyle):DimensionFitStyle { - return (obj || new DimensionFitStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDimensionFitStyle(bb:flatbuffers.ByteBuffer, obj?:DimensionFitStyle):DimensionFitStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DimensionFitStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -rule():DIMENSION_FIT_RULE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -textPlacement():DIMENSION_TEXT_PLACEMENT|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -forceTextInside():boolean { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startDimensionFitStyle(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addRule(builder:flatbuffers.Builder, rule:DIMENSION_FIT_RULE) { - builder.addFieldInt8(0, rule, null); -} - -static addTextPlacement(builder:flatbuffers.Builder, textPlacement:DIMENSION_TEXT_PLACEMENT) { - builder.addFieldInt8(1, textPlacement, null); -} - -static addForceTextInside(builder:flatbuffers.Builder, forceTextInside:boolean) { - builder.addFieldInt8(2, +forceTextInside, +false); -} - -static endDimensionFitStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDimensionFitStyle(builder:flatbuffers.Builder, rule:DIMENSION_FIT_RULE|null, textPlacement:DIMENSION_TEXT_PLACEMENT|null, forceTextInside:boolean):flatbuffers.Offset { - DimensionFitStyle.startDimensionFitStyle(builder); - if (rule !== null) - DimensionFitStyle.addRule(builder, rule); - if (textPlacement !== null) - DimensionFitStyle.addTextPlacement(builder, textPlacement); - DimensionFitStyle.addForceTextInside(builder, forceTextInside); - return DimensionFitStyle.endDimensionFitStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-line-style.ts b/packages/ducjs/src/flatbuffers/duc/dimension-line-style.ts deleted file mode 100644 index a63fcebf..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-line-style.ts +++ /dev/null @@ -1,61 +0,0 @@ -// 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 { ElementStroke } from '../duc/element-stroke'; - - -export class DimensionLineStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DimensionLineStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDimensionLineStyle(bb:flatbuffers.ByteBuffer, obj?:DimensionLineStyle):DimensionLineStyle { - return (obj || new DimensionLineStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDimensionLineStyle(bb:flatbuffers.ByteBuffer, obj?:DimensionLineStyle):DimensionLineStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DimensionLineStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -stroke(obj?:ElementStroke):ElementStroke|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new ElementStroke()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -textGap():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startDimensionLineStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addStroke(builder:flatbuffers.Builder, strokeOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, strokeOffset, 0); -} - -static addTextGap(builder:flatbuffers.Builder, textGap:number) { - builder.addFieldFloat64(1, textGap, 0.0); -} - -static endDimensionLineStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDimensionLineStyle(builder:flatbuffers.Builder, strokeOffset:flatbuffers.Offset, textGap:number):flatbuffers.Offset { - DimensionLineStyle.startDimensionLineStyle(builder); - DimensionLineStyle.addStroke(builder, strokeOffset); - DimensionLineStyle.addTextGap(builder, textGap); - return DimensionLineStyle.endDimensionLineStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-symbol-style.ts b/packages/ducjs/src/flatbuffers/duc/dimension-symbol-style.ts deleted file mode 100644 index b9c59f99..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-symbol-style.ts +++ /dev/null @@ -1,90 +0,0 @@ -// 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 { DucHead } from '../duc/duc-head'; -import { MARK_ELLIPSE_CENTER } from '../duc/mark-ellipse-center'; - - -export class DimensionSymbolStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DimensionSymbolStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDimensionSymbolStyle(bb:flatbuffers.ByteBuffer, obj?:DimensionSymbolStyle):DimensionSymbolStyle { - return (obj || new DimensionSymbolStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDimensionSymbolStyle(bb:flatbuffers.ByteBuffer, obj?:DimensionSymbolStyle):DimensionSymbolStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DimensionSymbolStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -headsOverride(index: number, obj?:DucHead):DucHead|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new DucHead()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -headsOverrideLength():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -centerMarkType():MARK_ELLIPSE_CENTER|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -centerMarkSize():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startDimensionSymbolStyle(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addHeadsOverride(builder:flatbuffers.Builder, headsOverrideOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, headsOverrideOffset, 0); -} - -static createHeadsOverrideVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startHeadsOverrideVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addCenterMarkType(builder:flatbuffers.Builder, centerMarkType:MARK_ELLIPSE_CENTER) { - builder.addFieldInt8(1, centerMarkType, null); -} - -static addCenterMarkSize(builder:flatbuffers.Builder, centerMarkSize:number) { - builder.addFieldFloat64(2, centerMarkSize, 0.0); -} - -static endDimensionSymbolStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDimensionSymbolStyle(builder:flatbuffers.Builder, headsOverrideOffset:flatbuffers.Offset, centerMarkType:MARK_ELLIPSE_CENTER|null, centerMarkSize:number):flatbuffers.Offset { - DimensionSymbolStyle.startDimensionSymbolStyle(builder); - DimensionSymbolStyle.addHeadsOverride(builder, headsOverrideOffset); - if (centerMarkType !== null) - DimensionSymbolStyle.addCenterMarkType(builder, centerMarkType); - DimensionSymbolStyle.addCenterMarkSize(builder, centerMarkSize); - return DimensionSymbolStyle.endDimensionSymbolStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-text-placement.ts b/packages/ducjs/src/flatbuffers/duc/dimension-text-placement.ts deleted file mode 100644 index 56a64c3d..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-text-placement.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum DIMENSION_TEXT_PLACEMENT { - BESIDE_LINE = 10, - OVER_LINE = 11, - OVER_LINE_WITH_LEADER = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-tolerance-style.ts b/packages/ducjs/src/flatbuffers/duc/dimension-tolerance-style.ts deleted file mode 100644 index 0ac1f93d..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-tolerance-style.ts +++ /dev/null @@ -1,92 +0,0 @@ -// 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 { DucTextStyle } from '../duc/duc-text-style'; -import { TOLERANCE_DISPLAY } from '../duc/tolerance-display'; - - -export class DimensionToleranceStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DimensionToleranceStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDimensionToleranceStyle(bb:flatbuffers.ByteBuffer, obj?:DimensionToleranceStyle):DimensionToleranceStyle { - return (obj || new DimensionToleranceStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDimensionToleranceStyle(bb:flatbuffers.ByteBuffer, obj?:DimensionToleranceStyle):DimensionToleranceStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DimensionToleranceStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -enabled():boolean { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -displayMethod():TOLERANCE_DISPLAY|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -upperValue():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -lowerValue():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -precision():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -textStyle(obj?:DucTextStyle):DucTextStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new DucTextStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDimensionToleranceStyle(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addEnabled(builder:flatbuffers.Builder, enabled:boolean) { - builder.addFieldInt8(0, +enabled, +false); -} - -static addDisplayMethod(builder:flatbuffers.Builder, displayMethod:TOLERANCE_DISPLAY) { - builder.addFieldInt8(1, displayMethod, null); -} - -static addUpperValue(builder:flatbuffers.Builder, upperValue:number) { - builder.addFieldFloat64(2, upperValue, 0.0); -} - -static addLowerValue(builder:flatbuffers.Builder, lowerValue:number) { - builder.addFieldFloat64(3, lowerValue, 0.0); -} - -static addPrecision(builder:flatbuffers.Builder, precision:number) { - builder.addFieldInt32(4, precision, 0); -} - -static addTextStyle(builder:flatbuffers.Builder, textStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, textStyleOffset, 0); -} - -static endDimensionToleranceStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-type.ts b/packages/ducjs/src/flatbuffers/duc/dimension-type.ts deleted file mode 100644 index 6f468d96..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-type.ts +++ /dev/null @@ -1,19 +0,0 @@ -// 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 */ - -export enum DIMENSION_TYPE { - LINEAR = 10, - ALIGNED = 11, - ANGULAR = 12, - ARC_LENGTH = 13, - RADIUS = 14, - DIAMETER = 15, - CENTER_MARK = 16, - ROTATED = 17, - SPACING = 18, - CONTINUE = 19, - BASELINE = 20, - JOGGED_LINEAR = 21, - ORDINATE = 22 -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-units-format.ts b/packages/ducjs/src/flatbuffers/duc/dimension-units-format.ts deleted file mode 100644 index 8827f358..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-units-format.ts +++ /dev/null @@ -1,11 +0,0 @@ -// 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 */ - -export enum DIMENSION_UNITS_FORMAT { - DECIMAL = 10, - ENGINEERING = 11, - ARCHITECTURAL = 12, - FRACTIONAL = 13, - SCIENTIFIC = 14 -} diff --git a/packages/ducjs/src/flatbuffers/duc/dimension-validation-rules.ts b/packages/ducjs/src/flatbuffers/duc/dimension-validation-rules.ts deleted file mode 100644 index 9181f6b1..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dimension-validation-rules.ts +++ /dev/null @@ -1,95 +0,0 @@ -// 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 DimensionValidationRules { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DimensionValidationRules { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDimensionValidationRules(bb:flatbuffers.ByteBuffer, obj?:DimensionValidationRules):DimensionValidationRules { - return (obj || new DimensionValidationRules()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDimensionValidationRules(bb:flatbuffers.ByteBuffer, obj?:DimensionValidationRules):DimensionValidationRules { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DimensionValidationRules()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -minTextHeight():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -maxTextHeight():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -allowedPrecisions(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readInt32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0; -} - -allowedPrecisionsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -allowedPrecisionsArray():Int32Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? new Int32Array(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 startDimensionValidationRules(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addMinTextHeight(builder:flatbuffers.Builder, minTextHeight:number) { - builder.addFieldFloat64(0, minTextHeight, 0.0); -} - -static addMaxTextHeight(builder:flatbuffers.Builder, maxTextHeight:number) { - builder.addFieldFloat64(1, maxTextHeight, 0.0); -} - -static addAllowedPrecisions(builder:flatbuffers.Builder, allowedPrecisionsOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, allowedPrecisionsOffset, 0); -} - -static createAllowedPrecisionsVector(builder:flatbuffers.Builder, data:number[]|Int32Array):flatbuffers.Offset; -/** - * @deprecated This Uint8Array overload will be removed in the future. - */ -static createAllowedPrecisionsVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; -static createAllowedPrecisionsVector(builder:flatbuffers.Builder, data:number[]|Int32Array|Uint8Array):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addInt32(data[i]!); - } - return builder.endVector(); -} - -static startAllowedPrecisionsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static endDimensionValidationRules(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDimensionValidationRules(builder:flatbuffers.Builder, minTextHeight:number, maxTextHeight:number, allowedPrecisionsOffset:flatbuffers.Offset):flatbuffers.Offset { - DimensionValidationRules.startDimensionValidationRules(builder); - DimensionValidationRules.addMinTextHeight(builder, minTextHeight); - DimensionValidationRules.addMaxTextHeight(builder, maxTextHeight); - DimensionValidationRules.addAllowedPrecisions(builder, allowedPrecisionsOffset); - return DimensionValidationRules.endDimensionValidationRules(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/document-grid-align-items.ts b/packages/ducjs/src/flatbuffers/duc/document-grid-align-items.ts deleted file mode 100644 index ee99b87f..00000000 --- a/packages/ducjs/src/flatbuffers/duc/document-grid-align-items.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum DOCUMENT_GRID_ALIGN_ITEMS { - START = 10, - CENTER = 11, - END = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/document-grid-config.ts b/packages/ducjs/src/flatbuffers/duc/document-grid-config.ts deleted file mode 100644 index 90ee2784..00000000 --- a/packages/ducjs/src/flatbuffers/duc/document-grid-config.ts +++ /dev/null @@ -1,102 +0,0 @@ -// 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 { DOCUMENT_GRID_ALIGN_ITEMS } from '../duc/document-grid-align-items'; - - -export class DocumentGridConfig { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DocumentGridConfig { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDocumentGridConfig(bb:flatbuffers.ByteBuffer, obj?:DocumentGridConfig):DocumentGridConfig { - return (obj || new DocumentGridConfig()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDocumentGridConfig(bb:flatbuffers.ByteBuffer, obj?:DocumentGridConfig):DocumentGridConfig { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DocumentGridConfig()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -columns():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -gapX():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -gapY():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -alignItems():DOCUMENT_GRID_ALIGN_ITEMS|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -firstPageAlone():boolean { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -scale():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startDocumentGridConfig(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addColumns(builder:flatbuffers.Builder, columns:number) { - builder.addFieldInt32(0, columns, 0); -} - -static addGapX(builder:flatbuffers.Builder, gapX:number) { - builder.addFieldFloat64(1, gapX, 0.0); -} - -static addGapY(builder:flatbuffers.Builder, gapY:number) { - builder.addFieldFloat64(2, gapY, 0.0); -} - -static addAlignItems(builder:flatbuffers.Builder, alignItems:DOCUMENT_GRID_ALIGN_ITEMS) { - builder.addFieldInt8(3, alignItems, null); -} - -static addFirstPageAlone(builder:flatbuffers.Builder, firstPageAlone:boolean) { - builder.addFieldInt8(4, +firstPageAlone, +false); -} - -static addScale(builder:flatbuffers.Builder, scale:number) { - builder.addFieldFloat64(5, scale, 0.0); -} - -static endDocumentGridConfig(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDocumentGridConfig(builder:flatbuffers.Builder, columns:number, gapX:number, gapY:number, alignItems:DOCUMENT_GRID_ALIGN_ITEMS|null, firstPageAlone:boolean, scale:number):flatbuffers.Offset { - DocumentGridConfig.startDocumentGridConfig(builder); - DocumentGridConfig.addColumns(builder, columns); - DocumentGridConfig.addGapX(builder, gapX); - DocumentGridConfig.addGapY(builder, gapY); - if (alignItems !== null) - DocumentGridConfig.addAlignItems(builder, alignItems); - DocumentGridConfig.addFirstPageAlone(builder, firstPageAlone); - DocumentGridConfig.addScale(builder, scale); - return DocumentGridConfig.endDocumentGridConfig(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-arrow-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-arrow-element.ts deleted file mode 100644 index d7739114..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-arrow-element.ts +++ /dev/null @@ -1,61 +0,0 @@ -// 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 { _DucLinearElementBase } from '../duc/duc-linear-element-base'; - - -export class DucArrowElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucArrowElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucArrowElement(bb:flatbuffers.ByteBuffer, obj?:DucArrowElement):DucArrowElement { - return (obj || new DucArrowElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucArrowElement(bb:flatbuffers.ByteBuffer, obj?:DucArrowElement):DucArrowElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucArrowElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -linearBase(obj?:_DucLinearElementBase):_DucLinearElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucLinearElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -elbowed():boolean { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startDucArrowElement(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addLinearBase(builder:flatbuffers.Builder, linearBaseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, linearBaseOffset, 0); -} - -static addElbowed(builder:flatbuffers.Builder, elbowed:boolean) { - builder.addFieldInt8(1, +elbowed, +false); -} - -static endDucArrowElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucArrowElement(builder:flatbuffers.Builder, linearBaseOffset:flatbuffers.Offset, elbowed:boolean):flatbuffers.Offset { - DucArrowElement.startDucArrowElement(builder); - DucArrowElement.addLinearBase(builder, linearBaseOffset); - DucArrowElement.addElbowed(builder, elbowed); - return DucArrowElement.endDucArrowElement(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-block-attribute-definition-entry.ts b/packages/ducjs/src/flatbuffers/duc/duc-block-attribute-definition-entry.ts deleted file mode 100644 index 7498533e..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-block-attribute-definition-entry.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 { DucBlockAttributeDefinition } from '../duc/duc-block-attribute-definition'; - - -export class DucBlockAttributeDefinitionEntry { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucBlockAttributeDefinitionEntry { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucBlockAttributeDefinitionEntry(bb:flatbuffers.ByteBuffer, obj?:DucBlockAttributeDefinitionEntry):DucBlockAttributeDefinitionEntry { - return (obj || new DucBlockAttributeDefinitionEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucBlockAttributeDefinitionEntry(bb:flatbuffers.ByteBuffer, obj?:DucBlockAttributeDefinitionEntry):DucBlockAttributeDefinitionEntry { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucBlockAttributeDefinitionEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -key():string|null -key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -key(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -value(obj?:DucBlockAttributeDefinition):DucBlockAttributeDefinition|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucBlockAttributeDefinition()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucBlockAttributeDefinitionEntry(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, keyOffset, 0); -} - -static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, valueOffset, 0); -} - -static endDucBlockAttributeDefinitionEntry(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // key - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-block-attribute-definition.ts b/packages/ducjs/src/flatbuffers/duc/duc-block-attribute-definition.ts deleted file mode 100644 index 4e2fcdad..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-block-attribute-definition.ts +++ /dev/null @@ -1,84 +0,0 @@ -// 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 DucBlockAttributeDefinition { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucBlockAttributeDefinition { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucBlockAttributeDefinition(bb:flatbuffers.ByteBuffer, obj?:DucBlockAttributeDefinition):DucBlockAttributeDefinition { - return (obj || new DucBlockAttributeDefinition()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucBlockAttributeDefinition(bb:flatbuffers.ByteBuffer, obj?:DucBlockAttributeDefinition):DucBlockAttributeDefinition { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucBlockAttributeDefinition()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -tag():string|null -tag(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -tag(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -prompt():string|null -prompt(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -prompt(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -defaultValue():string|null -defaultValue(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -defaultValue(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -isConstant():boolean { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startDucBlockAttributeDefinition(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addTag(builder:flatbuffers.Builder, tagOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, tagOffset, 0); -} - -static addPrompt(builder:flatbuffers.Builder, promptOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, promptOffset, 0); -} - -static addDefaultValue(builder:flatbuffers.Builder, defaultValueOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, defaultValueOffset, 0); -} - -static addIsConstant(builder:flatbuffers.Builder, isConstant:boolean) { - builder.addFieldInt8(3, +isConstant, +false); -} - -static endDucBlockAttributeDefinition(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucBlockAttributeDefinition(builder:flatbuffers.Builder, tagOffset:flatbuffers.Offset, promptOffset:flatbuffers.Offset, defaultValueOffset:flatbuffers.Offset, isConstant:boolean):flatbuffers.Offset { - DucBlockAttributeDefinition.startDucBlockAttributeDefinition(builder); - DucBlockAttributeDefinition.addTag(builder, tagOffset); - DucBlockAttributeDefinition.addPrompt(builder, promptOffset); - DucBlockAttributeDefinition.addDefaultValue(builder, defaultValueOffset); - DucBlockAttributeDefinition.addIsConstant(builder, isConstant); - return DucBlockAttributeDefinition.endDucBlockAttributeDefinition(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-block-collection-entry.ts b/packages/ducjs/src/flatbuffers/duc/duc-block-collection-entry.ts deleted file mode 100644 index e4cd37cb..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-block-collection-entry.ts +++ /dev/null @@ -1,60 +0,0 @@ -// 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 DucBlockCollectionEntry { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucBlockCollectionEntry { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucBlockCollectionEntry(bb:flatbuffers.ByteBuffer, obj?:DucBlockCollectionEntry):DucBlockCollectionEntry { - return (obj || new DucBlockCollectionEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucBlockCollectionEntry(bb:flatbuffers.ByteBuffer, obj?:DucBlockCollectionEntry):DucBlockCollectionEntry { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucBlockCollectionEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -isCollection():boolean { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startDucBlockCollectionEntry(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addIsCollection(builder:flatbuffers.Builder, isCollection:boolean) { - builder.addFieldInt8(1, +isCollection, +false); -} - -static endDucBlockCollectionEntry(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucBlockCollectionEntry(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, isCollection:boolean):flatbuffers.Offset { - DucBlockCollectionEntry.startDucBlockCollectionEntry(builder); - DucBlockCollectionEntry.addId(builder, idOffset); - DucBlockCollectionEntry.addIsCollection(builder, isCollection); - return DucBlockCollectionEntry.endDucBlockCollectionEntry(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-block-collection.ts b/packages/ducjs/src/flatbuffers/duc/duc-block-collection.ts deleted file mode 100644 index 3b530198..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-block-collection.ts +++ /dev/null @@ -1,126 +0,0 @@ -// 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 { DucBlockCollectionEntry } from '../duc/duc-block-collection-entry'; -import { DucBlockMetadata } from '../duc/duc-block-metadata'; - - -export class DucBlockCollection { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucBlockCollection { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucBlockCollection(bb:flatbuffers.ByteBuffer, obj?:DucBlockCollection):DucBlockCollection { - return (obj || new DucBlockCollection()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucBlockCollection(bb:flatbuffers.ByteBuffer, obj?:DucBlockCollection):DucBlockCollection { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucBlockCollection()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -label():string|null -label(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -label(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -children(index: number, obj?:DucBlockCollectionEntry):DucBlockCollectionEntry|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new DucBlockCollectionEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -childrenLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -metadata(obj?:DucBlockMetadata):DucBlockMetadata|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new DucBlockMetadata()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -thumbnail(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; -} - -thumbnailLength():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -thumbnailArray():Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - 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; -} - -static startDucBlockCollection(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addLabel(builder:flatbuffers.Builder, labelOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, labelOffset, 0); -} - -static addChildren(builder:flatbuffers.Builder, childrenOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, childrenOffset, 0); -} - -static createChildrenVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startChildrenVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addMetadata(builder:flatbuffers.Builder, metadataOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, metadataOffset, 0); -} - -static addThumbnail(builder:flatbuffers.Builder, thumbnailOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, thumbnailOffset, 0); -} - -static createThumbnailVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { - builder.startVector(1, data.length, 1); - for (let i = data.length - 1; i >= 0; i--) { - builder.addInt8(data[i]!); - } - return builder.endVector(); -} - -static startThumbnailVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(1, numElems, 1); -} - -static endDucBlockCollection(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-block-duplication-array.ts b/packages/ducjs/src/flatbuffers/duc/duc-block-duplication-array.ts deleted file mode 100644 index b14e4dae..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-block-duplication-array.ts +++ /dev/null @@ -1,78 +0,0 @@ -// 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 DucBlockDuplicationArray { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucBlockDuplicationArray { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucBlockDuplicationArray(bb:flatbuffers.ByteBuffer, obj?:DucBlockDuplicationArray):DucBlockDuplicationArray { - return (obj || new DucBlockDuplicationArray()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucBlockDuplicationArray(bb:flatbuffers.ByteBuffer, obj?:DucBlockDuplicationArray):DucBlockDuplicationArray { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucBlockDuplicationArray()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -rows():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -cols():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -rowSpacing():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -colSpacing():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startDucBlockDuplicationArray(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addRows(builder:flatbuffers.Builder, rows:number) { - builder.addFieldInt32(0, rows, 0); -} - -static addCols(builder:flatbuffers.Builder, cols:number) { - builder.addFieldInt32(1, cols, 0); -} - -static addRowSpacing(builder:flatbuffers.Builder, rowSpacing:number) { - builder.addFieldFloat64(2, rowSpacing, 0.0); -} - -static addColSpacing(builder:flatbuffers.Builder, colSpacing:number) { - builder.addFieldFloat64(3, colSpacing, 0.0); -} - -static endDucBlockDuplicationArray(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucBlockDuplicationArray(builder:flatbuffers.Builder, rows:number, cols:number, rowSpacing:number, colSpacing:number):flatbuffers.Offset { - DucBlockDuplicationArray.startDucBlockDuplicationArray(builder); - DucBlockDuplicationArray.addRows(builder, rows); - DucBlockDuplicationArray.addCols(builder, cols); - DucBlockDuplicationArray.addRowSpacing(builder, rowSpacing); - DucBlockDuplicationArray.addColSpacing(builder, colSpacing); - return DucBlockDuplicationArray.endDucBlockDuplicationArray(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-block-instance-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-block-instance-element.ts deleted file mode 100644 index 7061e4fa..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-block-instance-element.ts +++ /dev/null @@ -1,34 +0,0 @@ -// 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 DucBlockInstanceElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucBlockInstanceElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucBlockInstanceElement(bb:flatbuffers.ByteBuffer, obj?:DucBlockInstanceElement):DucBlockInstanceElement { - return (obj || new DucBlockInstanceElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucBlockInstanceElement(bb:flatbuffers.ByteBuffer, obj?:DucBlockInstanceElement):DucBlockInstanceElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucBlockInstanceElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static startDucBlockInstanceElement(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static endDucBlockInstanceElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-block-instance.ts b/packages/ducjs/src/flatbuffers/duc/duc-block-instance.ts deleted file mode 100644 index 58522347..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-block-instance.ts +++ /dev/null @@ -1,130 +0,0 @@ -// 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 { DucBlockDuplicationArray } from '../duc/duc-block-duplication-array'; -import { StringValueEntry } from '../duc/string-value-entry'; - - -export class DucBlockInstance { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucBlockInstance { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucBlockInstance(bb:flatbuffers.ByteBuffer, obj?:DucBlockInstance):DucBlockInstance { - return (obj || new DucBlockInstance()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucBlockInstance(bb:flatbuffers.ByteBuffer, obj?:DucBlockInstance):DucBlockInstance { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucBlockInstance()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -blockId():string|null -blockId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -blockId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -elementOverrides(index: number, obj?:StringValueEntry):StringValueEntry|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new StringValueEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -elementOverridesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -attributeValues(index: number, obj?:StringValueEntry):StringValueEntry|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new StringValueEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -attributeValuesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -duplicationArray(obj?:DucBlockDuplicationArray):DucBlockDuplicationArray|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new DucBlockDuplicationArray()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -version():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -static startDucBlockInstance(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addBlockId(builder:flatbuffers.Builder, blockIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, blockIdOffset, 0); -} - -static addElementOverrides(builder:flatbuffers.Builder, elementOverridesOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, elementOverridesOffset, 0); -} - -static createElementOverridesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startElementOverridesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addAttributeValues(builder:flatbuffers.Builder, attributeValuesOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, attributeValuesOffset, 0); -} - -static createAttributeValuesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startAttributeValuesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addDuplicationArray(builder:flatbuffers.Builder, duplicationArrayOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, duplicationArrayOffset, 0); -} - -static addVersion(builder:flatbuffers.Builder, version:number) { - builder.addFieldInt32(5, version, 0); -} - -static endDucBlockInstance(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-block-metadata.ts b/packages/ducjs/src/flatbuffers/duc/duc-block-metadata.ts deleted file mode 100644 index 76fa029f..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-block-metadata.ts +++ /dev/null @@ -1,112 +0,0 @@ -// 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 DucBlockMetadata { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucBlockMetadata { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucBlockMetadata(bb:flatbuffers.ByteBuffer, obj?:DucBlockMetadata):DucBlockMetadata { - return (obj || new DucBlockMetadata()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucBlockMetadata(bb:flatbuffers.ByteBuffer, obj?:DucBlockMetadata):DucBlockMetadata { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucBlockMetadata()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -source():string|null -source(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -source(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -usageCount():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -createdAt():bigint { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); -} - -updatedAt():bigint { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); -} - -localization(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; -} - -localizationLength():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -localizationArray():Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - 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; -} - -static startDucBlockMetadata(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addSource(builder:flatbuffers.Builder, sourceOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, sourceOffset, 0); -} - -static addUsageCount(builder:flatbuffers.Builder, usageCount:number) { - builder.addFieldInt32(1, usageCount, 0); -} - -static addCreatedAt(builder:flatbuffers.Builder, createdAt:bigint) { - builder.addFieldInt64(2, createdAt, BigInt('0')); -} - -static addUpdatedAt(builder:flatbuffers.Builder, updatedAt:bigint) { - builder.addFieldInt64(3, updatedAt, BigInt('0')); -} - -static addLocalization(builder:flatbuffers.Builder, localizationOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, localizationOffset, 0); -} - -static createLocalizationVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { - builder.startVector(1, data.length, 1); - for (let i = data.length - 1; i >= 0; i--) { - builder.addInt8(data[i]!); - } - return builder.endVector(); -} - -static startLocalizationVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(1, numElems, 1); -} - -static endDucBlockMetadata(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucBlockMetadata(builder:flatbuffers.Builder, sourceOffset:flatbuffers.Offset, usageCount:number, createdAt:bigint, updatedAt:bigint, localizationOffset:flatbuffers.Offset):flatbuffers.Offset { - DucBlockMetadata.startDucBlockMetadata(builder); - DucBlockMetadata.addSource(builder, sourceOffset); - DucBlockMetadata.addUsageCount(builder, usageCount); - DucBlockMetadata.addCreatedAt(builder, createdAt); - DucBlockMetadata.addUpdatedAt(builder, updatedAt); - DucBlockMetadata.addLocalization(builder, localizationOffset); - return DucBlockMetadata.endDucBlockMetadata(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-block.ts b/packages/ducjs/src/flatbuffers/duc/duc-block.ts deleted file mode 100644 index ef723802..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-block.ts +++ /dev/null @@ -1,147 +0,0 @@ -// 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 { DucBlockAttributeDefinitionEntry } from '../duc/duc-block-attribute-definition-entry'; -import { DucBlockMetadata } from '../duc/duc-block-metadata'; - - -export class DucBlock { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucBlock { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucBlock(bb:flatbuffers.ByteBuffer, obj?:DucBlock):DucBlock { - return (obj || new DucBlock()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucBlock(bb:flatbuffers.ByteBuffer, obj?:DucBlock):DucBlock { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucBlock()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -label():string|null -label(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -label(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -description():string|null -description(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -description(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -version():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -attributeDefinitions(index: number, obj?:DucBlockAttributeDefinitionEntry):DucBlockAttributeDefinitionEntry|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new DucBlockAttributeDefinitionEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -attributeDefinitionsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -metadata(obj?:DucBlockMetadata):DucBlockMetadata|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new DucBlockMetadata()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -thumbnail(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; -} - -thumbnailLength():number { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -thumbnailArray():Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - 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; -} - -static startDucBlock(builder:flatbuffers.Builder) { - builder.startObject(7); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addLabel(builder:flatbuffers.Builder, labelOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, labelOffset, 0); -} - -static addDescription(builder:flatbuffers.Builder, descriptionOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, descriptionOffset, 0); -} - -static addVersion(builder:flatbuffers.Builder, version:number) { - builder.addFieldInt32(3, version, 0); -} - -static addAttributeDefinitions(builder:flatbuffers.Builder, attributeDefinitionsOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, attributeDefinitionsOffset, 0); -} - -static createAttributeDefinitionsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startAttributeDefinitionsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addMetadata(builder:flatbuffers.Builder, metadataOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, metadataOffset, 0); -} - -static addThumbnail(builder:flatbuffers.Builder, thumbnailOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, thumbnailOffset, 0); -} - -static createThumbnailVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { - builder.startVector(1, data.length, 1); - for (let i = data.length - 1; i >= 0; i--) { - builder.addInt8(data[i]!); - } - return builder.endVector(); -} - -static startThumbnailVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(1, numElems, 1); -} - -static endDucBlock(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // id - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-common-style.ts b/packages/ducjs/src/flatbuffers/duc/duc-common-style.ts deleted file mode 100644 index 1c5772b7..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-common-style.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { ElementBackground } from '../duc/element-background'; -import { ElementStroke } from '../duc/element-stroke'; - - -export class DucCommonStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucCommonStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucCommonStyle(bb:flatbuffers.ByteBuffer, obj?:DucCommonStyle):DucCommonStyle { - return (obj || new DucCommonStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucCommonStyle(bb:flatbuffers.ByteBuffer, obj?:DucCommonStyle):DucCommonStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucCommonStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -background(obj?:ElementBackground):ElementBackground|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new ElementBackground()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -stroke(obj?:ElementStroke):ElementStroke|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new ElementStroke()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucCommonStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addBackground(builder:flatbuffers.Builder, backgroundOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, backgroundOffset, 0); -} - -static addStroke(builder:flatbuffers.Builder, strokeOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, strokeOffset, 0); -} - -static endDucCommonStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-dimension-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-dimension-element.ts deleted file mode 100644 index 8bf9b816..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-dimension-element.ts +++ /dev/null @@ -1,156 +0,0 @@ -// 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 { AXIS } from '../duc/axis'; -import { DIMENSION_TYPE } from '../duc/dimension-type'; -import { DimensionBaselineData } from '../duc/dimension-baseline-data'; -import { DimensionBindings } from '../duc/dimension-bindings'; -import { DimensionContinueData } from '../duc/dimension-continue-data'; -import { DimensionDefinitionPoints } from '../duc/dimension-definition-points'; -import { DimensionToleranceStyle } from '../duc/dimension-tolerance-style'; -import { DucDimensionStyle } from '../duc/duc-dimension-style'; -import { GeometricPoint } from '../duc/geometric-point'; -import { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucDimensionElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucDimensionElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucDimensionElement(bb:flatbuffers.ByteBuffer, obj?:DucDimensionElement):DucDimensionElement { - return (obj || new DucDimensionElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucDimensionElement(bb:flatbuffers.ByteBuffer, obj?:DucDimensionElement):DucDimensionElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucDimensionElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucDimensionStyle):DucDimensionStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucDimensionStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -dimensionType():DIMENSION_TYPE|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -definitionPoints(obj?:DimensionDefinitionPoints):DimensionDefinitionPoints|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new DimensionDefinitionPoints()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -obliqueAngle():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -ordinateAxis():AXIS|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -bindings(obj?:DimensionBindings):DimensionBindings|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? (obj || new DimensionBindings()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -textOverride():string|null -textOverride(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -textOverride(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -textPosition(obj?:GeometricPoint):GeometricPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? (obj || new GeometricPoint()).__init(this.bb_pos + offset, this.bb!) : null; -} - -toleranceOverride(obj?:DimensionToleranceStyle):DimensionToleranceStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? (obj || new DimensionToleranceStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -baselineData(obj?:DimensionBaselineData):DimensionBaselineData|null { - const offset = this.bb!.__offset(this.bb_pos, 24); - return offset ? (obj || new DimensionBaselineData()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -continueData(obj?:DimensionContinueData):DimensionContinueData|null { - const offset = this.bb!.__offset(this.bb_pos, 26); - return offset ? (obj || new DimensionContinueData()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucDimensionElement(builder:flatbuffers.Builder) { - builder.startObject(12); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static addDimensionType(builder:flatbuffers.Builder, dimensionType:DIMENSION_TYPE) { - builder.addFieldInt8(2, dimensionType, null); -} - -static addDefinitionPoints(builder:flatbuffers.Builder, definitionPointsOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, definitionPointsOffset, 0); -} - -static addObliqueAngle(builder:flatbuffers.Builder, obliqueAngle:number) { - builder.addFieldFloat32(4, obliqueAngle, 0.0); -} - -static addOrdinateAxis(builder:flatbuffers.Builder, ordinateAxis:AXIS) { - builder.addFieldInt8(5, ordinateAxis, null); -} - -static addBindings(builder:flatbuffers.Builder, bindingsOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, bindingsOffset, 0); -} - -static addTextOverride(builder:flatbuffers.Builder, textOverrideOffset:flatbuffers.Offset) { - builder.addFieldOffset(7, textOverrideOffset, 0); -} - -static addTextPosition(builder:flatbuffers.Builder, textPositionOffset:flatbuffers.Offset) { - builder.addFieldStruct(8, textPositionOffset, 0); -} - -static addToleranceOverride(builder:flatbuffers.Builder, toleranceOverrideOffset:flatbuffers.Offset) { - builder.addFieldOffset(9, toleranceOverrideOffset, 0); -} - -static addBaselineData(builder:flatbuffers.Builder, baselineDataOffset:flatbuffers.Offset) { - builder.addFieldOffset(10, baselineDataOffset, 0); -} - -static addContinueData(builder:flatbuffers.Builder, continueDataOffset:flatbuffers.Offset) { - builder.addFieldOffset(11, continueDataOffset, 0); -} - -static endDucDimensionElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-dimension-style.ts b/packages/ducjs/src/flatbuffers/duc/duc-dimension-style.ts deleted file mode 100644 index f3f768af..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-dimension-style.ts +++ /dev/null @@ -1,96 +0,0 @@ -// 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 { DimensionExtLineStyle } from '../duc/dimension-ext-line-style'; -import { DimensionFitStyle } from '../duc/dimension-fit-style'; -import { DimensionLineStyle } from '../duc/dimension-line-style'; -import { DimensionSymbolStyle } from '../duc/dimension-symbol-style'; -import { DimensionToleranceStyle } from '../duc/dimension-tolerance-style'; -import { DucTextStyle } from '../duc/duc-text-style'; - - -export class DucDimensionStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucDimensionStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucDimensionStyle(bb:flatbuffers.ByteBuffer, obj?:DucDimensionStyle):DucDimensionStyle { - return (obj || new DucDimensionStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucDimensionStyle(bb:flatbuffers.ByteBuffer, obj?:DucDimensionStyle):DucDimensionStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucDimensionStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -dimLine(obj?:DimensionLineStyle):DimensionLineStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new DimensionLineStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -extLine(obj?:DimensionExtLineStyle):DimensionExtLineStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DimensionExtLineStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -textStyle(obj?:DucTextStyle):DucTextStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new DucTextStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -symbols(obj?:DimensionSymbolStyle):DimensionSymbolStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new DimensionSymbolStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -tolerance(obj?:DimensionToleranceStyle):DimensionToleranceStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new DimensionToleranceStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -fit(obj?:DimensionFitStyle):DimensionFitStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new DimensionFitStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucDimensionStyle(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addDimLine(builder:flatbuffers.Builder, dimLineOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, dimLineOffset, 0); -} - -static addExtLine(builder:flatbuffers.Builder, extLineOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, extLineOffset, 0); -} - -static addTextStyle(builder:flatbuffers.Builder, textStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, textStyleOffset, 0); -} - -static addSymbols(builder:flatbuffers.Builder, symbolsOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, symbolsOffset, 0); -} - -static addTolerance(builder:flatbuffers.Builder, toleranceOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, toleranceOffset, 0); -} - -static addFit(builder:flatbuffers.Builder, fitOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, fitOffset, 0); -} - -static endDucDimensionStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-doc-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-doc-element.ts deleted file mode 100644 index 17176afb..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-doc-element.ts +++ /dev/null @@ -1,144 +0,0 @@ -// 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 { ColumnLayout } from '../duc/column-layout'; -import { DocumentGridConfig } from '../duc/document-grid-config'; -import { DucDocStyle } from '../duc/duc-doc-style'; -import { DucTextDynamicPart } from '../duc/duc-text-dynamic-part'; -import { TEXT_FLOW_DIRECTION } from '../duc/text-flow-direction'; -import { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucDocElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucDocElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucDocElement(bb:flatbuffers.ByteBuffer, obj?:DucDocElement):DucDocElement { - return (obj || new DucDocElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucDocElement(bb:flatbuffers.ByteBuffer, obj?:DucDocElement):DucDocElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucDocElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucDocStyle):DucDocStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucDocStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -text():string|null -text(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -text(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -dynamic(index: number, obj?:DucTextDynamicPart):DucTextDynamicPart|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new DucTextDynamicPart()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -dynamicLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -flowDirection():TEXT_FLOW_DIRECTION|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -columns(obj?:ColumnLayout):ColumnLayout|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new ColumnLayout()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -autoResize():boolean { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -gridConfig(obj?:DocumentGridConfig):DocumentGridConfig|null { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? (obj || new DocumentGridConfig()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -fileId():string|null -fileId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -fileId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDucDocElement(builder:flatbuffers.Builder) { - builder.startObject(9); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static addText(builder:flatbuffers.Builder, textOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, textOffset, 0); -} - -static addDynamic(builder:flatbuffers.Builder, dynamicOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, dynamicOffset, 0); -} - -static createDynamicVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startDynamicVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addFlowDirection(builder:flatbuffers.Builder, flowDirection:TEXT_FLOW_DIRECTION) { - builder.addFieldInt8(4, flowDirection, null); -} - -static addColumns(builder:flatbuffers.Builder, columnsOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, columnsOffset, 0); -} - -static addAutoResize(builder:flatbuffers.Builder, autoResize:boolean) { - builder.addFieldInt8(6, +autoResize, +false); -} - -static addGridConfig(builder:flatbuffers.Builder, gridConfigOffset:flatbuffers.Offset) { - builder.addFieldOffset(7, gridConfigOffset, 0); -} - -static addFileId(builder:flatbuffers.Builder, fileIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(8, fileIdOffset, 0); -} - -static endDucDocElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-doc-style.ts b/packages/ducjs/src/flatbuffers/duc/duc-doc-style.ts deleted file mode 100644 index 18eacdfd..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-doc-style.ts +++ /dev/null @@ -1,66 +0,0 @@ -// 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 { DucTextStyle } from '../duc/duc-text-style'; -import { ParagraphFormatting } from '../duc/paragraph-formatting'; -import { StackFormat } from '../duc/stack-format'; - - -export class DucDocStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucDocStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucDocStyle(bb:flatbuffers.ByteBuffer, obj?:DucDocStyle):DucDocStyle { - return (obj || new DucDocStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucDocStyle(bb:flatbuffers.ByteBuffer, obj?:DucDocStyle):DucDocStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucDocStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -textStyle(obj?:DucTextStyle):DucTextStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new DucTextStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -paragraph(obj?:ParagraphFormatting):ParagraphFormatting|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new ParagraphFormatting()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -stackFormat(obj?:StackFormat):StackFormat|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new StackFormat()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucDocStyle(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addTextStyle(builder:flatbuffers.Builder, textStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, textStyleOffset, 0); -} - -static addParagraph(builder:flatbuffers.Builder, paragraphOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, paragraphOffset, 0); -} - -static addStackFormat(builder:flatbuffers.Builder, stackFormatOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, stackFormatOffset, 0); -} - -static endDucDocStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-element-base.ts b/packages/ducjs/src/flatbuffers/duc/duc-element-base.ts deleted file mode 100644 index f26c8bfa..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-element-base.ts +++ /dev/null @@ -1,423 +0,0 @@ -// 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 { BoundElement } from '../duc/bound-element'; -import { _DucElementStylesBase } from '../duc/duc-element-styles-base'; - - -export class _DucElementBase { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):_DucElementBase { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAs_DucElementBase(bb:flatbuffers.ByteBuffer, obj?:_DucElementBase):_DucElementBase { - return (obj || new _DucElementBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAs_DucElementBase(bb:flatbuffers.ByteBuffer, obj?:_DucElementBase):_DucElementBase { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new _DucElementBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -styles(obj?:_DucElementStylesBase):_DucElementStylesBase|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new _DucElementStylesBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -x():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -y():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -width():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -height():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -angle():number { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -scope():string|null -scope(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -scope(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -label():string|null -label(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -label(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -description():string|null -description(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -description(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -isVisible():boolean { - const offset = this.bb!.__offset(this.bb_pos, 24); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -seed():number { - const offset = this.bb!.__offset(this.bb_pos, 26); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -version():number { - const offset = this.bb!.__offset(this.bb_pos, 28); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -versionNonce():number { - const offset = this.bb!.__offset(this.bb_pos, 30); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -updated():bigint { - const offset = this.bb!.__offset(this.bb_pos, 32); - return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); -} - -index():string|null -index(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -index(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 34); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -isPlot():boolean { - const offset = this.bb!.__offset(this.bb_pos, 36); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -isAnnotative():boolean { - const offset = this.bb!.__offset(this.bb_pos, 38); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -isDeleted():boolean { - const offset = this.bb!.__offset(this.bb_pos, 40); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -groupIds(index: number):string -groupIds(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -groupIds(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 42); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -groupIdsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 42); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -regionIds(index: number):string -regionIds(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -regionIds(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 44); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -regionIdsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 44); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -layerId():string|null -layerId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -layerId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 46); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -frameId():string|null -frameId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -frameId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 48); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -boundElements(index: number, obj?:BoundElement):BoundElement|null { - const offset = this.bb!.__offset(this.bb_pos, 50); - return offset ? (obj || new BoundElement()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -boundElementsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 50); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -zIndex():number { - const offset = this.bb!.__offset(this.bb_pos, 52); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -link():string|null -link(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -link(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 54); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -locked():boolean { - const offset = this.bb!.__offset(this.bb_pos, 56); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -blockIds(index: number):string -blockIds(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -blockIds(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 60); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -blockIdsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 60); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -instanceId():string|null -instanceId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -instanceId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 62); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -customData(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 64); - return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; -} - -customDataLength():number { - const offset = this.bb!.__offset(this.bb_pos, 64); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -customDataArray():Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 64); - 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; -} - -static start_DucElementBase(builder:flatbuffers.Builder) { - builder.startObject(31); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStyles(builder:flatbuffers.Builder, stylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, stylesOffset, 0); -} - -static addX(builder:flatbuffers.Builder, x:number) { - builder.addFieldFloat64(2, x, 0.0); -} - -static addY(builder:flatbuffers.Builder, y:number) { - builder.addFieldFloat64(3, y, 0.0); -} - -static addWidth(builder:flatbuffers.Builder, width:number) { - builder.addFieldFloat64(4, width, 0.0); -} - -static addHeight(builder:flatbuffers.Builder, height:number) { - builder.addFieldFloat64(5, height, 0.0); -} - -static addAngle(builder:flatbuffers.Builder, angle:number) { - builder.addFieldFloat64(6, angle, 0.0); -} - -static addScope(builder:flatbuffers.Builder, scopeOffset:flatbuffers.Offset) { - builder.addFieldOffset(7, scopeOffset, 0); -} - -static addLabel(builder:flatbuffers.Builder, labelOffset:flatbuffers.Offset) { - builder.addFieldOffset(8, labelOffset, 0); -} - -static addDescription(builder:flatbuffers.Builder, descriptionOffset:flatbuffers.Offset) { - builder.addFieldOffset(9, descriptionOffset, 0); -} - -static addIsVisible(builder:flatbuffers.Builder, isVisible:boolean) { - builder.addFieldInt8(10, +isVisible, +false); -} - -static addSeed(builder:flatbuffers.Builder, seed:number) { - builder.addFieldInt32(11, seed, 0); -} - -static addVersion(builder:flatbuffers.Builder, version:number) { - builder.addFieldInt32(12, version, 0); -} - -static addVersionNonce(builder:flatbuffers.Builder, versionNonce:number) { - builder.addFieldInt32(13, versionNonce, 0); -} - -static addUpdated(builder:flatbuffers.Builder, updated:bigint) { - builder.addFieldInt64(14, updated, BigInt('0')); -} - -static addIndex(builder:flatbuffers.Builder, indexOffset:flatbuffers.Offset) { - builder.addFieldOffset(15, indexOffset, 0); -} - -static addIsPlot(builder:flatbuffers.Builder, isPlot:boolean) { - builder.addFieldInt8(16, +isPlot, +false); -} - -static addIsAnnotative(builder:flatbuffers.Builder, isAnnotative:boolean) { - builder.addFieldInt8(17, +isAnnotative, +false); -} - -static addIsDeleted(builder:flatbuffers.Builder, isDeleted:boolean) { - builder.addFieldInt8(18, +isDeleted, +false); -} - -static addGroupIds(builder:flatbuffers.Builder, groupIdsOffset:flatbuffers.Offset) { - builder.addFieldOffset(19, groupIdsOffset, 0); -} - -static createGroupIdsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startGroupIdsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addRegionIds(builder:flatbuffers.Builder, regionIdsOffset:flatbuffers.Offset) { - builder.addFieldOffset(20, regionIdsOffset, 0); -} - -static createRegionIdsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startRegionIdsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addLayerId(builder:flatbuffers.Builder, layerIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(21, layerIdOffset, 0); -} - -static addFrameId(builder:flatbuffers.Builder, frameIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(22, frameIdOffset, 0); -} - -static addBoundElements(builder:flatbuffers.Builder, boundElementsOffset:flatbuffers.Offset) { - builder.addFieldOffset(23, boundElementsOffset, 0); -} - -static createBoundElementsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startBoundElementsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addZIndex(builder:flatbuffers.Builder, zIndex:number) { - builder.addFieldFloat32(24, zIndex, 0.0); -} - -static addLink(builder:flatbuffers.Builder, linkOffset:flatbuffers.Offset) { - builder.addFieldOffset(25, linkOffset, 0); -} - -static addLocked(builder:flatbuffers.Builder, locked:boolean) { - builder.addFieldInt8(26, +locked, +false); -} - -static addBlockIds(builder:flatbuffers.Builder, blockIdsOffset:flatbuffers.Offset) { - builder.addFieldOffset(28, blockIdsOffset, 0); -} - -static createBlockIdsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startBlockIdsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addInstanceId(builder:flatbuffers.Builder, instanceIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(29, instanceIdOffset, 0); -} - -static addCustomData(builder:flatbuffers.Builder, customDataOffset:flatbuffers.Offset) { - builder.addFieldOffset(30, customDataOffset, 0); -} - -static createCustomDataVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { - builder.startVector(1, data.length, 1); - for (let i = data.length - 1; i >= 0; i--) { - builder.addInt8(data[i]!); - } - return builder.endVector(); -} - -static startCustomDataVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(1, numElems, 1); -} - -static end_DucElementBase(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // id - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-element-styles-base.ts b/packages/ducjs/src/flatbuffers/duc/duc-element-styles-base.ts deleted file mode 100644 index 312a13e4..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-element-styles-base.ts +++ /dev/null @@ -1,128 +0,0 @@ -// 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 { BLENDING } from '../duc/blending'; -import { ElementBackground } from '../duc/element-background'; -import { ElementStroke } from '../duc/element-stroke'; - - -export class _DucElementStylesBase { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):_DucElementStylesBase { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAs_DucElementStylesBase(bb:flatbuffers.ByteBuffer, obj?:_DucElementStylesBase):_DucElementStylesBase { - return (obj || new _DucElementStylesBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAs_DucElementStylesBase(bb:flatbuffers.ByteBuffer, obj?:_DucElementStylesBase):_DucElementStylesBase { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new _DucElementStylesBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -roundness():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -blending():BLENDING|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -background(index: number, obj?:ElementBackground):ElementBackground|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new ElementBackground()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -backgroundLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -stroke(index: number, obj?:ElementStroke):ElementStroke|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new ElementStroke()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -strokeLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -opacity():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static start_DucElementStylesBase(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addRoundness(builder:flatbuffers.Builder, roundness:number) { - builder.addFieldFloat64(0, roundness, 0.0); -} - -static addBlending(builder:flatbuffers.Builder, blending:BLENDING) { - builder.addFieldInt8(1, blending, null); -} - -static addBackground(builder:flatbuffers.Builder, backgroundOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, backgroundOffset, 0); -} - -static createBackgroundVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startBackgroundVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addStroke(builder:flatbuffers.Builder, strokeOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, strokeOffset, 0); -} - -static createStrokeVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startStrokeVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addOpacity(builder:flatbuffers.Builder, opacity:number) { - builder.addFieldFloat64(4, opacity, 0.0); -} - -static end_DucElementStylesBase(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static create_DucElementStylesBase(builder:flatbuffers.Builder, roundness:number, blending:BLENDING|null, backgroundOffset:flatbuffers.Offset, strokeOffset:flatbuffers.Offset, opacity:number):flatbuffers.Offset { - _DucElementStylesBase.start_DucElementStylesBase(builder); - _DucElementStylesBase.addRoundness(builder, roundness); - if (blending !== null) - _DucElementStylesBase.addBlending(builder, blending); - _DucElementStylesBase.addBackground(builder, backgroundOffset); - _DucElementStylesBase.addStroke(builder, strokeOffset); - _DucElementStylesBase.addOpacity(builder, opacity); - return _DucElementStylesBase.end_DucElementStylesBase(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-ellipse-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-ellipse-element.ts deleted file mode 100644 index 093b345e..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-ellipse-element.ts +++ /dev/null @@ -1,91 +0,0 @@ -// 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 { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucEllipseElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucEllipseElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucEllipseElement(bb:flatbuffers.ByteBuffer, obj?:DucEllipseElement):DucEllipseElement { - return (obj || new DucEllipseElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucEllipseElement(bb:flatbuffers.ByteBuffer, obj?:DucEllipseElement):DucEllipseElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucEllipseElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -ratio():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -startAngle():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -endAngle():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -showAuxCrosshair():boolean { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startDucEllipseElement(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addRatio(builder:flatbuffers.Builder, ratio:number) { - builder.addFieldFloat32(1, ratio, 0.0); -} - -static addStartAngle(builder:flatbuffers.Builder, startAngle:number) { - builder.addFieldFloat64(2, startAngle, 0.0); -} - -static addEndAngle(builder:flatbuffers.Builder, endAngle:number) { - builder.addFieldFloat64(3, endAngle, 0.0); -} - -static addShowAuxCrosshair(builder:flatbuffers.Builder, showAuxCrosshair:boolean) { - builder.addFieldInt8(4, +showAuxCrosshair, +false); -} - -static endDucEllipseElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucEllipseElement(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset, ratio:number, startAngle:number, endAngle:number, showAuxCrosshair:boolean):flatbuffers.Offset { - DucEllipseElement.startDucEllipseElement(builder); - DucEllipseElement.addBase(builder, baseOffset); - DucEllipseElement.addRatio(builder, ratio); - DucEllipseElement.addStartAngle(builder, startAngle); - DucEllipseElement.addEndAngle(builder, endAngle); - DucEllipseElement.addShowAuxCrosshair(builder, showAuxCrosshair); - return DucEllipseElement.endDucEllipseElement(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-embeddable-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-embeddable-element.ts deleted file mode 100644 index 8af19534..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-embeddable-element.ts +++ /dev/null @@ -1,51 +0,0 @@ -// 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 { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucEmbeddableElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucEmbeddableElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucEmbeddableElement(bb:flatbuffers.ByteBuffer, obj?:DucEmbeddableElement):DucEmbeddableElement { - return (obj || new DucEmbeddableElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucEmbeddableElement(bb:flatbuffers.ByteBuffer, obj?:DucEmbeddableElement):DucEmbeddableElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucEmbeddableElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucEmbeddableElement(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static endDucEmbeddableElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucEmbeddableElement(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset):flatbuffers.Offset { - DucEmbeddableElement.startDucEmbeddableElement(builder); - DucEmbeddableElement.addBase(builder, baseOffset); - return DucEmbeddableElement.endDucEmbeddableElement(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-external-file-data.ts b/packages/ducjs/src/flatbuffers/duc/duc-external-file-data.ts deleted file mode 100644 index 90479024..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-external-file-data.ts +++ /dev/null @@ -1,116 +0,0 @@ -// 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 DucExternalFileData { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucExternalFileData { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucExternalFileData(bb:flatbuffers.ByteBuffer, obj?:DucExternalFileData):DucExternalFileData { - return (obj || new DucExternalFileData()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucExternalFileData(bb:flatbuffers.ByteBuffer, obj?:DucExternalFileData):DucExternalFileData { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucExternalFileData()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -mimeType():string|null -mimeType(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -mimeType(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -data(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; -} - -dataLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -dataArray():Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - 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; -} - -created():bigint { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); -} - -lastRetrieved():bigint|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readInt64(this.bb_pos + offset) : null; -} - -static startDucExternalFileData(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addMimeType(builder:flatbuffers.Builder, mimeTypeOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, mimeTypeOffset, 0); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, idOffset, 0); -} - -static addData(builder:flatbuffers.Builder, dataOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, dataOffset, 0); -} - -static createDataVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { - builder.startVector(1, data.length, 1); - for (let i = data.length - 1; i >= 0; i--) { - builder.addInt8(data[i]!); - } - return builder.endVector(); -} - -static startDataVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(1, numElems, 1); -} - -static addCreated(builder:flatbuffers.Builder, created:bigint) { - builder.addFieldInt64(3, created, BigInt('0')); -} - -static addLastRetrieved(builder:flatbuffers.Builder, lastRetrieved:bigint) { - builder.addFieldInt64(4, lastRetrieved, null); -} - -static endDucExternalFileData(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 6) // id - return offset; -} - -static createDucExternalFileData(builder:flatbuffers.Builder, mimeTypeOffset:flatbuffers.Offset, idOffset:flatbuffers.Offset, dataOffset:flatbuffers.Offset, created:bigint, lastRetrieved:bigint|null):flatbuffers.Offset { - DucExternalFileData.startDucExternalFileData(builder); - DucExternalFileData.addMimeType(builder, mimeTypeOffset); - DucExternalFileData.addId(builder, idOffset); - DucExternalFileData.addData(builder, dataOffset); - DucExternalFileData.addCreated(builder, created); - if (lastRetrieved !== null) - DucExternalFileData.addLastRetrieved(builder, lastRetrieved); - return DucExternalFileData.endDucExternalFileData(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-external-file-entry.ts b/packages/ducjs/src/flatbuffers/duc/duc-external-file-entry.ts deleted file mode 100644 index 278f6ae7..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-external-file-entry.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 { DucExternalFileData } from '../duc/duc-external-file-data'; - - -export class DucExternalFileEntry { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucExternalFileEntry { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucExternalFileEntry(bb:flatbuffers.ByteBuffer, obj?:DucExternalFileEntry):DucExternalFileEntry { - return (obj || new DucExternalFileEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucExternalFileEntry(bb:flatbuffers.ByteBuffer, obj?:DucExternalFileEntry):DucExternalFileEntry { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucExternalFileEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -key():string|null -key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -key(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -value(obj?:DucExternalFileData):DucExternalFileData|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucExternalFileData()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucExternalFileEntry(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, keyOffset, 0); -} - -static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, valueOffset, 0); -} - -static endDucExternalFileEntry(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // key - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-feature-control-frame-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-feature-control-frame-element.ts deleted file mode 100644 index babe20bb..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-feature-control-frame-element.ts +++ /dev/null @@ -1,114 +0,0 @@ -// 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 { DucFeatureControlFrameStyle } from '../duc/duc-feature-control-frame-style'; -import { FCFDatumDefinition } from '../duc/fcfdatum-definition'; -import { FCFFrameModifiers } from '../duc/fcfframe-modifiers'; -import { FCFSegmentRow } from '../duc/fcfsegment-row'; -import { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucFeatureControlFrameElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucFeatureControlFrameElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucFeatureControlFrameElement(bb:flatbuffers.ByteBuffer, obj?:DucFeatureControlFrameElement):DucFeatureControlFrameElement { - return (obj || new DucFeatureControlFrameElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucFeatureControlFrameElement(bb:flatbuffers.ByteBuffer, obj?:DucFeatureControlFrameElement):DucFeatureControlFrameElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucFeatureControlFrameElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucFeatureControlFrameStyle):DucFeatureControlFrameStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucFeatureControlFrameStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -rows(index: number, obj?:FCFSegmentRow):FCFSegmentRow|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new FCFSegmentRow()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -rowsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -frameModifiers(obj?:FCFFrameModifiers):FCFFrameModifiers|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new FCFFrameModifiers()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -leaderElementId():string|null -leaderElementId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -leaderElementId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -datumDefinition(obj?:FCFDatumDefinition):FCFDatumDefinition|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new FCFDatumDefinition()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucFeatureControlFrameElement(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static addRows(builder:flatbuffers.Builder, rowsOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, rowsOffset, 0); -} - -static createRowsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startRowsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addFrameModifiers(builder:flatbuffers.Builder, frameModifiersOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, frameModifiersOffset, 0); -} - -static addLeaderElementId(builder:flatbuffers.Builder, leaderElementIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, leaderElementIdOffset, 0); -} - -static addDatumDefinition(builder:flatbuffers.Builder, datumDefinitionOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, datumDefinitionOffset, 0); -} - -static endDucFeatureControlFrameElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-feature-control-frame-style.ts b/packages/ducjs/src/flatbuffers/duc/duc-feature-control-frame-style.ts deleted file mode 100644 index 22e8f9e6..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-feature-control-frame-style.ts +++ /dev/null @@ -1,76 +0,0 @@ -// 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 { DucTextStyle } from '../duc/duc-text-style'; -import { FCFDatumStyle } from '../duc/fcfdatum-style'; -import { FCFLayoutStyle } from '../duc/fcflayout-style'; -import { FCFSymbolStyle } from '../duc/fcfsymbol-style'; - - -export class DucFeatureControlFrameStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucFeatureControlFrameStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucFeatureControlFrameStyle(bb:flatbuffers.ByteBuffer, obj?:DucFeatureControlFrameStyle):DucFeatureControlFrameStyle { - return (obj || new DucFeatureControlFrameStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucFeatureControlFrameStyle(bb:flatbuffers.ByteBuffer, obj?:DucFeatureControlFrameStyle):DucFeatureControlFrameStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucFeatureControlFrameStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -textStyle(obj?:DucTextStyle):DucTextStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucTextStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -layout(obj?:FCFLayoutStyle):FCFLayoutStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new FCFLayoutStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -symbols(obj?:FCFSymbolStyle):FCFSymbolStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new FCFSymbolStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -datumStyle(obj?:FCFDatumStyle):FCFDatumStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new FCFDatumStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucFeatureControlFrameStyle(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addTextStyle(builder:flatbuffers.Builder, textStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, textStyleOffset, 0); -} - -static addLayout(builder:flatbuffers.Builder, layoutOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, layoutOffset, 0); -} - -static addSymbols(builder:flatbuffers.Builder, symbolsOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, symbolsOffset, 0); -} - -static addDatumStyle(builder:flatbuffers.Builder, datumStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, datumStyleOffset, 0); -} - -static endDucFeatureControlFrameStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-frame-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-frame-element.ts deleted file mode 100644 index b46790a0..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-frame-element.ts +++ /dev/null @@ -1,51 +0,0 @@ -// 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 { _DucStackElementBase } from '../duc/duc-stack-element-base'; - - -export class DucFrameElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucFrameElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucFrameElement(bb:flatbuffers.ByteBuffer, obj?:DucFrameElement):DucFrameElement { - return (obj || new DucFrameElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucFrameElement(bb:flatbuffers.ByteBuffer, obj?:DucFrameElement):DucFrameElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucFrameElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -stackElementBase(obj?:_DucStackElementBase):_DucStackElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucStackElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucFrameElement(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addStackElementBase(builder:flatbuffers.Builder, stackElementBaseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, stackElementBaseOffset, 0); -} - -static endDucFrameElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucFrameElement(builder:flatbuffers.Builder, stackElementBaseOffset:flatbuffers.Offset):flatbuffers.Offset { - DucFrameElement.startDucFrameElement(builder); - DucFrameElement.addStackElementBase(builder, stackElementBaseOffset); - return DucFrameElement.endDucFrameElement(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-free-draw-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-free-draw-element.ts deleted file mode 100644 index 38ddc171..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-free-draw-element.ts +++ /dev/null @@ -1,204 +0,0 @@ -// 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 { DucFreeDrawEnds } from '../duc/duc-free-draw-ends'; -import { DucPoint } from '../duc/duc-point'; -import { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucFreeDrawElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucFreeDrawElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucFreeDrawElement(bb:flatbuffers.ByteBuffer, obj?:DucFreeDrawElement):DucFreeDrawElement { - return (obj || new DucFreeDrawElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucFreeDrawElement(bb:flatbuffers.ByteBuffer, obj?:DucFreeDrawElement):DucFreeDrawElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucFreeDrawElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -points(index: number, obj?:DucPoint):DucPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucPoint()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -pointsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -size():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -thinning():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -smoothing():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -streamline():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -easing():string|null -easing(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -easing(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -start(obj?:DucFreeDrawEnds):DucFreeDrawEnds|null { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? (obj || new DucFreeDrawEnds()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -end(obj?:DucFreeDrawEnds):DucFreeDrawEnds|null { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? (obj || new DucFreeDrawEnds()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -pressures(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? this.bb!.readFloat32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0; -} - -pressuresLength():number { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -pressuresArray():Float32Array|null { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? new Float32Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; -} - -simulatePressure():boolean { - const offset = this.bb!.__offset(this.bb_pos, 24); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -lastCommittedPoint(obj?:DucPoint):DucPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 26); - return offset ? (obj || new DucPoint()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -svgPath():string|null -svgPath(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -svgPath(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 28); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDucFreeDrawElement(builder:flatbuffers.Builder) { - builder.startObject(13); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addPoints(builder:flatbuffers.Builder, pointsOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, pointsOffset, 0); -} - -static createPointsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startPointsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addSize(builder:flatbuffers.Builder, size:number) { - builder.addFieldFloat64(2, size, 0.0); -} - -static addThinning(builder:flatbuffers.Builder, thinning:number) { - builder.addFieldFloat32(3, thinning, 0.0); -} - -static addSmoothing(builder:flatbuffers.Builder, smoothing:number) { - builder.addFieldFloat32(4, smoothing, 0.0); -} - -static addStreamline(builder:flatbuffers.Builder, streamline:number) { - builder.addFieldFloat32(5, streamline, 0.0); -} - -static addEasing(builder:flatbuffers.Builder, easingOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, easingOffset, 0); -} - -static addStart(builder:flatbuffers.Builder, startOffset:flatbuffers.Offset) { - builder.addFieldOffset(7, startOffset, 0); -} - -static addEnd(builder:flatbuffers.Builder, endOffset:flatbuffers.Offset) { - builder.addFieldOffset(8, endOffset, 0); -} - -static addPressures(builder:flatbuffers.Builder, pressuresOffset:flatbuffers.Offset) { - builder.addFieldOffset(9, pressuresOffset, 0); -} - -static createPressuresVector(builder:flatbuffers.Builder, data:number[]|Float32Array):flatbuffers.Offset; -/** - * @deprecated This Uint8Array overload will be removed in the future. - */ -static createPressuresVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; -static createPressuresVector(builder:flatbuffers.Builder, data:number[]|Float32Array|Uint8Array):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addFloat32(data[i]!); - } - return builder.endVector(); -} - -static startPressuresVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addSimulatePressure(builder:flatbuffers.Builder, simulatePressure:boolean) { - builder.addFieldInt8(10, +simulatePressure, +false); -} - -static addLastCommittedPoint(builder:flatbuffers.Builder, lastCommittedPointOffset:flatbuffers.Offset) { - builder.addFieldOffset(11, lastCommittedPointOffset, 0); -} - -static addSvgPath(builder:flatbuffers.Builder, svgPathOffset:flatbuffers.Offset) { - builder.addFieldOffset(12, svgPathOffset, 0); -} - -static endDucFreeDrawElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-free-draw-ends.ts b/packages/ducjs/src/flatbuffers/duc/duc-free-draw-ends.ts deleted file mode 100644 index 3d7a863d..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-free-draw-ends.ts +++ /dev/null @@ -1,70 +0,0 @@ -// 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 DucFreeDrawEnds { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucFreeDrawEnds { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucFreeDrawEnds(bb:flatbuffers.ByteBuffer, obj?:DucFreeDrawEnds):DucFreeDrawEnds { - return (obj || new DucFreeDrawEnds()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucFreeDrawEnds(bb:flatbuffers.ByteBuffer, obj?:DucFreeDrawEnds):DucFreeDrawEnds { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucFreeDrawEnds()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -cap():boolean { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -taper():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -easing():string|null -easing(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -easing(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDucFreeDrawEnds(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addCap(builder:flatbuffers.Builder, cap:boolean) { - builder.addFieldInt8(0, +cap, +false); -} - -static addTaper(builder:flatbuffers.Builder, taper:number) { - builder.addFieldFloat32(1, taper, 0.0); -} - -static addEasing(builder:flatbuffers.Builder, easingOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, easingOffset, 0); -} - -static endDucFreeDrawEnds(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucFreeDrawEnds(builder:flatbuffers.Builder, cap:boolean, taper:number, easingOffset:flatbuffers.Offset):flatbuffers.Offset { - DucFreeDrawEnds.startDucFreeDrawEnds(builder); - DucFreeDrawEnds.addCap(builder, cap); - DucFreeDrawEnds.addTaper(builder, taper); - DucFreeDrawEnds.addEasing(builder, easingOffset); - return DucFreeDrawEnds.endDucFreeDrawEnds(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-global-state.ts b/packages/ducjs/src/flatbuffers/duc/duc-global-state.ts deleted file mode 100644 index 56937a5d..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-global-state.ts +++ /dev/null @@ -1,158 +0,0 @@ -// 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 { PRUNING_LEVEL } from '../duc/pruning-level'; - - -export class DucGlobalState { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucGlobalState { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucGlobalState(bb:flatbuffers.ByteBuffer, obj?:DucGlobalState):DucGlobalState { - return (obj || new DucGlobalState()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucGlobalState(bb:flatbuffers.ByteBuffer, obj?:DucGlobalState):DucGlobalState { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucGlobalState()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -name():string|null -name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -name(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -viewBackgroundColor():string|null -viewBackgroundColor(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -viewBackgroundColor(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -mainScope():string|null -mainScope(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -mainScope(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -dashSpacingScale():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -isDashSpacingAffectedByViewportScale():boolean { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -scopeExponentThreshold():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readInt8(this.bb_pos + offset) : 0; -} - -dimensionsAssociativeByDefault():boolean { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -useAnnotativeScaling():boolean { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -displayPrecisionLinear():number { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -displayPrecisionAngular():number { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -pruningLevel():PRUNING_LEVEL|null { - const offset = this.bb!.__offset(this.bb_pos, 24); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startDucGlobalState(builder:flatbuffers.Builder) { - builder.startObject(11); -} - -static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, nameOffset, 0); -} - -static addViewBackgroundColor(builder:flatbuffers.Builder, viewBackgroundColorOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, viewBackgroundColorOffset, 0); -} - -static addMainScope(builder:flatbuffers.Builder, mainScopeOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, mainScopeOffset, 0); -} - -static addDashSpacingScale(builder:flatbuffers.Builder, dashSpacingScale:number) { - builder.addFieldFloat32(3, dashSpacingScale, 0.0); -} - -static addIsDashSpacingAffectedByViewportScale(builder:flatbuffers.Builder, isDashSpacingAffectedByViewportScale:boolean) { - builder.addFieldInt8(4, +isDashSpacingAffectedByViewportScale, +false); -} - -static addScopeExponentThreshold(builder:flatbuffers.Builder, scopeExponentThreshold:number) { - builder.addFieldInt8(5, scopeExponentThreshold, 0); -} - -static addDimensionsAssociativeByDefault(builder:flatbuffers.Builder, dimensionsAssociativeByDefault:boolean) { - builder.addFieldInt8(6, +dimensionsAssociativeByDefault, +false); -} - -static addUseAnnotativeScaling(builder:flatbuffers.Builder, useAnnotativeScaling:boolean) { - builder.addFieldInt8(7, +useAnnotativeScaling, +false); -} - -static addDisplayPrecisionLinear(builder:flatbuffers.Builder, displayPrecisionLinear:number) { - builder.addFieldInt32(8, displayPrecisionLinear, 0); -} - -static addDisplayPrecisionAngular(builder:flatbuffers.Builder, displayPrecisionAngular:number) { - builder.addFieldInt32(9, displayPrecisionAngular, 0); -} - -static addPruningLevel(builder:flatbuffers.Builder, pruningLevel:PRUNING_LEVEL) { - builder.addFieldInt8(10, pruningLevel, null); -} - -static endDucGlobalState(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucGlobalState(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, viewBackgroundColorOffset:flatbuffers.Offset, mainScopeOffset:flatbuffers.Offset, dashSpacingScale:number, isDashSpacingAffectedByViewportScale:boolean, scopeExponentThreshold:number, dimensionsAssociativeByDefault:boolean, useAnnotativeScaling:boolean, displayPrecisionLinear:number, displayPrecisionAngular:number, pruningLevel:PRUNING_LEVEL|null):flatbuffers.Offset { - 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); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-group.ts b/packages/ducjs/src/flatbuffers/duc/duc-group.ts deleted file mode 100644 index c290d827..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-group.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 { _DucStackBase } from '../duc/duc-stack-base'; - - -export class DucGroup { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucGroup { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucGroup(bb:flatbuffers.ByteBuffer, obj?:DucGroup):DucGroup { - return (obj || new DucGroup()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucGroup(bb:flatbuffers.ByteBuffer, obj?:DucGroup):DucGroup { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucGroup()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -stackBase(obj?:_DucStackBase):_DucStackBase|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new _DucStackBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucGroup(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStackBase(builder:flatbuffers.Builder, stackBaseOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, stackBaseOffset, 0); -} - -static endDucGroup(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // id - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-hatch-style.ts b/packages/ducjs/src/flatbuffers/duc/duc-hatch-style.ts deleted file mode 100644 index 3dad133b..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-hatch-style.ts +++ /dev/null @@ -1,104 +0,0 @@ -// 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'; -import { HATCH_STYLE } from '../duc/hatch-style'; - - -export class DucHatchStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucHatchStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucHatchStyle(bb:flatbuffers.ByteBuffer, obj?:DucHatchStyle):DucHatchStyle { - return (obj || new DucHatchStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucHatchStyle(bb:flatbuffers.ByteBuffer, obj?:DucHatchStyle):DucHatchStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucHatchStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -hatchStyle():HATCH_STYLE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -patternName():string|null -patternName(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -patternName(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -patternScale():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -patternAngle():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -patternOrigin(obj?:DucPoint):DucPoint|null { - 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():boolean { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -customPattern(obj?:CustomHatchPattern):CustomHatchPattern|null { - 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:flatbuffers.Builder) { - builder.startObject(7); -} - -static addHatchStyle(builder:flatbuffers.Builder, hatchStyle:HATCH_STYLE) { - builder.addFieldInt8(0, hatchStyle, null); -} - -static addPatternName(builder:flatbuffers.Builder, patternNameOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, patternNameOffset, 0); -} - -static addPatternScale(builder:flatbuffers.Builder, patternScale:number) { - builder.addFieldFloat32(2, patternScale, 0.0); -} - -static addPatternAngle(builder:flatbuffers.Builder, patternAngle:number) { - builder.addFieldFloat64(3, patternAngle, 0.0); -} - -static addPatternOrigin(builder:flatbuffers.Builder, patternOriginOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, patternOriginOffset, 0); -} - -static addPatternDouble(builder:flatbuffers.Builder, patternDouble:boolean) { - builder.addFieldInt8(5, +patternDouble, +false); -} - -static addCustomPattern(builder:flatbuffers.Builder, customPatternOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, customPatternOffset, 0); -} - -static endDucHatchStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-head.ts b/packages/ducjs/src/flatbuffers/duc/duc-head.ts deleted file mode 100644 index 46cd9417..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-head.ts +++ /dev/null @@ -1,74 +0,0 @@ -// 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 { LINE_HEAD } from '../duc/line-head'; - - -export class DucHead { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucHead { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucHead(bb:flatbuffers.ByteBuffer, obj?:DucHead):DucHead { - return (obj || new DucHead()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucHead(bb:flatbuffers.ByteBuffer, obj?:DucHead):DucHead { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucHead()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -type():LINE_HEAD|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -blockId():string|null -blockId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -blockId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -size():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startDucHead(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addType(builder:flatbuffers.Builder, type:LINE_HEAD) { - builder.addFieldInt8(0, type, null); -} - -static addBlockId(builder:flatbuffers.Builder, blockIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, blockIdOffset, 0); -} - -static addSize(builder:flatbuffers.Builder, size:number) { - builder.addFieldFloat64(2, size, 0.0); -} - -static endDucHead(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucHead(builder:flatbuffers.Builder, type:LINE_HEAD|null, blockIdOffset:flatbuffers.Offset, size:number):flatbuffers.Offset { - DucHead.startDucHead(builder); - if (type !== null) - DucHead.addType(builder, type); - DucHead.addBlockId(builder, blockIdOffset); - DucHead.addSize(builder, size); - return DucHead.endDucHead(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-image-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-image-element.ts deleted file mode 100644 index e5684f4f..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-image-element.ts +++ /dev/null @@ -1,123 +0,0 @@ -// 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 { DucImageFilter } from '../duc/duc-image-filter'; -import { IMAGE_STATUS } from '../duc/image-status'; -import { ImageCrop } from '../duc/image-crop'; -import { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucImageElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucImageElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucImageElement(bb:flatbuffers.ByteBuffer, obj?:DucImageElement):DucImageElement { - return (obj || new DucImageElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucImageElement(bb:flatbuffers.ByteBuffer, obj?:DucImageElement):DucImageElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucImageElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -fileId():string|null -fileId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -fileId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -status():IMAGE_STATUS|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -scale(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0; -} - -scaleLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -scaleArray():Float64Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - 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; -} - -crop(obj?:ImageCrop):ImageCrop|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new ImageCrop()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -filter(obj?:DucImageFilter):DucImageFilter|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new DucImageFilter()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucImageElement(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addFileId(builder:flatbuffers.Builder, fileIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, fileIdOffset, 0); -} - -static addStatus(builder:flatbuffers.Builder, status:IMAGE_STATUS) { - builder.addFieldInt8(2, status, null); -} - -static addScale(builder:flatbuffers.Builder, scaleOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, scaleOffset, 0); -} - -static createScaleVector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset; -/** - * @deprecated This Uint8Array overload will be removed in the future. - */ -static createScaleVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; -static createScaleVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset { - builder.startVector(8, data.length, 8); - for (let i = data.length - 1; i >= 0; i--) { - builder.addFloat64(data[i]!); - } - return builder.endVector(); -} - -static startScaleVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(8, numElems, 8); -} - -static addCrop(builder:flatbuffers.Builder, cropOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, cropOffset, 0); -} - -static addFilter(builder:flatbuffers.Builder, filterOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, filterOffset, 0); -} - -static endDucImageElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-image-filter.ts b/packages/ducjs/src/flatbuffers/duc/duc-image-filter.ts deleted file mode 100644 index b626965d..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-image-filter.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 DucImageFilter { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucImageFilter { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucImageFilter(bb:flatbuffers.ByteBuffer, obj?:DucImageFilter):DucImageFilter { - return (obj || new DucImageFilter()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucImageFilter(bb:flatbuffers.ByteBuffer, obj?:DucImageFilter):DucImageFilter { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucImageFilter()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -brightness():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -contrast():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -static startDucImageFilter(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addBrightness(builder:flatbuffers.Builder, brightness:number) { - builder.addFieldFloat32(0, brightness, 0.0); -} - -static addContrast(builder:flatbuffers.Builder, contrast:number) { - builder.addFieldFloat32(1, contrast, 0.0); -} - -static endDucImageFilter(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucImageFilter(builder:flatbuffers.Builder, brightness:number, contrast:number):flatbuffers.Offset { - DucImageFilter.startDucImageFilter(builder); - DucImageFilter.addBrightness(builder, brightness); - DucImageFilter.addContrast(builder, contrast); - return DucImageFilter.endDucImageFilter(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-layer-overrides.ts b/packages/ducjs/src/flatbuffers/duc/duc-layer-overrides.ts deleted file mode 100644 index a51a7750..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-layer-overrides.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { ElementBackground } from '../duc/element-background'; -import { ElementStroke } from '../duc/element-stroke'; - - -export class DucLayerOverrides { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucLayerOverrides { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucLayerOverrides(bb:flatbuffers.ByteBuffer, obj?:DucLayerOverrides):DucLayerOverrides { - return (obj || new DucLayerOverrides()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucLayerOverrides(bb:flatbuffers.ByteBuffer, obj?:DucLayerOverrides):DucLayerOverrides { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucLayerOverrides()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -stroke(obj?:ElementStroke):ElementStroke|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new ElementStroke()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -background(obj?:ElementBackground):ElementBackground|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new ElementBackground()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucLayerOverrides(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addStroke(builder:flatbuffers.Builder, strokeOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, strokeOffset, 0); -} - -static addBackground(builder:flatbuffers.Builder, backgroundOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, backgroundOffset, 0); -} - -static endDucLayerOverrides(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-layer.ts b/packages/ducjs/src/flatbuffers/duc/duc-layer.ts deleted file mode 100644 index ca20a083..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-layer.ts +++ /dev/null @@ -1,77 +0,0 @@ -// 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 { DucLayerOverrides } from '../duc/duc-layer-overrides'; -import { _DucStackBase } from '../duc/duc-stack-base'; - - -export class DucLayer { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucLayer { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucLayer(bb:flatbuffers.ByteBuffer, obj?:DucLayer):DucLayer { - return (obj || new DucLayer()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucLayer(bb:flatbuffers.ByteBuffer, obj?:DucLayer):DucLayer { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucLayer()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -stackBase(obj?:_DucStackBase):_DucStackBase|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new _DucStackBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -readonly():boolean { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -overrides(obj?:DucLayerOverrides):DucLayerOverrides|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new DucLayerOverrides()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucLayer(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStackBase(builder:flatbuffers.Builder, stackBaseOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, stackBaseOffset, 0); -} - -static addReadonly(builder:flatbuffers.Builder, readonly:boolean) { - builder.addFieldInt8(2, +readonly, +false); -} - -static addOverrides(builder:flatbuffers.Builder, overridesOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, overridesOffset, 0); -} - -static endDucLayer(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // id - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-leader-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-leader-element.ts deleted file mode 100644 index 69ff6eb3..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-leader-element.ts +++ /dev/null @@ -1,76 +0,0 @@ -// 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 { DucLeaderStyle } from '../duc/duc-leader-style'; -import { GeometricPoint } from '../duc/geometric-point'; -import { LeaderContent } from '../duc/leader-content'; -import { _DucLinearElementBase } from '../duc/duc-linear-element-base'; - - -export class DucLeaderElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucLeaderElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucLeaderElement(bb:flatbuffers.ByteBuffer, obj?:DucLeaderElement):DucLeaderElement { - return (obj || new DucLeaderElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucLeaderElement(bb:flatbuffers.ByteBuffer, obj?:DucLeaderElement):DucLeaderElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucLeaderElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -linearBase(obj?:_DucLinearElementBase):_DucLinearElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucLinearElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucLeaderStyle):DucLeaderStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucLeaderStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -content(obj?:LeaderContent):LeaderContent|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new LeaderContent()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -contentAnchor(obj?:GeometricPoint):GeometricPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new GeometricPoint()).__init(this.bb_pos + offset, this.bb!) : null; -} - -static startDucLeaderElement(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addLinearBase(builder:flatbuffers.Builder, linearBaseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, linearBaseOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static addContent(builder:flatbuffers.Builder, contentOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, contentOffset, 0); -} - -static addContentAnchor(builder:flatbuffers.Builder, contentAnchorOffset:flatbuffers.Offset) { - builder.addFieldStruct(3, contentAnchorOffset, 0); -} - -static endDucLeaderElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-leader-style.ts b/packages/ducjs/src/flatbuffers/duc/duc-leader-style.ts deleted file mode 100644 index 8b09db85..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-leader-style.ts +++ /dev/null @@ -1,102 +0,0 @@ -// 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 { BLOCK_ATTACHMENT } from '../duc/block-attachment'; -import { DucHead } from '../duc/duc-head'; -import { DucTextStyle } from '../duc/duc-text-style'; -import { VERTICAL_ALIGN } from '../duc/vertical-align'; - - -export class DucLeaderStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucLeaderStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucLeaderStyle(bb:flatbuffers.ByteBuffer, obj?:DucLeaderStyle):DucLeaderStyle { - return (obj || new DucLeaderStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucLeaderStyle(bb:flatbuffers.ByteBuffer, obj?:DucLeaderStyle):DucLeaderStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucLeaderStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -headsOverride(index: number, obj?:DucHead):DucHead|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucHead()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -headsOverrideLength():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -dogleg():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -textStyle(obj?:DucTextStyle):DucTextStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new DucTextStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -textAttachment():VERTICAL_ALIGN|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -blockAttachment():BLOCK_ATTACHMENT|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startDucLeaderStyle(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addHeadsOverride(builder:flatbuffers.Builder, headsOverrideOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, headsOverrideOffset, 0); -} - -static createHeadsOverrideVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startHeadsOverrideVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addDogleg(builder:flatbuffers.Builder, dogleg:number) { - builder.addFieldFloat64(2, dogleg, 0.0); -} - -static addTextStyle(builder:flatbuffers.Builder, textStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, textStyleOffset, 0); -} - -static addTextAttachment(builder:flatbuffers.Builder, textAttachment:VERTICAL_ALIGN) { - builder.addFieldInt8(4, textAttachment, null); -} - -static addBlockAttachment(builder:flatbuffers.Builder, blockAttachment:BLOCK_ATTACHMENT) { - builder.addFieldInt8(5, blockAttachment, null); -} - -static endDucLeaderStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-line-reference.ts b/packages/ducjs/src/flatbuffers/duc/duc-line-reference.ts deleted file mode 100644 index a15231a3..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-line-reference.ts +++ /dev/null @@ -1,55 +0,0 @@ -// 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'; - - -export class DucLineReference { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucLineReference { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucLineReference(bb:flatbuffers.ByteBuffer, obj?:DucLineReference):DucLineReference { - return (obj || new DucLineReference()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucLineReference(bb:flatbuffers.ByteBuffer, obj?:DucLineReference):DucLineReference { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucLineReference()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -index():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -handle(obj?:GeometricPoint):GeometricPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new GeometricPoint()).__init(this.bb_pos + offset, this.bb!) : null; -} - -static startDucLineReference(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addIndex(builder:flatbuffers.Builder, index:number) { - builder.addFieldInt32(0, index, 0); -} - -static addHandle(builder:flatbuffers.Builder, handleOffset:flatbuffers.Offset) { - builder.addFieldStruct(1, handleOffset, 0); -} - -static endDucLineReference(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-line.ts b/packages/ducjs/src/flatbuffers/duc/duc-line.ts deleted file mode 100644 index 4a0406e2..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-line.ts +++ /dev/null @@ -1,55 +0,0 @@ -// 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 { DucLineReference } from '../duc/duc-line-reference'; - - -export class DucLine { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucLine { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucLine(bb:flatbuffers.ByteBuffer, obj?:DucLine):DucLine { - return (obj || new DucLine()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucLine(bb:flatbuffers.ByteBuffer, obj?:DucLine):DucLine { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucLine()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -start(obj?:DucLineReference):DucLineReference|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new DucLineReference()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -end(obj?:DucLineReference):DucLineReference|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucLineReference()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucLine(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addStart(builder:flatbuffers.Builder, startOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, startOffset, 0); -} - -static addEnd(builder:flatbuffers.Builder, endOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, endOffset, 0); -} - -static endDucLine(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-linear-element-base.ts b/packages/ducjs/src/flatbuffers/duc/duc-linear-element-base.ts deleted file mode 100644 index 967a82a7..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-linear-element-base.ts +++ /dev/null @@ -1,155 +0,0 @@ -// 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 { DucLine } from '../duc/duc-line'; -import { DucPath } from '../duc/duc-path'; -import { DucPoint } from '../duc/duc-point'; -import { DucPointBinding } from '../duc/duc-point-binding'; -import { _DucElementBase } from '../duc/duc-element-base'; - - -export class _DucLinearElementBase { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):_DucLinearElementBase { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAs_DucLinearElementBase(bb:flatbuffers.ByteBuffer, obj?:_DucLinearElementBase):_DucLinearElementBase { - return (obj || new _DucLinearElementBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAs_DucLinearElementBase(bb:flatbuffers.ByteBuffer, obj?:_DucLinearElementBase):_DucLinearElementBase { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new _DucLinearElementBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -points(index: number, obj?:DucPoint):DucPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucPoint()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -pointsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -lines(index: number, obj?:DucLine):DucLine|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new DucLine()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -linesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -pathOverrides(index: number, obj?:DucPath):DucPath|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new DucPath()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -pathOverridesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -lastCommittedPoint(obj?:DucPoint):DucPoint|null { - 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; -} - -startBinding(obj?:DucPointBinding):DucPointBinding|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new DucPointBinding()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -endBinding(obj?:DucPointBinding):DucPointBinding|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? (obj || new DucPointBinding()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static start_DucLinearElementBase(builder:flatbuffers.Builder) { - builder.startObject(7); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addPoints(builder:flatbuffers.Builder, pointsOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, pointsOffset, 0); -} - -static createPointsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startPointsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addLines(builder:flatbuffers.Builder, linesOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, linesOffset, 0); -} - -static createLinesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startLinesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addPathOverrides(builder:flatbuffers.Builder, pathOverridesOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, pathOverridesOffset, 0); -} - -static createPathOverridesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startPathOverridesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addLastCommittedPoint(builder:flatbuffers.Builder, lastCommittedPointOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, lastCommittedPointOffset, 0); -} - -static addStartBinding(builder:flatbuffers.Builder, startBindingOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, startBindingOffset, 0); -} - -static addEndBinding(builder:flatbuffers.Builder, endBindingOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, endBindingOffset, 0); -} - -static end_DucLinearElementBase(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-linear-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-linear-element.ts deleted file mode 100644 index 8e4c164b..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-linear-element.ts +++ /dev/null @@ -1,61 +0,0 @@ -// 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 { _DucLinearElementBase } from '../duc/duc-linear-element-base'; - - -export class DucLinearElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucLinearElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucLinearElement(bb:flatbuffers.ByteBuffer, obj?:DucLinearElement):DucLinearElement { - return (obj || new DucLinearElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucLinearElement(bb:flatbuffers.ByteBuffer, obj?:DucLinearElement):DucLinearElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucLinearElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -linearBase(obj?:_DucLinearElementBase):_DucLinearElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucLinearElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -wipeoutBelow():boolean { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startDucLinearElement(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addLinearBase(builder:flatbuffers.Builder, linearBaseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, linearBaseOffset, 0); -} - -static addWipeoutBelow(builder:flatbuffers.Builder, wipeoutBelow:boolean) { - builder.addFieldInt8(1, +wipeoutBelow, +false); -} - -static endDucLinearElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucLinearElement(builder:flatbuffers.Builder, linearBaseOffset:flatbuffers.Offset, wipeoutBelow:boolean):flatbuffers.Offset { - DucLinearElement.startDucLinearElement(builder); - DucLinearElement.addLinearBase(builder, linearBaseOffset); - DucLinearElement.addWipeoutBelow(builder, wipeoutBelow); - return DucLinearElement.endDucLinearElement(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-local-state.ts b/packages/ducjs/src/flatbuffers/duc/duc-local-state.ts deleted file mode 100644 index dad59f34..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-local-state.ts +++ /dev/null @@ -1,274 +0,0 @@ -// 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 { DucHead } from '../duc/duc-head'; -import { ElementBackground } from '../duc/element-background'; -import { ElementStroke } from '../duc/element-stroke'; -import { TEXT_ALIGN } from '../duc/text-align'; - - -export class DucLocalState { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucLocalState { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucLocalState(bb:flatbuffers.ByteBuffer, obj?:DucLocalState):DucLocalState { - return (obj || new DucLocalState()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucLocalState(bb:flatbuffers.ByteBuffer, obj?:DucLocalState):DucLocalState { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucLocalState()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -scope():string|null -scope(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -scope(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -activeStandardId():string|null -activeStandardId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -activeStandardId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -scrollX():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -scrollY():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -zoom():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -activeGridSettings(index: number):string -activeGridSettings(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -activeGridSettings(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -activeGridSettingsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -activeSnapSettings():string|null -activeSnapSettings(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -activeSnapSettings(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -isBindingEnabled():boolean { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -currentItemStroke(obj?:ElementStroke):ElementStroke|null { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? (obj || new ElementStroke()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -currentItemBackground(obj?:ElementBackground):ElementBackground|null { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? (obj || new ElementBackground()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -currentItemOpacity():number { - const offset = this.bb!.__offset(this.bb_pos, 24); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -currentItemFontFamily():string|null -currentItemFontFamily(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -currentItemFontFamily(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 26); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -currentItemFontSize():number { - const offset = this.bb!.__offset(this.bb_pos, 28); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -currentItemTextAlign():TEXT_ALIGN|null { - const offset = this.bb!.__offset(this.bb_pos, 30); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -currentItemStartLineHead(obj?:DucHead):DucHead|null { - const offset = this.bb!.__offset(this.bb_pos, 32); - return offset ? (obj || new DucHead()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -currentItemEndLineHead(obj?:DucHead):DucHead|null { - const offset = this.bb!.__offset(this.bb_pos, 34); - return offset ? (obj || new DucHead()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -currentItemRoundness():number { - const offset = this.bb!.__offset(this.bb_pos, 36); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -penMode():boolean { - const offset = this.bb!.__offset(this.bb_pos, 38); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -viewModeEnabled():boolean { - const offset = this.bb!.__offset(this.bb_pos, 40); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -objectsSnapModeEnabled():boolean { - const offset = this.bb!.__offset(this.bb_pos, 42); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -gridModeEnabled():boolean { - const offset = this.bb!.__offset(this.bb_pos, 44); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -outlineModeEnabled():boolean { - const offset = this.bb!.__offset(this.bb_pos, 46); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -manualSaveMode():boolean { - const offset = this.bb!.__offset(this.bb_pos, 48); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startDucLocalState(builder:flatbuffers.Builder) { - builder.startObject(23); -} - -static addScope(builder:flatbuffers.Builder, scopeOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, scopeOffset, 0); -} - -static addActiveStandardId(builder:flatbuffers.Builder, activeStandardIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, activeStandardIdOffset, 0); -} - -static addScrollX(builder:flatbuffers.Builder, scrollX:number) { - builder.addFieldFloat64(2, scrollX, 0.0); -} - -static addScrollY(builder:flatbuffers.Builder, scrollY:number) { - builder.addFieldFloat64(3, scrollY, 0.0); -} - -static addZoom(builder:flatbuffers.Builder, zoom:number) { - builder.addFieldFloat64(4, zoom, 0.0); -} - -static addActiveGridSettings(builder:flatbuffers.Builder, activeGridSettingsOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, activeGridSettingsOffset, 0); -} - -static createActiveGridSettingsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startActiveGridSettingsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addActiveSnapSettings(builder:flatbuffers.Builder, activeSnapSettingsOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, activeSnapSettingsOffset, 0); -} - -static addIsBindingEnabled(builder:flatbuffers.Builder, isBindingEnabled:boolean) { - builder.addFieldInt8(7, +isBindingEnabled, +false); -} - -static addCurrentItemStroke(builder:flatbuffers.Builder, currentItemStrokeOffset:flatbuffers.Offset) { - builder.addFieldOffset(8, currentItemStrokeOffset, 0); -} - -static addCurrentItemBackground(builder:flatbuffers.Builder, currentItemBackgroundOffset:flatbuffers.Offset) { - builder.addFieldOffset(9, currentItemBackgroundOffset, 0); -} - -static addCurrentItemOpacity(builder:flatbuffers.Builder, currentItemOpacity:number) { - builder.addFieldFloat32(10, currentItemOpacity, 0.0); -} - -static addCurrentItemFontFamily(builder:flatbuffers.Builder, currentItemFontFamilyOffset:flatbuffers.Offset) { - builder.addFieldOffset(11, currentItemFontFamilyOffset, 0); -} - -static addCurrentItemFontSize(builder:flatbuffers.Builder, currentItemFontSize:number) { - builder.addFieldFloat64(12, currentItemFontSize, 0.0); -} - -static addCurrentItemTextAlign(builder:flatbuffers.Builder, currentItemTextAlign:TEXT_ALIGN) { - builder.addFieldInt8(13, currentItemTextAlign, null); -} - -static addCurrentItemStartLineHead(builder:flatbuffers.Builder, currentItemStartLineHeadOffset:flatbuffers.Offset) { - builder.addFieldOffset(14, currentItemStartLineHeadOffset, 0); -} - -static addCurrentItemEndLineHead(builder:flatbuffers.Builder, currentItemEndLineHeadOffset:flatbuffers.Offset) { - builder.addFieldOffset(15, currentItemEndLineHeadOffset, 0); -} - -static addCurrentItemRoundness(builder:flatbuffers.Builder, currentItemRoundness:number) { - builder.addFieldFloat64(16, currentItemRoundness, 0.0); -} - -static addPenMode(builder:flatbuffers.Builder, penMode:boolean) { - builder.addFieldInt8(17, +penMode, +false); -} - -static addViewModeEnabled(builder:flatbuffers.Builder, viewModeEnabled:boolean) { - builder.addFieldInt8(18, +viewModeEnabled, +false); -} - -static addObjectsSnapModeEnabled(builder:flatbuffers.Builder, objectsSnapModeEnabled:boolean) { - builder.addFieldInt8(19, +objectsSnapModeEnabled, +false); -} - -static addGridModeEnabled(builder:flatbuffers.Builder, gridModeEnabled:boolean) { - builder.addFieldInt8(20, +gridModeEnabled, +false); -} - -static addOutlineModeEnabled(builder:flatbuffers.Builder, outlineModeEnabled:boolean) { - builder.addFieldInt8(21, +outlineModeEnabled, +false); -} - -static addManualSaveMode(builder:flatbuffers.Builder, manualSaveMode:boolean) { - builder.addFieldInt8(22, +manualSaveMode, +false); -} - -static endDucLocalState(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-mermaid-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-mermaid-element.ts deleted file mode 100644 index 43bdfaaa..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-mermaid-element.ts +++ /dev/null @@ -1,87 +0,0 @@ -// 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 { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucMermaidElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucMermaidElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucMermaidElement(bb:flatbuffers.ByteBuffer, obj?:DucMermaidElement):DucMermaidElement { - return (obj || new DucMermaidElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucMermaidElement(bb:flatbuffers.ByteBuffer, obj?:DucMermaidElement):DucMermaidElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucMermaidElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -source():string|null -source(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -source(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -theme():string|null -theme(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -theme(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -svgPath():string|null -svgPath(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -svgPath(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDucMermaidElement(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addSource(builder:flatbuffers.Builder, sourceOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, sourceOffset, 0); -} - -static addTheme(builder:flatbuffers.Builder, themeOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, themeOffset, 0); -} - -static addSvgPath(builder:flatbuffers.Builder, svgPathOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, svgPathOffset, 0); -} - -static endDucMermaidElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucMermaidElement(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset, sourceOffset:flatbuffers.Offset, themeOffset:flatbuffers.Offset, svgPathOffset:flatbuffers.Offset):flatbuffers.Offset { - DucMermaidElement.startDucMermaidElement(builder); - DucMermaidElement.addBase(builder, baseOffset); - DucMermaidElement.addSource(builder, sourceOffset); - DucMermaidElement.addTheme(builder, themeOffset); - DucMermaidElement.addSvgPath(builder, svgPathOffset); - return DucMermaidElement.endDucMermaidElement(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-model-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-model-element.ts deleted file mode 100644 index debfc012..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-model-element.ts +++ /dev/null @@ -1,104 +0,0 @@ -// 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 { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucModelElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucModelElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucModelElement(bb:flatbuffers.ByteBuffer, obj?:DucModelElement):DucModelElement { - return (obj || new DucModelElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucModelElement(bb:flatbuffers.ByteBuffer, obj?:DucModelElement):DucModelElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucModelElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -source():string|null -source(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -source(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -svgPath():string|null -svgPath(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -svgPath(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -fileIds(index: number):string -fileIds(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -fileIds(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -fileIdsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -static startDucModelElement(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addSource(builder:flatbuffers.Builder, sourceOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, sourceOffset, 0); -} - -static addSvgPath(builder:flatbuffers.Builder, svgPathOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, svgPathOffset, 0); -} - -static addFileIds(builder:flatbuffers.Builder, fileIdsOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, fileIdsOffset, 0); -} - -static createFileIdsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startFileIdsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static endDucModelElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucModelElement(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset, sourceOffset:flatbuffers.Offset, svgPathOffset:flatbuffers.Offset, fileIdsOffset:flatbuffers.Offset):flatbuffers.Offset { - DucModelElement.startDucModelElement(builder); - DucModelElement.addBase(builder, baseOffset); - DucModelElement.addSource(builder, sourceOffset); - DucModelElement.addSvgPath(builder, svgPathOffset); - DucModelElement.addFileIds(builder, fileIdsOffset); - return DucModelElement.endDucModelElement(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-parametric-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-parametric-element.ts deleted file mode 100644 index 786a669b..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-parametric-element.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { ParametricSource } from '../duc/parametric-source'; -import { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucParametricElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucParametricElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucParametricElement(bb:flatbuffers.ByteBuffer, obj?:DucParametricElement):DucParametricElement { - return (obj || new DucParametricElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucParametricElement(bb:flatbuffers.ByteBuffer, obj?:DucParametricElement):DucParametricElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucParametricElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -source(obj?:ParametricSource):ParametricSource|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new ParametricSource()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucParametricElement(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addSource(builder:flatbuffers.Builder, sourceOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, sourceOffset, 0); -} - -static endDucParametricElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-path.ts b/packages/ducjs/src/flatbuffers/duc/duc-path.ts deleted file mode 100644 index 21e2ade3..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-path.ts +++ /dev/null @@ -1,92 +0,0 @@ -// 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 { ElementBackground } from '../duc/element-background'; -import { ElementStroke } from '../duc/element-stroke'; - - -export class DucPath { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucPath { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucPath(bb:flatbuffers.ByteBuffer, obj?:DucPath):DucPath { - return (obj || new DucPath()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucPath(bb:flatbuffers.ByteBuffer, obj?:DucPath):DucPath { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucPath()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -lineIndices(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readInt32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0; -} - -lineIndicesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -lineIndicesArray():Int32Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? new Int32Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; -} - -background(obj?:ElementBackground):ElementBackground|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new ElementBackground()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -stroke(obj?:ElementStroke):ElementStroke|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new ElementStroke()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucPath(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addLineIndices(builder:flatbuffers.Builder, lineIndicesOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, lineIndicesOffset, 0); -} - -static createLineIndicesVector(builder:flatbuffers.Builder, data:number[]|Int32Array):flatbuffers.Offset; -/** - * @deprecated This Uint8Array overload will be removed in the future. - */ -static createLineIndicesVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; -static createLineIndicesVector(builder:flatbuffers.Builder, data:number[]|Int32Array|Uint8Array):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addInt32(data[i]!); - } - return builder.endVector(); -} - -static startLineIndicesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addBackground(builder:flatbuffers.Builder, backgroundOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, backgroundOffset, 0); -} - -static addStroke(builder:flatbuffers.Builder, strokeOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, strokeOffset, 0); -} - -static endDucPath(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-pdf-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-pdf-element.ts deleted file mode 100644 index 8c4279c4..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-pdf-element.ts +++ /dev/null @@ -1,67 +0,0 @@ -// 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 { DocumentGridConfig } from '../duc/document-grid-config'; -import { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucPdfElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucPdfElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucPdfElement(bb:flatbuffers.ByteBuffer, obj?:DucPdfElement):DucPdfElement { - return (obj || new DucPdfElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucPdfElement(bb:flatbuffers.ByteBuffer, obj?:DucPdfElement):DucPdfElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucPdfElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -fileId():string|null -fileId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -fileId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -gridConfig(obj?:DocumentGridConfig):DocumentGridConfig|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new DocumentGridConfig()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucPdfElement(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addFileId(builder:flatbuffers.Builder, fileIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, fileIdOffset, 0); -} - -static addGridConfig(builder:flatbuffers.Builder, gridConfigOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, gridConfigOffset, 0); -} - -static endDucPdfElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-plot-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-plot-element.ts deleted file mode 100644 index 9ebf600c..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-plot-element.ts +++ /dev/null @@ -1,66 +0,0 @@ -// 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 { DucPlotStyle } from '../duc/duc-plot-style'; -import { PlotLayout } from '../duc/plot-layout'; -import { _DucStackElementBase } from '../duc/duc-stack-element-base'; - - -export class DucPlotElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucPlotElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucPlotElement(bb:flatbuffers.ByteBuffer, obj?:DucPlotElement):DucPlotElement { - return (obj || new DucPlotElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucPlotElement(bb:flatbuffers.ByteBuffer, obj?:DucPlotElement):DucPlotElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucPlotElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -stackElementBase(obj?:_DucStackElementBase):_DucStackElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucStackElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucPlotStyle):DucPlotStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucPlotStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -layout(obj?:PlotLayout):PlotLayout|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new PlotLayout()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucPlotElement(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addStackElementBase(builder:flatbuffers.Builder, stackElementBaseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, stackElementBaseOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static addLayout(builder:flatbuffers.Builder, layoutOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, layoutOffset, 0); -} - -static endDucPlotElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-plot-style.ts b/packages/ducjs/src/flatbuffers/duc/duc-plot-style.ts deleted file mode 100644 index fa1a8334..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-plot-style.ts +++ /dev/null @@ -1,38 +0,0 @@ -// 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 DucPlotStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucPlotStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucPlotStyle(bb:flatbuffers.ByteBuffer, obj?:DucPlotStyle):DucPlotStyle { - return (obj || new DucPlotStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucPlotStyle(bb:flatbuffers.ByteBuffer, obj?:DucPlotStyle):DucPlotStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucPlotStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static startDucPlotStyle(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static endDucPlotStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucPlotStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - DucPlotStyle.startDucPlotStyle(builder); - return DucPlotStyle.endDucPlotStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-point-binding.ts b/packages/ducjs/src/flatbuffers/duc/duc-point-binding.ts deleted file mode 100644 index 7d2d56f5..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-point-binding.ts +++ /dev/null @@ -1,95 +0,0 @@ -// 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 { DucHead } from '../duc/duc-head'; -import { GeometricPoint } from '../duc/geometric-point'; -import { PointBindingPoint } from '../duc/point-binding-point'; - - -export class DucPointBinding { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucPointBinding { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucPointBinding(bb:flatbuffers.ByteBuffer, obj?:DucPointBinding):DucPointBinding { - return (obj || new DucPointBinding()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucPointBinding(bb:flatbuffers.ByteBuffer, obj?:DucPointBinding):DucPointBinding { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucPointBinding()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -elementId():string|null -elementId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -elementId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -focus():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -gap():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -fixedPoint(obj?:GeometricPoint):GeometricPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new GeometricPoint()).__init(this.bb_pos + offset, this.bb!) : null; -} - -point(obj?:PointBindingPoint):PointBindingPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new PointBindingPoint()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -head(obj?:DucHead):DucHead|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new DucHead()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucPointBinding(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addElementId(builder:flatbuffers.Builder, elementIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, elementIdOffset, 0); -} - -static addFocus(builder:flatbuffers.Builder, focus:number) { - builder.addFieldFloat32(1, focus, 0.0); -} - -static addGap(builder:flatbuffers.Builder, gap:number) { - builder.addFieldFloat64(2, gap, 0.0); -} - -static addFixedPoint(builder:flatbuffers.Builder, fixedPointOffset:flatbuffers.Offset) { - builder.addFieldStruct(3, fixedPointOffset, 0); -} - -static addPoint(builder:flatbuffers.Builder, pointOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, pointOffset, 0); -} - -static addHead(builder:flatbuffers.Builder, headOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, headOffset, 0); -} - -static endDucPointBinding(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-point.ts b/packages/ducjs/src/flatbuffers/duc/duc-point.ts deleted file mode 100644 index 0c6abe5a..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-point.ts +++ /dev/null @@ -1,72 +0,0 @@ -// 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 { BEZIER_MIRRORING } from '../duc/bezier-mirroring'; - - -export class DucPoint { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucPoint { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucPoint(bb:flatbuffers.ByteBuffer, obj?:DucPoint):DucPoint { - return (obj || new DucPoint()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucPoint(bb:flatbuffers.ByteBuffer, obj?:DucPoint):DucPoint { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucPoint()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -x():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -y():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -mirroring():BEZIER_MIRRORING|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startDucPoint(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addX(builder:flatbuffers.Builder, x:number) { - builder.addFieldFloat64(0, x, 0.0); -} - -static addY(builder:flatbuffers.Builder, y:number) { - builder.addFieldFloat64(1, y, 0.0); -} - -static addMirroring(builder:flatbuffers.Builder, mirroring:BEZIER_MIRRORING) { - builder.addFieldInt8(2, mirroring, null); -} - -static endDucPoint(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucPoint(builder:flatbuffers.Builder, x:number, y:number, mirroring:BEZIER_MIRRORING|null):flatbuffers.Offset { - DucPoint.startDucPoint(builder); - DucPoint.addX(builder, x); - DucPoint.addY(builder, y); - if (mirroring !== null) - DucPoint.addMirroring(builder, mirroring); - return DucPoint.endDucPoint(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-polygon-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-polygon-element.ts deleted file mode 100644 index e8ae9888..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-polygon-element.ts +++ /dev/null @@ -1,61 +0,0 @@ -// 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 { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucPolygonElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucPolygonElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucPolygonElement(bb:flatbuffers.ByteBuffer, obj?:DucPolygonElement):DucPolygonElement { - return (obj || new DucPolygonElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucPolygonElement(bb:flatbuffers.ByteBuffer, obj?:DucPolygonElement):DucPolygonElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucPolygonElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -sides():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -static startDucPolygonElement(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addSides(builder:flatbuffers.Builder, sides:number) { - builder.addFieldInt32(1, sides, 0); -} - -static endDucPolygonElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucPolygonElement(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset, sides:number):flatbuffers.Offset { - DucPolygonElement.startDucPolygonElement(builder); - DucPolygonElement.addBase(builder, baseOffset); - DucPolygonElement.addSides(builder, sides); - return DucPolygonElement.endDucPolygonElement(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-rectangle-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-rectangle-element.ts deleted file mode 100644 index 6ed35d2a..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-rectangle-element.ts +++ /dev/null @@ -1,51 +0,0 @@ -// 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 { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucRectangleElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucRectangleElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucRectangleElement(bb:flatbuffers.ByteBuffer, obj?:DucRectangleElement):DucRectangleElement { - return (obj || new DucRectangleElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucRectangleElement(bb:flatbuffers.ByteBuffer, obj?:DucRectangleElement):DucRectangleElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucRectangleElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucRectangleElement(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static endDucRectangleElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucRectangleElement(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset):flatbuffers.Offset { - DucRectangleElement.startDucRectangleElement(builder); - DucRectangleElement.addBase(builder, baseOffset); - return DucRectangleElement.endDucRectangleElement(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-region.ts b/packages/ducjs/src/flatbuffers/duc/duc-region.ts deleted file mode 100644 index d89ce858..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-region.ts +++ /dev/null @@ -1,68 +0,0 @@ -// 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 { BOOLEAN_OPERATION } from '../duc/boolean-operation'; -import { _DucStackBase } from '../duc/duc-stack-base'; - - -export class DucRegion { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucRegion { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucRegion(bb:flatbuffers.ByteBuffer, obj?:DucRegion):DucRegion { - return (obj || new DucRegion()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucRegion(bb:flatbuffers.ByteBuffer, obj?:DucRegion):DucRegion { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucRegion()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -stackBase(obj?:_DucStackBase):_DucStackBase|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new _DucStackBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -booleanOperation():BOOLEAN_OPERATION|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startDucRegion(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStackBase(builder:flatbuffers.Builder, stackBaseOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, stackBaseOffset, 0); -} - -static addBooleanOperation(builder:flatbuffers.Builder, booleanOperation:BOOLEAN_OPERATION) { - builder.addFieldInt8(2, booleanOperation, null); -} - -static endDucRegion(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // id - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-stack-base.ts b/packages/ducjs/src/flatbuffers/duc/duc-stack-base.ts deleted file mode 100644 index 3b2b40b0..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-stack-base.ts +++ /dev/null @@ -1,104 +0,0 @@ -// 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 { DucStackLikeStyles } from '../duc/duc-stack-like-styles'; - - -export class _DucStackBase { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):_DucStackBase { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAs_DucStackBase(bb:flatbuffers.ByteBuffer, obj?:_DucStackBase):_DucStackBase { - return (obj || new _DucStackBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAs_DucStackBase(bb:flatbuffers.ByteBuffer, obj?:_DucStackBase):_DucStackBase { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new _DucStackBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -label():string|null -label(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -label(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -description():string|null -description(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -description(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -isCollapsed():boolean { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -isPlot():boolean { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -isVisible():boolean { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -locked():boolean { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -styles(obj?:DucStackLikeStyles):DucStackLikeStyles|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? (obj || new DucStackLikeStyles()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static start_DucStackBase(builder:flatbuffers.Builder) { - builder.startObject(7); -} - -static addLabel(builder:flatbuffers.Builder, labelOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, labelOffset, 0); -} - -static addDescription(builder:flatbuffers.Builder, descriptionOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, descriptionOffset, 0); -} - -static addIsCollapsed(builder:flatbuffers.Builder, isCollapsed:boolean) { - builder.addFieldInt8(2, +isCollapsed, +false); -} - -static addIsPlot(builder:flatbuffers.Builder, isPlot:boolean) { - builder.addFieldInt8(3, +isPlot, +false); -} - -static addIsVisible(builder:flatbuffers.Builder, isVisible:boolean) { - builder.addFieldInt8(4, +isVisible, +false); -} - -static addLocked(builder:flatbuffers.Builder, locked:boolean) { - builder.addFieldInt8(5, +locked, +false); -} - -static addStyles(builder:flatbuffers.Builder, stylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, stylesOffset, 0); -} - -static end_DucStackBase(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-stack-element-base.ts b/packages/ducjs/src/flatbuffers/duc/duc-stack-element-base.ts deleted file mode 100644 index 0d19d8fe..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-stack-element-base.ts +++ /dev/null @@ -1,85 +0,0 @@ -// 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 { _DucElementBase } from '../duc/duc-element-base'; -import { _DucStackBase } from '../duc/duc-stack-base'; - - -export class _DucStackElementBase { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):_DucStackElementBase { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAs_DucStackElementBase(bb:flatbuffers.ByteBuffer, obj?:_DucStackElementBase):_DucStackElementBase { - return (obj || new _DucStackElementBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAs_DucStackElementBase(bb:flatbuffers.ByteBuffer, obj?:_DucStackElementBase):_DucStackElementBase { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new _DucStackElementBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -stackBase(obj?:_DucStackBase):_DucStackBase|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new _DucStackBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -clip():boolean { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -labelVisible():boolean { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -standardOverride():string|null -standardOverride(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -standardOverride(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static start_DucStackElementBase(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addStackBase(builder:flatbuffers.Builder, stackBaseOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, stackBaseOffset, 0); -} - -static addClip(builder:flatbuffers.Builder, clip:boolean) { - builder.addFieldInt8(2, +clip, +false); -} - -static addLabelVisible(builder:flatbuffers.Builder, labelVisible:boolean) { - builder.addFieldInt8(3, +labelVisible, +false); -} - -static addStandardOverride(builder:flatbuffers.Builder, standardOverrideOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, standardOverrideOffset, 0); -} - -static end_DucStackElementBase(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-stack-like-styles.ts b/packages/ducjs/src/flatbuffers/duc/duc-stack-like-styles.ts deleted file mode 100644 index a01f137a..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-stack-like-styles.ts +++ /dev/null @@ -1,60 +0,0 @@ -// 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 DucStackLikeStyles { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucStackLikeStyles { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucStackLikeStyles(bb:flatbuffers.ByteBuffer, obj?:DucStackLikeStyles):DucStackLikeStyles { - return (obj || new DucStackLikeStyles()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucStackLikeStyles(bb:flatbuffers.ByteBuffer, obj?:DucStackLikeStyles):DucStackLikeStyles { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucStackLikeStyles()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -opacity():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -labelingColor():string|null -labelingColor(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -labelingColor(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDucStackLikeStyles(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addOpacity(builder:flatbuffers.Builder, opacity:number) { - builder.addFieldFloat64(0, opacity, 0.0); -} - -static addLabelingColor(builder:flatbuffers.Builder, labelingColorOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, labelingColorOffset, 0); -} - -static endDucStackLikeStyles(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucStackLikeStyles(builder:flatbuffers.Builder, opacity:number, labelingColorOffset:flatbuffers.Offset):flatbuffers.Offset { - DucStackLikeStyles.startDucStackLikeStyles(builder); - DucStackLikeStyles.addOpacity(builder, opacity); - DucStackLikeStyles.addLabelingColor(builder, labelingColorOffset); - return DucStackLikeStyles.endDucStackLikeStyles(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-table-auto-size.ts b/packages/ducjs/src/flatbuffers/duc/duc-table-auto-size.ts deleted file mode 100644 index 670742f5..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-table-auto-size.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 DucTableAutoSize { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTableAutoSize { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTableAutoSize(bb:flatbuffers.ByteBuffer, obj?:DucTableAutoSize):DucTableAutoSize { - return (obj || new DucTableAutoSize()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTableAutoSize(bb:flatbuffers.ByteBuffer, obj?:DucTableAutoSize):DucTableAutoSize { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTableAutoSize()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -columns():boolean { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -rows():boolean { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startDucTableAutoSize(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addColumns(builder:flatbuffers.Builder, columns:boolean) { - builder.addFieldInt8(0, +columns, +false); -} - -static addRows(builder:flatbuffers.Builder, rows:boolean) { - builder.addFieldInt8(1, +rows, +false); -} - -static endDucTableAutoSize(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucTableAutoSize(builder:flatbuffers.Builder, columns:boolean, rows:boolean):flatbuffers.Offset { - DucTableAutoSize.startDucTableAutoSize(builder); - DucTableAutoSize.addColumns(builder, columns); - DucTableAutoSize.addRows(builder, rows); - return DucTableAutoSize.endDucTableAutoSize(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-table-cell-entry.ts b/packages/ducjs/src/flatbuffers/duc/duc-table-cell-entry.ts deleted file mode 100644 index 3d3fd878..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-table-cell-entry.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 { DucTableCell } from '../duc/duc-table-cell'; - - -export class DucTableCellEntry { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTableCellEntry { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTableCellEntry(bb:flatbuffers.ByteBuffer, obj?:DucTableCellEntry):DucTableCellEntry { - return (obj || new DucTableCellEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTableCellEntry(bb:flatbuffers.ByteBuffer, obj?:DucTableCellEntry):DucTableCellEntry { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTableCellEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -key():string|null -key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -key(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -value(obj?:DucTableCell):DucTableCell|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucTableCell()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucTableCellEntry(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, keyOffset, 0); -} - -static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, valueOffset, 0); -} - -static endDucTableCellEntry(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // key - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-table-cell-span.ts b/packages/ducjs/src/flatbuffers/duc/duc-table-cell-span.ts deleted file mode 100644 index b4b19280..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-table-cell-span.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 DucTableCellSpan { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTableCellSpan { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTableCellSpan(bb:flatbuffers.ByteBuffer, obj?:DucTableCellSpan):DucTableCellSpan { - return (obj || new DucTableCellSpan()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTableCellSpan(bb:flatbuffers.ByteBuffer, obj?:DucTableCellSpan):DucTableCellSpan { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTableCellSpan()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -columns():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -rows():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -static startDucTableCellSpan(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addColumns(builder:flatbuffers.Builder, columns:number) { - builder.addFieldInt32(0, columns, 0); -} - -static addRows(builder:flatbuffers.Builder, rows:number) { - builder.addFieldInt32(1, rows, 0); -} - -static endDucTableCellSpan(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucTableCellSpan(builder:flatbuffers.Builder, columns:number, rows:number):flatbuffers.Offset { - DucTableCellSpan.startDucTableCellSpan(builder); - DucTableCellSpan.addColumns(builder, columns); - DucTableCellSpan.addRows(builder, rows); - return DucTableCellSpan.endDucTableCellSpan(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-table-cell-style.ts b/packages/ducjs/src/flatbuffers/duc/duc-table-cell-style.ts deleted file mode 100644 index 415f56a0..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-table-cell-style.ts +++ /dev/null @@ -1,76 +0,0 @@ -// 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 { DucTextStyle } from '../duc/duc-text-style'; -import { Margins } from '../duc/margins'; -import { TABLE_CELL_ALIGNMENT } from '../duc/table-cell-alignment'; -import { _DucElementStylesBase } from '../duc/duc-element-styles-base'; - - -export class DucTableCellStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTableCellStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTableCellStyle(bb:flatbuffers.ByteBuffer, obj?:DucTableCellStyle):DucTableCellStyle { - return (obj || new DucTableCellStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTableCellStyle(bb:flatbuffers.ByteBuffer, obj?:DucTableCellStyle):DucTableCellStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTableCellStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -baseStyle(obj?:_DucElementStylesBase):_DucElementStylesBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementStylesBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -textStyle(obj?:DucTextStyle):DucTextStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucTextStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -margins(obj?:Margins):Margins|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new Margins()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -alignment():TABLE_CELL_ALIGNMENT|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startDucTableCellStyle(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addBaseStyle(builder:flatbuffers.Builder, baseStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseStyleOffset, 0); -} - -static addTextStyle(builder:flatbuffers.Builder, textStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, textStyleOffset, 0); -} - -static addMargins(builder:flatbuffers.Builder, marginsOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, marginsOffset, 0); -} - -static addAlignment(builder:flatbuffers.Builder, alignment:TABLE_CELL_ALIGNMENT) { - builder.addFieldInt8(3, alignment, null); -} - -static endDucTableCellStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-table-cell.ts b/packages/ducjs/src/flatbuffers/duc/duc-table-cell.ts deleted file mode 100644 index 2a00c7b2..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-table-cell.ts +++ /dev/null @@ -1,98 +0,0 @@ -// 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 { DucTableCellSpan } from '../duc/duc-table-cell-span'; -import { DucTableCellStyle } from '../duc/duc-table-cell-style'; - - -export class DucTableCell { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTableCell { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTableCell(bb:flatbuffers.ByteBuffer, obj?:DucTableCell):DucTableCell { - return (obj || new DucTableCell()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTableCell(bb:flatbuffers.ByteBuffer, obj?:DucTableCell):DucTableCell { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTableCell()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -rowId():string|null -rowId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -rowId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -columnId():string|null -columnId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -columnId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -data():string|null -data(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -data(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -span(obj?:DucTableCellSpan):DucTableCellSpan|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new DucTableCellSpan()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -locked():boolean { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -styleOverrides(obj?:DucTableCellStyle):DucTableCellStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new DucTableCellStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucTableCell(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addRowId(builder:flatbuffers.Builder, rowIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, rowIdOffset, 0); -} - -static addColumnId(builder:flatbuffers.Builder, columnIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, columnIdOffset, 0); -} - -static addData(builder:flatbuffers.Builder, dataOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, dataOffset, 0); -} - -static addSpan(builder:flatbuffers.Builder, spanOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, spanOffset, 0); -} - -static addLocked(builder:flatbuffers.Builder, locked:boolean) { - builder.addFieldInt8(4, +locked, +false); -} - -static addStyleOverrides(builder:flatbuffers.Builder, styleOverridesOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, styleOverridesOffset, 0); -} - -static endDucTableCell(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-table-column-entry.ts b/packages/ducjs/src/flatbuffers/duc/duc-table-column-entry.ts deleted file mode 100644 index 9ee37231..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-table-column-entry.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 { DucTableColumn } from '../duc/duc-table-column'; - - -export class DucTableColumnEntry { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTableColumnEntry { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTableColumnEntry(bb:flatbuffers.ByteBuffer, obj?:DucTableColumnEntry):DucTableColumnEntry { - return (obj || new DucTableColumnEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTableColumnEntry(bb:flatbuffers.ByteBuffer, obj?:DucTableColumnEntry):DucTableColumnEntry { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTableColumnEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -key():string|null -key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -key(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -value(obj?:DucTableColumn):DucTableColumn|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucTableColumn()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucTableColumnEntry(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, keyOffset, 0); -} - -static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, valueOffset, 0); -} - -static endDucTableColumnEntry(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // key - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-table-column.ts b/packages/ducjs/src/flatbuffers/duc/duc-table-column.ts deleted file mode 100644 index a51738f8..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-table-column.ts +++ /dev/null @@ -1,67 +0,0 @@ -// 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 { DucTableCellStyle } from '../duc/duc-table-cell-style'; - - -export class DucTableColumn { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTableColumn { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTableColumn(bb:flatbuffers.ByteBuffer, obj?:DucTableColumn):DucTableColumn { - return (obj || new DucTableColumn()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTableColumn(bb:flatbuffers.ByteBuffer, obj?:DucTableColumn):DucTableColumn { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTableColumn()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -width():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -styleOverrides(obj?:DucTableCellStyle):DucTableCellStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new DucTableCellStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucTableColumn(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addWidth(builder:flatbuffers.Builder, width:number) { - builder.addFieldFloat64(1, width, 0.0); -} - -static addStyleOverrides(builder:flatbuffers.Builder, styleOverridesOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, styleOverridesOffset, 0); -} - -static endDucTableColumn(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // id - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-table-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-table-element.ts deleted file mode 100644 index f759e588..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-table-element.ts +++ /dev/null @@ -1,212 +0,0 @@ -// 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 { DucTableAutoSize } from '../duc/duc-table-auto-size'; -import { DucTableCellEntry } from '../duc/duc-table-cell-entry'; -import { DucTableColumnEntry } from '../duc/duc-table-column-entry'; -import { DucTableRowEntry } from '../duc/duc-table-row-entry'; -import { DucTableStyle } from '../duc/duc-table-style'; -import { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucTableElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTableElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTableElement(bb:flatbuffers.ByteBuffer, obj?:DucTableElement):DucTableElement { - return (obj || new DucTableElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTableElement(bb:flatbuffers.ByteBuffer, obj?:DucTableElement):DucTableElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTableElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucTableStyle):DucTableStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucTableStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -columnOrder(index: number):string -columnOrder(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -columnOrder(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -columnOrderLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -rowOrder(index: number):string -rowOrder(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -rowOrder(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -rowOrderLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -columns(index: number, obj?:DucTableColumnEntry):DucTableColumnEntry|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new DucTableColumnEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -columnsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -rows(index: number, obj?:DucTableRowEntry):DucTableRowEntry|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new DucTableRowEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -rowsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -cells(index: number, obj?:DucTableCellEntry):DucTableCellEntry|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? (obj || new DucTableCellEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -cellsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -headerRowCount():number { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -autoSize(obj?:DucTableAutoSize):DucTableAutoSize|null { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? (obj || new DucTableAutoSize()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucTableElement(builder:flatbuffers.Builder) { - builder.startObject(9); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static addColumnOrder(builder:flatbuffers.Builder, columnOrderOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, columnOrderOffset, 0); -} - -static createColumnOrderVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startColumnOrderVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addRowOrder(builder:flatbuffers.Builder, rowOrderOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, rowOrderOffset, 0); -} - -static createRowOrderVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startRowOrderVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addColumns(builder:flatbuffers.Builder, columnsOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, columnsOffset, 0); -} - -static createColumnsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startColumnsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addRows(builder:flatbuffers.Builder, rowsOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, rowsOffset, 0); -} - -static createRowsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startRowsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addCells(builder:flatbuffers.Builder, cellsOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, cellsOffset, 0); -} - -static createCellsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startCellsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addHeaderRowCount(builder:flatbuffers.Builder, headerRowCount:number) { - builder.addFieldInt32(7, headerRowCount, 0); -} - -static addAutoSize(builder:flatbuffers.Builder, autoSizeOffset:flatbuffers.Offset) { - builder.addFieldOffset(8, autoSizeOffset, 0); -} - -static endDucTableElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-table-row-entry.ts b/packages/ducjs/src/flatbuffers/duc/duc-table-row-entry.ts deleted file mode 100644 index 74976153..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-table-row-entry.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 { DucTableRow } from '../duc/duc-table-row'; - - -export class DucTableRowEntry { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTableRowEntry { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTableRowEntry(bb:flatbuffers.ByteBuffer, obj?:DucTableRowEntry):DucTableRowEntry { - return (obj || new DucTableRowEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTableRowEntry(bb:flatbuffers.ByteBuffer, obj?:DucTableRowEntry):DucTableRowEntry { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTableRowEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -key():string|null -key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -key(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -value(obj?:DucTableRow):DucTableRow|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucTableRow()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucTableRowEntry(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, keyOffset, 0); -} - -static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, valueOffset, 0); -} - -static endDucTableRowEntry(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // key - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-table-row.ts b/packages/ducjs/src/flatbuffers/duc/duc-table-row.ts deleted file mode 100644 index d6307193..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-table-row.ts +++ /dev/null @@ -1,67 +0,0 @@ -// 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 { DucTableCellStyle } from '../duc/duc-table-cell-style'; - - -export class DucTableRow { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTableRow { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTableRow(bb:flatbuffers.ByteBuffer, obj?:DucTableRow):DucTableRow { - return (obj || new DucTableRow()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTableRow(bb:flatbuffers.ByteBuffer, obj?:DucTableRow):DucTableRow { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTableRow()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -height():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -styleOverrides(obj?:DucTableCellStyle):DucTableCellStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new DucTableCellStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucTableRow(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addHeight(builder:flatbuffers.Builder, height:number) { - builder.addFieldFloat64(1, height, 0.0); -} - -static addStyleOverrides(builder:flatbuffers.Builder, styleOverridesOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, styleOverridesOffset, 0); -} - -static endDucTableRow(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // id - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-table-style.ts b/packages/ducjs/src/flatbuffers/duc/duc-table-style.ts deleted file mode 100644 index 27596c2f..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-table-style.ts +++ /dev/null @@ -1,74 +0,0 @@ -// 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 { DucTableCellStyle } from '../duc/duc-table-cell-style'; -import { TABLE_FLOW_DIRECTION } from '../duc/table-flow-direction'; - - -export class DucTableStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTableStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTableStyle(bb:flatbuffers.ByteBuffer, obj?:DucTableStyle):DucTableStyle { - return (obj || new DucTableStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTableStyle(bb:flatbuffers.ByteBuffer, obj?:DucTableStyle):DucTableStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTableStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -flowDirection():TABLE_FLOW_DIRECTION|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -headerRowStyle(obj?:DucTableCellStyle):DucTableCellStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new DucTableCellStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -dataRowStyle(obj?:DucTableCellStyle):DucTableCellStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new DucTableCellStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -dataColumnStyle(obj?:DucTableCellStyle):DucTableCellStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new DucTableCellStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startDucTableStyle(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addFlowDirection(builder:flatbuffers.Builder, flowDirection:TABLE_FLOW_DIRECTION) { - builder.addFieldInt8(1, flowDirection, null); -} - -static addHeaderRowStyle(builder:flatbuffers.Builder, headerRowStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, headerRowStyleOffset, 0); -} - -static addDataRowStyle(builder:flatbuffers.Builder, dataRowStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, dataRowStyleOffset, 0); -} - -static addDataColumnStyle(builder:flatbuffers.Builder, dataColumnStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, dataColumnStyleOffset, 0); -} - -static endDucTableStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-dictionary-source.ts b/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-dictionary-source.ts deleted file mode 100644 index 2055ee59..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-dictionary-source.ts +++ /dev/null @@ -1,50 +0,0 @@ -// 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 DucTextDynamicDictionarySource { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTextDynamicDictionarySource { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTextDynamicDictionarySource(bb:flatbuffers.ByteBuffer, obj?:DucTextDynamicDictionarySource):DucTextDynamicDictionarySource { - return (obj || new DucTextDynamicDictionarySource()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTextDynamicDictionarySource(bb:flatbuffers.ByteBuffer, obj?:DucTextDynamicDictionarySource):DucTextDynamicDictionarySource { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTextDynamicDictionarySource()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -key():string|null -key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -key(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDucTextDynamicDictionarySource(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, keyOffset, 0); -} - -static endDucTextDynamicDictionarySource(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucTextDynamicDictionarySource(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset):flatbuffers.Offset { - DucTextDynamicDictionarySource.startDucTextDynamicDictionarySource(builder); - DucTextDynamicDictionarySource.addKey(builder, keyOffset); - return DucTextDynamicDictionarySource.endDucTextDynamicDictionarySource(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-element-source.ts b/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-element-source.ts deleted file mode 100644 index b25b2a2e..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-element-source.ts +++ /dev/null @@ -1,64 +0,0 @@ -// 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 { TEXT_FIELD_SOURCE_PROPERTY } from '../duc/text-field-source-property'; - - -export class DucTextDynamicElementSource { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTextDynamicElementSource { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTextDynamicElementSource(bb:flatbuffers.ByteBuffer, obj?:DucTextDynamicElementSource):DucTextDynamicElementSource { - return (obj || new DucTextDynamicElementSource()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTextDynamicElementSource(bb:flatbuffers.ByteBuffer, obj?:DucTextDynamicElementSource):DucTextDynamicElementSource { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTextDynamicElementSource()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -elementId():string|null -elementId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -elementId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -property():TEXT_FIELD_SOURCE_PROPERTY|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startDucTextDynamicElementSource(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addElementId(builder:flatbuffers.Builder, elementIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, elementIdOffset, 0); -} - -static addProperty(builder:flatbuffers.Builder, property:TEXT_FIELD_SOURCE_PROPERTY) { - builder.addFieldInt8(1, property, null); -} - -static endDucTextDynamicElementSource(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucTextDynamicElementSource(builder:flatbuffers.Builder, elementIdOffset:flatbuffers.Offset, property:TEXT_FIELD_SOURCE_PROPERTY|null):flatbuffers.Offset { - DucTextDynamicElementSource.startDucTextDynamicElementSource(builder); - DucTextDynamicElementSource.addElementId(builder, elementIdOffset); - if (property !== null) - DucTextDynamicElementSource.addProperty(builder, property); - return DucTextDynamicElementSource.endDucTextDynamicElementSource(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-part.ts b/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-part.ts deleted file mode 100644 index 2ea3b125..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-part.ts +++ /dev/null @@ -1,78 +0,0 @@ -// 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 { DucTextDynamicSource } from '../duc/duc-text-dynamic-source'; -import { PrimaryUnits } from '../duc/primary-units'; - - -export class DucTextDynamicPart { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTextDynamicPart { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTextDynamicPart(bb:flatbuffers.ByteBuffer, obj?:DucTextDynamicPart):DucTextDynamicPart { - return (obj || new DucTextDynamicPart()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTextDynamicPart(bb:flatbuffers.ByteBuffer, obj?:DucTextDynamicPart):DucTextDynamicPart { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTextDynamicPart()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -tag():string|null -tag(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -tag(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -source(obj?:DucTextDynamicSource):DucTextDynamicSource|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucTextDynamicSource()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -formatting(obj?:PrimaryUnits):PrimaryUnits|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new PrimaryUnits()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -cachedValue():string|null -cachedValue(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -cachedValue(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDucTextDynamicPart(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addTag(builder:flatbuffers.Builder, tagOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, tagOffset, 0); -} - -static addSource(builder:flatbuffers.Builder, sourceOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, sourceOffset, 0); -} - -static addFormatting(builder:flatbuffers.Builder, formattingOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, formattingOffset, 0); -} - -static addCachedValue(builder:flatbuffers.Builder, cachedValueOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, cachedValueOffset, 0); -} - -static endDucTextDynamicPart(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-source-data.ts b/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-source-data.ts deleted file mode 100644 index eca1c78d..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-source-data.ts +++ /dev/null @@ -1,38 +0,0 @@ -// 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 { DucTextDynamicDictionarySource } from '../duc/duc-text-dynamic-dictionary-source'; -import { DucTextDynamicElementSource } from '../duc/duc-text-dynamic-element-source'; - - -export enum DucTextDynamicSourceData { - NONE = 0, - DucTextDynamicElementSource = 1, - DucTextDynamicDictionarySource = 2 -} - -export function unionToDucTextDynamicSourceData( - type: DucTextDynamicSourceData, - accessor: (obj:DucTextDynamicDictionarySource|DucTextDynamicElementSource) => DucTextDynamicDictionarySource|DucTextDynamicElementSource|null -): DucTextDynamicDictionarySource|DucTextDynamicElementSource|null { - switch(DucTextDynamicSourceData[type]) { - case 'NONE': return null; - case 'DucTextDynamicElementSource': return accessor(new DucTextDynamicElementSource())! as DucTextDynamicElementSource; - case 'DucTextDynamicDictionarySource': return accessor(new DucTextDynamicDictionarySource())! as DucTextDynamicDictionarySource; - default: return null; - } -} - -export function unionListToDucTextDynamicSourceData( - type: DucTextDynamicSourceData, - accessor: (index: number, obj:DucTextDynamicDictionarySource|DucTextDynamicElementSource) => DucTextDynamicDictionarySource|DucTextDynamicElementSource|null, - index: number -): DucTextDynamicDictionarySource|DucTextDynamicElementSource|null { - switch(DucTextDynamicSourceData[type]) { - case 'NONE': return null; - case 'DucTextDynamicElementSource': return accessor(index, new DucTextDynamicElementSource())! as DucTextDynamicElementSource; - case 'DucTextDynamicDictionarySource': return accessor(index, new DucTextDynamicDictionarySource())! as DucTextDynamicDictionarySource; - default: return null; - } -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-source.ts b/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-source.ts deleted file mode 100644 index 9e22651c..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-text-dynamic-source.ts +++ /dev/null @@ -1,73 +0,0 @@ -// 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 { DucTextDynamicSourceData, unionToDucTextDynamicSourceData, unionListToDucTextDynamicSourceData } from '../duc/duc-text-dynamic-source-data'; -import { TEXT_FIELD_SOURCE_TYPE } from '../duc/text-field-source-type'; - - -export class DucTextDynamicSource { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTextDynamicSource { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTextDynamicSource(bb:flatbuffers.ByteBuffer, obj?:DucTextDynamicSource):DucTextDynamicSource { - return (obj || new DucTextDynamicSource()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTextDynamicSource(bb:flatbuffers.ByteBuffer, obj?:DucTextDynamicSource):DucTextDynamicSource { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTextDynamicSource()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -textSourceType():TEXT_FIELD_SOURCE_TYPE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -sourceType():DucTextDynamicSourceData { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : DucTextDynamicSourceData.NONE; -} - -source(obj:any):any|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null; -} - -static startDucTextDynamicSource(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addTextSourceType(builder:flatbuffers.Builder, textSourceType:TEXT_FIELD_SOURCE_TYPE) { - builder.addFieldInt8(0, textSourceType, null); -} - -static addSourceType(builder:flatbuffers.Builder, sourceType:DucTextDynamicSourceData) { - builder.addFieldInt8(1, sourceType, DucTextDynamicSourceData.NONE); -} - -static addSource(builder:flatbuffers.Builder, sourceOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, sourceOffset, 0); -} - -static endDucTextDynamicSource(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucTextDynamicSource(builder:flatbuffers.Builder, textSourceType:TEXT_FIELD_SOURCE_TYPE|null, sourceType:DucTextDynamicSourceData, sourceOffset:flatbuffers.Offset):flatbuffers.Offset { - DucTextDynamicSource.startDucTextDynamicSource(builder); - if (textSourceType !== null) - DucTextDynamicSource.addTextSourceType(builder, textSourceType); - DucTextDynamicSource.addSourceType(builder, sourceType); - DucTextDynamicSource.addSource(builder, sourceOffset); - return DucTextDynamicSource.endDucTextDynamicSource(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-text-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-text-element.ts deleted file mode 100644 index 6b0ab516..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-text-element.ts +++ /dev/null @@ -1,125 +0,0 @@ -// 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 { DucTextDynamicPart } from '../duc/duc-text-dynamic-part'; -import { DucTextStyle } from '../duc/duc-text-style'; -import { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucTextElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTextElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTextElement(bb:flatbuffers.ByteBuffer, obj?:DucTextElement):DucTextElement { - return (obj || new DucTextElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTextElement(bb:flatbuffers.ByteBuffer, obj?:DucTextElement):DucTextElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTextElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucTextStyle):DucTextStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucTextStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -text():string|null -text(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -text(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -dynamic(index: number, obj?:DucTextDynamicPart):DucTextDynamicPart|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new DucTextDynamicPart()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -dynamicLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -autoResize():boolean { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -containerId():string|null -containerId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -containerId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -originalText():string|null -originalText(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -originalText(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDucTextElement(builder:flatbuffers.Builder) { - builder.startObject(7); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static addText(builder:flatbuffers.Builder, textOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, textOffset, 0); -} - -static addDynamic(builder:flatbuffers.Builder, dynamicOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, dynamicOffset, 0); -} - -static createDynamicVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startDynamicVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addAutoResize(builder:flatbuffers.Builder, autoResize:boolean) { - builder.addFieldInt8(4, +autoResize, +false); -} - -static addContainerId(builder:flatbuffers.Builder, containerIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, containerIdOffset, 0); -} - -static addOriginalText(builder:flatbuffers.Builder, originalTextOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, originalTextOffset, 0); -} - -static endDucTextElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-text-style.ts b/packages/ducjs/src/flatbuffers/duc/duc-text-style.ts deleted file mode 100644 index b748c824..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-text-style.ts +++ /dev/null @@ -1,160 +0,0 @@ -// 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 { LineSpacing } from '../duc/line-spacing'; -import { TEXT_ALIGN } from '../duc/text-align'; -import { VERTICAL_ALIGN } from '../duc/vertical-align'; - - -export class DucTextStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucTextStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucTextStyle(bb:flatbuffers.ByteBuffer, obj?:DucTextStyle):DucTextStyle { - return (obj || new DucTextStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucTextStyle(bb:flatbuffers.ByteBuffer, obj?:DucTextStyle):DucTextStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucTextStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -isLtr():boolean { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -fontFamily():string|null -fontFamily(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -fontFamily(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -bigFontFamily():string|null -bigFontFamily(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -bigFontFamily(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -textAlign():TEXT_ALIGN|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -verticalAlign():VERTICAL_ALIGN|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -lineHeight():number { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -lineSpacing(obj?:LineSpacing):LineSpacing|null { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? (obj || new LineSpacing()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -obliqueAngle():number { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -fontSize():number { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -paperTextHeight():number { - const offset = this.bb!.__offset(this.bb_pos, 24); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -widthFactor():number { - const offset = this.bb!.__offset(this.bb_pos, 26); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -isUpsideDown():boolean { - const offset = this.bb!.__offset(this.bb_pos, 28); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -isBackwards():boolean { - const offset = this.bb!.__offset(this.bb_pos, 30); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startDucTextStyle(builder:flatbuffers.Builder) { - builder.startObject(14); -} - -static addIsLtr(builder:flatbuffers.Builder, isLtr:boolean) { - builder.addFieldInt8(1, +isLtr, +false); -} - -static addFontFamily(builder:flatbuffers.Builder, fontFamilyOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, fontFamilyOffset, 0); -} - -static addBigFontFamily(builder:flatbuffers.Builder, bigFontFamilyOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, bigFontFamilyOffset, 0); -} - -static addTextAlign(builder:flatbuffers.Builder, textAlign:TEXT_ALIGN) { - builder.addFieldInt8(4, textAlign, null); -} - -static addVerticalAlign(builder:flatbuffers.Builder, verticalAlign:VERTICAL_ALIGN) { - builder.addFieldInt8(5, verticalAlign, null); -} - -static addLineHeight(builder:flatbuffers.Builder, lineHeight:number) { - builder.addFieldFloat32(6, lineHeight, 0.0); -} - -static addLineSpacing(builder:flatbuffers.Builder, lineSpacingOffset:flatbuffers.Offset) { - builder.addFieldOffset(7, lineSpacingOffset, 0); -} - -static addObliqueAngle(builder:flatbuffers.Builder, obliqueAngle:number) { - builder.addFieldFloat64(8, obliqueAngle, 0.0); -} - -static addFontSize(builder:flatbuffers.Builder, fontSize:number) { - builder.addFieldFloat64(9, fontSize, 0.0); -} - -static addPaperTextHeight(builder:flatbuffers.Builder, paperTextHeight:number) { - builder.addFieldFloat64(10, paperTextHeight, 0.0); -} - -static addWidthFactor(builder:flatbuffers.Builder, widthFactor:number) { - builder.addFieldFloat32(11, widthFactor, 0.0); -} - -static addIsUpsideDown(builder:flatbuffers.Builder, isUpsideDown:boolean) { - builder.addFieldInt8(12, +isUpsideDown, +false); -} - -static addIsBackwards(builder:flatbuffers.Builder, isBackwards:boolean) { - builder.addFieldInt8(13, +isBackwards, +false); -} - -static endDucTextStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-ucs.ts b/packages/ducjs/src/flatbuffers/duc/duc-ucs.ts deleted file mode 100644 index 1b6d5241..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-ucs.ts +++ /dev/null @@ -1,61 +0,0 @@ -// 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'; - - -export class DucUcs { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucUcs { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucUcs(bb:flatbuffers.ByteBuffer, obj?:DucUcs):DucUcs { - return (obj || new DucUcs()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucUcs(bb:flatbuffers.ByteBuffer, obj?:DucUcs):DucUcs { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucUcs()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -origin(obj?:GeometricPoint):GeometricPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new GeometricPoint()).__init(this.bb_pos + offset, this.bb!) : null; -} - -angle():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startDucUcs(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addOrigin(builder:flatbuffers.Builder, originOffset:flatbuffers.Offset) { - builder.addFieldStruct(0, originOffset, 0); -} - -static addAngle(builder:flatbuffers.Builder, angle:number) { - builder.addFieldFloat64(1, angle, 0.0); -} - -static endDucUcs(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucUcs(builder:flatbuffers.Builder, originOffset:flatbuffers.Offset, angle:number):flatbuffers.Offset { - DucUcs.startDucUcs(builder); - DucUcs.addOrigin(builder, originOffset); - DucUcs.addAngle(builder, angle); - return DucUcs.endDucUcs(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-view.ts b/packages/ducjs/src/flatbuffers/duc/duc-view.ts deleted file mode 100644 index 314d5e3b..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-view.ts +++ /dev/null @@ -1,93 +0,0 @@ -// 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 { DucPoint } from '../duc/duc-point'; - - -export class DucView { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucView { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucView(bb:flatbuffers.ByteBuffer, obj?:DucView):DucView { - return (obj || new DucView()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucView(bb:flatbuffers.ByteBuffer, obj?:DucView):DucView { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucView()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -scrollX():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -scrollY():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -zoom():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -twistAngle():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -centerPoint(obj?:DucPoint):DucPoint|null { - 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; -} - -scope():string|null -scope(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -scope(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDucView(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addScrollX(builder:flatbuffers.Builder, scrollX:number) { - builder.addFieldFloat64(0, scrollX, 0.0); -} - -static addScrollY(builder:flatbuffers.Builder, scrollY:number) { - builder.addFieldFloat64(1, scrollY, 0.0); -} - -static addZoom(builder:flatbuffers.Builder, zoom:number) { - builder.addFieldFloat64(2, zoom, 0.0); -} - -static addTwistAngle(builder:flatbuffers.Builder, twistAngle:number) { - builder.addFieldFloat64(3, twistAngle, 0.0); -} - -static addCenterPoint(builder:flatbuffers.Builder, centerPointOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, centerPointOffset, 0); -} - -static addScope(builder:flatbuffers.Builder, scopeOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, scopeOffset, 0); -} - -static endDucView(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-viewport-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-viewport-element.ts deleted file mode 100644 index 80b21db3..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-viewport-element.ts +++ /dev/null @@ -1,134 +0,0 @@ -// 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 { DucView } from '../duc/duc-view'; -import { DucViewportStyle } from '../duc/duc-viewport-style'; -import { VIEWPORT_SHADE_PLOT } from '../duc/viewport-shade-plot'; -import { _DucLinearElementBase } from '../duc/duc-linear-element-base'; -import { _DucStackBase } from '../duc/duc-stack-base'; - - -export class DucViewportElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucViewportElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucViewportElement(bb:flatbuffers.ByteBuffer, obj?:DucViewportElement):DucViewportElement { - return (obj || new DucViewportElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucViewportElement(bb:flatbuffers.ByteBuffer, obj?:DucViewportElement):DucViewportElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucViewportElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -linearBase(obj?:_DucLinearElementBase):_DucLinearElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucLinearElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -stackBase(obj?:_DucStackBase):_DucStackBase|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new _DucStackBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucViewportStyle):DucViewportStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new DucViewportStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -view(obj?:DucView):DucView|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new DucView()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -scale():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -shadePlot():VIEWPORT_SHADE_PLOT|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -frozenGroupIds(index: number):string -frozenGroupIds(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -frozenGroupIds(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -frozenGroupIdsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -standardOverride():string|null -standardOverride(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -standardOverride(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDucViewportElement(builder:flatbuffers.Builder) { - builder.startObject(8); -} - -static addLinearBase(builder:flatbuffers.Builder, linearBaseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, linearBaseOffset, 0); -} - -static addStackBase(builder:flatbuffers.Builder, stackBaseOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, stackBaseOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, styleOffset, 0); -} - -static addView(builder:flatbuffers.Builder, viewOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, viewOffset, 0); -} - -static addScale(builder:flatbuffers.Builder, scale:number) { - builder.addFieldFloat32(4, scale, 0.0); -} - -static addShadePlot(builder:flatbuffers.Builder, shadePlot:VIEWPORT_SHADE_PLOT) { - builder.addFieldInt8(5, shadePlot, null); -} - -static addFrozenGroupIds(builder:flatbuffers.Builder, frozenGroupIdsOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, frozenGroupIdsOffset, 0); -} - -static createFrozenGroupIdsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startFrozenGroupIdsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addStandardOverride(builder:flatbuffers.Builder, standardOverrideOffset:flatbuffers.Offset) { - builder.addFieldOffset(7, standardOverrideOffset, 0); -} - -static endDucViewportElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-viewport-style.ts b/packages/ducjs/src/flatbuffers/duc/duc-viewport-style.ts deleted file mode 100644 index 3961bc93..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-viewport-style.ts +++ /dev/null @@ -1,48 +0,0 @@ -// 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 DucViewportStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucViewportStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucViewportStyle(bb:flatbuffers.ByteBuffer, obj?:DucViewportStyle):DucViewportStyle { - return (obj || new DucViewportStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucViewportStyle(bb:flatbuffers.ByteBuffer, obj?:DucViewportStyle):DucViewportStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucViewportStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -scaleIndicatorVisible():boolean { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startDucViewportStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addScaleIndicatorVisible(builder:flatbuffers.Builder, scaleIndicatorVisible:boolean) { - builder.addFieldInt8(1, +scaleIndicatorVisible, +false); -} - -static endDucViewportStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucViewportStyle(builder:flatbuffers.Builder, scaleIndicatorVisible:boolean):flatbuffers.Offset { - DucViewportStyle.startDucViewportStyle(builder); - DucViewportStyle.addScaleIndicatorVisible(builder, scaleIndicatorVisible); - return DucViewportStyle.endDucViewportStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-xray-element.ts b/packages/ducjs/src/flatbuffers/duc/duc-xray-element.ts deleted file mode 100644 index 32cf1f01..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-xray-element.ts +++ /dev/null @@ -1,84 +0,0 @@ -// 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 { DucPoint } from '../duc/duc-point'; -import { DucXRayStyle } from '../duc/duc-xray-style'; -import { _DucElementBase } from '../duc/duc-element-base'; - - -export class DucXRayElement { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucXRayElement { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucXRayElement(bb:flatbuffers.ByteBuffer, obj?:DucXRayElement):DucXRayElement { - return (obj || new DucXRayElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucXRayElement(bb:flatbuffers.ByteBuffer, obj?:DucXRayElement):DucXRayElement { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucXRayElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_DucElementBase):_DucElementBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _DucElementBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucXRayStyle):DucXRayStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucXRayStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -origin(obj?:DucPoint):DucPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new DucPoint()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -direction(obj?:DucPoint):DucPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new DucPoint()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -startFromOrigin():boolean { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startDucXRayElement(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static addOrigin(builder:flatbuffers.Builder, originOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, originOffset, 0); -} - -static addDirection(builder:flatbuffers.Builder, directionOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, directionOffset, 0); -} - -static addStartFromOrigin(builder:flatbuffers.Builder, startFromOrigin:boolean) { - builder.addFieldInt8(4, +startFromOrigin, +false); -} - -static endDucXRayElement(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/duc-xray-style.ts b/packages/ducjs/src/flatbuffers/duc/duc-xray-style.ts deleted file mode 100644 index ea93e644..00000000 --- a/packages/ducjs/src/flatbuffers/duc/duc-xray-style.ts +++ /dev/null @@ -1,50 +0,0 @@ -// 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 DucXRayStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DucXRayStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDucXRayStyle(bb:flatbuffers.ByteBuffer, obj?:DucXRayStyle):DucXRayStyle { - return (obj || new DucXRayStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDucXRayStyle(bb:flatbuffers.ByteBuffer, obj?:DucXRayStyle):DucXRayStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DucXRayStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -color():string|null -color(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -color(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startDucXRayStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addColor(builder:flatbuffers.Builder, colorOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, colorOffset, 0); -} - -static endDucXRayStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDucXRayStyle(builder:flatbuffers.Builder, colorOffset:flatbuffers.Offset):flatbuffers.Offset { - DucXRayStyle.startDucXRayStyle(builder); - DucXRayStyle.addColor(builder, colorOffset); - return DucXRayStyle.endDucXRayStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/dynamic-snap-settings.ts b/packages/ducjs/src/flatbuffers/duc/dynamic-snap-settings.ts deleted file mode 100644 index 48542d0f..00000000 --- a/packages/ducjs/src/flatbuffers/duc/dynamic-snap-settings.ts +++ /dev/null @@ -1,68 +0,0 @@ -// 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 DynamicSnapSettings { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):DynamicSnapSettings { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsDynamicSnapSettings(bb:flatbuffers.ByteBuffer, obj?:DynamicSnapSettings):DynamicSnapSettings { - return (obj || new DynamicSnapSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsDynamicSnapSettings(bb:flatbuffers.ByteBuffer, obj?:DynamicSnapSettings):DynamicSnapSettings { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new DynamicSnapSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -enabledDuringDrag():boolean { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -enabledDuringRotation():boolean { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -enabledDuringScale():boolean { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startDynamicSnapSettings(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addEnabledDuringDrag(builder:flatbuffers.Builder, enabledDuringDrag:boolean) { - builder.addFieldInt8(0, +enabledDuringDrag, +false); -} - -static addEnabledDuringRotation(builder:flatbuffers.Builder, enabledDuringRotation:boolean) { - builder.addFieldInt8(1, +enabledDuringRotation, +false); -} - -static addEnabledDuringScale(builder:flatbuffers.Builder, enabledDuringScale:boolean) { - builder.addFieldInt8(2, +enabledDuringScale, +false); -} - -static endDynamicSnapSettings(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createDynamicSnapSettings(builder:flatbuffers.Builder, enabledDuringDrag:boolean, enabledDuringRotation:boolean, enabledDuringScale:boolean):flatbuffers.Offset { - DynamicSnapSettings.startDynamicSnapSettings(builder); - DynamicSnapSettings.addEnabledDuringDrag(builder, enabledDuringDrag); - DynamicSnapSettings.addEnabledDuringRotation(builder, enabledDuringRotation); - DynamicSnapSettings.addEnabledDuringScale(builder, enabledDuringScale); - return DynamicSnapSettings.endDynamicSnapSettings(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/element-background.ts b/packages/ducjs/src/flatbuffers/duc/element-background.ts deleted file mode 100644 index 4ae94bd8..00000000 --- a/packages/ducjs/src/flatbuffers/duc/element-background.ts +++ /dev/null @@ -1,51 +0,0 @@ -// 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 { ElementContentBase } from '../duc/element-content-base'; - - -export class ElementBackground { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):ElementBackground { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsElementBackground(bb:flatbuffers.ByteBuffer, obj?:ElementBackground):ElementBackground { - return (obj || new ElementBackground()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsElementBackground(bb:flatbuffers.ByteBuffer, obj?:ElementBackground):ElementBackground { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new ElementBackground()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -content(obj?:ElementContentBase):ElementContentBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new ElementContentBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startElementBackground(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addContent(builder:flatbuffers.Builder, contentOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, contentOffset, 0); -} - -static endElementBackground(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createElementBackground(builder:flatbuffers.Builder, contentOffset:flatbuffers.Offset):flatbuffers.Offset { - ElementBackground.startElementBackground(builder); - ElementBackground.addContent(builder, contentOffset); - return ElementBackground.endElementBackground(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/element-content-base.ts b/packages/ducjs/src/flatbuffers/duc/element-content-base.ts deleted file mode 100644 index 897bbf14..00000000 --- a/packages/ducjs/src/flatbuffers/duc/element-content-base.ts +++ /dev/null @@ -1,105 +0,0 @@ -// 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 { DucHatchStyle } from '../duc/duc-hatch-style'; -import { DucImageFilter } from '../duc/duc-image-filter'; -import { ELEMENT_CONTENT_PREFERENCE } from '../duc/element-content-preference'; -import { TilingProperties } from '../duc/tiling-properties'; - - -export class ElementContentBase { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):ElementContentBase { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsElementContentBase(bb:flatbuffers.ByteBuffer, obj?:ElementContentBase):ElementContentBase { - return (obj || new ElementContentBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsElementContentBase(bb:flatbuffers.ByteBuffer, obj?:ElementContentBase):ElementContentBase { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new ElementContentBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -preference():ELEMENT_CONTENT_PREFERENCE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -src():string|null -src(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -src(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -visible():boolean { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -opacity():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -tiling(obj?:TilingProperties):TilingProperties|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new TilingProperties()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -hatch(obj?:DucHatchStyle):DucHatchStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new DucHatchStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -imageFilter(obj?:DucImageFilter):DucImageFilter|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? (obj || new DucImageFilter()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startElementContentBase(builder:flatbuffers.Builder) { - builder.startObject(7); -} - -static addPreference(builder:flatbuffers.Builder, preference:ELEMENT_CONTENT_PREFERENCE) { - builder.addFieldInt8(0, preference, null); -} - -static addSrc(builder:flatbuffers.Builder, srcOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, srcOffset, 0); -} - -static addVisible(builder:flatbuffers.Builder, visible:boolean) { - builder.addFieldInt8(2, +visible, +false); -} - -static addOpacity(builder:flatbuffers.Builder, opacity:number) { - builder.addFieldFloat64(3, opacity, 0.0); -} - -static addTiling(builder:flatbuffers.Builder, tilingOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, tilingOffset, 0); -} - -static addHatch(builder:flatbuffers.Builder, hatchOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, hatchOffset, 0); -} - -static addImageFilter(builder:flatbuffers.Builder, imageFilterOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, imageFilterOffset, 0); -} - -static endElementContentBase(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/element-content-preference.ts b/packages/ducjs/src/flatbuffers/duc/element-content-preference.ts deleted file mode 100644 index 80c65c40..00000000 --- a/packages/ducjs/src/flatbuffers/duc/element-content-preference.ts +++ /dev/null @@ -1,12 +0,0 @@ -// 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 */ - -export enum ELEMENT_CONTENT_PREFERENCE { - SOLID = 12, - FILL = 14, - FIT = 15, - TILE = 16, - STRETCH = 17, - HATCH = 18 -} diff --git a/packages/ducjs/src/flatbuffers/duc/element-stroke.ts b/packages/ducjs/src/flatbuffers/duc/element-stroke.ts deleted file mode 100644 index 7b495f6d..00000000 --- a/packages/ducjs/src/flatbuffers/duc/element-stroke.ts +++ /dev/null @@ -1,85 +0,0 @@ -// 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 { ElementContentBase } from '../duc/element-content-base'; -import { STROKE_PLACEMENT } from '../duc/stroke-placement'; -import { StrokeSides } from '../duc/stroke-sides'; -import { StrokeStyle } from '../duc/stroke-style'; - - -export class ElementStroke { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):ElementStroke { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsElementStroke(bb:flatbuffers.ByteBuffer, obj?:ElementStroke):ElementStroke { - return (obj || new ElementStroke()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsElementStroke(bb:flatbuffers.ByteBuffer, obj?:ElementStroke):ElementStroke { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new ElementStroke()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -content(obj?:ElementContentBase):ElementContentBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new ElementContentBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -width():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -style(obj?:StrokeStyle):StrokeStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new StrokeStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -placement():STROKE_PLACEMENT|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -strokeSides(obj?:StrokeSides):StrokeSides|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new StrokeSides()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startElementStroke(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addContent(builder:flatbuffers.Builder, contentOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, contentOffset, 0); -} - -static addWidth(builder:flatbuffers.Builder, width:number) { - builder.addFieldFloat64(1, width, 0.0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, styleOffset, 0); -} - -static addPlacement(builder:flatbuffers.Builder, placement:STROKE_PLACEMENT) { - builder.addFieldInt8(3, placement, null); -} - -static addStrokeSides(builder:flatbuffers.Builder, strokeSidesOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, strokeSidesOffset, 0); -} - -static endElementStroke(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/element-wrapper.ts b/packages/ducjs/src/flatbuffers/duc/element-wrapper.ts deleted file mode 100644 index 9b5502f0..00000000 --- a/packages/ducjs/src/flatbuffers/duc/element-wrapper.ts +++ /dev/null @@ -1,61 +0,0 @@ -// 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 { Element, unionToElement, unionListToElement } from '../duc/element'; - - -export class ElementWrapper { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):ElementWrapper { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsElementWrapper(bb:flatbuffers.ByteBuffer, obj?:ElementWrapper):ElementWrapper { - return (obj || new ElementWrapper()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsElementWrapper(bb:flatbuffers.ByteBuffer, obj?:ElementWrapper):ElementWrapper { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new ElementWrapper()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -elementType():Element { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : Element.NONE; -} - -element(obj:any):any|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null; -} - -static startElementWrapper(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addElementType(builder:flatbuffers.Builder, elementType:Element) { - builder.addFieldInt8(0, elementType, Element.NONE); -} - -static addElement(builder:flatbuffers.Builder, elementOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, elementOffset, 0); -} - -static endElementWrapper(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createElementWrapper(builder:flatbuffers.Builder, elementType:Element, elementOffset:flatbuffers.Offset):flatbuffers.Offset { - ElementWrapper.startElementWrapper(builder); - ElementWrapper.addElementType(builder, elementType); - ElementWrapper.addElement(builder, elementOffset); - return ElementWrapper.endElementWrapper(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/element.ts b/packages/ducjs/src/flatbuffers/duc/element.ts deleted file mode 100644 index ccf581f1..00000000 --- a/packages/ducjs/src/flatbuffers/duc/element.ts +++ /dev/null @@ -1,122 +0,0 @@ -// 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 { DucArrowElement } from '../duc/duc-arrow-element'; -import { DucBlockInstanceElement } from '../duc/duc-block-instance-element'; -import { DucDimensionElement } from '../duc/duc-dimension-element'; -import { DucDocElement } from '../duc/duc-doc-element'; -import { DucEllipseElement } from '../duc/duc-ellipse-element'; -import { DucEmbeddableElement } from '../duc/duc-embeddable-element'; -import { DucFeatureControlFrameElement } from '../duc/duc-feature-control-frame-element'; -import { DucFrameElement } from '../duc/duc-frame-element'; -import { DucFreeDrawElement } from '../duc/duc-free-draw-element'; -import { DucImageElement } from '../duc/duc-image-element'; -import { DucLeaderElement } from '../duc/duc-leader-element'; -import { DucLinearElement } from '../duc/duc-linear-element'; -import { DucMermaidElement } from '../duc/duc-mermaid-element'; -import { DucModelElement } from '../duc/duc-model-element'; -import { DucParametricElement } from '../duc/duc-parametric-element'; -import { DucPdfElement } from '../duc/duc-pdf-element'; -import { DucPlotElement } from '../duc/duc-plot-element'; -import { DucPolygonElement } from '../duc/duc-polygon-element'; -import { DucRectangleElement } from '../duc/duc-rectangle-element'; -import { DucTableElement } from '../duc/duc-table-element'; -import { DucTextElement } from '../duc/duc-text-element'; -import { DucViewportElement } from '../duc/duc-viewport-element'; -import { DucXRayElement } from '../duc/duc-xray-element'; - - -export enum Element { - NONE = 0, - DucRectangleElement = 1, - DucPolygonElement = 2, - DucEllipseElement = 3, - DucEmbeddableElement = 4, - DucPdfElement = 5, - DucMermaidElement = 6, - DucTableElement = 7, - DucImageElement = 8, - DucTextElement = 9, - DucLinearElement = 10, - DucArrowElement = 11, - DucFreeDrawElement = 12, - DucBlockInstanceElement = 13, - DucFrameElement = 14, - DucPlotElement = 15, - DucViewportElement = 16, - DucXRayElement = 17, - DucLeaderElement = 18, - DucDimensionElement = 19, - DucFeatureControlFrameElement = 20, - DucDocElement = 21, - DucParametricElement = 22, - DucModelElement = 23 -} - -export function unionToElement( - type: Element, - accessor: (obj:DucArrowElement|DucBlockInstanceElement|DucDimensionElement|DucDocElement|DucEllipseElement|DucEmbeddableElement|DucFeatureControlFrameElement|DucFrameElement|DucFreeDrawElement|DucImageElement|DucLeaderElement|DucLinearElement|DucMermaidElement|DucModelElement|DucParametricElement|DucPdfElement|DucPlotElement|DucPolygonElement|DucRectangleElement|DucTableElement|DucTextElement|DucViewportElement|DucXRayElement) => DucArrowElement|DucBlockInstanceElement|DucDimensionElement|DucDocElement|DucEllipseElement|DucEmbeddableElement|DucFeatureControlFrameElement|DucFrameElement|DucFreeDrawElement|DucImageElement|DucLeaderElement|DucLinearElement|DucMermaidElement|DucModelElement|DucParametricElement|DucPdfElement|DucPlotElement|DucPolygonElement|DucRectangleElement|DucTableElement|DucTextElement|DucViewportElement|DucXRayElement|null -): DucArrowElement|DucBlockInstanceElement|DucDimensionElement|DucDocElement|DucEllipseElement|DucEmbeddableElement|DucFeatureControlFrameElement|DucFrameElement|DucFreeDrawElement|DucImageElement|DucLeaderElement|DucLinearElement|DucMermaidElement|DucModelElement|DucParametricElement|DucPdfElement|DucPlotElement|DucPolygonElement|DucRectangleElement|DucTableElement|DucTextElement|DucViewportElement|DucXRayElement|null { - switch(Element[type]) { - case 'NONE': return null; - case 'DucRectangleElement': return accessor(new DucRectangleElement())! as DucRectangleElement; - case 'DucPolygonElement': return accessor(new DucPolygonElement())! as DucPolygonElement; - case 'DucEllipseElement': return accessor(new DucEllipseElement())! as DucEllipseElement; - case 'DucEmbeddableElement': return accessor(new DucEmbeddableElement())! as DucEmbeddableElement; - case 'DucPdfElement': return accessor(new DucPdfElement())! as DucPdfElement; - case 'DucMermaidElement': return accessor(new DucMermaidElement())! as DucMermaidElement; - case 'DucTableElement': return accessor(new DucTableElement())! as DucTableElement; - case 'DucImageElement': return accessor(new DucImageElement())! as DucImageElement; - case 'DucTextElement': return accessor(new DucTextElement())! as DucTextElement; - case 'DucLinearElement': return accessor(new DucLinearElement())! as DucLinearElement; - case 'DucArrowElement': return accessor(new DucArrowElement())! as DucArrowElement; - case 'DucFreeDrawElement': return accessor(new DucFreeDrawElement())! as DucFreeDrawElement; - case 'DucBlockInstanceElement': return accessor(new DucBlockInstanceElement())! as DucBlockInstanceElement; - case 'DucFrameElement': return accessor(new DucFrameElement())! as DucFrameElement; - case 'DucPlotElement': return accessor(new DucPlotElement())! as DucPlotElement; - case 'DucViewportElement': return accessor(new DucViewportElement())! as DucViewportElement; - case 'DucXRayElement': return accessor(new DucXRayElement())! as DucXRayElement; - case 'DucLeaderElement': return accessor(new DucLeaderElement())! as DucLeaderElement; - case 'DucDimensionElement': return accessor(new DucDimensionElement())! as DucDimensionElement; - case 'DucFeatureControlFrameElement': return accessor(new DucFeatureControlFrameElement())! as DucFeatureControlFrameElement; - case 'DucDocElement': return accessor(new DucDocElement())! as DucDocElement; - case 'DucParametricElement': return accessor(new DucParametricElement())! as DucParametricElement; - case 'DucModelElement': return accessor(new DucModelElement())! as DucModelElement; - default: return null; - } -} - -export function unionListToElement( - type: Element, - accessor: (index: number, obj:DucArrowElement|DucBlockInstanceElement|DucDimensionElement|DucDocElement|DucEllipseElement|DucEmbeddableElement|DucFeatureControlFrameElement|DucFrameElement|DucFreeDrawElement|DucImageElement|DucLeaderElement|DucLinearElement|DucMermaidElement|DucModelElement|DucParametricElement|DucPdfElement|DucPlotElement|DucPolygonElement|DucRectangleElement|DucTableElement|DucTextElement|DucViewportElement|DucXRayElement) => DucArrowElement|DucBlockInstanceElement|DucDimensionElement|DucDocElement|DucEllipseElement|DucEmbeddableElement|DucFeatureControlFrameElement|DucFrameElement|DucFreeDrawElement|DucImageElement|DucLeaderElement|DucLinearElement|DucMermaidElement|DucModelElement|DucParametricElement|DucPdfElement|DucPlotElement|DucPolygonElement|DucRectangleElement|DucTableElement|DucTextElement|DucViewportElement|DucXRayElement|null, - index: number -): DucArrowElement|DucBlockInstanceElement|DucDimensionElement|DucDocElement|DucEllipseElement|DucEmbeddableElement|DucFeatureControlFrameElement|DucFrameElement|DucFreeDrawElement|DucImageElement|DucLeaderElement|DucLinearElement|DucMermaidElement|DucModelElement|DucParametricElement|DucPdfElement|DucPlotElement|DucPolygonElement|DucRectangleElement|DucTableElement|DucTextElement|DucViewportElement|DucXRayElement|null { - switch(Element[type]) { - case 'NONE': return null; - case 'DucRectangleElement': return accessor(index, new DucRectangleElement())! as DucRectangleElement; - case 'DucPolygonElement': return accessor(index, new DucPolygonElement())! as DucPolygonElement; - case 'DucEllipseElement': return accessor(index, new DucEllipseElement())! as DucEllipseElement; - case 'DucEmbeddableElement': return accessor(index, new DucEmbeddableElement())! as DucEmbeddableElement; - case 'DucPdfElement': return accessor(index, new DucPdfElement())! as DucPdfElement; - case 'DucMermaidElement': return accessor(index, new DucMermaidElement())! as DucMermaidElement; - case 'DucTableElement': return accessor(index, new DucTableElement())! as DucTableElement; - case 'DucImageElement': return accessor(index, new DucImageElement())! as DucImageElement; - case 'DucTextElement': return accessor(index, new DucTextElement())! as DucTextElement; - case 'DucLinearElement': return accessor(index, new DucLinearElement())! as DucLinearElement; - case 'DucArrowElement': return accessor(index, new DucArrowElement())! as DucArrowElement; - case 'DucFreeDrawElement': return accessor(index, new DucFreeDrawElement())! as DucFreeDrawElement; - case 'DucBlockInstanceElement': return accessor(index, new DucBlockInstanceElement())! as DucBlockInstanceElement; - case 'DucFrameElement': return accessor(index, new DucFrameElement())! as DucFrameElement; - case 'DucPlotElement': return accessor(index, new DucPlotElement())! as DucPlotElement; - case 'DucViewportElement': return accessor(index, new DucViewportElement())! as DucViewportElement; - case 'DucXRayElement': return accessor(index, new DucXRayElement())! as DucXRayElement; - case 'DucLeaderElement': return accessor(index, new DucLeaderElement())! as DucLeaderElement; - case 'DucDimensionElement': return accessor(index, new DucDimensionElement())! as DucDimensionElement; - case 'DucFeatureControlFrameElement': return accessor(index, new DucFeatureControlFrameElement())! as DucFeatureControlFrameElement; - case 'DucDocElement': return accessor(index, new DucDocElement())! as DucDocElement; - case 'DucParametricElement': return accessor(index, new DucParametricElement())! as DucParametricElement; - case 'DucModelElement': return accessor(index, new DucModelElement())! as DucModelElement; - default: return null; - } -} diff --git a/packages/ducjs/src/flatbuffers/duc/exported-data-state.ts b/packages/ducjs/src/flatbuffers/duc/exported-data-state.ts deleted file mode 100644 index 1ce1361b..00000000 --- a/packages/ducjs/src/flatbuffers/duc/exported-data-state.ts +++ /dev/null @@ -1,432 +0,0 @@ -// 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 { DictionaryEntry } from '../duc/dictionary-entry'; -import { DucBlock } from '../duc/duc-block'; -import { DucBlockCollection } from '../duc/duc-block-collection'; -import { DucBlockInstance } from '../duc/duc-block-instance'; -import { DucExternalFileEntry } from '../duc/duc-external-file-entry'; -import { DucGlobalState } from '../duc/duc-global-state'; -import { DucGroup } from '../duc/duc-group'; -import { DucLayer } from '../duc/duc-layer'; -import { DucLocalState } from '../duc/duc-local-state'; -import { DucRegion } from '../duc/duc-region'; -import { ElementWrapper } from '../duc/element-wrapper'; -import { Standard } from '../duc/standard'; -import { VersionGraph } from '../duc/version-graph'; - - -export class ExportedDataState { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):ExportedDataState { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsExportedDataState(bb:flatbuffers.ByteBuffer, obj?:ExportedDataState):ExportedDataState { - return (obj || new ExportedDataState()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsExportedDataState(bb:flatbuffers.ByteBuffer, obj?:ExportedDataState):ExportedDataState { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new ExportedDataState()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean { - return bb.__has_identifier('DUC_'); -} - -type():string|null -type(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -type(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -versionLegacy():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -source():string|null -source(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -source(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -version():string|null -version(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -version(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -thumbnail(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; -} - -thumbnailLength():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -thumbnailArray():Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - 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; -} - -dictionary(index: number, obj?:DictionaryEntry):DictionaryEntry|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new DictionaryEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -dictionaryLength():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -elements(index: number, obj?:ElementWrapper):ElementWrapper|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? (obj || new ElementWrapper()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -elementsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -blocks(index: number, obj?:DucBlock):DucBlock|null { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? (obj || new DucBlock()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -blocksLength():number { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -groups(index: number, obj?:DucGroup):DucGroup|null { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? (obj || new DucGroup()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -groupsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -regions(index: number, obj?:DucRegion):DucRegion|null { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? (obj || new DucRegion()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -regionsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -layers(index: number, obj?:DucLayer):DucLayer|null { - const offset = this.bb!.__offset(this.bb_pos, 24); - return offset ? (obj || new DucLayer()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -layersLength():number { - const offset = this.bb!.__offset(this.bb_pos, 24); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -standards(index: number, obj?:Standard):Standard|null { - const offset = this.bb!.__offset(this.bb_pos, 26); - return offset ? (obj || new Standard()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -standardsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 26); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -ducLocalState(obj?:DucLocalState):DucLocalState|null { - const offset = this.bb!.__offset(this.bb_pos, 28); - return offset ? (obj || new DucLocalState()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -ducGlobalState(obj?:DucGlobalState):DucGlobalState|null { - const offset = this.bb!.__offset(this.bb_pos, 30); - return offset ? (obj || new DucGlobalState()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -externalFiles(index: number, obj?:DucExternalFileEntry):DucExternalFileEntry|null { - const offset = this.bb!.__offset(this.bb_pos, 32); - return offset ? (obj || new DucExternalFileEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -externalFilesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 32); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -versionGraph(obj?:VersionGraph):VersionGraph|null { - const offset = this.bb!.__offset(this.bb_pos, 34); - return offset ? (obj || new VersionGraph()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 36); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -blockInstances(index: number, obj?:DucBlockInstance):DucBlockInstance|null { - const offset = this.bb!.__offset(this.bb_pos, 38); - return offset ? (obj || new DucBlockInstance()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -blockInstancesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 38); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -blockCollections(index: number, obj?:DucBlockCollection):DucBlockCollection|null { - const offset = this.bb!.__offset(this.bb_pos, 40); - return offset ? (obj || new DucBlockCollection()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -blockCollectionsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 40); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -static startExportedDataState(builder:flatbuffers.Builder) { - builder.startObject(19); -} - -static addType(builder:flatbuffers.Builder, typeOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, typeOffset, 0); -} - -static addVersionLegacy(builder:flatbuffers.Builder, versionLegacy:number) { - builder.addFieldInt32(1, versionLegacy, 0); -} - -static addSource(builder:flatbuffers.Builder, sourceOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, sourceOffset, 0); -} - -static addVersion(builder:flatbuffers.Builder, versionOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, versionOffset, 0); -} - -static addThumbnail(builder:flatbuffers.Builder, thumbnailOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, thumbnailOffset, 0); -} - -static createThumbnailVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { - builder.startVector(1, data.length, 1); - for (let i = data.length - 1; i >= 0; i--) { - builder.addInt8(data[i]!); - } - return builder.endVector(); -} - -static startThumbnailVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(1, numElems, 1); -} - -static addDictionary(builder:flatbuffers.Builder, dictionaryOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, dictionaryOffset, 0); -} - -static createDictionaryVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startDictionaryVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addElements(builder:flatbuffers.Builder, elementsOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, elementsOffset, 0); -} - -static createElementsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startElementsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addBlocks(builder:flatbuffers.Builder, blocksOffset:flatbuffers.Offset) { - builder.addFieldOffset(7, blocksOffset, 0); -} - -static createBlocksVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startBlocksVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addGroups(builder:flatbuffers.Builder, groupsOffset:flatbuffers.Offset) { - builder.addFieldOffset(8, groupsOffset, 0); -} - -static createGroupsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startGroupsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addRegions(builder:flatbuffers.Builder, regionsOffset:flatbuffers.Offset) { - builder.addFieldOffset(9, regionsOffset, 0); -} - -static createRegionsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startRegionsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addLayers(builder:flatbuffers.Builder, layersOffset:flatbuffers.Offset) { - builder.addFieldOffset(10, layersOffset, 0); -} - -static createLayersVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startLayersVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addStandards(builder:flatbuffers.Builder, standardsOffset:flatbuffers.Offset) { - builder.addFieldOffset(11, standardsOffset, 0); -} - -static createStandardsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startStandardsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addDucLocalState(builder:flatbuffers.Builder, ducLocalStateOffset:flatbuffers.Offset) { - builder.addFieldOffset(12, ducLocalStateOffset, 0); -} - -static addDucGlobalState(builder:flatbuffers.Builder, ducGlobalStateOffset:flatbuffers.Offset) { - builder.addFieldOffset(13, ducGlobalStateOffset, 0); -} - -static addExternalFiles(builder:flatbuffers.Builder, externalFilesOffset:flatbuffers.Offset) { - builder.addFieldOffset(14, externalFilesOffset, 0); -} - -static createExternalFilesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startExternalFilesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addVersionGraph(builder:flatbuffers.Builder, versionGraphOffset:flatbuffers.Offset) { - builder.addFieldOffset(15, versionGraphOffset, 0); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(16, idOffset, 0); -} - -static addBlockInstances(builder:flatbuffers.Builder, blockInstancesOffset:flatbuffers.Offset) { - builder.addFieldOffset(17, blockInstancesOffset, 0); -} - -static createBlockInstancesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startBlockInstancesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addBlockCollections(builder:flatbuffers.Builder, blockCollectionsOffset:flatbuffers.Offset) { - builder.addFieldOffset(18, blockCollectionsOffset, 0); -} - -static createBlockCollectionsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startBlockCollectionsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static endExportedDataState(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static finishExportedDataStateBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { - builder.finish(offset, 'DUC_'); -} - -static finishSizePrefixedExportedDataStateBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { - builder.finish(offset, 'DUC_', true); -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/fcfbetween-modifier.ts b/packages/ducjs/src/flatbuffers/duc/fcfbetween-modifier.ts deleted file mode 100644 index 57ca372a..00000000 --- a/packages/ducjs/src/flatbuffers/duc/fcfbetween-modifier.ts +++ /dev/null @@ -1,62 +0,0 @@ -// 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 FCFBetweenModifier { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):FCFBetweenModifier { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsFCFBetweenModifier(bb:flatbuffers.ByteBuffer, obj?:FCFBetweenModifier):FCFBetweenModifier { - return (obj || new FCFBetweenModifier()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsFCFBetweenModifier(bb:flatbuffers.ByteBuffer, obj?:FCFBetweenModifier):FCFBetweenModifier { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new FCFBetweenModifier()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -start():string|null -start(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -start(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -end():string|null -end(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -end(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startFCFBetweenModifier(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addStart(builder:flatbuffers.Builder, startOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, startOffset, 0); -} - -static addEnd(builder:flatbuffers.Builder, endOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, endOffset, 0); -} - -static endFCFBetweenModifier(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createFCFBetweenModifier(builder:flatbuffers.Builder, startOffset:flatbuffers.Offset, endOffset:flatbuffers.Offset):flatbuffers.Offset { - FCFBetweenModifier.startFCFBetweenModifier(builder); - FCFBetweenModifier.addStart(builder, startOffset); - FCFBetweenModifier.addEnd(builder, endOffset); - return FCFBetweenModifier.endFCFBetweenModifier(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/fcfdatum-definition.ts b/packages/ducjs/src/flatbuffers/duc/fcfdatum-definition.ts deleted file mode 100644 index 5a56461a..00000000 --- a/packages/ducjs/src/flatbuffers/duc/fcfdatum-definition.ts +++ /dev/null @@ -1,57 +0,0 @@ -// 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 { DucPointBinding } from '../duc/duc-point-binding'; - - -export class FCFDatumDefinition { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):FCFDatumDefinition { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsFCFDatumDefinition(bb:flatbuffers.ByteBuffer, obj?:FCFDatumDefinition):FCFDatumDefinition { - return (obj || new FCFDatumDefinition()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsFCFDatumDefinition(bb:flatbuffers.ByteBuffer, obj?:FCFDatumDefinition):FCFDatumDefinition { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new FCFDatumDefinition()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -letter():string|null -letter(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -letter(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -featureBinding(obj?:DucPointBinding):DucPointBinding|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucPointBinding()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startFCFDatumDefinition(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addLetter(builder:flatbuffers.Builder, letterOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, letterOffset, 0); -} - -static addFeatureBinding(builder:flatbuffers.Builder, featureBindingOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, featureBindingOffset, 0); -} - -static endFCFDatumDefinition(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/fcfdatum-style.ts b/packages/ducjs/src/flatbuffers/duc/fcfdatum-style.ts deleted file mode 100644 index 45ddc971..00000000 --- a/packages/ducjs/src/flatbuffers/duc/fcfdatum-style.ts +++ /dev/null @@ -1,52 +0,0 @@ -// 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 { DATUM_BRACKET_STYLE } from '../duc/datum-bracket-style'; - - -export class FCFDatumStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):FCFDatumStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsFCFDatumStyle(bb:flatbuffers.ByteBuffer, obj?:FCFDatumStyle):FCFDatumStyle { - return (obj || new FCFDatumStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsFCFDatumStyle(bb:flatbuffers.ByteBuffer, obj?:FCFDatumStyle):FCFDatumStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new FCFDatumStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -bracketStyle():DATUM_BRACKET_STYLE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startFCFDatumStyle(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addBracketStyle(builder:flatbuffers.Builder, bracketStyle:DATUM_BRACKET_STYLE) { - builder.addFieldInt8(0, bracketStyle, null); -} - -static endFCFDatumStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createFCFDatumStyle(builder:flatbuffers.Builder, bracketStyle:DATUM_BRACKET_STYLE|null):flatbuffers.Offset { - FCFDatumStyle.startFCFDatumStyle(builder); - if (bracketStyle !== null) - FCFDatumStyle.addBracketStyle(builder, bracketStyle); - return FCFDatumStyle.endFCFDatumStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/fcfframe-modifiers.ts b/packages/ducjs/src/flatbuffers/duc/fcfframe-modifiers.ts deleted file mode 100644 index cb7d4527..00000000 --- a/packages/ducjs/src/flatbuffers/duc/fcfframe-modifiers.ts +++ /dev/null @@ -1,83 +0,0 @@ -// 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 { FCFBetweenModifier } from '../duc/fcfbetween-modifier'; -import { FCFProjectedZoneModifier } from '../duc/fcfprojected-zone-modifier'; - - -export class FCFFrameModifiers { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):FCFFrameModifiers { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsFCFFrameModifiers(bb:flatbuffers.ByteBuffer, obj?:FCFFrameModifiers):FCFFrameModifiers { - return (obj || new FCFFrameModifiers()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsFCFFrameModifiers(bb:flatbuffers.ByteBuffer, obj?:FCFFrameModifiers):FCFFrameModifiers { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new FCFFrameModifiers()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -allAround():boolean { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -allOver():boolean { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -continuousFeature():boolean { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -between(obj?:FCFBetweenModifier):FCFBetweenModifier|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new FCFBetweenModifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -projectedToleranceZone(obj?:FCFProjectedZoneModifier):FCFProjectedZoneModifier|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new FCFProjectedZoneModifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startFCFFrameModifiers(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addAllAround(builder:flatbuffers.Builder, allAround:boolean) { - builder.addFieldInt8(0, +allAround, +false); -} - -static addAllOver(builder:flatbuffers.Builder, allOver:boolean) { - builder.addFieldInt8(1, +allOver, +false); -} - -static addContinuousFeature(builder:flatbuffers.Builder, continuousFeature:boolean) { - builder.addFieldInt8(2, +continuousFeature, +false); -} - -static addBetween(builder:flatbuffers.Builder, betweenOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, betweenOffset, 0); -} - -static addProjectedToleranceZone(builder:flatbuffers.Builder, projectedToleranceZoneOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, projectedToleranceZoneOffset, 0); -} - -static endFCFFrameModifiers(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/fcflayout-style.ts b/packages/ducjs/src/flatbuffers/duc/fcflayout-style.ts deleted file mode 100644 index 5f8e577e..00000000 --- a/packages/ducjs/src/flatbuffers/duc/fcflayout-style.ts +++ /dev/null @@ -1,68 +0,0 @@ -// 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 FCFLayoutStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):FCFLayoutStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsFCFLayoutStyle(bb:flatbuffers.ByteBuffer, obj?:FCFLayoutStyle):FCFLayoutStyle { - return (obj || new FCFLayoutStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsFCFLayoutStyle(bb:flatbuffers.ByteBuffer, obj?:FCFLayoutStyle):FCFLayoutStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new FCFLayoutStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -padding():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -segmentSpacing():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -rowSpacing():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startFCFLayoutStyle(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addPadding(builder:flatbuffers.Builder, padding:number) { - builder.addFieldFloat64(0, padding, 0.0); -} - -static addSegmentSpacing(builder:flatbuffers.Builder, segmentSpacing:number) { - builder.addFieldFloat64(1, segmentSpacing, 0.0); -} - -static addRowSpacing(builder:flatbuffers.Builder, rowSpacing:number) { - builder.addFieldFloat64(2, rowSpacing, 0.0); -} - -static endFCFLayoutStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createFCFLayoutStyle(builder:flatbuffers.Builder, padding:number, segmentSpacing:number, rowSpacing:number):flatbuffers.Offset { - FCFLayoutStyle.startFCFLayoutStyle(builder); - FCFLayoutStyle.addPadding(builder, padding); - FCFLayoutStyle.addSegmentSpacing(builder, segmentSpacing); - FCFLayoutStyle.addRowSpacing(builder, rowSpacing); - return FCFLayoutStyle.endFCFLayoutStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/fcfprojected-zone-modifier.ts b/packages/ducjs/src/flatbuffers/duc/fcfprojected-zone-modifier.ts deleted file mode 100644 index eb367556..00000000 --- a/packages/ducjs/src/flatbuffers/duc/fcfprojected-zone-modifier.ts +++ /dev/null @@ -1,48 +0,0 @@ -// 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 FCFProjectedZoneModifier { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):FCFProjectedZoneModifier { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsFCFProjectedZoneModifier(bb:flatbuffers.ByteBuffer, obj?:FCFProjectedZoneModifier):FCFProjectedZoneModifier { - return (obj || new FCFProjectedZoneModifier()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsFCFProjectedZoneModifier(bb:flatbuffers.ByteBuffer, obj?:FCFProjectedZoneModifier):FCFProjectedZoneModifier { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new FCFProjectedZoneModifier()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -value():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startFCFProjectedZoneModifier(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addValue(builder:flatbuffers.Builder, value:number) { - builder.addFieldFloat64(0, value, 0.0); -} - -static endFCFProjectedZoneModifier(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createFCFProjectedZoneModifier(builder:flatbuffers.Builder, value:number):flatbuffers.Offset { - FCFProjectedZoneModifier.startFCFProjectedZoneModifier(builder); - FCFProjectedZoneModifier.addValue(builder, value); - return FCFProjectedZoneModifier.endFCFProjectedZoneModifier(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/fcfsegment-row.ts b/packages/ducjs/src/flatbuffers/duc/fcfsegment-row.ts deleted file mode 100644 index cc3e4d79..00000000 --- a/packages/ducjs/src/flatbuffers/duc/fcfsegment-row.ts +++ /dev/null @@ -1,68 +0,0 @@ -// 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 { FeatureControlFrameSegment } from '../duc/feature-control-frame-segment'; - - -export class FCFSegmentRow { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):FCFSegmentRow { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsFCFSegmentRow(bb:flatbuffers.ByteBuffer, obj?:FCFSegmentRow):FCFSegmentRow { - return (obj || new FCFSegmentRow()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsFCFSegmentRow(bb:flatbuffers.ByteBuffer, obj?:FCFSegmentRow):FCFSegmentRow { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new FCFSegmentRow()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -segments(index: number, obj?:FeatureControlFrameSegment):FeatureControlFrameSegment|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new FeatureControlFrameSegment()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -segmentsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -static startFCFSegmentRow(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addSegments(builder:flatbuffers.Builder, segmentsOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, segmentsOffset, 0); -} - -static createSegmentsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startSegmentsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static endFCFSegmentRow(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createFCFSegmentRow(builder:flatbuffers.Builder, segmentsOffset:flatbuffers.Offset):flatbuffers.Offset { - FCFSegmentRow.startFCFSegmentRow(builder); - FCFSegmentRow.addSegments(builder, segmentsOffset); - return FCFSegmentRow.endFCFSegmentRow(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/fcfsymbol-style.ts b/packages/ducjs/src/flatbuffers/duc/fcfsymbol-style.ts deleted file mode 100644 index aa4956bd..00000000 --- a/packages/ducjs/src/flatbuffers/duc/fcfsymbol-style.ts +++ /dev/null @@ -1,48 +0,0 @@ -// 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 FCFSymbolStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):FCFSymbolStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsFCFSymbolStyle(bb:flatbuffers.ByteBuffer, obj?:FCFSymbolStyle):FCFSymbolStyle { - return (obj || new FCFSymbolStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsFCFSymbolStyle(bb:flatbuffers.ByteBuffer, obj?:FCFSymbolStyle):FCFSymbolStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new FCFSymbolStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -scale():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -static startFCFSymbolStyle(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addScale(builder:flatbuffers.Builder, scale:number) { - builder.addFieldFloat32(0, scale, 0.0); -} - -static endFCFSymbolStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createFCFSymbolStyle(builder:flatbuffers.Builder, scale:number):flatbuffers.Offset { - FCFSymbolStyle.startFCFSymbolStyle(builder); - FCFSymbolStyle.addScale(builder, scale); - return FCFSymbolStyle.endFCFSymbolStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/feature-control-frame-segment.ts b/packages/ducjs/src/flatbuffers/duc/feature-control-frame-segment.ts deleted file mode 100644 index cf4a2ccf..00000000 --- a/packages/ducjs/src/flatbuffers/duc/feature-control-frame-segment.ts +++ /dev/null @@ -1,83 +0,0 @@ -// 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 { DatumReference } from '../duc/datum-reference'; -import { GDT_SYMBOL } from '../duc/gdt-symbol'; -import { ToleranceClause } from '../duc/tolerance-clause'; - - -export class FeatureControlFrameSegment { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):FeatureControlFrameSegment { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsFeatureControlFrameSegment(bb:flatbuffers.ByteBuffer, obj?:FeatureControlFrameSegment):FeatureControlFrameSegment { - return (obj || new FeatureControlFrameSegment()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsFeatureControlFrameSegment(bb:flatbuffers.ByteBuffer, obj?:FeatureControlFrameSegment):FeatureControlFrameSegment { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new FeatureControlFrameSegment()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -symbol():GDT_SYMBOL|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -tolerance(obj?:ToleranceClause):ToleranceClause|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new ToleranceClause()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -datums(index: number, obj?:DatumReference):DatumReference|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new DatumReference()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -datumsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -static startFeatureControlFrameSegment(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addSymbol(builder:flatbuffers.Builder, symbol:GDT_SYMBOL) { - builder.addFieldInt8(0, symbol, null); -} - -static addTolerance(builder:flatbuffers.Builder, toleranceOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, toleranceOffset, 0); -} - -static addDatums(builder:flatbuffers.Builder, datumsOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, datumsOffset, 0); -} - -static createDatumsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startDatumsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static endFeatureControlFrameSegment(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/feature-modifier.ts b/packages/ducjs/src/flatbuffers/duc/feature-modifier.ts deleted file mode 100644 index 7427a229..00000000 --- a/packages/ducjs/src/flatbuffers/duc/feature-modifier.ts +++ /dev/null @@ -1,22 +0,0 @@ -// 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 */ - -export enum FEATURE_MODIFIER { - NONE = 0, - FREE_STATE = 10, - TANGENT_PLANE = 11, - PROJECTED_TOLERANCE_ZONE = 12, - DIAMETER = 13, - SPHERICAL_DIAMETER = 14, - RADIUS = 15, - SPHERICAL_RADIUS = 16, - CONTROLLED_RADIUS = 17, - SQUARE = 18, - TRANSLATION = 19, - ALL_AROUND = 20, - ALL_OVER = 21, - STATISTICAL = 22, - CONTINUOUS_FEATURE = 23, - UNEQUALLY_DISPOSED = 24 -} diff --git a/packages/ducjs/src/flatbuffers/duc/gdt-symbol.ts b/packages/ducjs/src/flatbuffers/duc/gdt-symbol.ts deleted file mode 100644 index 16023d54..00000000 --- a/packages/ducjs/src/flatbuffers/duc/gdt-symbol.ts +++ /dev/null @@ -1,26 +0,0 @@ -// 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 */ - -export enum GDT_SYMBOL { - STRAIGHTNESS = 10, - FLATNESS = 11, - CIRCULARITY = 12, - CYLINDRICITY = 13, - PERPENDICULARITY = 14, - ANGULARITY = 15, - PARALLELISM = 16, - POSITION = 17, - TRUE_POSITION = 18, - CONCENTRICITY = 19, - COAXIALITY = 20, - SYMMETRY = 21, - CIRCULAR_RUNOUT = 22, - TOTAL_RUNOUT = 23, - PROFILE_OF_LINE = 24, - PROFILE_OF_SURFACE = 25, - STATISTICAL = 26, - ALL_AROUND = 27, - ALL_OVER = 28, - BETWEEN = 29 -} diff --git a/packages/ducjs/src/flatbuffers/duc/geometric-point.ts b/packages/ducjs/src/flatbuffers/duc/geometric-point.ts deleted file mode 100644 index f47a3a39..00000000 --- a/packages/ducjs/src/flatbuffers/duc/geometric-point.ts +++ /dev/null @@ -1,35 +0,0 @@ -// 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 GeometricPoint { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):GeometricPoint { - this.bb_pos = i; - this.bb = bb; - return this; -} - -x():number { - return this.bb!.readFloat64(this.bb_pos); -} - -y():number { - return this.bb!.readFloat64(this.bb_pos + 8); -} - -static sizeOf():number { - return 16; -} - -static createGeometricPoint(builder:flatbuffers.Builder, x: number, y: number):flatbuffers.Offset { - builder.prep(8, 16); - builder.writeFloat64(y); - builder.writeFloat64(x); - return builder.offset(); -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/grid-display-type.ts b/packages/ducjs/src/flatbuffers/duc/grid-display-type.ts deleted file mode 100644 index fe6de0e2..00000000 --- a/packages/ducjs/src/flatbuffers/duc/grid-display-type.ts +++ /dev/null @@ -1,10 +0,0 @@ -// 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 */ - -export enum GRID_DISPLAY_TYPE { - LINES = 10, - DOTS = 11, - CROSSES = 12, - ADAPTIVE = 13 -} diff --git a/packages/ducjs/src/flatbuffers/duc/grid-settings.ts b/packages/ducjs/src/flatbuffers/duc/grid-settings.ts deleted file mode 100644 index da521cea..00000000 --- a/packages/ducjs/src/flatbuffers/duc/grid-settings.ts +++ /dev/null @@ -1,213 +0,0 @@ -// 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 { GRID_DISPLAY_TYPE } from '../duc/grid-display-type'; -import { GRID_TYPE } from '../duc/grid-type'; -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 { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):GridSettings { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsGridSettings(bb:flatbuffers.ByteBuffer, obj?:GridSettings):GridSettings { - return (obj || new GridSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsGridSettings(bb:flatbuffers.ByteBuffer, obj?:GridSettings):GridSettings { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new GridSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -type():GRID_TYPE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -readonly():boolean { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -displayType():GRID_DISPLAY_TYPE|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -isAdaptive():boolean { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -xSpacing():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -ySpacing():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -subdivisions():number { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -origin(obj?:GeometricPoint):GeometricPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? (obj || new GeometricPoint()).__init(this.bb_pos + offset, this.bb!) : null; -} - -rotation():number { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -followUcs():boolean { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -majorStyle(obj?:GridStyle):GridStyle|null { - 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?:GridStyle):GridStyle|null { - 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():boolean { - const offset = this.bb!.__offset(this.bb_pos, 28); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -minZoom():number { - const offset = this.bb!.__offset(this.bb_pos, 30); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -maxZoom():number { - const offset = this.bb!.__offset(this.bb_pos, 32); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -autoHide():boolean { - const offset = this.bb!.__offset(this.bb_pos, 34); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -polarSettings(obj?:PolarGridSettings):PolarGridSettings|null { - 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?:IsometricGridSettings):IsometricGridSettings|null { - 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():boolean { - const offset = this.bb!.__offset(this.bb_pos, 40); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startGridSettings(builder:flatbuffers.Builder) { - builder.startObject(19); -} - -static addType(builder:flatbuffers.Builder, type:GRID_TYPE) { - builder.addFieldInt8(0, type, null); -} - -static addReadonly(builder:flatbuffers.Builder, readonly:boolean) { - builder.addFieldInt8(1, +readonly, +false); -} - -static addDisplayType(builder:flatbuffers.Builder, displayType:GRID_DISPLAY_TYPE) { - builder.addFieldInt8(2, displayType, null); -} - -static addIsAdaptive(builder:flatbuffers.Builder, isAdaptive:boolean) { - builder.addFieldInt8(3, +isAdaptive, +false); -} - -static addXSpacing(builder:flatbuffers.Builder, xSpacing:number) { - builder.addFieldFloat64(4, xSpacing, 0.0); -} - -static addYSpacing(builder:flatbuffers.Builder, ySpacing:number) { - builder.addFieldFloat64(5, ySpacing, 0.0); -} - -static addSubdivisions(builder:flatbuffers.Builder, subdivisions:number) { - builder.addFieldInt32(6, subdivisions, 0); -} - -static addOrigin(builder:flatbuffers.Builder, originOffset:flatbuffers.Offset) { - builder.addFieldStruct(7, originOffset, 0); -} - -static addRotation(builder:flatbuffers.Builder, rotation:number) { - builder.addFieldFloat64(8, rotation, 0.0); -} - -static addFollowUcs(builder:flatbuffers.Builder, followUcs:boolean) { - builder.addFieldInt8(9, +followUcs, +false); -} - -static addMajorStyle(builder:flatbuffers.Builder, majorStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(10, majorStyleOffset, 0); -} - -static addMinorStyle(builder:flatbuffers.Builder, minorStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(11, minorStyleOffset, 0); -} - -static addShowMinor(builder:flatbuffers.Builder, showMinor:boolean) { - builder.addFieldInt8(12, +showMinor, +false); -} - -static addMinZoom(builder:flatbuffers.Builder, minZoom:number) { - builder.addFieldFloat64(13, minZoom, 0.0); -} - -static addMaxZoom(builder:flatbuffers.Builder, maxZoom:number) { - builder.addFieldFloat64(14, maxZoom, 0.0); -} - -static addAutoHide(builder:flatbuffers.Builder, autoHide:boolean) { - builder.addFieldInt8(15, +autoHide, +false); -} - -static addPolarSettings(builder:flatbuffers.Builder, polarSettingsOffset:flatbuffers.Offset) { - builder.addFieldOffset(16, polarSettingsOffset, 0); -} - -static addIsometricSettings(builder:flatbuffers.Builder, isometricSettingsOffset:flatbuffers.Offset) { - builder.addFieldOffset(17, isometricSettingsOffset, 0); -} - -static addEnableSnapping(builder:flatbuffers.Builder, enableSnapping:boolean) { - builder.addFieldInt8(18, +enableSnapping, +false); -} - -static endGridSettings(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/grid-style.ts b/packages/ducjs/src/flatbuffers/duc/grid-style.ts deleted file mode 100644 index e883f5ef..00000000 --- a/packages/ducjs/src/flatbuffers/duc/grid-style.ts +++ /dev/null @@ -1,97 +0,0 @@ -// 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 { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):GridStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsGridStyle(bb:flatbuffers.ByteBuffer, obj?:GridStyle):GridStyle { - return (obj || new GridStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsGridStyle(bb:flatbuffers.ByteBuffer, obj?:GridStyle):GridStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new GridStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -color():string|null -color(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -color(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -opacity():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -dashPattern(index: number):number|null { - 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():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -dashPatternArray():Float64Array|null { - 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:flatbuffers.Builder) { - builder.startObject(3); -} - -static addColor(builder:flatbuffers.Builder, colorOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, colorOffset, 0); -} - -static addOpacity(builder:flatbuffers.Builder, opacity:number) { - builder.addFieldFloat64(1, opacity, 0.0); -} - -static addDashPattern(builder:flatbuffers.Builder, dashPatternOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, dashPatternOffset, 0); -} - -static createDashPatternVector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset; -/** - * @deprecated This Uint8Array overload will be removed in the future. - */ -static createDashPatternVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; -static createDashPatternVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset { - 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:flatbuffers.Builder, numElems:number) { - builder.startVector(8, numElems, 8); -} - -static endGridStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createGridStyle(builder:flatbuffers.Builder, colorOffset:flatbuffers.Offset, opacity:number, dashPatternOffset:flatbuffers.Offset):flatbuffers.Offset { - GridStyle.startGridStyle(builder); - GridStyle.addColor(builder, colorOffset); - GridStyle.addOpacity(builder, opacity); - GridStyle.addDashPattern(builder, dashPatternOffset); - return GridStyle.endGridStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/grid-type.ts b/packages/ducjs/src/flatbuffers/duc/grid-type.ts deleted file mode 100644 index 086997c8..00000000 --- a/packages/ducjs/src/flatbuffers/duc/grid-type.ts +++ /dev/null @@ -1,11 +0,0 @@ -// 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 */ - -export enum GRID_TYPE { - RECTANGULAR = 10, - ISOMETRIC = 11, - POLAR = 12, - TRIANGULAR = 13, - CUSTOM = 14 -} diff --git a/packages/ducjs/src/flatbuffers/duc/handle-type.ts b/packages/ducjs/src/flatbuffers/duc/handle-type.ts deleted file mode 100644 index 04eeac33..00000000 --- a/packages/ducjs/src/flatbuffers/duc/handle-type.ts +++ /dev/null @@ -1,8 +0,0 @@ -// 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 */ - -export enum HANDLE_TYPE { - HANDLE_IN = 10, - HANDLE_OUT = 11 -} diff --git a/packages/ducjs/src/flatbuffers/duc/hatch-pattern-line.ts b/packages/ducjs/src/flatbuffers/duc/hatch-pattern-line.ts deleted file mode 100644 index 07409867..00000000 --- a/packages/ducjs/src/flatbuffers/duc/hatch-pattern-line.ts +++ /dev/null @@ -1,127 +0,0 @@ -// 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 { DucPoint } from '../duc/duc-point'; - - -export class HatchPatternLine { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):HatchPatternLine { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsHatchPatternLine(bb:flatbuffers.ByteBuffer, obj?:HatchPatternLine):HatchPatternLine { - return (obj || new HatchPatternLine()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsHatchPatternLine(bb:flatbuffers.ByteBuffer, obj?:HatchPatternLine):HatchPatternLine { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new HatchPatternLine()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -angle():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -origin(obj?:DucPoint):DucPoint|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucPoint()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -offset(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0; -} - -offsetLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -offsetArray():Float64Array|null { - 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; -} - -dashPattern(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0; -} - -dashPatternLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -dashPatternArray():Float64Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - 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 startHatchPatternLine(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addAngle(builder:flatbuffers.Builder, angle:number) { - builder.addFieldFloat64(0, angle, 0.0); -} - -static addOrigin(builder:flatbuffers.Builder, originOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, originOffset, 0); -} - -static addOffset(builder:flatbuffers.Builder, offsetOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, offsetOffset, 0); -} - -static createOffsetVector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset; -/** - * @deprecated This Uint8Array overload will be removed in the future. - */ -static createOffsetVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; -static createOffsetVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset { - builder.startVector(8, data.length, 8); - for (let i = data.length - 1; i >= 0; i--) { - builder.addFloat64(data[i]!); - } - return builder.endVector(); -} - -static startOffsetVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(8, numElems, 8); -} - -static addDashPattern(builder:flatbuffers.Builder, dashPatternOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, dashPatternOffset, 0); -} - -static createDashPatternVector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset; -/** - * @deprecated This Uint8Array overload will be removed in the future. - */ -static createDashPatternVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; -static createDashPatternVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset { - 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:flatbuffers.Builder, numElems:number) { - builder.startVector(8, numElems, 8); -} - -static endHatchPatternLine(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/hatch-style.ts b/packages/ducjs/src/flatbuffers/duc/hatch-style.ts deleted file mode 100644 index fbd6ae24..00000000 --- a/packages/ducjs/src/flatbuffers/duc/hatch-style.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum HATCH_STYLE { - NORMAL = 10, - OUTER = 11, - IGNORE = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-common-style.ts b/packages/ducjs/src/flatbuffers/duc/identified-common-style.ts deleted file mode 100644 index 5781a645..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-common-style.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucCommonStyle } from '../duc/duc-common-style'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedCommonStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedCommonStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedCommonStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedCommonStyle):IdentifiedCommonStyle { - return (obj || new IdentifiedCommonStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedCommonStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedCommonStyle):IdentifiedCommonStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedCommonStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucCommonStyle):DucCommonStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucCommonStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedCommonStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static endIdentifiedCommonStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-dimension-style.ts b/packages/ducjs/src/flatbuffers/duc/identified-dimension-style.ts deleted file mode 100644 index 5e2f177b..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-dimension-style.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucDimensionStyle } from '../duc/duc-dimension-style'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedDimensionStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedDimensionStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedDimensionStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedDimensionStyle):IdentifiedDimensionStyle { - return (obj || new IdentifiedDimensionStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedDimensionStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedDimensionStyle):IdentifiedDimensionStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedDimensionStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucDimensionStyle):DucDimensionStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucDimensionStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedDimensionStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static endIdentifiedDimensionStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-doc-style.ts b/packages/ducjs/src/flatbuffers/duc/identified-doc-style.ts deleted file mode 100644 index 88d4f8a4..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-doc-style.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucDocStyle } from '../duc/duc-doc-style'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedDocStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedDocStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedDocStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedDocStyle):IdentifiedDocStyle { - return (obj || new IdentifiedDocStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedDocStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedDocStyle):IdentifiedDocStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedDocStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucDocStyle):DucDocStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucDocStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedDocStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static endIdentifiedDocStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-fcfstyle.ts b/packages/ducjs/src/flatbuffers/duc/identified-fcfstyle.ts deleted file mode 100644 index 46ddb6ca..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-fcfstyle.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucFeatureControlFrameStyle } from '../duc/duc-feature-control-frame-style'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedFCFStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedFCFStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedFCFStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedFCFStyle):IdentifiedFCFStyle { - return (obj || new IdentifiedFCFStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedFCFStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedFCFStyle):IdentifiedFCFStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedFCFStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucFeatureControlFrameStyle):DucFeatureControlFrameStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucFeatureControlFrameStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedFCFStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static endIdentifiedFCFStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-grid-settings.ts b/packages/ducjs/src/flatbuffers/duc/identified-grid-settings.ts deleted file mode 100644 index 0a3a8065..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-grid-settings.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { GridSettings } from '../duc/grid-settings'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedGridSettings { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedGridSettings { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedGridSettings(bb:flatbuffers.ByteBuffer, obj?:IdentifiedGridSettings):IdentifiedGridSettings { - return (obj || new IdentifiedGridSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedGridSettings(bb:flatbuffers.ByteBuffer, obj?:IdentifiedGridSettings):IdentifiedGridSettings { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedGridSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -settings(obj?:GridSettings):GridSettings|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new GridSettings()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedGridSettings(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addSettings(builder:flatbuffers.Builder, settingsOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, settingsOffset, 0); -} - -static endIdentifiedGridSettings(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-hatch-style.ts b/packages/ducjs/src/flatbuffers/duc/identified-hatch-style.ts deleted file mode 100644 index 8896e4fb..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-hatch-style.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucHatchStyle } from '../duc/duc-hatch-style'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedHatchStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedHatchStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedHatchStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedHatchStyle):IdentifiedHatchStyle { - return (obj || new IdentifiedHatchStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedHatchStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedHatchStyle):IdentifiedHatchStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedHatchStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucHatchStyle):DucHatchStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucHatchStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedHatchStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static endIdentifiedHatchStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-leader-style.ts b/packages/ducjs/src/flatbuffers/duc/identified-leader-style.ts deleted file mode 100644 index 583f2e0d..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-leader-style.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucLeaderStyle } from '../duc/duc-leader-style'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedLeaderStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedLeaderStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedLeaderStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedLeaderStyle):IdentifiedLeaderStyle { - return (obj || new IdentifiedLeaderStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedLeaderStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedLeaderStyle):IdentifiedLeaderStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedLeaderStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucLeaderStyle):DucLeaderStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucLeaderStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedLeaderStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static endIdentifiedLeaderStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-snap-settings.ts b/packages/ducjs/src/flatbuffers/duc/identified-snap-settings.ts deleted file mode 100644 index 7ddfbece..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-snap-settings.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { Identifier } from '../duc/identifier'; -import { SnapSettings } from '../duc/snap-settings'; - - -export class IdentifiedSnapSettings { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedSnapSettings { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedSnapSettings(bb:flatbuffers.ByteBuffer, obj?:IdentifiedSnapSettings):IdentifiedSnapSettings { - return (obj || new IdentifiedSnapSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedSnapSettings(bb:flatbuffers.ByteBuffer, obj?:IdentifiedSnapSettings):IdentifiedSnapSettings { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedSnapSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -settings(obj?:SnapSettings):SnapSettings|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new SnapSettings()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedSnapSettings(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addSettings(builder:flatbuffers.Builder, settingsOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, settingsOffset, 0); -} - -static endIdentifiedSnapSettings(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-stack-like-style.ts b/packages/ducjs/src/flatbuffers/duc/identified-stack-like-style.ts deleted file mode 100644 index 3ddc914d..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-stack-like-style.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucStackLikeStyles } from '../duc/duc-stack-like-styles'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedStackLikeStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedStackLikeStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedStackLikeStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedStackLikeStyle):IdentifiedStackLikeStyle { - return (obj || new IdentifiedStackLikeStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedStackLikeStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedStackLikeStyle):IdentifiedStackLikeStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedStackLikeStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucStackLikeStyles):DucStackLikeStyles|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucStackLikeStyles()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedStackLikeStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static endIdentifiedStackLikeStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-table-style.ts b/packages/ducjs/src/flatbuffers/duc/identified-table-style.ts deleted file mode 100644 index 793f0d37..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-table-style.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucTableStyle } from '../duc/duc-table-style'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedTableStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedTableStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedTableStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedTableStyle):IdentifiedTableStyle { - return (obj || new IdentifiedTableStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedTableStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedTableStyle):IdentifiedTableStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedTableStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucTableStyle):DucTableStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucTableStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedTableStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static endIdentifiedTableStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-text-style.ts b/packages/ducjs/src/flatbuffers/duc/identified-text-style.ts deleted file mode 100644 index 06dd03b4..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-text-style.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucTextStyle } from '../duc/duc-text-style'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedTextStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedTextStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedTextStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedTextStyle):IdentifiedTextStyle { - return (obj || new IdentifiedTextStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedTextStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedTextStyle):IdentifiedTextStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedTextStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucTextStyle):DucTextStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucTextStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedTextStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static endIdentifiedTextStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-ucs.ts b/packages/ducjs/src/flatbuffers/duc/identified-ucs.ts deleted file mode 100644 index 051cc80f..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-ucs.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucUcs } from '../duc/duc-ucs'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedUcs { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedUcs { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedUcs(bb:flatbuffers.ByteBuffer, obj?:IdentifiedUcs):IdentifiedUcs { - return (obj || new IdentifiedUcs()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedUcs(bb:flatbuffers.ByteBuffer, obj?:IdentifiedUcs):IdentifiedUcs { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedUcs()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -ucs(obj?:DucUcs):DucUcs|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucUcs()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedUcs(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addUcs(builder:flatbuffers.Builder, ucsOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, ucsOffset, 0); -} - -static endIdentifiedUcs(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-view.ts b/packages/ducjs/src/flatbuffers/duc/identified-view.ts deleted file mode 100644 index 04662f85..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-view.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucView } from '../duc/duc-view'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedView { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedView { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedView(bb:flatbuffers.ByteBuffer, obj?:IdentifiedView):IdentifiedView { - return (obj || new IdentifiedView()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedView(bb:flatbuffers.ByteBuffer, obj?:IdentifiedView):IdentifiedView { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedView()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -view(obj?:DucView):DucView|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucView()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedView(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addView(builder:flatbuffers.Builder, viewOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, viewOffset, 0); -} - -static endIdentifiedView(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-viewport-style.ts b/packages/ducjs/src/flatbuffers/duc/identified-viewport-style.ts deleted file mode 100644 index e6378cf5..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-viewport-style.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucViewportStyle } from '../duc/duc-viewport-style'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedViewportStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedViewportStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedViewportStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedViewportStyle):IdentifiedViewportStyle { - return (obj || new IdentifiedViewportStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedViewportStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedViewportStyle):IdentifiedViewportStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedViewportStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucViewportStyle):DucViewportStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucViewportStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedViewportStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static endIdentifiedViewportStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identified-xray-style.ts b/packages/ducjs/src/flatbuffers/duc/identified-xray-style.ts deleted file mode 100644 index 518fdb96..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identified-xray-style.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DucXRayStyle } from '../duc/duc-xray-style'; -import { Identifier } from '../duc/identifier'; - - -export class IdentifiedXRayStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IdentifiedXRayStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifiedXRayStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedXRayStyle):IdentifiedXRayStyle { - return (obj || new IdentifiedXRayStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifiedXRayStyle(bb:flatbuffers.ByteBuffer, obj?:IdentifiedXRayStyle):IdentifiedXRayStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IdentifiedXRayStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -style(obj?:DucXRayStyle):DucXRayStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new DucXRayStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startIdentifiedXRayStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addStyle(builder:flatbuffers.Builder, styleOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, styleOffset, 0); -} - -static endIdentifiedXRayStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/identifier.ts b/packages/ducjs/src/flatbuffers/duc/identifier.ts deleted file mode 100644 index 353993a9..00000000 --- a/packages/ducjs/src/flatbuffers/duc/identifier.ts +++ /dev/null @@ -1,75 +0,0 @@ -// 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 Identifier { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):Identifier { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIdentifier(bb:flatbuffers.ByteBuffer, obj?:Identifier):Identifier { - return (obj || new Identifier()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIdentifier(bb:flatbuffers.ByteBuffer, obj?:Identifier):Identifier { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new Identifier()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -name():string|null -name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -name(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -description():string|null -description(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -description(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startIdentifier(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, nameOffset, 0); -} - -static addDescription(builder:flatbuffers.Builder, descriptionOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, descriptionOffset, 0); -} - -static endIdentifier(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // id - return offset; -} - -static createIdentifier(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, nameOffset:flatbuffers.Offset, descriptionOffset:flatbuffers.Offset):flatbuffers.Offset { - Identifier.startIdentifier(builder); - Identifier.addId(builder, idOffset); - Identifier.addName(builder, nameOffset); - Identifier.addDescription(builder, descriptionOffset); - return Identifier.endIdentifier(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/image-crop.ts b/packages/ducjs/src/flatbuffers/duc/image-crop.ts deleted file mode 100644 index 5fab0104..00000000 --- a/packages/ducjs/src/flatbuffers/duc/image-crop.ts +++ /dev/null @@ -1,98 +0,0 @@ -// 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 ImageCrop { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):ImageCrop { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsImageCrop(bb:flatbuffers.ByteBuffer, obj?:ImageCrop):ImageCrop { - return (obj || new ImageCrop()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsImageCrop(bb:flatbuffers.ByteBuffer, obj?:ImageCrop):ImageCrop { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new ImageCrop()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -x():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -y():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -width():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -height():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -naturalWidth():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -naturalHeight():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startImageCrop(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addX(builder:flatbuffers.Builder, x:number) { - builder.addFieldFloat64(0, x, 0.0); -} - -static addY(builder:flatbuffers.Builder, y:number) { - builder.addFieldFloat64(1, y, 0.0); -} - -static addWidth(builder:flatbuffers.Builder, width:number) { - builder.addFieldFloat64(2, width, 0.0); -} - -static addHeight(builder:flatbuffers.Builder, height:number) { - builder.addFieldFloat64(3, height, 0.0); -} - -static addNaturalWidth(builder:flatbuffers.Builder, naturalWidth:number) { - builder.addFieldFloat64(4, naturalWidth, 0.0); -} - -static addNaturalHeight(builder:flatbuffers.Builder, naturalHeight:number) { - builder.addFieldFloat64(5, naturalHeight, 0.0); -} - -static endImageCrop(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createImageCrop(builder:flatbuffers.Builder, x:number, y:number, width:number, height:number, naturalWidth:number, naturalHeight:number):flatbuffers.Offset { - ImageCrop.startImageCrop(builder); - ImageCrop.addX(builder, x); - ImageCrop.addY(builder, y); - ImageCrop.addWidth(builder, width); - ImageCrop.addHeight(builder, height); - ImageCrop.addNaturalWidth(builder, naturalWidth); - ImageCrop.addNaturalHeight(builder, naturalHeight); - return ImageCrop.endImageCrop(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/image-status.ts b/packages/ducjs/src/flatbuffers/duc/image-status.ts deleted file mode 100644 index 798953d1..00000000 --- a/packages/ducjs/src/flatbuffers/duc/image-status.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum IMAGE_STATUS { - PENDING = 10, - SAVED = 11, - ERROR = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/isometric-grid-settings.ts b/packages/ducjs/src/flatbuffers/duc/isometric-grid-settings.ts deleted file mode 100644 index 679ff001..00000000 --- a/packages/ducjs/src/flatbuffers/duc/isometric-grid-settings.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 IsometricGridSettings { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):IsometricGridSettings { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsIsometricGridSettings(bb:flatbuffers.ByteBuffer, obj?:IsometricGridSettings):IsometricGridSettings { - return (obj || new IsometricGridSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsIsometricGridSettings(bb:flatbuffers.ByteBuffer, obj?:IsometricGridSettings):IsometricGridSettings { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new IsometricGridSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -leftAngle():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -rightAngle():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startIsometricGridSettings(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addLeftAngle(builder:flatbuffers.Builder, leftAngle:number) { - builder.addFieldFloat64(0, leftAngle, 0.0); -} - -static addRightAngle(builder:flatbuffers.Builder, rightAngle:number) { - builder.addFieldFloat64(1, rightAngle, 0.0); -} - -static endIsometricGridSettings(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createIsometricGridSettings(builder:flatbuffers.Builder, leftAngle:number, rightAngle:number):flatbuffers.Offset { - IsometricGridSettings.startIsometricGridSettings(builder); - IsometricGridSettings.addLeftAngle(builder, leftAngle); - IsometricGridSettings.addRightAngle(builder, rightAngle); - return IsometricGridSettings.endIsometricGridSettings(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/jsonpatch-operation.ts b/packages/ducjs/src/flatbuffers/duc/jsonpatch-operation.ts deleted file mode 100644 index e48c2293..00000000 --- a/packages/ducjs/src/flatbuffers/duc/jsonpatch-operation.ts +++ /dev/null @@ -1,86 +0,0 @@ -// 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 JSONPatchOperation { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):JSONPatchOperation { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsJSONPatchOperation(bb:flatbuffers.ByteBuffer, obj?:JSONPatchOperation):JSONPatchOperation { - return (obj || new JSONPatchOperation()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsJSONPatchOperation(bb:flatbuffers.ByteBuffer, obj?:JSONPatchOperation):JSONPatchOperation { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new JSONPatchOperation()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -op():string|null -op(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -op(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -path():string|null -path(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -path(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -from():string|null -from(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -from(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -value():string|null -value(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -value(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startJSONPatchOperation(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addOp(builder:flatbuffers.Builder, opOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, opOffset, 0); -} - -static addPath(builder:flatbuffers.Builder, pathOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, pathOffset, 0); -} - -static addFrom(builder:flatbuffers.Builder, fromOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, fromOffset, 0); -} - -static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, valueOffset, 0); -} - -static endJSONPatchOperation(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createJSONPatchOperation(builder:flatbuffers.Builder, opOffset:flatbuffers.Offset, pathOffset:flatbuffers.Offset, fromOffset:flatbuffers.Offset, valueOffset:flatbuffers.Offset):flatbuffers.Offset { - JSONPatchOperation.startJSONPatchOperation(builder); - JSONPatchOperation.addOp(builder, opOffset); - JSONPatchOperation.addPath(builder, pathOffset); - JSONPatchOperation.addFrom(builder, fromOffset); - JSONPatchOperation.addValue(builder, valueOffset); - return JSONPatchOperation.endJSONPatchOperation(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/layer-snap-filters.ts b/packages/ducjs/src/flatbuffers/duc/layer-snap-filters.ts deleted file mode 100644 index f7dccbea..00000000 --- a/packages/ducjs/src/flatbuffers/duc/layer-snap-filters.ts +++ /dev/null @@ -1,96 +0,0 @@ -// 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 LayerSnapFilters { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):LayerSnapFilters { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsLayerSnapFilters(bb:flatbuffers.ByteBuffer, obj?:LayerSnapFilters):LayerSnapFilters { - return (obj || new LayerSnapFilters()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsLayerSnapFilters(bb:flatbuffers.ByteBuffer, obj?:LayerSnapFilters):LayerSnapFilters { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new LayerSnapFilters()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -includeLayers(index: number):string -includeLayers(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -includeLayers(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -includeLayersLength():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -excludeLayers(index: number):string -excludeLayers(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -excludeLayers(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -excludeLayersLength():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -static startLayerSnapFilters(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addIncludeLayers(builder:flatbuffers.Builder, includeLayersOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, includeLayersOffset, 0); -} - -static createIncludeLayersVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startIncludeLayersVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addExcludeLayers(builder:flatbuffers.Builder, excludeLayersOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, excludeLayersOffset, 0); -} - -static createExcludeLayersVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startExcludeLayersVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static endLayerSnapFilters(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createLayerSnapFilters(builder:flatbuffers.Builder, includeLayersOffset:flatbuffers.Offset, excludeLayersOffset:flatbuffers.Offset):flatbuffers.Offset { - LayerSnapFilters.startLayerSnapFilters(builder); - LayerSnapFilters.addIncludeLayers(builder, includeLayersOffset); - LayerSnapFilters.addExcludeLayers(builder, excludeLayersOffset); - return LayerSnapFilters.endLayerSnapFilters(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/layer-validation-rules.ts b/packages/ducjs/src/flatbuffers/duc/layer-validation-rules.ts deleted file mode 100644 index 087cb354..00000000 --- a/packages/ducjs/src/flatbuffers/duc/layer-validation-rules.ts +++ /dev/null @@ -1,67 +0,0 @@ -// 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 LayerValidationRules { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):LayerValidationRules { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsLayerValidationRules(bb:flatbuffers.ByteBuffer, obj?:LayerValidationRules):LayerValidationRules { - return (obj || new LayerValidationRules()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsLayerValidationRules(bb:flatbuffers.ByteBuffer, obj?:LayerValidationRules):LayerValidationRules { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new LayerValidationRules()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -prohibitedLayerNames(index: number):string -prohibitedLayerNames(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -prohibitedLayerNames(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -prohibitedLayerNamesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -static startLayerValidationRules(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addProhibitedLayerNames(builder:flatbuffers.Builder, prohibitedLayerNamesOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, prohibitedLayerNamesOffset, 0); -} - -static createProhibitedLayerNamesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startProhibitedLayerNamesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static endLayerValidationRules(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createLayerValidationRules(builder:flatbuffers.Builder, prohibitedLayerNamesOffset:flatbuffers.Offset):flatbuffers.Offset { - LayerValidationRules.startLayerValidationRules(builder); - LayerValidationRules.addProhibitedLayerNames(builder, prohibitedLayerNamesOffset); - return LayerValidationRules.endLayerValidationRules(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/leader-block-content.ts b/packages/ducjs/src/flatbuffers/duc/leader-block-content.ts deleted file mode 100644 index 368879a9..00000000 --- a/packages/ducjs/src/flatbuffers/duc/leader-block-content.ts +++ /dev/null @@ -1,107 +0,0 @@ -// 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 { StringValueEntry } from '../duc/string-value-entry'; - - -export class LeaderBlockContent { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):LeaderBlockContent { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsLeaderBlockContent(bb:flatbuffers.ByteBuffer, obj?:LeaderBlockContent):LeaderBlockContent { - return (obj || new LeaderBlockContent()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsLeaderBlockContent(bb:flatbuffers.ByteBuffer, obj?:LeaderBlockContent):LeaderBlockContent { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new LeaderBlockContent()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -blockId():string|null -blockId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -blockId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -attributeValues(index: number, obj?:StringValueEntry):StringValueEntry|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new StringValueEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -attributeValuesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -elementOverrides(index: number, obj?:StringValueEntry):StringValueEntry|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new StringValueEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -elementOverridesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -static startLeaderBlockContent(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addBlockId(builder:flatbuffers.Builder, blockIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, blockIdOffset, 0); -} - -static addAttributeValues(builder:flatbuffers.Builder, attributeValuesOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, attributeValuesOffset, 0); -} - -static createAttributeValuesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startAttributeValuesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addElementOverrides(builder:flatbuffers.Builder, elementOverridesOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, elementOverridesOffset, 0); -} - -static createElementOverridesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startElementOverridesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static endLeaderBlockContent(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createLeaderBlockContent(builder:flatbuffers.Builder, blockIdOffset:flatbuffers.Offset, attributeValuesOffset:flatbuffers.Offset, elementOverridesOffset:flatbuffers.Offset):flatbuffers.Offset { - LeaderBlockContent.startLeaderBlockContent(builder); - LeaderBlockContent.addBlockId(builder, blockIdOffset); - LeaderBlockContent.addAttributeValues(builder, attributeValuesOffset); - LeaderBlockContent.addElementOverrides(builder, elementOverridesOffset); - return LeaderBlockContent.endLeaderBlockContent(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/leader-content-data.ts b/packages/ducjs/src/flatbuffers/duc/leader-content-data.ts deleted file mode 100644 index 8c4cf7ac..00000000 --- a/packages/ducjs/src/flatbuffers/duc/leader-content-data.ts +++ /dev/null @@ -1,38 +0,0 @@ -// 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 { LeaderBlockContent } from '../duc/leader-block-content'; -import { LeaderTextBlockContent } from '../duc/leader-text-block-content'; - - -export enum LeaderContentData { - NONE = 0, - LeaderTextBlockContent = 1, - LeaderBlockContent = 2 -} - -export function unionToLeaderContentData( - type: LeaderContentData, - accessor: (obj:LeaderBlockContent|LeaderTextBlockContent) => LeaderBlockContent|LeaderTextBlockContent|null -): LeaderBlockContent|LeaderTextBlockContent|null { - switch(LeaderContentData[type]) { - case 'NONE': return null; - case 'LeaderTextBlockContent': return accessor(new LeaderTextBlockContent())! as LeaderTextBlockContent; - case 'LeaderBlockContent': return accessor(new LeaderBlockContent())! as LeaderBlockContent; - default: return null; - } -} - -export function unionListToLeaderContentData( - type: LeaderContentData, - accessor: (index: number, obj:LeaderBlockContent|LeaderTextBlockContent) => LeaderBlockContent|LeaderTextBlockContent|null, - index: number -): LeaderBlockContent|LeaderTextBlockContent|null { - switch(LeaderContentData[type]) { - case 'NONE': return null; - case 'LeaderTextBlockContent': return accessor(index, new LeaderTextBlockContent())! as LeaderTextBlockContent; - case 'LeaderBlockContent': return accessor(index, new LeaderBlockContent())! as LeaderBlockContent; - default: return null; - } -} diff --git a/packages/ducjs/src/flatbuffers/duc/leader-content-type.ts b/packages/ducjs/src/flatbuffers/duc/leader-content-type.ts deleted file mode 100644 index 3e494e38..00000000 --- a/packages/ducjs/src/flatbuffers/duc/leader-content-type.ts +++ /dev/null @@ -1,8 +0,0 @@ -// 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 */ - -export enum LEADER_CONTENT_TYPE { - TEXT = 10, - BLOCK = 11 -} diff --git a/packages/ducjs/src/flatbuffers/duc/leader-content.ts b/packages/ducjs/src/flatbuffers/duc/leader-content.ts deleted file mode 100644 index 6732ad88..00000000 --- a/packages/ducjs/src/flatbuffers/duc/leader-content.ts +++ /dev/null @@ -1,73 +0,0 @@ -// 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 { LEADER_CONTENT_TYPE } from '../duc/leader-content-type'; -import { LeaderContentData, unionToLeaderContentData, unionListToLeaderContentData } from '../duc/leader-content-data'; - - -export class LeaderContent { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):LeaderContent { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsLeaderContent(bb:flatbuffers.ByteBuffer, obj?:LeaderContent):LeaderContent { - return (obj || new LeaderContent()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsLeaderContent(bb:flatbuffers.ByteBuffer, obj?:LeaderContent):LeaderContent { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new LeaderContent()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -leaderContentType():LEADER_CONTENT_TYPE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -contentType():LeaderContentData { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : LeaderContentData.NONE; -} - -content(obj:any):any|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null; -} - -static startLeaderContent(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addLeaderContentType(builder:flatbuffers.Builder, leaderContentType:LEADER_CONTENT_TYPE) { - builder.addFieldInt8(0, leaderContentType, null); -} - -static addContentType(builder:flatbuffers.Builder, contentType:LeaderContentData) { - builder.addFieldInt8(1, contentType, LeaderContentData.NONE); -} - -static addContent(builder:flatbuffers.Builder, contentOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, contentOffset, 0); -} - -static endLeaderContent(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createLeaderContent(builder:flatbuffers.Builder, leaderContentType:LEADER_CONTENT_TYPE|null, contentType:LeaderContentData, contentOffset:flatbuffers.Offset):flatbuffers.Offset { - LeaderContent.startLeaderContent(builder); - if (leaderContentType !== null) - LeaderContent.addLeaderContentType(builder, leaderContentType); - LeaderContent.addContentType(builder, contentType); - LeaderContent.addContent(builder, contentOffset); - return LeaderContent.endLeaderContent(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/leader-text-block-content.ts b/packages/ducjs/src/flatbuffers/duc/leader-text-block-content.ts deleted file mode 100644 index 014eea77..00000000 --- a/packages/ducjs/src/flatbuffers/duc/leader-text-block-content.ts +++ /dev/null @@ -1,50 +0,0 @@ -// 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 LeaderTextBlockContent { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):LeaderTextBlockContent { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsLeaderTextBlockContent(bb:flatbuffers.ByteBuffer, obj?:LeaderTextBlockContent):LeaderTextBlockContent { - return (obj || new LeaderTextBlockContent()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsLeaderTextBlockContent(bb:flatbuffers.ByteBuffer, obj?:LeaderTextBlockContent):LeaderTextBlockContent { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new LeaderTextBlockContent()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -text():string|null -text(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -text(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startLeaderTextBlockContent(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addText(builder:flatbuffers.Builder, textOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, textOffset, 0); -} - -static endLeaderTextBlockContent(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createLeaderTextBlockContent(builder:flatbuffers.Builder, textOffset:flatbuffers.Offset):flatbuffers.Offset { - LeaderTextBlockContent.startLeaderTextBlockContent(builder); - LeaderTextBlockContent.addText(builder, textOffset); - return LeaderTextBlockContent.endLeaderTextBlockContent(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/line-head.ts b/packages/ducjs/src/flatbuffers/duc/line-head.ts deleted file mode 100644 index 088ea6cf..00000000 --- a/packages/ducjs/src/flatbuffers/duc/line-head.ts +++ /dev/null @@ -1,21 +0,0 @@ -// 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 */ - -export enum LINE_HEAD { - ARROW = 10, - BAR = 11, - CIRCLE = 12, - CIRCLE_OUTLINED = 13, - TRIANGLE = 14, - TRIANGLE_OUTLINED = 15, - DIAMOND = 16, - DIAMOND_OUTLINED = 17, - CROSS = 18, - OPEN_ARROW = 19, - REVERSED_ARROW = 20, - REVERSED_TRIANGLE = 21, - REVERSED_TRIANGLE_OUTLINED = 22, - CONE = 23, - HALF_CONE = 24 -} diff --git a/packages/ducjs/src/flatbuffers/duc/line-spacing-type.ts b/packages/ducjs/src/flatbuffers/duc/line-spacing-type.ts deleted file mode 100644 index eea10444..00000000 --- a/packages/ducjs/src/flatbuffers/duc/line-spacing-type.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum LINE_SPACING_TYPE { - AT_LEAST = 10, - EXACTLY = 11, - MULTIPLE = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/line-spacing.ts b/packages/ducjs/src/flatbuffers/duc/line-spacing.ts deleted file mode 100644 index 1737f8e4..00000000 --- a/packages/ducjs/src/flatbuffers/duc/line-spacing.ts +++ /dev/null @@ -1,62 +0,0 @@ -// 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 { LINE_SPACING_TYPE } from '../duc/line-spacing-type'; - - -export class LineSpacing { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):LineSpacing { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsLineSpacing(bb:flatbuffers.ByteBuffer, obj?:LineSpacing):LineSpacing { - return (obj || new LineSpacing()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsLineSpacing(bb:flatbuffers.ByteBuffer, obj?:LineSpacing):LineSpacing { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new LineSpacing()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -value():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -type():LINE_SPACING_TYPE|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startLineSpacing(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addValue(builder:flatbuffers.Builder, value:number) { - builder.addFieldFloat64(0, value, 0.0); -} - -static addType(builder:flatbuffers.Builder, type:LINE_SPACING_TYPE) { - builder.addFieldInt8(1, type, null); -} - -static endLineSpacing(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createLineSpacing(builder:flatbuffers.Builder, value:number, type:LINE_SPACING_TYPE|null):flatbuffers.Offset { - LineSpacing.startLineSpacing(builder); - LineSpacing.addValue(builder, value); - if (type !== null) - LineSpacing.addType(builder, type); - return LineSpacing.endLineSpacing(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/linear-unit-system.ts b/packages/ducjs/src/flatbuffers/duc/linear-unit-system.ts deleted file mode 100644 index d178c13f..00000000 --- a/packages/ducjs/src/flatbuffers/duc/linear-unit-system.ts +++ /dev/null @@ -1,95 +0,0 @@ -// 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 { DECIMAL_SEPARATOR } from '../duc/decimal-separator'; -import { DIMENSION_UNITS_FORMAT } from '../duc/dimension-units-format'; -import { _UnitSystemBase } from '../duc/unit-system-base'; - - -export class LinearUnitSystem { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):LinearUnitSystem { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsLinearUnitSystem(bb:flatbuffers.ByteBuffer, obj?:LinearUnitSystem):LinearUnitSystem { - return (obj || new LinearUnitSystem()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsLinearUnitSystem(bb:flatbuffers.ByteBuffer, obj?:LinearUnitSystem):LinearUnitSystem { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new LinearUnitSystem()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -base(obj?:_UnitSystemBase):_UnitSystemBase|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new _UnitSystemBase()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -format():DIMENSION_UNITS_FORMAT|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -decimalSeparator():DECIMAL_SEPARATOR|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -suppressZeroFeet():boolean { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -suppressZeroInches():boolean { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startLinearUnitSystem(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addBase(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, baseOffset, 0); -} - -static addFormat(builder:flatbuffers.Builder, format:DIMENSION_UNITS_FORMAT) { - builder.addFieldInt8(1, format, null); -} - -static addDecimalSeparator(builder:flatbuffers.Builder, decimalSeparator:DECIMAL_SEPARATOR) { - builder.addFieldInt8(2, decimalSeparator, null); -} - -static addSuppressZeroFeet(builder:flatbuffers.Builder, suppressZeroFeet:boolean) { - builder.addFieldInt8(3, +suppressZeroFeet, +false); -} - -static addSuppressZeroInches(builder:flatbuffers.Builder, suppressZeroInches:boolean) { - builder.addFieldInt8(4, +suppressZeroInches, +false); -} - -static endLinearUnitSystem(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createLinearUnitSystem(builder:flatbuffers.Builder, baseOffset:flatbuffers.Offset, format:DIMENSION_UNITS_FORMAT|null, decimalSeparator:DECIMAL_SEPARATOR|null, suppressZeroFeet:boolean, suppressZeroInches:boolean):flatbuffers.Offset { - LinearUnitSystem.startLinearUnitSystem(builder); - LinearUnitSystem.addBase(builder, baseOffset); - if (format !== null) - LinearUnitSystem.addFormat(builder, format); - if (decimalSeparator !== null) - LinearUnitSystem.addDecimalSeparator(builder, decimalSeparator); - LinearUnitSystem.addSuppressZeroFeet(builder, suppressZeroFeet); - LinearUnitSystem.addSuppressZeroInches(builder, suppressZeroInches); - return LinearUnitSystem.endLinearUnitSystem(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/margins.ts b/packages/ducjs/src/flatbuffers/duc/margins.ts deleted file mode 100644 index d66d7dec..00000000 --- a/packages/ducjs/src/flatbuffers/duc/margins.ts +++ /dev/null @@ -1,78 +0,0 @@ -// 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 Margins { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):Margins { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsMargins(bb:flatbuffers.ByteBuffer, obj?:Margins):Margins { - return (obj || new Margins()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsMargins(bb:flatbuffers.ByteBuffer, obj?:Margins):Margins { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new Margins()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -top():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -right():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -bottom():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -left():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startMargins(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addTop(builder:flatbuffers.Builder, top:number) { - builder.addFieldFloat64(0, top, 0.0); -} - -static addRight(builder:flatbuffers.Builder, right:number) { - builder.addFieldFloat64(1, right, 0.0); -} - -static addBottom(builder:flatbuffers.Builder, bottom:number) { - builder.addFieldFloat64(2, bottom, 0.0); -} - -static addLeft(builder:flatbuffers.Builder, left:number) { - builder.addFieldFloat64(3, left, 0.0); -} - -static endMargins(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createMargins(builder:flatbuffers.Builder, top:number, right:number, bottom:number, left:number):flatbuffers.Offset { - Margins.startMargins(builder); - Margins.addTop(builder, top); - Margins.addRight(builder, right); - Margins.addBottom(builder, bottom); - Margins.addLeft(builder, left); - return Margins.endMargins(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/mark-ellipse-center.ts b/packages/ducjs/src/flatbuffers/duc/mark-ellipse-center.ts deleted file mode 100644 index 520ee94e..00000000 --- a/packages/ducjs/src/flatbuffers/duc/mark-ellipse-center.ts +++ /dev/null @@ -1,8 +0,0 @@ -// 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 */ - -export enum MARK_ELLIPSE_CENTER { - MARK = 10, - LINE = 11 -} diff --git a/packages/ducjs/src/flatbuffers/duc/material-condition.ts b/packages/ducjs/src/flatbuffers/duc/material-condition.ts deleted file mode 100644 index 2bee5779..00000000 --- a/packages/ducjs/src/flatbuffers/duc/material-condition.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum MATERIAL_CONDITION { - MAXIMUM = 10, - LEAST = 11, - REGARDLESS = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/object-snap-mode.ts b/packages/ducjs/src/flatbuffers/duc/object-snap-mode.ts deleted file mode 100644 index 5b85d3a3..00000000 --- a/packages/ducjs/src/flatbuffers/duc/object-snap-mode.ts +++ /dev/null @@ -1,26 +0,0 @@ -// 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 */ - -export enum OBJECT_SNAP_MODE { - NONE = 0, - ENDPOINT = 10, - MIDPOINT = 11, - CENTER = 12, - QUADRANT = 13, - INTERSECTION = 14, - EXTENSION = 15, - PERPENDICULAR = 16, - TANGENT = 17, - NEAREST = 18, - NODE = 19, - INSERT = 20, - PARALLEL = 21, - APPARENT = 22, - FROM = 23, - POINT_FILTER = 24, - TEMPORARY = 25, - BETWEEN_TWO_POINTS = 26, - POINT_ON_CURVE = 27, - GEOMETRIC = 28 -} diff --git a/packages/ducjs/src/flatbuffers/duc/paragraph-formatting.ts b/packages/ducjs/src/flatbuffers/duc/paragraph-formatting.ts deleted file mode 100644 index d8d595d8..00000000 --- a/packages/ducjs/src/flatbuffers/duc/paragraph-formatting.ts +++ /dev/null @@ -1,135 +0,0 @@ -// 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 ParagraphFormatting { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):ParagraphFormatting { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsParagraphFormatting(bb:flatbuffers.ByteBuffer, obj?:ParagraphFormatting):ParagraphFormatting { - return (obj || new ParagraphFormatting()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsParagraphFormatting(bb:flatbuffers.ByteBuffer, obj?:ParagraphFormatting):ParagraphFormatting { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new ParagraphFormatting()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -firstLineIndent():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -hangingIndent():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -leftIndent():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -rightIndent():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -spaceBefore():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -spaceAfter():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -tabStops(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0; -} - -tabStopsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -tabStopsArray():Float64Array|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - 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 startParagraphFormatting(builder:flatbuffers.Builder) { - builder.startObject(7); -} - -static addFirstLineIndent(builder:flatbuffers.Builder, firstLineIndent:number) { - builder.addFieldFloat64(0, firstLineIndent, 0.0); -} - -static addHangingIndent(builder:flatbuffers.Builder, hangingIndent:number) { - builder.addFieldFloat64(1, hangingIndent, 0.0); -} - -static addLeftIndent(builder:flatbuffers.Builder, leftIndent:number) { - builder.addFieldFloat64(2, leftIndent, 0.0); -} - -static addRightIndent(builder:flatbuffers.Builder, rightIndent:number) { - builder.addFieldFloat64(3, rightIndent, 0.0); -} - -static addSpaceBefore(builder:flatbuffers.Builder, spaceBefore:number) { - builder.addFieldFloat64(4, spaceBefore, 0.0); -} - -static addSpaceAfter(builder:flatbuffers.Builder, spaceAfter:number) { - builder.addFieldFloat64(5, spaceAfter, 0.0); -} - -static addTabStops(builder:flatbuffers.Builder, tabStopsOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, tabStopsOffset, 0); -} - -static createTabStopsVector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset; -/** - * @deprecated This Uint8Array overload will be removed in the future. - */ -static createTabStopsVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; -static createTabStopsVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset { - builder.startVector(8, data.length, 8); - for (let i = data.length - 1; i >= 0; i--) { - builder.addFloat64(data[i]!); - } - return builder.endVector(); -} - -static startTabStopsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(8, numElems, 8); -} - -static endParagraphFormatting(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createParagraphFormatting(builder:flatbuffers.Builder, firstLineIndent:number, hangingIndent:number, leftIndent:number, rightIndent:number, spaceBefore:number, spaceAfter:number, tabStopsOffset:flatbuffers.Offset):flatbuffers.Offset { - ParagraphFormatting.startParagraphFormatting(builder); - ParagraphFormatting.addFirstLineIndent(builder, firstLineIndent); - ParagraphFormatting.addHangingIndent(builder, hangingIndent); - ParagraphFormatting.addLeftIndent(builder, leftIndent); - ParagraphFormatting.addRightIndent(builder, rightIndent); - ParagraphFormatting.addSpaceBefore(builder, spaceBefore); - ParagraphFormatting.addSpaceAfter(builder, spaceAfter); - ParagraphFormatting.addTabStops(builder, tabStopsOffset); - return ParagraphFormatting.endParagraphFormatting(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/parametric-source-type.ts b/packages/ducjs/src/flatbuffers/duc/parametric-source-type.ts deleted file mode 100644 index 470b4f7b..00000000 --- a/packages/ducjs/src/flatbuffers/duc/parametric-source-type.ts +++ /dev/null @@ -1,8 +0,0 @@ -// 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 */ - -export enum PARAMETRIC_SOURCE_TYPE { - CODE = 10, - FILE = 11 -} diff --git a/packages/ducjs/src/flatbuffers/duc/parametric-source.ts b/packages/ducjs/src/flatbuffers/duc/parametric-source.ts deleted file mode 100644 index 59a41d4c..00000000 --- a/packages/ducjs/src/flatbuffers/duc/parametric-source.ts +++ /dev/null @@ -1,76 +0,0 @@ -// 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 { PARAMETRIC_SOURCE_TYPE } from '../duc/parametric-source-type'; - - -export class ParametricSource { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):ParametricSource { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsParametricSource(bb:flatbuffers.ByteBuffer, obj?:ParametricSource):ParametricSource { - return (obj || new ParametricSource()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsParametricSource(bb:flatbuffers.ByteBuffer, obj?:ParametricSource):ParametricSource { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new ParametricSource()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -type():PARAMETRIC_SOURCE_TYPE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -code():string|null -code(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -code(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -fileId():string|null -fileId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -fileId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startParametricSource(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addType(builder:flatbuffers.Builder, type:PARAMETRIC_SOURCE_TYPE) { - builder.addFieldInt8(0, type, null); -} - -static addCode(builder:flatbuffers.Builder, codeOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, codeOffset, 0); -} - -static addFileId(builder:flatbuffers.Builder, fileIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, fileIdOffset, 0); -} - -static endParametricSource(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createParametricSource(builder:flatbuffers.Builder, type:PARAMETRIC_SOURCE_TYPE|null, codeOffset:flatbuffers.Offset, fileIdOffset:flatbuffers.Offset):flatbuffers.Offset { - ParametricSource.startParametricSource(builder); - if (type !== null) - ParametricSource.addType(builder, type); - ParametricSource.addCode(builder, codeOffset); - ParametricSource.addFileId(builder, fileIdOffset); - return ParametricSource.endParametricSource(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/plot-layout.ts b/packages/ducjs/src/flatbuffers/duc/plot-layout.ts deleted file mode 100644 index 5c547b81..00000000 --- a/packages/ducjs/src/flatbuffers/duc/plot-layout.ts +++ /dev/null @@ -1,51 +0,0 @@ -// 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 { Margins } from '../duc/margins'; - - -export class PlotLayout { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):PlotLayout { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsPlotLayout(bb:flatbuffers.ByteBuffer, obj?:PlotLayout):PlotLayout { - return (obj || new PlotLayout()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsPlotLayout(bb:flatbuffers.ByteBuffer, obj?:PlotLayout):PlotLayout { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new PlotLayout()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -margins(obj?:Margins):Margins|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Margins()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startPlotLayout(builder:flatbuffers.Builder) { - builder.startObject(1); -} - -static addMargins(builder:flatbuffers.Builder, marginsOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, marginsOffset, 0); -} - -static endPlotLayout(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createPlotLayout(builder:flatbuffers.Builder, marginsOffset:flatbuffers.Offset):flatbuffers.Offset { - PlotLayout.startPlotLayout(builder); - PlotLayout.addMargins(builder, marginsOffset); - return PlotLayout.endPlotLayout(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/point-binding-point.ts b/packages/ducjs/src/flatbuffers/duc/point-binding-point.ts deleted file mode 100644 index b20ca18f..00000000 --- a/packages/ducjs/src/flatbuffers/duc/point-binding-point.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 PointBindingPoint { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):PointBindingPoint { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsPointBindingPoint(bb:flatbuffers.ByteBuffer, obj?:PointBindingPoint):PointBindingPoint { - return (obj || new PointBindingPoint()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsPointBindingPoint(bb:flatbuffers.ByteBuffer, obj?:PointBindingPoint):PointBindingPoint { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new PointBindingPoint()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -index():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -offset():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startPointBindingPoint(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addIndex(builder:flatbuffers.Builder, index:number) { - builder.addFieldInt32(0, index, 0); -} - -static addOffset(builder:flatbuffers.Builder, offset:number) { - builder.addFieldFloat64(1, offset, 0.0); -} - -static endPointBindingPoint(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createPointBindingPoint(builder:flatbuffers.Builder, index:number, offset:number):flatbuffers.Offset { - PointBindingPoint.startPointBindingPoint(builder); - PointBindingPoint.addIndex(builder, index); - PointBindingPoint.addOffset(builder, offset); - return PointBindingPoint.endPointBindingPoint(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/polar-grid-settings.ts b/packages/ducjs/src/flatbuffers/duc/polar-grid-settings.ts deleted file mode 100644 index f855e454..00000000 --- a/packages/ducjs/src/flatbuffers/duc/polar-grid-settings.ts +++ /dev/null @@ -1,68 +0,0 @@ -// 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 PolarGridSettings { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):PolarGridSettings { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsPolarGridSettings(bb:flatbuffers.ByteBuffer, obj?:PolarGridSettings):PolarGridSettings { - return (obj || new PolarGridSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsPolarGridSettings(bb:flatbuffers.ByteBuffer, obj?:PolarGridSettings):PolarGridSettings { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new PolarGridSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -radialDivisions():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -radialSpacing():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -showLabels():boolean { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startPolarGridSettings(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addRadialDivisions(builder:flatbuffers.Builder, radialDivisions:number) { - builder.addFieldInt32(0, radialDivisions, 0); -} - -static addRadialSpacing(builder:flatbuffers.Builder, radialSpacing:number) { - builder.addFieldFloat64(1, radialSpacing, 0.0); -} - -static addShowLabels(builder:flatbuffers.Builder, showLabels:boolean) { - builder.addFieldInt8(2, +showLabels, +false); -} - -static endPolarGridSettings(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createPolarGridSettings(builder:flatbuffers.Builder, radialDivisions:number, radialSpacing:number, showLabels:boolean):flatbuffers.Offset { - PolarGridSettings.startPolarGridSettings(builder); - PolarGridSettings.addRadialDivisions(builder, radialDivisions); - PolarGridSettings.addRadialSpacing(builder, radialSpacing); - PolarGridSettings.addShowLabels(builder, showLabels); - return PolarGridSettings.endPolarGridSettings(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/polar-tracking-settings.ts b/packages/ducjs/src/flatbuffers/duc/polar-tracking-settings.ts deleted file mode 100644 index d6faeb59..00000000 --- a/packages/ducjs/src/flatbuffers/duc/polar-tracking-settings.ts +++ /dev/null @@ -1,115 +0,0 @@ -// 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 PolarTrackingSettings { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):PolarTrackingSettings { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsPolarTrackingSettings(bb:flatbuffers.ByteBuffer, obj?:PolarTrackingSettings):PolarTrackingSettings { - return (obj || new PolarTrackingSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsPolarTrackingSettings(bb:flatbuffers.ByteBuffer, obj?:PolarTrackingSettings):PolarTrackingSettings { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new PolarTrackingSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -enabled():boolean { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -angles(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0; -} - -anglesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -anglesArray():Float64Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - 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; -} - -incrementAngle():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -trackFromLastPoint():boolean { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -showPolarCoordinates():boolean { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startPolarTrackingSettings(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addEnabled(builder:flatbuffers.Builder, enabled:boolean) { - builder.addFieldInt8(0, +enabled, +false); -} - -static addAngles(builder:flatbuffers.Builder, anglesOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, anglesOffset, 0); -} - -static createAnglesVector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset; -/** - * @deprecated This Uint8Array overload will be removed in the future. - */ -static createAnglesVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; -static createAnglesVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset { - builder.startVector(8, data.length, 8); - for (let i = data.length - 1; i >= 0; i--) { - builder.addFloat64(data[i]!); - } - return builder.endVector(); -} - -static startAnglesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(8, numElems, 8); -} - -static addIncrementAngle(builder:flatbuffers.Builder, incrementAngle:number) { - builder.addFieldFloat64(2, incrementAngle, 0.0); -} - -static addTrackFromLastPoint(builder:flatbuffers.Builder, trackFromLastPoint:boolean) { - builder.addFieldInt8(3, +trackFromLastPoint, +false); -} - -static addShowPolarCoordinates(builder:flatbuffers.Builder, showPolarCoordinates:boolean) { - builder.addFieldInt8(4, +showPolarCoordinates, +false); -} - -static endPolarTrackingSettings(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createPolarTrackingSettings(builder:flatbuffers.Builder, enabled:boolean, anglesOffset:flatbuffers.Offset, incrementAngle:number, trackFromLastPoint:boolean, showPolarCoordinates:boolean):flatbuffers.Offset { - PolarTrackingSettings.startPolarTrackingSettings(builder); - PolarTrackingSettings.addEnabled(builder, enabled); - PolarTrackingSettings.addAngles(builder, anglesOffset); - PolarTrackingSettings.addIncrementAngle(builder, incrementAngle); - PolarTrackingSettings.addTrackFromLastPoint(builder, trackFromLastPoint); - PolarTrackingSettings.addShowPolarCoordinates(builder, showPolarCoordinates); - return PolarTrackingSettings.endPolarTrackingSettings(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/primary-units.ts b/packages/ducjs/src/flatbuffers/duc/primary-units.ts deleted file mode 100644 index 8dd1817f..00000000 --- a/packages/ducjs/src/flatbuffers/duc/primary-units.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { AngularUnitSystem } from '../duc/angular-unit-system'; -import { LinearUnitSystem } from '../duc/linear-unit-system'; - - -export class PrimaryUnits { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):PrimaryUnits { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsPrimaryUnits(bb:flatbuffers.ByteBuffer, obj?:PrimaryUnits):PrimaryUnits { - return (obj || new PrimaryUnits()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsPrimaryUnits(bb:flatbuffers.ByteBuffer, obj?:PrimaryUnits):PrimaryUnits { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new PrimaryUnits()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -linear(obj?:LinearUnitSystem):LinearUnitSystem|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new LinearUnitSystem()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -angular(obj?:AngularUnitSystem):AngularUnitSystem|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new AngularUnitSystem()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startPrimaryUnits(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addLinear(builder:flatbuffers.Builder, linearOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, linearOffset, 0); -} - -static addAngular(builder:flatbuffers.Builder, angularOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, angularOffset, 0); -} - -static endPrimaryUnits(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/pruning-level.ts b/packages/ducjs/src/flatbuffers/duc/pruning-level.ts deleted file mode 100644 index 4779c8ad..00000000 --- a/packages/ducjs/src/flatbuffers/duc/pruning-level.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum PRUNING_LEVEL { - CONSERVATIVE = 10, - BALANCED = 20, - AGGRESSIVE = 30 -} diff --git a/packages/ducjs/src/flatbuffers/duc/snap-marker-settings.ts b/packages/ducjs/src/flatbuffers/duc/snap-marker-settings.ts deleted file mode 100644 index 11c5a0ad..00000000 --- a/packages/ducjs/src/flatbuffers/duc/snap-marker-settings.ts +++ /dev/null @@ -1,98 +0,0 @@ -// 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 { SnapMarkerStyleEntry } from '../duc/snap-marker-style-entry'; - - -export class SnapMarkerSettings { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):SnapMarkerSettings { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsSnapMarkerSettings(bb:flatbuffers.ByteBuffer, obj?:SnapMarkerSettings):SnapMarkerSettings { - return (obj || new SnapMarkerSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsSnapMarkerSettings(bb:flatbuffers.ByteBuffer, obj?:SnapMarkerSettings):SnapMarkerSettings { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new SnapMarkerSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -enabled():boolean { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -size():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -duration():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -styles(index: number, obj?:SnapMarkerStyleEntry):SnapMarkerStyleEntry|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new SnapMarkerStyleEntry()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -stylesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -static startSnapMarkerSettings(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addEnabled(builder:flatbuffers.Builder, enabled:boolean) { - builder.addFieldInt8(0, +enabled, +false); -} - -static addSize(builder:flatbuffers.Builder, size:number) { - builder.addFieldInt32(1, size, 0); -} - -static addDuration(builder:flatbuffers.Builder, duration:number) { - builder.addFieldInt32(2, duration, 0); -} - -static addStyles(builder:flatbuffers.Builder, stylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, stylesOffset, 0); -} - -static createStylesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startStylesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static endSnapMarkerSettings(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createSnapMarkerSettings(builder:flatbuffers.Builder, enabled:boolean, size:number, duration:number, stylesOffset:flatbuffers.Offset):flatbuffers.Offset { - SnapMarkerSettings.startSnapMarkerSettings(builder); - SnapMarkerSettings.addEnabled(builder, enabled); - SnapMarkerSettings.addSize(builder, size); - SnapMarkerSettings.addDuration(builder, duration); - SnapMarkerSettings.addStyles(builder, stylesOffset); - return SnapMarkerSettings.endSnapMarkerSettings(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/snap-marker-shape.ts b/packages/ducjs/src/flatbuffers/duc/snap-marker-shape.ts deleted file mode 100644 index c8fc70a5..00000000 --- a/packages/ducjs/src/flatbuffers/duc/snap-marker-shape.ts +++ /dev/null @@ -1,10 +0,0 @@ -// 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 */ - -export enum SNAP_MARKER_SHAPE { - SQUARE = 10, - CIRCLE = 11, - TRIANGLE = 12, - X = 13 -} diff --git a/packages/ducjs/src/flatbuffers/duc/snap-marker-style-entry.ts b/packages/ducjs/src/flatbuffers/duc/snap-marker-style-entry.ts deleted file mode 100644 index 8b11e3b3..00000000 --- a/packages/ducjs/src/flatbuffers/duc/snap-marker-style-entry.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { OBJECT_SNAP_MODE } from '../duc/object-snap-mode'; -import { SnapMarkerStyle } from '../duc/snap-marker-style'; - - -export class SnapMarkerStyleEntry { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):SnapMarkerStyleEntry { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsSnapMarkerStyleEntry(bb:flatbuffers.ByteBuffer, obj?:SnapMarkerStyleEntry):SnapMarkerStyleEntry { - return (obj || new SnapMarkerStyleEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsSnapMarkerStyleEntry(bb:flatbuffers.ByteBuffer, obj?:SnapMarkerStyleEntry):SnapMarkerStyleEntry { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new SnapMarkerStyleEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -key():OBJECT_SNAP_MODE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -value(obj?:SnapMarkerStyle):SnapMarkerStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new SnapMarkerStyle()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startSnapMarkerStyleEntry(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addKey(builder:flatbuffers.Builder, key:OBJECT_SNAP_MODE) { - builder.addFieldInt8(0, key, null); -} - -static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, valueOffset, 0); -} - -static endSnapMarkerStyleEntry(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/snap-marker-style.ts b/packages/ducjs/src/flatbuffers/duc/snap-marker-style.ts deleted file mode 100644 index 241c925b..00000000 --- a/packages/ducjs/src/flatbuffers/duc/snap-marker-style.ts +++ /dev/null @@ -1,64 +0,0 @@ -// 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 { SNAP_MARKER_SHAPE } from '../duc/snap-marker-shape'; - - -export class SnapMarkerStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):SnapMarkerStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsSnapMarkerStyle(bb:flatbuffers.ByteBuffer, obj?:SnapMarkerStyle):SnapMarkerStyle { - return (obj || new SnapMarkerStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsSnapMarkerStyle(bb:flatbuffers.ByteBuffer, obj?:SnapMarkerStyle):SnapMarkerStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new SnapMarkerStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -shape():SNAP_MARKER_SHAPE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -color():string|null -color(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -color(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startSnapMarkerStyle(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addShape(builder:flatbuffers.Builder, shape:SNAP_MARKER_SHAPE) { - builder.addFieldInt8(0, shape, null); -} - -static addColor(builder:flatbuffers.Builder, colorOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, colorOffset, 0); -} - -static endSnapMarkerStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createSnapMarkerStyle(builder:flatbuffers.Builder, shape:SNAP_MARKER_SHAPE|null, colorOffset:flatbuffers.Offset):flatbuffers.Offset { - SnapMarkerStyle.startSnapMarkerStyle(builder); - if (shape !== null) - SnapMarkerStyle.addShape(builder, shape); - SnapMarkerStyle.addColor(builder, colorOffset); - return SnapMarkerStyle.endSnapMarkerStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/snap-mode.ts b/packages/ducjs/src/flatbuffers/duc/snap-mode.ts deleted file mode 100644 index 9195b5b6..00000000 --- a/packages/ducjs/src/flatbuffers/duc/snap-mode.ts +++ /dev/null @@ -1,8 +0,0 @@ -// 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 */ - -export enum SNAP_MODE { - RUNNING = 10, - SINGLE = 11 -} diff --git a/packages/ducjs/src/flatbuffers/duc/snap-override-behavior.ts b/packages/ducjs/src/flatbuffers/duc/snap-override-behavior.ts deleted file mode 100644 index 06ddad9b..00000000 --- a/packages/ducjs/src/flatbuffers/duc/snap-override-behavior.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum SNAP_OVERRIDE_BEHAVIOR { - DISABLE = 10, - FORCE_GRID = 11, - FORCE_OBJECT = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/snap-override.ts b/packages/ducjs/src/flatbuffers/duc/snap-override.ts deleted file mode 100644 index bf21dde6..00000000 --- a/packages/ducjs/src/flatbuffers/duc/snap-override.ts +++ /dev/null @@ -1,64 +0,0 @@ -// 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 { SNAP_OVERRIDE_BEHAVIOR } from '../duc/snap-override-behavior'; - - -export class SnapOverride { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):SnapOverride { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsSnapOverride(bb:flatbuffers.ByteBuffer, obj?:SnapOverride):SnapOverride { - return (obj || new SnapOverride()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsSnapOverride(bb:flatbuffers.ByteBuffer, obj?:SnapOverride):SnapOverride { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new SnapOverride()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -key():string|null -key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -key(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -behavior():SNAP_OVERRIDE_BEHAVIOR|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startSnapOverride(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, keyOffset, 0); -} - -static addBehavior(builder:flatbuffers.Builder, behavior:SNAP_OVERRIDE_BEHAVIOR) { - builder.addFieldInt8(1, behavior, null); -} - -static endSnapOverride(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createSnapOverride(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset, behavior:SNAP_OVERRIDE_BEHAVIOR|null):flatbuffers.Offset { - SnapOverride.startSnapOverride(builder); - SnapOverride.addKey(builder, keyOffset); - if (behavior !== null) - SnapOverride.addBehavior(builder, behavior); - return SnapOverride.endSnapOverride(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/snap-settings.ts b/packages/ducjs/src/flatbuffers/duc/snap-settings.ts deleted file mode 100644 index d2941825..00000000 --- a/packages/ducjs/src/flatbuffers/duc/snap-settings.ts +++ /dev/null @@ -1,313 +0,0 @@ -// 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 { OBJECT_SNAP_MODE } from '../duc/object-snap-mode'; -import { PolarTrackingSettings } from '../duc/polar-tracking-settings'; -import { SNAP_MODE } from '../duc/snap-mode'; -import { SnapMarkerSettings } from '../duc/snap-marker-settings'; -import { SnapOverride } from '../duc/snap-override'; -import { TrackingLineStyle } from '../duc/tracking-line-style'; - - -export class SnapSettings { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):SnapSettings { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsSnapSettings(bb:flatbuffers.ByteBuffer, obj?:SnapSettings):SnapSettings { - return (obj || new SnapSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsSnapSettings(bb:flatbuffers.ByteBuffer, obj?:SnapSettings):SnapSettings { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new SnapSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -readonly():boolean { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -twistAngle():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -snapTolerance():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -objectSnapAperture():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -isOrthoModeOn():boolean { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -polarTracking(obj?:PolarTrackingSettings):PolarTrackingSettings|null { - 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():boolean { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -activeObjectSnapModes(index: number):OBJECT_SNAP_MODE|null { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; -} - -activeObjectSnapModesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -activeObjectSnapModesArray():Uint8Array|null { - 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: number):OBJECT_SNAP_MODE|null { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; -} - -snapPriorityLength():number { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -snapPriorityArray():Uint8Array|null { - 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():boolean { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -trackingLineStyle(obj?:TrackingLineStyle):TrackingLineStyle|null { - 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?:DynamicSnapSettings):DynamicSnapSettings|null { - 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: number, obj?:SnapOverride):SnapOverride|null { - 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():number { - const offset = this.bb!.__offset(this.bb_pos, 28); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -incrementalDistance():number { - const offset = this.bb!.__offset(this.bb_pos, 30); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -magneticStrength():number { - const offset = this.bb!.__offset(this.bb_pos, 32); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -layerSnapFilters(obj?:LayerSnapFilters):LayerSnapFilters|null { - 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: number):string -elementTypeFilters(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -elementTypeFilters(index: number,optionalEncoding?:any):string|Uint8Array|null { - 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():number { - const offset = this.bb!.__offset(this.bb_pos, 36); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -snapMode():SNAP_MODE|null { - const offset = this.bb!.__offset(this.bb_pos, 38); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -snapMarkers(obj?:SnapMarkerSettings):SnapMarkerSettings|null { - 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():boolean { - const offset = this.bb!.__offset(this.bb_pos, 42); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -snapToGridIntersections():boolean { - const offset = this.bb!.__offset(this.bb_pos, 44); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static startSnapSettings(builder:flatbuffers.Builder) { - builder.startObject(21); -} - -static addReadonly(builder:flatbuffers.Builder, readonly:boolean) { - builder.addFieldInt8(0, +readonly, +false); -} - -static addTwistAngle(builder:flatbuffers.Builder, twistAngle:number) { - builder.addFieldFloat64(1, twistAngle, 0.0); -} - -static addSnapTolerance(builder:flatbuffers.Builder, snapTolerance:number) { - builder.addFieldInt32(2, snapTolerance, 0); -} - -static addObjectSnapAperture(builder:flatbuffers.Builder, objectSnapAperture:number) { - builder.addFieldInt32(3, objectSnapAperture, 0); -} - -static addIsOrthoModeOn(builder:flatbuffers.Builder, isOrthoModeOn:boolean) { - builder.addFieldInt8(4, +isOrthoModeOn, +false); -} - -static addPolarTracking(builder:flatbuffers.Builder, polarTrackingOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, polarTrackingOffset, 0); -} - -static addIsObjectSnapOn(builder:flatbuffers.Builder, isObjectSnapOn:boolean) { - builder.addFieldInt8(6, +isObjectSnapOn, +false); -} - -static addActiveObjectSnapModes(builder:flatbuffers.Builder, activeObjectSnapModesOffset:flatbuffers.Offset) { - builder.addFieldOffset(7, activeObjectSnapModesOffset, 0); -} - -static createActiveObjectSnapModesVector(builder:flatbuffers.Builder, data:OBJECT_SNAP_MODE[]):flatbuffers.Offset { - 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:flatbuffers.Builder, numElems:number) { - builder.startVector(1, numElems, 1); -} - -static addSnapPriority(builder:flatbuffers.Builder, snapPriorityOffset:flatbuffers.Offset) { - builder.addFieldOffset(8, snapPriorityOffset, 0); -} - -static createSnapPriorityVector(builder:flatbuffers.Builder, data:OBJECT_SNAP_MODE[]):flatbuffers.Offset { - 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:flatbuffers.Builder, numElems:number) { - builder.startVector(1, numElems, 1); -} - -static addShowTrackingLines(builder:flatbuffers.Builder, showTrackingLines:boolean) { - builder.addFieldInt8(9, +showTrackingLines, +false); -} - -static addTrackingLineStyle(builder:flatbuffers.Builder, trackingLineStyleOffset:flatbuffers.Offset) { - builder.addFieldOffset(10, trackingLineStyleOffset, 0); -} - -static addDynamicSnap(builder:flatbuffers.Builder, dynamicSnapOffset:flatbuffers.Offset) { - builder.addFieldOffset(11, dynamicSnapOffset, 0); -} - -static addTemporaryOverrides(builder:flatbuffers.Builder, temporaryOverridesOffset:flatbuffers.Offset) { - builder.addFieldOffset(12, temporaryOverridesOffset, 0); -} - -static createTemporaryOverridesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - 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:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addIncrementalDistance(builder:flatbuffers.Builder, incrementalDistance:number) { - builder.addFieldFloat64(13, incrementalDistance, 0.0); -} - -static addMagneticStrength(builder:flatbuffers.Builder, magneticStrength:number) { - builder.addFieldFloat64(14, magneticStrength, 0.0); -} - -static addLayerSnapFilters(builder:flatbuffers.Builder, layerSnapFiltersOffset:flatbuffers.Offset) { - builder.addFieldOffset(15, layerSnapFiltersOffset, 0); -} - -static addElementTypeFilters(builder:flatbuffers.Builder, elementTypeFiltersOffset:flatbuffers.Offset) { - builder.addFieldOffset(16, elementTypeFiltersOffset, 0); -} - -static createElementTypeFiltersVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - 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:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addSnapMode(builder:flatbuffers.Builder, snapMode:SNAP_MODE) { - builder.addFieldInt8(17, snapMode, null); -} - -static addSnapMarkers(builder:flatbuffers.Builder, snapMarkersOffset:flatbuffers.Offset) { - builder.addFieldOffset(18, snapMarkersOffset, 0); -} - -static addConstructionSnapEnabled(builder:flatbuffers.Builder, constructionSnapEnabled:boolean) { - builder.addFieldInt8(19, +constructionSnapEnabled, +false); -} - -static addSnapToGridIntersections(builder:flatbuffers.Builder, snapToGridIntersections:boolean) { - builder.addFieldInt8(20, +snapToGridIntersections, +false); -} - -static endSnapSettings(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/stack-format-properties.ts b/packages/ducjs/src/flatbuffers/duc/stack-format-properties.ts deleted file mode 100644 index 6859fac8..00000000 --- a/packages/ducjs/src/flatbuffers/duc/stack-format-properties.ts +++ /dev/null @@ -1,72 +0,0 @@ -// 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 { STACKED_TEXT_ALIGN } from '../duc/stacked-text-align'; - - -export class StackFormatProperties { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):StackFormatProperties { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsStackFormatProperties(bb:flatbuffers.ByteBuffer, obj?:StackFormatProperties):StackFormatProperties { - return (obj || new StackFormatProperties()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsStackFormatProperties(bb:flatbuffers.ByteBuffer, obj?:StackFormatProperties):StackFormatProperties { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new StackFormatProperties()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -upperScale():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -lowerScale():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -alignment():STACKED_TEXT_ALIGN|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startStackFormatProperties(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addUpperScale(builder:flatbuffers.Builder, upperScale:number) { - builder.addFieldFloat64(0, upperScale, 0.0); -} - -static addLowerScale(builder:flatbuffers.Builder, lowerScale:number) { - builder.addFieldFloat64(1, lowerScale, 0.0); -} - -static addAlignment(builder:flatbuffers.Builder, alignment:STACKED_TEXT_ALIGN) { - builder.addFieldInt8(2, alignment, null); -} - -static endStackFormatProperties(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createStackFormatProperties(builder:flatbuffers.Builder, upperScale:number, lowerScale:number, alignment:STACKED_TEXT_ALIGN|null):flatbuffers.Offset { - StackFormatProperties.startStackFormatProperties(builder); - StackFormatProperties.addUpperScale(builder, upperScale); - StackFormatProperties.addLowerScale(builder, lowerScale); - if (alignment !== null) - StackFormatProperties.addAlignment(builder, alignment); - return StackFormatProperties.endStackFormatProperties(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/stack-format.ts b/packages/ducjs/src/flatbuffers/duc/stack-format.ts deleted file mode 100644 index 75a7b014..00000000 --- a/packages/ducjs/src/flatbuffers/duc/stack-format.ts +++ /dev/null @@ -1,83 +0,0 @@ -// 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 { StackFormatProperties } from '../duc/stack-format-properties'; - - -export class StackFormat { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):StackFormat { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsStackFormat(bb:flatbuffers.ByteBuffer, obj?:StackFormat):StackFormat { - return (obj || new StackFormat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsStackFormat(bb:flatbuffers.ByteBuffer, obj?:StackFormat):StackFormat { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new StackFormat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -autoStack():boolean { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -stackChars(index: number):string -stackChars(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -stackChars(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -stackCharsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -properties(obj?:StackFormatProperties):StackFormatProperties|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new StackFormatProperties()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startStackFormat(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addAutoStack(builder:flatbuffers.Builder, autoStack:boolean) { - builder.addFieldInt8(0, +autoStack, +false); -} - -static addStackChars(builder:flatbuffers.Builder, stackCharsOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, stackCharsOffset, 0); -} - -static createStackCharsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startStackCharsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addProperties(builder:flatbuffers.Builder, propertiesOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, propertiesOffset, 0); -} - -static endStackFormat(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/stacked-text-align.ts b/packages/ducjs/src/flatbuffers/duc/stacked-text-align.ts deleted file mode 100644 index 51b6f814..00000000 --- a/packages/ducjs/src/flatbuffers/duc/stacked-text-align.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum STACKED_TEXT_ALIGN { - CENTER = 10, - DECIMAL = 11, - SLASH = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/standard-overrides.ts b/packages/ducjs/src/flatbuffers/duc/standard-overrides.ts deleted file mode 100644 index 3eb1e63d..00000000 --- a/packages/ducjs/src/flatbuffers/duc/standard-overrides.ts +++ /dev/null @@ -1,237 +0,0 @@ -// 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 { UnitPrecision } from '../duc/unit-precision'; - - -export class StandardOverrides { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):StandardOverrides { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsStandardOverrides(bb:flatbuffers.ByteBuffer, obj?:StandardOverrides):StandardOverrides { - return (obj || new StandardOverrides()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsStandardOverrides(bb:flatbuffers.ByteBuffer, obj?:StandardOverrides):StandardOverrides { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new StandardOverrides()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -mainScope():string|null -mainScope(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -mainScope(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -elementsStrokeWidthOverride():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -commonStyleId():string|null -commonStyleId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -commonStyleId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -stackLikeStyleId():string|null -stackLikeStyleId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -stackLikeStyleId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -textStyleId():string|null -textStyleId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -textStyleId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -dimensionStyleId():string|null -dimensionStyleId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -dimensionStyleId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -leaderStyleId():string|null -leaderStyleId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -leaderStyleId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -featureControlFrameStyleId():string|null -featureControlFrameStyleId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -featureControlFrameStyleId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -tableStyleId():string|null -tableStyleId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -tableStyleId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -docStyleId():string|null -docStyleId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -docStyleId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -viewportStyleId():string|null -viewportStyleId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -viewportStyleId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 24); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -plotStyleId():string|null -plotStyleId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -plotStyleId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 26); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -hatchStyleId():string|null -hatchStyleId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -hatchStyleId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 28); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -activeGridSettingsId(index: number):string -activeGridSettingsId(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array -activeGridSettingsId(index: number,optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 30); - return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; -} - -activeGridSettingsIdLength():number { - const offset = this.bb!.__offset(this.bb_pos, 30); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -activeSnapSettingsId():string|null -activeSnapSettingsId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -activeSnapSettingsId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 32); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -dashLineOverride():string|null -dashLineOverride(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -dashLineOverride(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 34); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -unitPrecision(obj?:UnitPrecision):UnitPrecision|null { - const offset = this.bb!.__offset(this.bb_pos, 36); - return offset ? (obj || new UnitPrecision()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startStandardOverrides(builder:flatbuffers.Builder) { - builder.startObject(17); -} - -static addMainScope(builder:flatbuffers.Builder, mainScopeOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, mainScopeOffset, 0); -} - -static addElementsStrokeWidthOverride(builder:flatbuffers.Builder, elementsStrokeWidthOverride:number) { - builder.addFieldFloat64(1, elementsStrokeWidthOverride, 0.0); -} - -static addCommonStyleId(builder:flatbuffers.Builder, commonStyleIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, commonStyleIdOffset, 0); -} - -static addStackLikeStyleId(builder:flatbuffers.Builder, stackLikeStyleIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, stackLikeStyleIdOffset, 0); -} - -static addTextStyleId(builder:flatbuffers.Builder, textStyleIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, textStyleIdOffset, 0); -} - -static addDimensionStyleId(builder:flatbuffers.Builder, dimensionStyleIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, dimensionStyleIdOffset, 0); -} - -static addLeaderStyleId(builder:flatbuffers.Builder, leaderStyleIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, leaderStyleIdOffset, 0); -} - -static addFeatureControlFrameStyleId(builder:flatbuffers.Builder, featureControlFrameStyleIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(7, featureControlFrameStyleIdOffset, 0); -} - -static addTableStyleId(builder:flatbuffers.Builder, tableStyleIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(8, tableStyleIdOffset, 0); -} - -static addDocStyleId(builder:flatbuffers.Builder, docStyleIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(9, docStyleIdOffset, 0); -} - -static addViewportStyleId(builder:flatbuffers.Builder, viewportStyleIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(10, viewportStyleIdOffset, 0); -} - -static addPlotStyleId(builder:flatbuffers.Builder, plotStyleIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(11, plotStyleIdOffset, 0); -} - -static addHatchStyleId(builder:flatbuffers.Builder, hatchStyleIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(12, hatchStyleIdOffset, 0); -} - -static addActiveGridSettingsId(builder:flatbuffers.Builder, activeGridSettingsIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(13, activeGridSettingsIdOffset, 0); -} - -static createActiveGridSettingsIdVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startActiveGridSettingsIdVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addActiveSnapSettingsId(builder:flatbuffers.Builder, activeSnapSettingsIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(14, activeSnapSettingsIdOffset, 0); -} - -static addDashLineOverride(builder:flatbuffers.Builder, dashLineOverrideOffset:flatbuffers.Offset) { - builder.addFieldOffset(15, dashLineOverrideOffset, 0); -} - -static addUnitPrecision(builder:flatbuffers.Builder, unitPrecisionOffset:flatbuffers.Offset) { - builder.addFieldOffset(16, unitPrecisionOffset, 0); -} - -static endStandardOverrides(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/standard-styles.ts b/packages/ducjs/src/flatbuffers/duc/standard-styles.ts deleted file mode 100644 index 5bc6d959..00000000 --- a/packages/ducjs/src/flatbuffers/duc/standard-styles.ts +++ /dev/null @@ -1,348 +0,0 @@ -// 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 { IdentifiedCommonStyle } from '../duc/identified-common-style'; -import { IdentifiedDimensionStyle } from '../duc/identified-dimension-style'; -import { IdentifiedDocStyle } from '../duc/identified-doc-style'; -import { IdentifiedFCFStyle } from '../duc/identified-fcfstyle'; -import { IdentifiedHatchStyle } from '../duc/identified-hatch-style'; -import { IdentifiedLeaderStyle } from '../duc/identified-leader-style'; -import { IdentifiedStackLikeStyle } from '../duc/identified-stack-like-style'; -import { IdentifiedTableStyle } from '../duc/identified-table-style'; -import { IdentifiedTextStyle } from '../duc/identified-text-style'; -import { IdentifiedViewportStyle } from '../duc/identified-viewport-style'; -import { IdentifiedXRayStyle } from '../duc/identified-xray-style'; - - -export class StandardStyles { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):StandardStyles { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsStandardStyles(bb:flatbuffers.ByteBuffer, obj?:StandardStyles):StandardStyles { - return (obj || new StandardStyles()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsStandardStyles(bb:flatbuffers.ByteBuffer, obj?:StandardStyles):StandardStyles { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new StandardStyles()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -commonStyles(index: number, obj?:IdentifiedCommonStyle):IdentifiedCommonStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new IdentifiedCommonStyle()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -commonStylesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -stackLikeStyles(index: number, obj?:IdentifiedStackLikeStyle):IdentifiedStackLikeStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new IdentifiedStackLikeStyle()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -stackLikeStylesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -textStyles(index: number, obj?:IdentifiedTextStyle):IdentifiedTextStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new IdentifiedTextStyle()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -textStylesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -dimensionStyles(index: number, obj?:IdentifiedDimensionStyle):IdentifiedDimensionStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new IdentifiedDimensionStyle()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -dimensionStylesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -leaderStyles(index: number, obj?:IdentifiedLeaderStyle):IdentifiedLeaderStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new IdentifiedLeaderStyle()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -leaderStylesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -featureControlFrameStyles(index: number, obj?:IdentifiedFCFStyle):IdentifiedFCFStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new IdentifiedFCFStyle()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -featureControlFrameStylesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -tableStyles(index: number, obj?:IdentifiedTableStyle):IdentifiedTableStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? (obj || new IdentifiedTableStyle()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -tableStylesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -docStyles(index: number, obj?:IdentifiedDocStyle):IdentifiedDocStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? (obj || new IdentifiedDocStyle()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -docStylesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -viewportStyles(index: number, obj?:IdentifiedViewportStyle):IdentifiedViewportStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? (obj || new IdentifiedViewportStyle()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -viewportStylesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 20); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -hatchStyles(index: number, obj?:IdentifiedHatchStyle):IdentifiedHatchStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? (obj || new IdentifiedHatchStyle()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -hatchStylesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 22); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -xrayStyles(index: number, obj?:IdentifiedXRayStyle):IdentifiedXRayStyle|null { - const offset = this.bb!.__offset(this.bb_pos, 24); - return offset ? (obj || new IdentifiedXRayStyle()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -xrayStylesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 24); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -static startStandardStyles(builder:flatbuffers.Builder) { - builder.startObject(11); -} - -static addCommonStyles(builder:flatbuffers.Builder, commonStylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, commonStylesOffset, 0); -} - -static createCommonStylesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startCommonStylesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addStackLikeStyles(builder:flatbuffers.Builder, stackLikeStylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, stackLikeStylesOffset, 0); -} - -static createStackLikeStylesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startStackLikeStylesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addTextStyles(builder:flatbuffers.Builder, textStylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, textStylesOffset, 0); -} - -static createTextStylesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startTextStylesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addDimensionStyles(builder:flatbuffers.Builder, dimensionStylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, dimensionStylesOffset, 0); -} - -static createDimensionStylesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startDimensionStylesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addLeaderStyles(builder:flatbuffers.Builder, leaderStylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, leaderStylesOffset, 0); -} - -static createLeaderStylesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startLeaderStylesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addFeatureControlFrameStyles(builder:flatbuffers.Builder, featureControlFrameStylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, featureControlFrameStylesOffset, 0); -} - -static createFeatureControlFrameStylesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startFeatureControlFrameStylesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addTableStyles(builder:flatbuffers.Builder, tableStylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, tableStylesOffset, 0); -} - -static createTableStylesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startTableStylesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addDocStyles(builder:flatbuffers.Builder, docStylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(7, docStylesOffset, 0); -} - -static createDocStylesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startDocStylesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addViewportStyles(builder:flatbuffers.Builder, viewportStylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(8, viewportStylesOffset, 0); -} - -static createViewportStylesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startViewportStylesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addHatchStyles(builder:flatbuffers.Builder, hatchStylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(9, hatchStylesOffset, 0); -} - -static createHatchStylesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startHatchStylesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addXrayStyles(builder:flatbuffers.Builder, xrayStylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(10, xrayStylesOffset, 0); -} - -static createXrayStylesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startXrayStylesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static endStandardStyles(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createStandardStyles(builder:flatbuffers.Builder, commonStylesOffset:flatbuffers.Offset, stackLikeStylesOffset:flatbuffers.Offset, textStylesOffset:flatbuffers.Offset, dimensionStylesOffset:flatbuffers.Offset, leaderStylesOffset:flatbuffers.Offset, featureControlFrameStylesOffset:flatbuffers.Offset, tableStylesOffset:flatbuffers.Offset, docStylesOffset:flatbuffers.Offset, viewportStylesOffset:flatbuffers.Offset, hatchStylesOffset:flatbuffers.Offset, xrayStylesOffset:flatbuffers.Offset):flatbuffers.Offset { - StandardStyles.startStandardStyles(builder); - StandardStyles.addCommonStyles(builder, commonStylesOffset); - StandardStyles.addStackLikeStyles(builder, stackLikeStylesOffset); - StandardStyles.addTextStyles(builder, textStylesOffset); - StandardStyles.addDimensionStyles(builder, dimensionStylesOffset); - StandardStyles.addLeaderStyles(builder, leaderStylesOffset); - StandardStyles.addFeatureControlFrameStyles(builder, featureControlFrameStylesOffset); - StandardStyles.addTableStyles(builder, tableStylesOffset); - StandardStyles.addDocStyles(builder, docStylesOffset); - StandardStyles.addViewportStyles(builder, viewportStylesOffset); - StandardStyles.addHatchStyles(builder, hatchStylesOffset); - StandardStyles.addXrayStyles(builder, xrayStylesOffset); - return StandardStyles.endStandardStyles(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/standard-units.ts b/packages/ducjs/src/flatbuffers/duc/standard-units.ts deleted file mode 100644 index 4bfb23fa..00000000 --- a/packages/ducjs/src/flatbuffers/duc/standard-units.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { AlternateUnits } from '../duc/alternate-units'; -import { PrimaryUnits } from '../duc/primary-units'; - - -export class StandardUnits { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):StandardUnits { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsStandardUnits(bb:flatbuffers.ByteBuffer, obj?:StandardUnits):StandardUnits { - return (obj || new StandardUnits()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsStandardUnits(bb:flatbuffers.ByteBuffer, obj?:StandardUnits):StandardUnits { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new StandardUnits()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -primaryUnits(obj?:PrimaryUnits):PrimaryUnits|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new PrimaryUnits()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -alternateUnits(obj?:AlternateUnits):AlternateUnits|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new AlternateUnits()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startStandardUnits(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addPrimaryUnits(builder:flatbuffers.Builder, primaryUnitsOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, primaryUnitsOffset, 0); -} - -static addAlternateUnits(builder:flatbuffers.Builder, alternateUnitsOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, alternateUnitsOffset, 0); -} - -static endStandardUnits(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/standard-validation.ts b/packages/ducjs/src/flatbuffers/duc/standard-validation.ts deleted file mode 100644 index 5398e0b4..00000000 --- a/packages/ducjs/src/flatbuffers/duc/standard-validation.ts +++ /dev/null @@ -1,56 +0,0 @@ -// 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 { DimensionValidationRules } from '../duc/dimension-validation-rules'; -import { LayerValidationRules } from '../duc/layer-validation-rules'; - - -export class StandardValidation { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):StandardValidation { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsStandardValidation(bb:flatbuffers.ByteBuffer, obj?:StandardValidation):StandardValidation { - return (obj || new StandardValidation()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsStandardValidation(bb:flatbuffers.ByteBuffer, obj?:StandardValidation):StandardValidation { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new StandardValidation()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -dimensionRules(obj?:DimensionValidationRules):DimensionValidationRules|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new DimensionValidationRules()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -layerRules(obj?:LayerValidationRules):LayerValidationRules|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new LayerValidationRules()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startStandardValidation(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addDimensionRules(builder:flatbuffers.Builder, dimensionRulesOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, dimensionRulesOffset, 0); -} - -static addLayerRules(builder:flatbuffers.Builder, layerRulesOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, layerRulesOffset, 0); -} - -static endStandardValidation(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/standard-view-settings.ts b/packages/ducjs/src/flatbuffers/duc/standard-view-settings.ts deleted file mode 100644 index c484c21f..00000000 --- a/packages/ducjs/src/flatbuffers/duc/standard-view-settings.ts +++ /dev/null @@ -1,152 +0,0 @@ -// 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 { IdentifiedGridSettings } from '../duc/identified-grid-settings'; -import { IdentifiedSnapSettings } from '../duc/identified-snap-settings'; -import { IdentifiedUcs } from '../duc/identified-ucs'; -import { IdentifiedView } from '../duc/identified-view'; - - -export class StandardViewSettings { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):StandardViewSettings { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsStandardViewSettings(bb:flatbuffers.ByteBuffer, obj?:StandardViewSettings):StandardViewSettings { - return (obj || new StandardViewSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsStandardViewSettings(bb:flatbuffers.ByteBuffer, obj?:StandardViewSettings):StandardViewSettings { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new StandardViewSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -views(index: number, obj?:IdentifiedView):IdentifiedView|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new IdentifiedView()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -viewsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -ucs(index: number, obj?:IdentifiedUcs):IdentifiedUcs|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? (obj || new IdentifiedUcs()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -ucsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -gridSettings(index: number, obj?:IdentifiedGridSettings):IdentifiedGridSettings|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new IdentifiedGridSettings()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -gridSettingsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -snapSettings(index: number, obj?:IdentifiedSnapSettings):IdentifiedSnapSettings|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new IdentifiedSnapSettings()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -snapSettingsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -static startStandardViewSettings(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addViews(builder:flatbuffers.Builder, viewsOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, viewsOffset, 0); -} - -static createViewsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startViewsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addUcs(builder:flatbuffers.Builder, ucsOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, ucsOffset, 0); -} - -static createUcsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startUcsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addGridSettings(builder:flatbuffers.Builder, gridSettingsOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, gridSettingsOffset, 0); -} - -static createGridSettingsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startGridSettingsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addSnapSettings(builder:flatbuffers.Builder, snapSettingsOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, snapSettingsOffset, 0); -} - -static createSnapSettingsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startSnapSettingsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static endStandardViewSettings(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createStandardViewSettings(builder:flatbuffers.Builder, viewsOffset:flatbuffers.Offset, ucsOffset:flatbuffers.Offset, gridSettingsOffset:flatbuffers.Offset, snapSettingsOffset:flatbuffers.Offset):flatbuffers.Offset { - StandardViewSettings.startStandardViewSettings(builder); - StandardViewSettings.addViews(builder, viewsOffset); - StandardViewSettings.addUcs(builder, ucsOffset); - StandardViewSettings.addGridSettings(builder, gridSettingsOffset); - StandardViewSettings.addSnapSettings(builder, snapSettingsOffset); - return StandardViewSettings.endStandardViewSettings(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/standard.ts b/packages/ducjs/src/flatbuffers/duc/standard.ts deleted file mode 100644 index 59daf3aa..00000000 --- a/packages/ducjs/src/flatbuffers/duc/standard.ts +++ /dev/null @@ -1,116 +0,0 @@ -// 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 { Identifier } from '../duc/identifier'; -import { StandardOverrides } from '../duc/standard-overrides'; -import { StandardStyles } from '../duc/standard-styles'; -import { StandardUnits } from '../duc/standard-units'; -import { StandardValidation } from '../duc/standard-validation'; -import { StandardViewSettings } from '../duc/standard-view-settings'; - - -export class Standard { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):Standard { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsStandard(bb:flatbuffers.ByteBuffer, obj?:Standard):Standard { - return (obj || new Standard()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsStandard(bb:flatbuffers.ByteBuffer, obj?:Standard):Standard { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new Standard()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -identifier(obj?:Identifier):Identifier|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new Identifier()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -version():string|null -version(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -version(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -readonly():boolean { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -overrides(obj?:StandardOverrides):StandardOverrides|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new StandardOverrides()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -styles(obj?:StandardStyles):StandardStyles|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new StandardStyles()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -viewSettings(obj?:StandardViewSettings):StandardViewSettings|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? (obj || new StandardViewSettings()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -units(obj?:StandardUnits):StandardUnits|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? (obj || new StandardUnits()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -validation(obj?:StandardValidation):StandardValidation|null { - const offset = this.bb!.__offset(this.bb_pos, 18); - return offset ? (obj || new StandardValidation()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startStandard(builder:flatbuffers.Builder) { - builder.startObject(8); -} - -static addIdentifier(builder:flatbuffers.Builder, identifierOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, identifierOffset, 0); -} - -static addVersion(builder:flatbuffers.Builder, versionOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, versionOffset, 0); -} - -static addReadonly(builder:flatbuffers.Builder, readonly:boolean) { - builder.addFieldInt8(2, +readonly, +false); -} - -static addOverrides(builder:flatbuffers.Builder, overridesOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, overridesOffset, 0); -} - -static addStyles(builder:flatbuffers.Builder, stylesOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, stylesOffset, 0); -} - -static addViewSettings(builder:flatbuffers.Builder, viewSettingsOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, viewSettingsOffset, 0); -} - -static addUnits(builder:flatbuffers.Builder, unitsOffset:flatbuffers.Offset) { - builder.addFieldOffset(6, unitsOffset, 0); -} - -static addValidation(builder:flatbuffers.Builder, validationOffset:flatbuffers.Offset) { - builder.addFieldOffset(7, validationOffset, 0); -} - -static endStandard(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/string-value-entry.ts b/packages/ducjs/src/flatbuffers/duc/string-value-entry.ts deleted file mode 100644 index 7bef9451..00000000 --- a/packages/ducjs/src/flatbuffers/duc/string-value-entry.ts +++ /dev/null @@ -1,63 +0,0 @@ -// 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 StringValueEntry { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):StringValueEntry { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsStringValueEntry(bb:flatbuffers.ByteBuffer, obj?:StringValueEntry):StringValueEntry { - return (obj || new StringValueEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsStringValueEntry(bb:flatbuffers.ByteBuffer, obj?:StringValueEntry):StringValueEntry { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new StringValueEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -key():string|null -key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -key(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -value():string|null -value(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -value(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startStringValueEntry(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, keyOffset, 0); -} - -static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, valueOffset, 0); -} - -static endStringValueEntry(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - builder.requiredField(offset, 4) // key - return offset; -} - -static createStringValueEntry(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset, valueOffset:flatbuffers.Offset):flatbuffers.Offset { - StringValueEntry.startStringValueEntry(builder); - StringValueEntry.addKey(builder, keyOffset); - StringValueEntry.addValue(builder, valueOffset); - return StringValueEntry.endStringValueEntry(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/stroke-cap.ts b/packages/ducjs/src/flatbuffers/duc/stroke-cap.ts deleted file mode 100644 index 9f52ae87..00000000 --- a/packages/ducjs/src/flatbuffers/duc/stroke-cap.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum STROKE_CAP { - BUTT = 10, - ROUND = 11, - SQUARE = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/stroke-join.ts b/packages/ducjs/src/flatbuffers/duc/stroke-join.ts deleted file mode 100644 index 573c0959..00000000 --- a/packages/ducjs/src/flatbuffers/duc/stroke-join.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum STROKE_JOIN { - MITER = 10, - ROUND = 11, - BEVEL = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/stroke-placement.ts b/packages/ducjs/src/flatbuffers/duc/stroke-placement.ts deleted file mode 100644 index c797d1aa..00000000 --- a/packages/ducjs/src/flatbuffers/duc/stroke-placement.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum STROKE_PLACEMENT { - INSIDE = 10, - CENTER = 11, - OUTSIDE = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/stroke-preference.ts b/packages/ducjs/src/flatbuffers/duc/stroke-preference.ts deleted file mode 100644 index 623ba349..00000000 --- a/packages/ducjs/src/flatbuffers/duc/stroke-preference.ts +++ /dev/null @@ -1,10 +0,0 @@ -// 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 */ - -export enum STROKE_PREFERENCE { - SOLID = 10, - DASHED = 11, - DOTTED = 12, - CUSTOM = 13 -} diff --git a/packages/ducjs/src/flatbuffers/duc/stroke-side-preference.ts b/packages/ducjs/src/flatbuffers/duc/stroke-side-preference.ts deleted file mode 100644 index 5b10c474..00000000 --- a/packages/ducjs/src/flatbuffers/duc/stroke-side-preference.ts +++ /dev/null @@ -1,12 +0,0 @@ -// 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 */ - -export enum STROKE_SIDE_PREFERENCE { - TOP = 10, - BOTTOM = 11, - LEFT = 12, - RIGHT = 13, - CUSTOM = 14, - ALL = 15 -} diff --git a/packages/ducjs/src/flatbuffers/duc/stroke-sides.ts b/packages/ducjs/src/flatbuffers/duc/stroke-sides.ts deleted file mode 100644 index b9ed99c5..00000000 --- a/packages/ducjs/src/flatbuffers/duc/stroke-sides.ts +++ /dev/null @@ -1,89 +0,0 @@ -// 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 { STROKE_SIDE_PREFERENCE } from '../duc/stroke-side-preference'; - - -export class StrokeSides { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):StrokeSides { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsStrokeSides(bb:flatbuffers.ByteBuffer, obj?:StrokeSides):StrokeSides { - return (obj || new StrokeSides()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsStrokeSides(bb:flatbuffers.ByteBuffer, obj?:StrokeSides):StrokeSides { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new StrokeSides()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -preference():STROKE_SIDE_PREFERENCE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -values(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0; -} - -valuesLength():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -valuesArray():Float64Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - 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 startStrokeSides(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addPreference(builder:flatbuffers.Builder, preference:STROKE_SIDE_PREFERENCE) { - builder.addFieldInt8(0, preference, null); -} - -static addValues(builder:flatbuffers.Builder, valuesOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, valuesOffset, 0); -} - -static createValuesVector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset; -/** - * @deprecated This Uint8Array overload will be removed in the future. - */ -static createValuesVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; -static createValuesVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset { - builder.startVector(8, data.length, 8); - for (let i = data.length - 1; i >= 0; i--) { - builder.addFloat64(data[i]!); - } - return builder.endVector(); -} - -static startValuesVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(8, numElems, 8); -} - -static endStrokeSides(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createStrokeSides(builder:flatbuffers.Builder, preference:STROKE_SIDE_PREFERENCE|null, valuesOffset:flatbuffers.Offset):flatbuffers.Offset { - StrokeSides.startStrokeSides(builder); - if (preference !== null) - StrokeSides.addPreference(builder, preference); - StrokeSides.addValues(builder, valuesOffset); - return StrokeSides.endStrokeSides(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/stroke-style.ts b/packages/ducjs/src/flatbuffers/duc/stroke-style.ts deleted file mode 100644 index cf3f33a5..00000000 --- a/packages/ducjs/src/flatbuffers/duc/stroke-style.ts +++ /dev/null @@ -1,147 +0,0 @@ -// 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 { STROKE_CAP } from '../duc/stroke-cap'; -import { STROKE_JOIN } from '../duc/stroke-join'; -import { STROKE_PREFERENCE } from '../duc/stroke-preference'; - - -export class StrokeStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):StrokeStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsStrokeStyle(bb:flatbuffers.ByteBuffer, obj?:StrokeStyle):StrokeStyle { - return (obj || new StrokeStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsStrokeStyle(bb:flatbuffers.ByteBuffer, obj?:StrokeStyle):StrokeStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new StrokeStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -preference():STROKE_PREFERENCE|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -cap():STROKE_CAP|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -join():STROKE_JOIN|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -dash(index: number):number|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0; -} - -dashLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -dashArray():Float64Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - 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; -} - -dashLineOverride():string|null -dashLineOverride(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -dashLineOverride(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -dashCap():STROKE_CAP|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -miterLimit():number|null { - const offset = this.bb!.__offset(this.bb_pos, 16); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : null; -} - -static startStrokeStyle(builder:flatbuffers.Builder) { - builder.startObject(7); -} - -static addPreference(builder:flatbuffers.Builder, preference:STROKE_PREFERENCE) { - builder.addFieldInt8(0, preference, null); -} - -static addCap(builder:flatbuffers.Builder, cap:STROKE_CAP) { - builder.addFieldInt8(1, cap, null); -} - -static addJoin(builder:flatbuffers.Builder, join:STROKE_JOIN) { - builder.addFieldInt8(2, join, null); -} - -static addDash(builder:flatbuffers.Builder, dashOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, dashOffset, 0); -} - -static createDashVector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset; -/** - * @deprecated This Uint8Array overload will be removed in the future. - */ -static createDashVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; -static createDashVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset { - builder.startVector(8, data.length, 8); - for (let i = data.length - 1; i >= 0; i--) { - builder.addFloat64(data[i]!); - } - return builder.endVector(); -} - -static startDashVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(8, numElems, 8); -} - -static addDashLineOverride(builder:flatbuffers.Builder, dashLineOverrideOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, dashLineOverrideOffset, 0); -} - -static addDashCap(builder:flatbuffers.Builder, dashCap:STROKE_CAP) { - builder.addFieldInt8(5, dashCap, null); -} - -static addMiterLimit(builder:flatbuffers.Builder, miterLimit:number) { - builder.addFieldFloat64(6, miterLimit, null); -} - -static endStrokeStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createStrokeStyle(builder:flatbuffers.Builder, preference:STROKE_PREFERENCE|null, cap:STROKE_CAP|null, join:STROKE_JOIN|null, dashOffset:flatbuffers.Offset, dashLineOverrideOffset:flatbuffers.Offset, dashCap:STROKE_CAP|null, miterLimit:number|null):flatbuffers.Offset { - StrokeStyle.startStrokeStyle(builder); - if (preference !== null) - StrokeStyle.addPreference(builder, preference); - if (cap !== null) - StrokeStyle.addCap(builder, cap); - if (join !== null) - StrokeStyle.addJoin(builder, join); - StrokeStyle.addDash(builder, dashOffset); - StrokeStyle.addDashLineOverride(builder, dashLineOverrideOffset); - if (dashCap !== null) - StrokeStyle.addDashCap(builder, dashCap); - if (miterLimit !== null) - StrokeStyle.addMiterLimit(builder, miterLimit); - return StrokeStyle.endStrokeStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/stroke-width.ts b/packages/ducjs/src/flatbuffers/duc/stroke-width.ts deleted file mode 100644 index 3d9ae3a4..00000000 --- a/packages/ducjs/src/flatbuffers/duc/stroke-width.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum STROKE_WIDTH { - THIN = 1, - BOLD = 2, - EXTRA_BOLD = 4 -} diff --git a/packages/ducjs/src/flatbuffers/duc/table-cell-alignment.ts b/packages/ducjs/src/flatbuffers/duc/table-cell-alignment.ts deleted file mode 100644 index bf073453..00000000 --- a/packages/ducjs/src/flatbuffers/duc/table-cell-alignment.ts +++ /dev/null @@ -1,15 +0,0 @@ -// 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 */ - -export enum TABLE_CELL_ALIGNMENT { - TOP_LEFT = 10, - TOP_CENTER = 11, - TOP_RIGHT = 12, - MIDDLE_LEFT = 13, - MIDDLE_CENTER = 14, - MIDDLE_RIGHT = 15, - BOTTOM_LEFT = 16, - BOTTOM_CENTER = 17, - BOTTOM_RIGHT = 18 -} diff --git a/packages/ducjs/src/flatbuffers/duc/table-flow-direction.ts b/packages/ducjs/src/flatbuffers/duc/table-flow-direction.ts deleted file mode 100644 index 1f04ee0b..00000000 --- a/packages/ducjs/src/flatbuffers/duc/table-flow-direction.ts +++ /dev/null @@ -1,8 +0,0 @@ -// 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 */ - -export enum TABLE_FLOW_DIRECTION { - DOWN = 10, - UP = 11 -} diff --git a/packages/ducjs/src/flatbuffers/duc/text-align.ts b/packages/ducjs/src/flatbuffers/duc/text-align.ts deleted file mode 100644 index adac9536..00000000 --- a/packages/ducjs/src/flatbuffers/duc/text-align.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum TEXT_ALIGN { - LEFT = 10, - CENTER = 11, - RIGHT = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/text-column.ts b/packages/ducjs/src/flatbuffers/duc/text-column.ts deleted file mode 100644 index 31bddf9b..00000000 --- a/packages/ducjs/src/flatbuffers/duc/text-column.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 TextColumn { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):TextColumn { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsTextColumn(bb:flatbuffers.ByteBuffer, obj?:TextColumn):TextColumn { - return (obj || new TextColumn()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsTextColumn(bb:flatbuffers.ByteBuffer, obj?:TextColumn):TextColumn { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new TextColumn()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -width():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -gutter():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -static startTextColumn(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addWidth(builder:flatbuffers.Builder, width:number) { - builder.addFieldFloat64(0, width, 0.0); -} - -static addGutter(builder:flatbuffers.Builder, gutter:number) { - builder.addFieldFloat64(1, gutter, 0.0); -} - -static endTextColumn(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createTextColumn(builder:flatbuffers.Builder, width:number, gutter:number):flatbuffers.Offset { - TextColumn.startTextColumn(builder); - TextColumn.addWidth(builder, width); - TextColumn.addGutter(builder, gutter); - return TextColumn.endTextColumn(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/text-field-source-property.ts b/packages/ducjs/src/flatbuffers/duc/text-field-source-property.ts deleted file mode 100644 index b9fddc21..00000000 --- a/packages/ducjs/src/flatbuffers/duc/text-field-source-property.ts +++ /dev/null @@ -1,17 +0,0 @@ -// 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 */ - -export enum TEXT_FIELD_SOURCE_PROPERTY { - AREA = 10, - PERIMETER = 11, - VOLUME = 12, - LENGTH = 13, - WIDTH = 14, - HEIGHT = 15, - RADIUS = 16, - DIAMETER = 17, - X_COORDINATE = 18, - Y_COORDINATE = 19, - LABEL = 20 -} diff --git a/packages/ducjs/src/flatbuffers/duc/text-field-source-type.ts b/packages/ducjs/src/flatbuffers/duc/text-field-source-type.ts deleted file mode 100644 index f9c907c4..00000000 --- a/packages/ducjs/src/flatbuffers/duc/text-field-source-type.ts +++ /dev/null @@ -1,8 +0,0 @@ -// 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 */ - -export enum TEXT_FIELD_SOURCE_TYPE { - ELEMENT = 10, - DICTIONARY = 20 -} diff --git a/packages/ducjs/src/flatbuffers/duc/text-flow-direction.ts b/packages/ducjs/src/flatbuffers/duc/text-flow-direction.ts deleted file mode 100644 index dd7a5298..00000000 --- a/packages/ducjs/src/flatbuffers/duc/text-flow-direction.ts +++ /dev/null @@ -1,10 +0,0 @@ -// 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 */ - -export enum TEXT_FLOW_DIRECTION { - LEFT_TO_RIGHT = 10, - RIGHT_TO_LEFT = 11, - TOP_TO_BOTTOM = 12, - BOTTOM_TO_TOP = 13 -} diff --git a/packages/ducjs/src/flatbuffers/duc/tiling-properties.ts b/packages/ducjs/src/flatbuffers/duc/tiling-properties.ts deleted file mode 100644 index e4076c9e..00000000 --- a/packages/ducjs/src/flatbuffers/duc/tiling-properties.ts +++ /dev/null @@ -1,91 +0,0 @@ -// 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 TilingProperties { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):TilingProperties { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsTilingProperties(bb:flatbuffers.ByteBuffer, obj?:TilingProperties):TilingProperties { - return (obj || new TilingProperties()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsTilingProperties(bb:flatbuffers.ByteBuffer, obj?:TilingProperties):TilingProperties { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new TilingProperties()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -sizeInPercent():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; -} - -angle():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -spacing():number|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : null; -} - -offsetX():number|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : null; -} - -offsetY():number|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : null; -} - -static startTilingProperties(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addSizeInPercent(builder:flatbuffers.Builder, sizeInPercent:number) { - builder.addFieldFloat32(0, sizeInPercent, 0.0); -} - -static addAngle(builder:flatbuffers.Builder, angle:number) { - builder.addFieldFloat64(1, angle, 0.0); -} - -static addSpacing(builder:flatbuffers.Builder, spacing:number) { - builder.addFieldFloat64(2, spacing, null); -} - -static addOffsetX(builder:flatbuffers.Builder, offsetX:number) { - builder.addFieldFloat64(3, offsetX, null); -} - -static addOffsetY(builder:flatbuffers.Builder, offsetY:number) { - builder.addFieldFloat64(4, offsetY, null); -} - -static endTilingProperties(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createTilingProperties(builder:flatbuffers.Builder, sizeInPercent:number, angle:number, spacing:number|null, offsetX:number|null, offsetY:number|null):flatbuffers.Offset { - TilingProperties.startTilingProperties(builder); - TilingProperties.addSizeInPercent(builder, sizeInPercent); - TilingProperties.addAngle(builder, angle); - if (spacing !== null) - TilingProperties.addSpacing(builder, spacing); - if (offsetX !== null) - TilingProperties.addOffsetX(builder, offsetX); - if (offsetY !== null) - TilingProperties.addOffsetY(builder, offsetY); - return TilingProperties.endTilingProperties(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/tolerance-clause.ts b/packages/ducjs/src/flatbuffers/duc/tolerance-clause.ts deleted file mode 100644 index a5c50705..00000000 --- a/packages/ducjs/src/flatbuffers/duc/tolerance-clause.ts +++ /dev/null @@ -1,109 +0,0 @@ -// 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 { FEATURE_MODIFIER } from '../duc/feature-modifier'; -import { MATERIAL_CONDITION } from '../duc/material-condition'; -import { TOLERANCE_ZONE_TYPE } from '../duc/tolerance-zone-type'; - - -export class ToleranceClause { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):ToleranceClause { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsToleranceClause(bb:flatbuffers.ByteBuffer, obj?:ToleranceClause):ToleranceClause { - return (obj || new ToleranceClause()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsToleranceClause(bb:flatbuffers.ByteBuffer, obj?:ToleranceClause):ToleranceClause { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new ToleranceClause()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -value():string|null -value(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -value(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -zoneType():TOLERANCE_ZONE_TYPE|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -featureModifiers(index: number):FEATURE_MODIFIER|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; -} - -featureModifiersLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -featureModifiersArray():Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - 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; -} - -materialCondition():MATERIAL_CONDITION|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -static startToleranceClause(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, valueOffset, 0); -} - -static addZoneType(builder:flatbuffers.Builder, zoneType:TOLERANCE_ZONE_TYPE) { - builder.addFieldInt8(1, zoneType, null); -} - -static addFeatureModifiers(builder:flatbuffers.Builder, featureModifiersOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, featureModifiersOffset, 0); -} - -static createFeatureModifiersVector(builder:flatbuffers.Builder, data:FEATURE_MODIFIER[]):flatbuffers.Offset { - builder.startVector(1, data.length, 1); - for (let i = data.length - 1; i >= 0; i--) { - builder.addInt8(data[i]!); - } - return builder.endVector(); -} - -static startFeatureModifiersVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(1, numElems, 1); -} - -static addMaterialCondition(builder:flatbuffers.Builder, materialCondition:MATERIAL_CONDITION) { - builder.addFieldInt8(3, materialCondition, null); -} - -static endToleranceClause(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createToleranceClause(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset, zoneType:TOLERANCE_ZONE_TYPE|null, featureModifiersOffset:flatbuffers.Offset, materialCondition:MATERIAL_CONDITION|null):flatbuffers.Offset { - ToleranceClause.startToleranceClause(builder); - ToleranceClause.addValue(builder, valueOffset); - if (zoneType !== null) - ToleranceClause.addZoneType(builder, zoneType); - ToleranceClause.addFeatureModifiers(builder, featureModifiersOffset); - if (materialCondition !== null) - ToleranceClause.addMaterialCondition(builder, materialCondition); - return ToleranceClause.endToleranceClause(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/tolerance-display.ts b/packages/ducjs/src/flatbuffers/duc/tolerance-display.ts deleted file mode 100644 index 24112c33..00000000 --- a/packages/ducjs/src/flatbuffers/duc/tolerance-display.ts +++ /dev/null @@ -1,11 +0,0 @@ -// 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 */ - -export enum TOLERANCE_DISPLAY { - NONE = 10, - SYMMETRICAL = 11, - DEVIATION = 12, - LIMITS = 13, - BASIC = 14 -} diff --git a/packages/ducjs/src/flatbuffers/duc/tolerance-type.ts b/packages/ducjs/src/flatbuffers/duc/tolerance-type.ts deleted file mode 100644 index 5af09003..00000000 --- a/packages/ducjs/src/flatbuffers/duc/tolerance-type.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum TOLERANCE_TYPE { - SINGLE = 10, - COMPOSITE = 11, - MULTIPLE = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/tolerance-zone-type.ts b/packages/ducjs/src/flatbuffers/duc/tolerance-zone-type.ts deleted file mode 100644 index bce48528..00000000 --- a/packages/ducjs/src/flatbuffers/duc/tolerance-zone-type.ts +++ /dev/null @@ -1,11 +0,0 @@ -// 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 */ - -export enum TOLERANCE_ZONE_TYPE { - CYLINDRICAL = 10, - SPHERICAL = 11, - RECTANGULAR = 12, - LINEAR = 13, - CIRCULAR = 14 -} diff --git a/packages/ducjs/src/flatbuffers/duc/tracking-line-style.ts b/packages/ducjs/src/flatbuffers/duc/tracking-line-style.ts deleted file mode 100644 index 2c4ae852..00000000 --- a/packages/ducjs/src/flatbuffers/duc/tracking-line-style.ts +++ /dev/null @@ -1,97 +0,0 @@ -// 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 TrackingLineStyle { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):TrackingLineStyle { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsTrackingLineStyle(bb:flatbuffers.ByteBuffer, obj?:TrackingLineStyle):TrackingLineStyle { - return (obj || new TrackingLineStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsTrackingLineStyle(bb:flatbuffers.ByteBuffer, obj?:TrackingLineStyle):TrackingLineStyle { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new TrackingLineStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -color():string|null -color(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -color(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -opacity():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; -} - -dashPattern(index: number):number|null { - 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():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -dashPatternArray():Float64Array|null { - 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 startTrackingLineStyle(builder:flatbuffers.Builder) { - builder.startObject(3); -} - -static addColor(builder:flatbuffers.Builder, colorOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, colorOffset, 0); -} - -static addOpacity(builder:flatbuffers.Builder, opacity:number) { - builder.addFieldFloat64(1, opacity, 0.0); -} - -static addDashPattern(builder:flatbuffers.Builder, dashPatternOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, dashPatternOffset, 0); -} - -static createDashPatternVector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset; -/** - * @deprecated This Uint8Array overload will be removed in the future. - */ -static createDashPatternVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset; -static createDashPatternVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset { - 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:flatbuffers.Builder, numElems:number) { - builder.startVector(8, numElems, 8); -} - -static endTrackingLineStyle(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createTrackingLineStyle(builder:flatbuffers.Builder, colorOffset:flatbuffers.Offset, opacity:number, dashPatternOffset:flatbuffers.Offset):flatbuffers.Offset { - TrackingLineStyle.startTrackingLineStyle(builder); - TrackingLineStyle.addColor(builder, colorOffset); - TrackingLineStyle.addOpacity(builder, opacity); - TrackingLineStyle.addDashPattern(builder, dashPatternOffset); - return TrackingLineStyle.endTrackingLineStyle(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/unit-precision.ts b/packages/ducjs/src/flatbuffers/duc/unit-precision.ts deleted file mode 100644 index e24e74b2..00000000 --- a/packages/ducjs/src/flatbuffers/duc/unit-precision.ts +++ /dev/null @@ -1,78 +0,0 @@ -// 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 UnitPrecision { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):UnitPrecision { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsUnitPrecision(bb:flatbuffers.ByteBuffer, obj?:UnitPrecision):UnitPrecision { - return (obj || new UnitPrecision()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsUnitPrecision(bb:flatbuffers.ByteBuffer, obj?:UnitPrecision):UnitPrecision { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new UnitPrecision()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -linear():number { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -angular():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -area():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -volume():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -static startUnitPrecision(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addLinear(builder:flatbuffers.Builder, linear:number) { - builder.addFieldInt32(0, linear, 0); -} - -static addAngular(builder:flatbuffers.Builder, angular:number) { - builder.addFieldInt32(1, angular, 0); -} - -static addArea(builder:flatbuffers.Builder, area:number) { - builder.addFieldInt32(2, area, 0); -} - -static addVolume(builder:flatbuffers.Builder, volume:number) { - builder.addFieldInt32(3, volume, 0); -} - -static endUnitPrecision(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createUnitPrecision(builder:flatbuffers.Builder, linear:number, angular:number, area:number, volume:number):flatbuffers.Offset { - UnitPrecision.startUnitPrecision(builder); - UnitPrecision.addLinear(builder, linear); - UnitPrecision.addAngular(builder, angular); - UnitPrecision.addArea(builder, area); - UnitPrecision.addVolume(builder, volume); - return UnitPrecision.endUnitPrecision(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/unit-system-base.ts b/packages/ducjs/src/flatbuffers/duc/unit-system-base.ts deleted file mode 100644 index b962f2f0..00000000 --- a/packages/ducjs/src/flatbuffers/duc/unit-system-base.ts +++ /dev/null @@ -1,82 +0,0 @@ -// 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 { UNIT_SYSTEM } from '../duc/unit-system'; - - -export class _UnitSystemBase { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):_UnitSystemBase { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAs_UnitSystemBase(bb:flatbuffers.ByteBuffer, obj?:_UnitSystemBase):_UnitSystemBase { - return (obj || new _UnitSystemBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAs_UnitSystemBase(bb:flatbuffers.ByteBuffer, obj?:_UnitSystemBase):_UnitSystemBase { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new _UnitSystemBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -system():UNIT_SYSTEM|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; -} - -precision():number { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; -} - -suppressLeadingZeros():boolean { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -suppressTrailingZeros():boolean { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -static start_UnitSystemBase(builder:flatbuffers.Builder) { - builder.startObject(4); -} - -static addSystem(builder:flatbuffers.Builder, system:UNIT_SYSTEM) { - builder.addFieldInt8(0, system, null); -} - -static addPrecision(builder:flatbuffers.Builder, precision:number) { - builder.addFieldInt32(1, precision, 0); -} - -static addSuppressLeadingZeros(builder:flatbuffers.Builder, suppressLeadingZeros:boolean) { - builder.addFieldInt8(2, +suppressLeadingZeros, +false); -} - -static addSuppressTrailingZeros(builder:flatbuffers.Builder, suppressTrailingZeros:boolean) { - builder.addFieldInt8(3, +suppressTrailingZeros, +false); -} - -static end_UnitSystemBase(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static create_UnitSystemBase(builder:flatbuffers.Builder, system:UNIT_SYSTEM|null, precision:number, suppressLeadingZeros:boolean, suppressTrailingZeros:boolean):flatbuffers.Offset { - _UnitSystemBase.start_UnitSystemBase(builder); - if (system !== null) - _UnitSystemBase.addSystem(builder, system); - _UnitSystemBase.addPrecision(builder, precision); - _UnitSystemBase.addSuppressLeadingZeros(builder, suppressLeadingZeros); - _UnitSystemBase.addSuppressTrailingZeros(builder, suppressTrailingZeros); - return _UnitSystemBase.end_UnitSystemBase(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/unit-system.ts b/packages/ducjs/src/flatbuffers/duc/unit-system.ts deleted file mode 100644 index d886bb16..00000000 --- a/packages/ducjs/src/flatbuffers/duc/unit-system.ts +++ /dev/null @@ -1,8 +0,0 @@ -// 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 */ - -export enum UNIT_SYSTEM { - METRIC = 10, - IMPERIAL = 11 -} diff --git a/packages/ducjs/src/flatbuffers/duc/version-base.ts b/packages/ducjs/src/flatbuffers/duc/version-base.ts deleted file mode 100644 index 484807d2..00000000 --- a/packages/ducjs/src/flatbuffers/duc/version-base.ts +++ /dev/null @@ -1,106 +0,0 @@ -// 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 VersionBase { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):VersionBase { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsVersionBase(bb:flatbuffers.ByteBuffer, obj?:VersionBase):VersionBase { - return (obj || new VersionBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsVersionBase(bb:flatbuffers.ByteBuffer, obj?:VersionBase):VersionBase { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new VersionBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -id():string|null -id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -id(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -parentId():string|null -parentId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -parentId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -timestamp():bigint { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); -} - -description():string|null -description(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -description(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -isManualSave():boolean { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; -} - -userId():string|null -userId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -userId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 14); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -static startVersionBase(builder:flatbuffers.Builder) { - builder.startObject(6); -} - -static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, idOffset, 0); -} - -static addParentId(builder:flatbuffers.Builder, parentIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, parentIdOffset, 0); -} - -static addTimestamp(builder:flatbuffers.Builder, timestamp:bigint) { - builder.addFieldInt64(2, timestamp, BigInt('0')); -} - -static addDescription(builder:flatbuffers.Builder, descriptionOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, descriptionOffset, 0); -} - -static addIsManualSave(builder:flatbuffers.Builder, isManualSave:boolean) { - builder.addFieldInt8(4, +isManualSave, +false); -} - -static addUserId(builder:flatbuffers.Builder, userIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(5, userIdOffset, 0); -} - -static endVersionBase(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createVersionBase(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, parentIdOffset:flatbuffers.Offset, timestamp:bigint, descriptionOffset:flatbuffers.Offset, isManualSave:boolean, userIdOffset:flatbuffers.Offset):flatbuffers.Offset { - VersionBase.startVersionBase(builder); - VersionBase.addId(builder, idOffset); - VersionBase.addParentId(builder, parentIdOffset); - VersionBase.addTimestamp(builder, timestamp); - VersionBase.addDescription(builder, descriptionOffset); - VersionBase.addIsManualSave(builder, isManualSave); - VersionBase.addUserId(builder, userIdOffset); - return VersionBase.endVersionBase(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/version-graph-metadata.ts b/packages/ducjs/src/flatbuffers/duc/version-graph-metadata.ts deleted file mode 100644 index 640e330b..00000000 --- a/packages/ducjs/src/flatbuffers/duc/version-graph-metadata.ts +++ /dev/null @@ -1,58 +0,0 @@ -// 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 VersionGraphMetadata { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):VersionGraphMetadata { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsVersionGraphMetadata(bb:flatbuffers.ByteBuffer, obj?:VersionGraphMetadata):VersionGraphMetadata { - return (obj || new VersionGraphMetadata()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsVersionGraphMetadata(bb:flatbuffers.ByteBuffer, obj?:VersionGraphMetadata):VersionGraphMetadata { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new VersionGraphMetadata()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -lastPruned():bigint { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); -} - -totalSize():bigint { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); -} - -static startVersionGraphMetadata(builder:flatbuffers.Builder) { - builder.startObject(2); -} - -static addLastPruned(builder:flatbuffers.Builder, lastPruned:bigint) { - builder.addFieldInt64(0, lastPruned, BigInt('0')); -} - -static addTotalSize(builder:flatbuffers.Builder, totalSize:bigint) { - builder.addFieldInt64(1, totalSize, BigInt('0')); -} - -static endVersionGraphMetadata(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -static createVersionGraphMetadata(builder:flatbuffers.Builder, lastPruned:bigint, totalSize:bigint):flatbuffers.Offset { - VersionGraphMetadata.startVersionGraphMetadata(builder); - VersionGraphMetadata.addLastPruned(builder, lastPruned); - VersionGraphMetadata.addTotalSize(builder, totalSize); - return VersionGraphMetadata.endVersionGraphMetadata(builder); -} -} diff --git a/packages/ducjs/src/flatbuffers/duc/version-graph.ts b/packages/ducjs/src/flatbuffers/duc/version-graph.ts deleted file mode 100644 index c9fdcc29..00000000 --- a/packages/ducjs/src/flatbuffers/duc/version-graph.ts +++ /dev/null @@ -1,122 +0,0 @@ -// 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 { Checkpoint } from '../duc/checkpoint'; -import { Delta } from '../duc/delta'; -import { VersionGraphMetadata } from '../duc/version-graph-metadata'; - - -export class VersionGraph { - bb: flatbuffers.ByteBuffer|null = null; - bb_pos = 0; - __init(i:number, bb:flatbuffers.ByteBuffer):VersionGraph { - this.bb_pos = i; - this.bb = bb; - return this; -} - -static getRootAsVersionGraph(bb:flatbuffers.ByteBuffer, obj?:VersionGraph):VersionGraph { - return (obj || new VersionGraph()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -static getSizePrefixedRootAsVersionGraph(bb:flatbuffers.ByteBuffer, obj?:VersionGraph):VersionGraph { - bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); - return (obj || new VersionGraph()).__init(bb.readInt32(bb.position()) + bb.position(), bb); -} - -userCheckpointVersionId():string|null -userCheckpointVersionId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -userCheckpointVersionId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -latestVersionId():string|null -latestVersionId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -latestVersionId(optionalEncoding?:any):string|Uint8Array|null { - const offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; -} - -checkpoints(index: number, obj?:Checkpoint):Checkpoint|null { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new Checkpoint()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -checkpointsLength():number { - const offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -deltas(index: number, obj?:Delta):Delta|null { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? (obj || new Delta()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; -} - -deltasLength():number { - const offset = this.bb!.__offset(this.bb_pos, 10); - return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; -} - -metadata(obj?:VersionGraphMetadata):VersionGraphMetadata|null { - const offset = this.bb!.__offset(this.bb_pos, 12); - return offset ? (obj || new VersionGraphMetadata()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; -} - -static startVersionGraph(builder:flatbuffers.Builder) { - builder.startObject(5); -} - -static addUserCheckpointVersionId(builder:flatbuffers.Builder, userCheckpointVersionIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, userCheckpointVersionIdOffset, 0); -} - -static addLatestVersionId(builder:flatbuffers.Builder, latestVersionIdOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, latestVersionIdOffset, 0); -} - -static addCheckpoints(builder:flatbuffers.Builder, checkpointsOffset:flatbuffers.Offset) { - builder.addFieldOffset(2, checkpointsOffset, 0); -} - -static createCheckpointsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startCheckpointsVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addDeltas(builder:flatbuffers.Builder, deltasOffset:flatbuffers.Offset) { - builder.addFieldOffset(3, deltasOffset, 0); -} - -static createDeltasVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { - builder.startVector(4, data.length, 4); - for (let i = data.length - 1; i >= 0; i--) { - builder.addOffset(data[i]!); - } - return builder.endVector(); -} - -static startDeltasVector(builder:flatbuffers.Builder, numElems:number) { - builder.startVector(4, numElems, 4); -} - -static addMetadata(builder:flatbuffers.Builder, metadataOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, metadataOffset, 0); -} - -static endVersionGraph(builder:flatbuffers.Builder):flatbuffers.Offset { - const offset = builder.endObject(); - return offset; -} - -} diff --git a/packages/ducjs/src/flatbuffers/duc/vertical-align.ts b/packages/ducjs/src/flatbuffers/duc/vertical-align.ts deleted file mode 100644 index 44325a49..00000000 --- a/packages/ducjs/src/flatbuffers/duc/vertical-align.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 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 */ - -export enum VERTICAL_ALIGN { - TOP = 10, - MIDDLE = 11, - BOTTOM = 12 -} diff --git a/packages/ducjs/src/flatbuffers/duc/viewport-shade-plot.ts b/packages/ducjs/src/flatbuffers/duc/viewport-shade-plot.ts deleted file mode 100644 index ae1864d2..00000000 --- a/packages/ducjs/src/flatbuffers/duc/viewport-shade-plot.ts +++ /dev/null @@ -1,10 +0,0 @@ -// 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 */ - -export enum VIEWPORT_SHADE_PLOT { - AS_DISPLAYED = 10, - WIREFRAME = 11, - HIDDEN = 12, - RENDERED = 13 -} diff --git a/packages/ducjs/src/flatbuffers/duc/youtube-states.ts b/packages/ducjs/src/flatbuffers/duc/youtube-states.ts deleted file mode 100644 index dff594c6..00000000 --- a/packages/ducjs/src/flatbuffers/duc/youtube-states.ts +++ /dev/null @@ -1,12 +0,0 @@ -// 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 */ - -export enum YOUTUBE_STATES { - UNSTARTED = -1, - ENDED = 0, - PLAYING = 1, - PAUSED = 2, - BUFFERING = 3, - CUED = 5 -} diff --git a/packages/ducjs/src/index.ts b/packages/ducjs/src/index.ts index e29cd552..f3bf3cad 100644 --- a/packages/ducjs/src/index.ts +++ b/packages/ducjs/src/index.ts @@ -1,9 +1,12 @@ -export * as DucBin from "./flatbuffers/duc"; - +export * from "./enums"; export * from "./lazy-files"; export * from "./parse"; export * from "./restore"; export * from "./serialize"; export * from "./technical"; +export * from "./transform"; export * from "./types"; export * from "./utils"; +export * as vc from "./version-control"; +export { ensureWasm, getWasmBinary } from "./wasm"; + diff --git a/packages/ducjs/src/lazy-files.ts b/packages/ducjs/src/lazy-files.ts index f476fac5..319687e0 100644 --- a/packages/ducjs/src/lazy-files.ts +++ b/packages/ducjs/src/lazy-files.ts @@ -1,238 +1,157 @@ +import { ensureWasm, wasmGetExternalFile, wasmListExternalFiles } from "./wasm"; +import type { DucExternalFileData, DucExternalFiles } from "./types"; + +export type LazyFileMetadata = { + id: string; + mimeType: string; + created: number; + lastRetrieved?: number; + version?: number; +}; + /** - * LazyExternalFileStore — Zero-copy, on-demand access to external file data from a FlatBuffer. - * - * Instead of eagerly parsing and copying every external file's binary data into JS memory, - * this store keeps a reference to the original FlatBuffer Uint8Array and reads file bytes - * only when explicitly requested. FlatBuffer `dataArray()` returns a zero-copy view - * (a Uint8Array pointing into the original buffer), so no allocation occurs until the - * consumer actually needs the data. + * Provides lazy access to external files embedded inside a `.duc` buffer. * - * Memory lifecycle: - * 1. On parse: only metadata (~200 bytes per file) enters JS heap. - * 2. On demand: `getFileData(fileId)` reads the zero-copy slice from the buffer. - * 3. The caller (renderer/worker) uses the data, then lets it GC naturally. - * 4. If the store is released, the buffer reference is dropped, freeing everything. - * - * This is the key to supporting 1000s of external files without RAM bloat. + * Instead of loading all file blobs into memory at parse time, this store + * keeps a reference to the raw `.duc` buffer and fetches individual files + * on demand via WASM calls. */ - -import * as flatbuffers from "flatbuffers"; -import { ExportedDataState as ExportedDataStateFb } from "./flatbuffers/duc"; -import type { DucExternalFileData, DucExternalFileMetadata, DucExternalFiles } from "./types"; -import type { ExternalFileId } from "./types/elements"; - -export type ExternalFileMetadataMap = Record; - -interface LazyFileEntry { - metadata: DucExternalFileMetadata; - /** Index into the ExportedDataState.externalFiles vector */ - vectorIndex: number; -} - export class LazyExternalFileStore { - private _buffer: Uint8Array | null; - private _byteBuffer: flatbuffers.ByteBuffer | null; - private _dataState: ExportedDataStateFb | null; - - /** Map from file id → lazy entry */ - private _entries = new Map(); - /** Map from element key → file id (the external_files vector uses element id as key) */ - private _keyToFileId = new Map(); - - /** - * Files that were added at runtime (e.g. user uploading a new image). - * These aren't in the original FlatBuffer so we hold their data directly. - */ - private _runtimeFiles = new Map(); + private buffer: Uint8Array | null; + private metadataCache: Map | null = null; + private runtimeFiles: Map = new Map(); constructor(buffer: Uint8Array) { - this._buffer = buffer; - this._byteBuffer = new flatbuffers.ByteBuffer(buffer); - this._dataState = ExportedDataStateFb.getRootAsExportedDataState(this._byteBuffer); - this._indexMetadata(); - console.info(`[LazyExternalFileStore] indexed ${this._entries.size} files from ${buffer.byteLength} byte buffer, ids: [${[...this._entries.keys()].map(k => k.slice(0, 12)).join(', ')}]`); + this.buffer = buffer; } - private _indexMetadata(): void { - if (!this._dataState) return; - - const count = this._dataState.externalFilesLength(); - for (let i = 0; i < count; i++) { - const entry = this._dataState.externalFiles(i); - if (!entry) continue; - - const key = entry.key(); - const fileData = entry.value(); - if (!key || !fileData) continue; - - const id = fileData.id() as ExternalFileId | null; - if (!id) continue; - - const metadata: DucExternalFileMetadata = { - id, - mimeType: fileData.mimeType() || "application/octet-stream", - created: Number(fileData.created()), - lastRetrieved: Number(fileData.lastRetrieved()) || undefined, - }; - - const lazyEntry: LazyFileEntry = { metadata, vectorIndex: i }; - this._entries.set(id, lazyEntry); - this._keyToFileId.set(key, id); - } + get isReleased(): boolean { + return this.buffer === null; } - /** Total number of external files */ get size(): number { - return this._entries.size + this._runtimeFiles.size; + return this.getMetadataMap().size + this.runtimeFiles.size; } - /** Whether a file with the given id exists */ + /** Check if a file with this ID exists. */ has(fileId: string): boolean { - return this._entries.has(fileId) || this._runtimeFiles.has(fileId); + return this.runtimeFiles.has(fileId) || this.getMetadataMap().has(fileId); } - /** Get metadata only (no binary data copied) — ~200 bytes per file */ - getMetadata(fileId: string): DucExternalFileMetadata | null { - const runtime = this._runtimeFiles.get(fileId); - if (runtime) { - const { data: _, ...meta } = runtime; - return meta; + /** Get metadata (without data blob) for a specific file. */ + getMetadata(fileId: string): LazyFileMetadata | undefined { + const rt = this.runtimeFiles.get(fileId); + if (rt) { + return { + id: rt.id, + mimeType: rt.mimeType, + created: rt.created, + lastRetrieved: rt.lastRetrieved, + version: rt.version, + }; } - return this._entries.get(fileId)?.metadata ?? null; + return this.getMetadataMap().get(fileId); } - /** Get all metadata entries (for UI listing, etc.) */ - getAllMetadata(): ExternalFileMetadataMap { - const result: ExternalFileMetadataMap = {}; - - for (const [id, entry] of this._entries) { - result[id] = entry.metadata; + /** Get metadata for all files. */ + getAllMetadata(): LazyFileMetadata[] { + const result: LazyFileMetadata[] = []; + for (const meta of this.getMetadataMap().values()) { + result.push(meta); } - for (const [id, file] of this._runtimeFiles) { - const { data: _, ...meta } = file; - result[id] = meta; + for (const [id, data] of this.runtimeFiles) { + if (!this.getMetadataMap().has(id)) { + result.push({ + id: data.id, + mimeType: data.mimeType, + created: data.created, + lastRetrieved: data.lastRetrieved, + version: data.version, + }); + } } - return result; } - /** - * Get full file data (metadata + binary bytes) ON DEMAND. - * - * For files from the original FlatBuffer, this returns a zero-copy Uint8Array - * view into the original buffer — no allocation for the file bytes themselves. - * The view is valid as long as this store hasn't been released. - * - * For runtime-added files, returns the data directly. - */ + /** Fetch the full file data (including blob) for a specific file. */ getFileData(fileId: string): DucExternalFileData | null { - const runtime = this._runtimeFiles.get(fileId); - if (runtime) return runtime; - - const entry = this._entries.get(fileId); - if (!entry || !this._dataState) return null; - - const fbEntry = this._dataState.externalFiles(entry.vectorIndex); - if (!fbEntry) return null; + const rt = this.runtimeFiles.get(fileId); + if (rt) return rt; - const fileData = fbEntry.value(); - if (!fileData) return null; - - const data = fileData.dataArray(); - if (!data) return null; - - return { - ...entry.metadata, - data, - }; + if (!this.buffer) return null; + const result = wasmGetExternalFile(this.buffer, fileId); + if (!result) return null; + return result as DucExternalFileData; } - /** - * Get a detached copy of the file data (allocates new ArrayBuffer). - * Use this when you need to transfer data to a worker or keep it beyond store lifetime. - */ + /** Fetch file data and return a copy of the data buffer (safe for transfer). */ getFileDataCopy(fileId: string): DucExternalFileData | null { - const fileDataRef = this.getFileData(fileId); - if (!fileDataRef) return null; - + const data = this.getFileData(fileId); + if (!data) return null; return { - ...fileDataRef, - data: new Uint8Array(fileDataRef.data), + ...data, + data: new Uint8Array(data.data), }; } - /** - * Add a file at runtime (user upload, paste, etc.). - * These files are held in memory since they aren't in the FlatBuffer. - */ - addRuntimeFile(fileData: DucExternalFileData): void { - this._runtimeFiles.set(fileData.id, fileData); + /** Add a file at runtime (not persisted in .duc until next serialize). */ + addRuntimeFile(fileId: string, data: DucExternalFileData): void { + this.runtimeFiles.set(fileId, data); } - /** Remove a runtime-added file */ - removeRuntimeFile(fileId: string): void { - this._runtimeFiles.delete(fileId); + /** Remove a runtime file. */ + removeRuntimeFile(fileId: string): boolean { + return this.runtimeFiles.delete(fileId); } - /** - * Export all files as a standard DucExternalFiles record. - * This COPIES all file data eagerly — use only for serialization. - */ + /** Export all files eagerly as a DucExternalFiles record. */ toExternalFiles(): DucExternalFiles { const result: DucExternalFiles = {}; - for (const [key, fileId] of this._keyToFileId) { - const fileData = this.getFileData(fileId); - if (fileData) { - result[key] = fileData; + if (this.buffer) { + const metas = this.getMetadataMap(); + for (const [id] of metas) { + const data = this.getFileData(id); + if (data) { + result[id] = data; + } } } - for (const [id, file] of this._runtimeFiles) { - result[id] = file; + for (const [id, data] of this.runtimeFiles) { + result[id] = data; } return result; } - /** - * Merge runtime files from the given DucExternalFiles map. - * Only adds files not already present in the store. - */ + /** Merge files from another source (only adds missing). */ mergeFiles(files: DucExternalFiles): void { - for (const [_key, fileData] of Object.entries(files)) { - if (!this.has(fileData.id)) { - this.addRuntimeFile(fileData); + for (const [id, data] of Object.entries(files)) { + if (!this.has(id)) { + this.runtimeFiles.set(id, data); } } } - /** Estimated RAM usage for metadata only (not counting the backing buffer) */ - get estimatedMetadataBytes(): number { - let bytes = 0; - for (const [, entry] of this._entries) { - bytes += 200 + entry.metadata.id.length * 2 + entry.metadata.mimeType.length * 2; - } - for (const [, file] of this._runtimeFiles) { - bytes += 200 + (file.data?.byteLength ?? 0); - } - return bytes; - } - - /** - * Release the FlatBuffer reference. After this, only runtime-added files remain accessible. - * Call this when switching documents or when the store is no longer needed. - */ + /** Release the underlying buffer to free memory. */ release(): void { - this._buffer = null; - this._byteBuffer = null; - this._dataState = null; - this._entries.clear(); - this._keyToFileId.clear(); + this.buffer = null; + this.metadataCache = null; } - /** Whether the store has been released */ - get isReleased(): boolean { - return this._buffer === null; + private getMetadataMap(): Map { + if (!this.metadataCache) { + this.metadataCache = new Map(); + if (this.buffer) { + const metas = wasmListExternalFiles(this.buffer) as LazyFileMetadata[]; + if (metas) { + for (const meta of metas) { + this.metadataCache.set(meta.id, meta); + } + } + } + } + return this.metadataCache; } } diff --git a/packages/ducjs/src/parse.ts b/packages/ducjs/src/parse.ts index 82333a8c..6d499463 100644 --- a/packages/ducjs/src/parse.ts +++ b/packages/ducjs/src/parse.ts @@ -1,2255 +1,99 @@ -import { FileSystemHandle } from 'browser-fs-access'; -import { decompressSync, strFromU8 } from 'fflate'; -import * as flatbuffers from "flatbuffers"; -import { nanoid } from 'nanoid'; -import { - CustomHatchPattern as CustomHatchPatternFb, - DOCUMENT_GRID_ALIGN_ITEMS, - DimensionToleranceStyle as DimensionToleranceStyleFb, - DocumentGridConfig as DocumentGridConfigFb, - DucArrowElement as DucArrowElementFb, - DucBlockCollection as DucBlockCollectionFb, - DucBlock as DucBlockFb, - DucBlockInstance as DucBlockInstanceFb, - DucBlockMetadata as DucBlockMetadataFb, - DucCommonStyle as DucCommonStyleFb, - DucDimensionElement as DucDimensionElementFb, - DucDimensionStyle as DucDimensionStyleFb, - DucDocElement as DucDocElementFb, - DucDocStyle as DucDocStyleFb, - DucEllipseElement as DucEllipseElementFb, - DucEmbeddableElement as DucEmbeddableElementFb, - DucExternalFileEntry, - DucFeatureControlFrameElement as DucFeatureControlFrameElementFb, - DucFeatureControlFrameStyle as DucFeatureControlFrameStyleFb, - DucFrameElement as DucFrameElementFb, - DucFreeDrawElement as DucFreeDrawElementFb, - DucGlobalState as DucGlobalStateFb, - DucGroup as DucGroupFb, - DucHatchStyle as DucHatchStyleFb, - DucHead as DucHeadFb, - DucImageElement as DucImageElementFb, - DucImageFilter as DucImageFilterFb, - DucLayer as DucLayerFb, - DucLeaderElement as DucLeaderElementFb, - DucLeaderStyle as DucLeaderStyleFb, - DucLine as DucLineFb, - DucLineReference as DucLineReferenceFb, - DucLinearElement as DucLinearElementFb, - DucLocalState as DucLocalStateFb, - DucMermaidElement as DucMermaidElementFb, - DucModelElement as DucModelElementFb, - DucPath as DucPathFb, - DucPdfElement as DucPdfElementFb, - DucPlotElement as DucPlotElementFb, - DucPlotStyle as DucPlotStyleFb, - DucPointBinding as DucPointBindingFb, - DucPoint as DucPointFb, - DucPolygonElement as DucPolygonElementFb, - DucRectangleElement as DucRectangleElementFb, - DucRegion as DucRegionFb, - DucStackLikeStyles as DucStackLikeStylesFb, - DucTableCellStyle as DucTableCellStyleFb, - DucTableElement as DucTableElementFb, - DucTableStyle as DucTableStyleFb, - DucTextDynamicDictionarySource as DucTextDynamicDictionarySourceFb, - DucTextDynamicElementSource as DucTextDynamicElementSourceFb, - DucTextElement as DucTextElementFb, - DucTextStyle as DucTextStyleFb, - DucUcs as DucUcsFb, - DucView as DucViewFb, - DucViewportElement as DucViewportElementFb, - DucViewportStyle as DucViewportStyleFb, - DucXRayElement as DucXRayElementFb, - DucXRayStyle as DucXRayStyleFb, - ElementBackground as ElementBackgroundFb, - ElementContentBase as ElementContentBaseFb, - ElementStroke as ElementStrokeFb, - Element as ElementUnion, - ElementWrapper, - ExportedDataState, - ExportedDataState as ExportedDataStateFb, - GeometricPoint as GeometricPointFb, - GridSettings as GridSettingsFb, - HatchPatternLine as HatchPatternLineFb, - LEADER_CONTENT_TYPE as LEADER_CONTENT_TYPE_ENUM, - LeaderBlockContent as LeaderBlockContentFb, - LeaderTextBlockContent as LeaderTextBlockContentFb, - Margins as MarginsFb, - PrimaryUnits as PrimaryUnitsFb, - SnapSettings as SnapSettingsFb, - Standard as StandardFb, - StrokeSides as StrokeSidesFb, - StrokeStyle as StrokeStyleFb, - TEXT_FIELD_SOURCE_TYPE, - TilingProperties as TilingPropertiesFb, - VersionGraph as VersionGraphFb, - _DucElementBase as _DucElementBaseFb, - _DucElementStylesBase as _DucElementStylesBaseFb, - _DucLinearElementBase as _DucLinearElementBaseFb, - _DucStackBase as _DucStackBaseFb, - _DucStackElementBase as _DucStackElementBaseFb -} from "./flatbuffers/duc"; -import { RestoreConfig, RestoredDataState, restore } from "./restore"; -import { - AngularUnitsFormat, - DimensionUnitsFormat, - Standard, - StandardUnits, - _UnitSystemBase -} from "./technical"; -import { - BlockLocalizationMap, - CustomHatchPattern, - DatumReference, - Dictionary, - DocumentGridConfig, - DucArrowElement, - DucBlock, - DucBlockAttributeDefinition, - DucBlockCollection, - DucBlockInstance, - DucBlockMetadata, - DucCommonStyle, - DucDimensionElement, - DucDimensionStyle, - DucDocElement, - DucDocStyle, - DucElement, - DucEllipseElement, - DucEmbeddableElement, - DucExternalFileMetadata, - DucExternalFiles, - DucFeatureControlFrameElement, - DucFeatureControlFrameStyle, - DucFrameElement, - DucFreeDrawElement, - DucGlobalState, - DucGroup, - DucHatchStyle, - DucHead, - DucImageElement, - DucImageFilter, - DucLayer, - DucLeaderElement, - DucLeaderStyle, - DucLine, - DucLineReference, - DucLinearElement, - DucLocalState, - DucMermaidElement, - DucModelElement, - DucPath, - DucPdfElement, - DucPlotElement, - DucPlotStyle, - DucPoint, - DucPointBinding, - DucPolygonElement, - DucRectangleElement, - DucRegion, - DucStackLikeStyles, - DucTableCell, - DucTableCellStyle, - DucTableColumn, - DucTableElement, - DucTableRow, - DucTableStyle, - DucTextDynamicPart, - DucTextDynamicSource, - DucTextElement, - DucTextStyle, - DucUcs, - DucView, - DucViewportElement, - DucViewportStyle, - DucXRayElement, - DucXRayStyle, - ElementBackground, - ElementContentBase, - ElementStroke, - ExternalFileId, - FeatureControlFrameSegment, - FractionalIndex, - GeometricPoint, - GridSettings, - HatchPatternLine, - JSONPatch, - LeaderContent, - LineHead, - NormalizedZoomValue, - ObjectSnapMode, - OrderedDucElement, - Percentage, - PlotLayout, - PrecisionValue, - Radian, - RawValue, - ScaleFactor, - Scope, - ScopedValue, - SnapMarkerStyle, - SnapSettings, - StrokeSides, - StrokeStyle, - TilingProperties, - VersionGraph, - ViewportScale, - Zoom, - _DucElementBase, - _DucElementStylesBase, - _DucLinearElementBase, - _DucStackBase, - _DucStackElementBase -} from "./types"; +import { restore, type ElementsConfig, type RestoreConfig, type RestoredDataState } from "./restore"; +import { transformFromRust } from "./transform"; +import type { DucExternalFiles, ExportedDataState } from "./types"; +import { ensureWasm, wasmParseDuc, wasmParseDucLazy } from "./wasm"; +export type { RestoredDataState }; -// #region HELPERS & LOW-LEVEL CASTS -// Helper functions for type casting -const toPrecisionValue = (value: number): PrecisionValue => ({ - value: value as RawValue, - scoped: value as ScopedValue, -}); - -const toRadian = (value: number): Radian => value as Radian; -const toPercentage = (value: number): Percentage => value as Percentage; -const toScaleFactor = (value: number): ScaleFactor => value as ScaleFactor; -const toZoom = (value: number): Zoom => ({ - value: value as NormalizedZoomValue -} as Zoom); -// #endregion - -// Helper function to parse binary JSON data (Uint8Array) to object -// The data is zlib-compressed JSON (new format) or plain JSON string (legacy format) -function parseBinaryToJson(binaryData: Uint8Array | null): Record | undefined { - if (!binaryData || binaryData.length === 0) return undefined; - - // Try new format: zlib-compressed binary JSON - try { - const decompressed = decompressSync(binaryData); - const text = strFromU8(decompressed); - return JSON.parse(text); - } catch (e) { - // Fall back to legacy format: plain JSON string (for old file compatibility) - try { - const text = new TextDecoder().decode(binaryData); - return JSON.parse(text); - } catch (e2) { - console.warn('Failed to parse binary JSON (tried both compressed and legacy formats):', e2); - return undefined; - } - } -} - -// #region GEOMETRY & UTILITY PARSERS -export function parseGeometricPoint(point: GeometricPointFb): GeometricPoint { - return { - x: point.x(), - y: point.y(), - }; -} - -export function parsePoint(point: DucPointFb): DucPoint { - return { - x: toPrecisionValue(point.x()), - y: toPrecisionValue(point.y()), - mirroring: point.mirroring() || undefined, - }; -} - -export function parseMargins(margins: MarginsFb): PlotLayout["margins"] { - return { - top: toPrecisionValue(margins.top()), - right: toPrecisionValue(margins.right()), - bottom: toPrecisionValue(margins.bottom()), - left: toPrecisionValue(margins.left()), - }; -} - -export function parseDocumentGridConfig(gridConfig: DocumentGridConfigFb): DocumentGridConfig { - return { - columns: gridConfig.columns(), - gapX: gridConfig.gapX(), - gapY: gridConfig.gapY(), - alignItems: (() => { - const align = gridConfig.alignItems(); - if (align === DOCUMENT_GRID_ALIGN_ITEMS.START) return 'start'; - if (align === DOCUMENT_GRID_ALIGN_ITEMS.CENTER) return 'center'; - if (align === DOCUMENT_GRID_ALIGN_ITEMS.END) return 'end'; - return 'start'; - })(), - firstPageAlone: gridConfig.firstPageAlone(), - scale: gridConfig.scale(), - }; -} - -export function parseHead(head: DucHeadFb): DucHead { - return { - type: head.type()!, - blockId: head.blockId(), - size: toPrecisionValue(head.size()), - }; -} -// #endregion - - -// #region STYLE PARSERS (LOW-LEVEL) -export function parseHatchPatternLine(line: HatchPatternLineFb): HatchPatternLine { - return { - angle: toRadian(line.angle()), - origin: parsePoint(line.origin()!), - offset: [toPrecisionValue(line.offset(0)!), toPrecisionValue(line.offset(1)!)], - dashPattern: Array.from(line.dashPatternArray() || []).map(toPrecisionValue), - }; -} - -export function parseCustomHatchPattern(pattern: CustomHatchPatternFb): CustomHatchPattern { - return { - name: pattern.name()!, - description: pattern.description() || undefined, - lines: Array.from({ length: pattern.linesLength() }, (_, i) => parseHatchPatternLine(pattern.lines(i)!)), - }; -} - -export function parseHatchStyle(hatch: DucHatchStyleFb): DucHatchStyle { - return { - hatchStyle: hatch.hatchStyle()!, - pattern: { - name: hatch.patternName()!, - scale: hatch.patternScale(), - angle: toRadian(hatch.patternAngle()), - origin: parsePoint(hatch.patternOrigin()!), - double: hatch.patternDouble(), - }, - customPattern: hatch.customPattern() ? parseCustomHatchPattern(hatch.customPattern()!) : undefined, - }; -} - -export function parseTilingProperties(tiling: TilingPropertiesFb): TilingProperties { - return { - sizeInPercent: toPercentage(tiling.sizeInPercent()), - angle: toRadian(tiling.angle()), - spacing: tiling.spacing() ?? undefined, - offsetX: tiling.offsetX() ?? undefined, - offsetY: tiling.offsetY() ?? undefined, - }; -} - -export function parseImageFilter(filter: DucImageFilterFb): DucImageFilter { - return { - brightness: toPercentage(filter.brightness()), - contrast: toPercentage(filter.contrast()), - }; -} - -export function parseElementContentBase(content: ElementContentBaseFb): ElementContentBase { - return { - preference: (content.preference() ?? undefined)!, - src: content.src()!, - visible: content.visible(), - opacity: toPercentage(content.opacity()), - tiling: content.tiling() ? parseTilingProperties(content.tiling()!) : undefined, - hatch: content.hatch() ? parseHatchStyle(content.hatch()!) : undefined, - imageFilter: content.imageFilter() ? parseImageFilter(content.imageFilter()!) : undefined, - }; -} - -export function parseStrokeStyle(style: StrokeStyleFb): StrokeStyle { - return { - preference: (style.preference() ?? undefined)!, - cap: style.cap() || undefined, - join: style.join() || undefined, - dash: Array.from(style.dashArray() || []), - dashLineOverride: style.dashLineOverride() || undefined, - dashCap: style.dashCap() || undefined, - miterLimit: style.miterLimit() ?? undefined, - }; -} - -export function parseStrokeSides(sides: StrokeSidesFb): StrokeSides { - return { - preference: (sides.preference() ?? undefined)!, - values: Array.from(sides.valuesArray() || []), - }; -} - -export function parseElementStroke(stroke: ElementStrokeFb): ElementStroke { - return { - content: parseElementContentBase(stroke.content()!), - width: toPrecisionValue(stroke.width()), - style: parseStrokeStyle(stroke.style()!), - placement: (stroke.placement() ?? undefined)!, - strokeSides: stroke.strokeSides() ? parseStrokeSides(stroke.strokeSides()!) : undefined, - }; -} - -export function parseElementBackground(background: ElementBackgroundFb): ElementBackground { - return { - content: parseElementContentBase(background.content()!), - }; -} - -export function parseElementStylesBase(styles: _DucElementStylesBaseFb): _DucElementStylesBase { - return { - roundness: toPrecisionValue(styles.roundness()), - blending: styles.blending() || undefined, - background: Array.from({ length: styles.backgroundLength() }, (_, i) => parseElementBackground(styles.background(i)!)), - stroke: Array.from({ length: styles.strokeLength() }, (_, i) => parseElementStroke(styles.stroke(i)!)), - opacity: toPercentage(styles.opacity()), - }; -} -// #endregion - - - -// #region BASE ELEMENT PARSERS - -export function parseElementBase(base: _DucElementBaseFb): _DucElementBase { - const styles = base.styles(); - const parsedStyles = styles ? parseElementStylesBase(styles) : { - roundness: toPrecisionValue(0), - blending: undefined, - background: [], - stroke: [], - opacity: toPercentage(1), - }; - - return { - id: base.id()!, - x: toPrecisionValue(base.x()), - y: toPrecisionValue(base.y()), - width: toPrecisionValue(base.width()), - height: toPrecisionValue(base.height()), - angle: toRadian(base.angle()), - scope: base.scope()! as Scope, - label: base.label()!, - description: base.description(), - isVisible: base.isVisible(), - seed: base.seed(), - version: base.version(), - versionNonce: base.versionNonce(), - updated: Number(base.updated()), - index: base.index() as FractionalIndex | null, - isPlot: base.isPlot(), - isAnnotative: base.isAnnotative(), - isDeleted: base.isDeleted(), - groupIds: Array.from({ length: base.groupIdsLength() }, (_, i) => base.groupIds(i)!), - regionIds: Array.from({ length: base.regionIdsLength() }, (_, i) => base.regionIds(i)!), - blockIds: Array.from({ length: base.blockIdsLength() }, (_, i) => base.blockIds(i)!), - instanceId: base.instanceId(), - layerId: base.layerId(), - frameId: base.frameId(), - boundElements: base.boundElementsLength() > 0 ? Array.from({ length: base.boundElementsLength() }, (_, i) => ({ - id: base.boundElements(i)!.id()!, - type: base.boundElements(i)!.type()! as DucElement["type"], - })) : null, - zIndex: base.zIndex(), - link: base.link(), - locked: base.locked(), - customData: parseBinaryToJson(base.customDataArray()), - ...parsedStyles, - } as _DucElementBase; -} - -export function parseLineReference(ref: DucLineReferenceFb): DucLineReference { - return { - index: ref.index(), - handle: ref.handle() ? { x: toPrecisionValue(ref.handle()!.x()), y: toPrecisionValue(ref.handle()!.y()) } : null, - }; -} - -export function parseLine(line: DucLineFb): DucLine { - return [ - parseLineReference(line.start()!), - parseLineReference(line.end()!), - ]; -} - -export function parsePath(path: DucPathFb): DucPath { - return { - lineIndices: Array.from(path.lineIndicesArray() || []), - background: path.background() ? parseElementBackground(path.background()!) : null, - stroke: path.stroke() ? parseElementStroke(path.stroke()!) : null, - }; -} - -export function parsePointBinding(binding: DucPointBindingFb): DucPointBinding { - const pointBindingPoint = binding.point(); - return { - elementId: binding.elementId()!, - focus: binding.focus(), - gap: toPrecisionValue(binding.gap()), - fixedPoint: binding.fixedPoint() ? parseGeometricPoint(binding.fixedPoint()!) : null, - point: pointBindingPoint ? { - index: pointBindingPoint.index(), - offset: pointBindingPoint.offset(), - } : null, - head: binding.head() ? parseHead(binding.head()!) : null, - }; -} - -export function parseLinearElementBase(base: _DucLinearElementBaseFb): _DucLinearElementBase { - return { - ...parseElementBase(base.base()!), - points: Array.from({ length: base.pointsLength() }, (_, i) => parsePoint(base.points(i)!)), - lines: Array.from({ length: base.linesLength() }, (_, i) => parseLine(base.lines(i)!)), - pathOverrides: Array.from({ length: base.pathOverridesLength() }, (_, i) => parsePath(base.pathOverrides(i)!)), - lastCommittedPoint: base.lastCommittedPoint() ? parsePoint(base.lastCommittedPoint()!) : null, - startBinding: base.startBinding() ? parsePointBinding(base.startBinding()!) : null, - endBinding: base.endBinding() ? parsePointBinding(base.endBinding()!) : null, - }; -} - -export function parseStackLikeStyles(styles: DucStackLikeStylesFb): DucStackLikeStyles { - return { - opacity: toPercentage(styles.opacity()), - labelingColor: styles.labelingColor()!, - }; -} - -export function parseStackBase(base: _DucStackBaseFb): _DucStackBase { - return { - label: base.label()!, - description: base.description(), - isCollapsed: base.isCollapsed(), - isPlot: base.isPlot(), - isVisible: base.isVisible(), - locked: base.locked(), - ...parseStackLikeStyles(base.styles()!), - }; -} - -export function parseStackElementBase(base: _DucStackElementBaseFb): _DucStackElementBase { - return { - ...parseElementBase(base.base()!), - ...parseStackBase(base.stackBase()!), - clip: base.clip(), - labelVisible: base.labelVisible(), - standardOverride: base.standardOverride(), - }; -} -// #endregion - -// #region ELEMENT-SPECIFIC PARSERS - -function parseRectangleElement(element: DucRectangleElementFb): DucRectangleElement { - return { - type: "rectangle", - ...parseElementBase(element.base()!), - }; -} - -function parsePolygonElement(element: DucPolygonElementFb): DucPolygonElement { - return { - type: "polygon", - ...parseElementBase(element.base()!), - sides: element.sides(), - }; -} - -function parseEllipseElement(element: DucEllipseElementFb): DucEllipseElement { - return { - type: "ellipse", - ...parseElementBase(element.base()!), - ratio: toPercentage(element.ratio()), - startAngle: toRadian(element.startAngle()), - endAngle: toRadian(element.endAngle()), - showAuxCrosshair: element.showAuxCrosshair(), - }; -} - -function parseEmbeddableElement(element: DucEmbeddableElementFb): DucEmbeddableElement { - return { - type: "embeddable", - ...parseElementBase(element.base()!), - }; -} - -function parsePdfElement(element: DucPdfElementFb): DucPdfElement { - const gridConfig = element.gridConfig(); - return { - type: "pdf", - ...parseElementBase(element.base()!), - fileId: element.fileId() as ExternalFileId | null, - gridConfig: gridConfig ? parseDocumentGridConfig(gridConfig) : { - columns: 1, - gapX: 0, - gapY: 0, - alignItems: 'start', - firstPageAlone: false, - scale: 1, - }, - }; -} - -function parseMermaidElement(element: DucMermaidElementFb): DucMermaidElement { - return { - type: "mermaid", - ...parseElementBase(element.base()!), - source: element.source()!, - theme: element.theme() || undefined, - svgPath: element.svgPath(), - }; -} - -function parseTableElement(element: DucTableElementFb): DucTableElement { - const style = element.style()!; - const columns: Record = {}; - for (let i = 0; i < element.columnsLength(); i++) { - const entry = element.columns(i)!; - const col = entry.value()!; - columns[entry.key()!] = { - id: col.id()!, - width: toPrecisionValue(col.width()), - styleOverrides: col.styleOverrides() ? parseTableCellStyle(col.styleOverrides()!) : undefined, - }; - } - const rows: Record = {}; - for (let i = 0; i < element.rowsLength(); i++) { - const entry = element.rows(i)!; - const row = entry.value()!; - rows[entry.key()!] = { - id: row.id()!, - height: toPrecisionValue(row.height()), - styleOverrides: row.styleOverrides() ? parseTableCellStyle(row.styleOverrides()!) : undefined, - }; - } - const cells: Record = {}; - for (let i = 0; i < element.cellsLength(); i++) { - const entry = element.cells(i)!; - const cell = entry.value()!; - const span = cell.span(); - cells[entry.key()!] = { - rowId: cell.rowId()!, - columnId: cell.columnId()!, - data: cell.data()!, - span: span ? { columns: span.columns(), rows: span.rows() } : undefined, - locked: cell.locked(), - styleOverrides: cell.styleOverrides() ? parseTableCellStyle(cell.styleOverrides()!) : undefined, - }; - } - - return { - type: "table", - ...parseElementBase(element.base()!), - ...parseTableStyle(style), - columnOrder: Array.from({ length: element.columnOrderLength() }, (_, i) => element.columnOrder(i)!), - rowOrder: Array.from({ length: element.rowOrderLength() }, (_, i) => element.rowOrder(i)!), - columns, - rows, - cells, - headerRowCount: element.headerRowCount(), - autoSize: { - columns: element.autoSize()!.columns(), - rows: element.autoSize()!.rows(), - }, - }; -} - -function parseImageElement(element: DucImageElementFb): DucImageElement { - const crop = element.crop(); - const filter = element.filter(); - return { - type: "image", - ...parseElementBase(element.base()!), - fileId: element.fileId() as ExternalFileId | null, - status: element.status()!, - scaleFlip: [element.scale(0)!, element.scale(1)!], - crop: crop ? { - x: crop.x(), - y: crop.y(), - width: crop.width(), - height: crop.height(), - naturalWidth: crop.naturalWidth(), - naturalHeight: crop.naturalHeight(), - } : null, - filter: filter ? parseImageFilter(filter) : null, - }; -} - -function parseTextElement(element: DucTextElementFb): DucTextElement { - const dynamicParts: DucTextDynamicPart[] = []; - for (let i = 0; i < element.dynamicLength(); i++) { - const partFb = element.dynamic(i)!; - const sourceFb = partFb.source()!; - let source: DucTextDynamicSource; - if (sourceFb.textSourceType() === TEXT_FIELD_SOURCE_TYPE.ELEMENT) { - const elementSource = sourceFb.source(new DucTextDynamicElementSourceFb())!; - source = { - sourceType: TEXT_FIELD_SOURCE_TYPE.ELEMENT, - elementId: elementSource.elementId()!, - property: elementSource.property(), - }; - } else { - const dictSource = sourceFb.source(new DucTextDynamicDictionarySourceFb())!; - source = { - sourceType: TEXT_FIELD_SOURCE_TYPE.DICTIONARY, - key: dictSource.key()!, - }; - } - dynamicParts.push({ - tag: partFb.tag()!, - source, - formatting: partFb.formatting() ? parsePrimaryUnits(partFb.formatting()!) : undefined, - cachedValue: partFb.cachedValue()!, - }); - } - - return { - type: "text", - ...parseElementBase(element.base()!), - ...parseTextStyle(element.style()!), - text: element.text()!, - dynamic: dynamicParts, - autoResize: element.autoResize(), - containerId: element.containerId(), - originalText: element.originalText()!, - }; -} - -function parseLinearElement(element: DucLinearElementFb): DucLinearElement { - return { - type: "line", - ...parseLinearElementBase(element.linearBase()!), - wipeoutBelow: element.wipeoutBelow(), - }; -} - -function parseArrowElement(element: DucArrowElementFb): DucArrowElement { - return { - type: "arrow", - ...parseLinearElementBase(element.linearBase()!), - elbowed: element.elbowed(), - }; -} - -function parseFreeDrawElement(element: DucFreeDrawElementFb): DucFreeDrawElement { - const start = element.start(); - const end = element.end(); - return { - type: "freedraw", - ...parseElementBase(element.base()!), - points: Array.from({ length: element.pointsLength() }, (_, i) => parsePoint(element.points(i)!)), - size: toPrecisionValue(element.size()), - thinning: toPercentage(element.thinning()), - smoothing: toPercentage(element.smoothing()), - streamline: toPercentage(element.streamline()), - easing: element.easing()! as any, - start: start ? { cap: start.cap() as any, taper: start.taper() as any, easing: start.easing()! as any } : null, - end: end ? { cap: end.cap(), taper: end.taper(), easing: end.easing()! as any } : null, - pressures: Array.from(element.pressuresArray() || []), - simulatePressure: element.simulatePressure(), - lastCommittedPoint: element.lastCommittedPoint() ? parsePoint(element.lastCommittedPoint()!) : null, - svgPath: element.svgPath(), - }; -} - -function parseBlockInstance(instance: DucBlockInstanceFb): DucBlockInstance { - const duplicationArray = instance.duplicationArray(); - const attributeValues: Record = {}; - for (let i = 0; i < instance.attributeValuesLength(); i++) { - const entry = instance.attributeValues(i)!; - attributeValues[entry.key()!] = entry.value()!; - } - const elementOverrides: Record = {}; - for (let i = 0; i < instance.elementOverridesLength(); i++) { - const entry = instance.elementOverrides(i)!; - elementOverrides[entry.key()!] = entry.value()!; - } - - return { - id: instance.id()!, - blockId: instance.blockId()!, - version: instance.version(), - attributeValues: attributeValues, - elementOverrides: elementOverrides, - duplicationArray: duplicationArray ? { - rows: duplicationArray.rows(), - cols: duplicationArray.cols(), - rowSpacing: toPrecisionValue(duplicationArray.rowSpacing()), - colSpacing: toPrecisionValue(duplicationArray.colSpacing()), - } : null, - }; -} - -// Helper function to parse block metadata from FlatBuffers -function parseBlockMetadata(metadataFb: DucBlockMetadataFb | null): DucBlockMetadata | undefined { - if (!metadataFb) return undefined; - - // localization is now binary JSON data (Uint8Array) - const localization = parseBinaryToJson(metadataFb.localizationArray()) as BlockLocalizationMap | undefined; - - const rawSource = metadataFb.source(); - const source = typeof rawSource === "string" && rawSource.trim().length - ? rawSource.trim() - : undefined; - - return { - ...(source ? { source } : {}), - usageCount: metadataFb.usageCount(), - createdAt: Number(metadataFb.createdAt()), - updatedAt: Number(metadataFb.updatedAt()), - localization, - }; -} - -function parseBlockCollection(collection: DucBlockCollectionFb): DucBlockCollection { - const children = Array.from({ length: collection.childrenLength() }, (_, i) => { - const child = collection.children(i)!; - return { - id: child.id()!, - isCollection: child.isCollection(), - }; - }); - - const metadata = parseBlockMetadata(collection.metadata()); - - return { - id: collection.id()!, - label: collection.label()!, - children, - metadata, - thumbnail: collection.thumbnailArray() || undefined, - }; -} - -function parseFrameElement(element: DucFrameElementFb): DucFrameElement { - return { - type: "frame", - ...parseStackElementBase(element.stackElementBase()!), - }; -} - -function parsePlotElement(element: DucPlotElementFb): DucPlotElement { - const layout = element.layout()!; - return { - type: "plot", - ...parseStackElementBase(element.stackElementBase()!), - ...parsePlotStyle(element.style()!), - layout: { - margins: parseMargins(layout.margins()!), - }, - }; -} - -function parseViewportElement(element: DucViewportElementFb): DucViewportElement { - return { - type: "viewport", - ...parseLinearElementBase(element.linearBase()!), - ...parseStackBase(element.stackBase()!), - ...parseViewportStyle(element.style()!), - view: parseView(element.view()!), - scale: element.scale() as ViewportScale, - shadePlot: element.shadePlot()!, - frozenGroupIds: Array.from({ length: element.frozenGroupIdsLength() }, (_, i) => element.frozenGroupIds(i)!), - standardOverride: element.standardOverride(), - }; -} - -function parseXRayElement(element: DucXRayElementFb): DucXRayElement { - return { - type: "xray", - ...parseElementBase(element.base()!), - ...parseXRayStyle(element.style()!), - origin: parsePoint(element.origin()!), - direction: parsePoint(element.direction()!), - startFromOrigin: element.startFromOrigin(), - }; -} - -function parseLeaderElement(element: DucLeaderElementFb): DucLeaderElement { - const contentFb = element.content(); - let leaderContent: LeaderContent | null = null; - if (contentFb) { - const contentType = contentFb.leaderContentType(); - if (contentType === LEADER_CONTENT_TYPE_ENUM.TEXT) { - const textContent = contentFb.content(new LeaderTextBlockContentFb())!; - leaderContent = { - type: "text", - text: textContent.text()!, - }; - } else if (contentType === LEADER_CONTENT_TYPE_ENUM.BLOCK) { - const blockContent = contentFb.content(new LeaderBlockContentFb())!; - const attributeValues: Record = {}; - for (let i = 0; i < blockContent.attributeValuesLength(); i++) { - const entry = blockContent.attributeValues(i)!; - attributeValues[entry.key()!] = entry.value()!; - } - const elementOverrides: Record = {}; - for (let i = 0; i < blockContent.elementOverridesLength(); i++) { - const entry = blockContent.elementOverrides(i)!; - elementOverrides[entry.key()!] = entry.value()!; - } - leaderContent = { - type: "block", - blockId: blockContent.blockId()!, - instanceData: { - attributeValues, - elementOverrides, - }, - }; - } - } - - return { - type: "leader", - ...parseLinearElementBase(element.linearBase()!), - ...parseLeaderStyle(element.style()!), - leaderContent, - contentAnchor: parseGeometricPoint(element.contentAnchor()!), - }; -} - -function parseDimensionElement(element: DucDimensionElementFb): DucDimensionElement { - const defPoints = element.definitionPoints()!; - const bindings = element.bindings(); - const toleranceOverride = element.toleranceOverride(); - return { - type: "dimension", - ...parseElementBase(element.base()!), - ...parseDimensionStyle(element.style()!), - dimensionType: element.dimensionType()!, - definitionPoints: { - origin1: parseGeometricPoint(defPoints.origin1()!), - origin2: defPoints.origin2() ? parseGeometricPoint(defPoints.origin2()!) : undefined, - location: parseGeometricPoint(defPoints.location()!), - center: defPoints.center() ? parseGeometricPoint(defPoints.center()!) : undefined, - jog: defPoints.jog() ? parseGeometricPoint(defPoints.jog()!) : undefined, - }, - obliqueAngle: toRadian(element.obliqueAngle()), - ordinateAxis: element.ordinateAxis() || null, - bindings: bindings ? { - origin1: bindings.origin1() ? parsePointBinding(bindings.origin1()!) : null, - origin2: bindings.origin2() ? parsePointBinding(bindings.origin2()!) : null, - center: bindings.center() ? parsePointBinding(bindings.center()!) : null, - } : undefined, - textOverride: element.textOverride(), - textPosition: element.textPosition() ? parseGeometricPoint(element.textPosition()!) : null, - toleranceOverride: toleranceOverride ? parseDimensionToleranceStyle(toleranceOverride) : undefined, - baselineData: element.baselineData() ? { baseDimensionId: element.baselineData()!.baseDimensionId()! } : undefined, - continueData: element.continueData() ? { continueFromDimensionId: element.continueData()!.continueFromDimensionId()! } : undefined, - calculatedValue: toPrecisionValue(0), // This is a runtime value - }; -} - -function parseFeatureControlFrameElement(element: DucFeatureControlFrameElementFb): DucFeatureControlFrameElement { - const frameModifiers = element.frameModifiers(); - const datumDef = element.datumDefinition(); - return { - type: "featurecontrolframe", - ...parseElementBase(element.base()!), - ...parseFeatureControlFrameStyle(element.style()!), - rows: Array.from({ length: element.rowsLength() }, (_, i) => { - const row = element.rows(i)!; - return Array.from({ length: row.segmentsLength() }, (_, j) => { - const seg = row.segments(j)!; - const tol = seg.tolerance()!; - return { - symbol: seg.symbol()!, - tolerance: { - value: tol.value()!, - zoneType: tol.zoneType() || undefined, - featureModifiers: Array.from(tol.featureModifiersArray() || []), - materialCondition: tol.materialCondition() || undefined, - }, - datums: Array.from({ length: seg.datumsLength() }, (_, k) => { - const datum = seg.datums(k)!; - return { - letters: datum.letters()!, - modifier: datum.modifier() || undefined, - }; - }) as [DatumReference?, DatumReference?, DatumReference?], - }; - }); - }) as readonly (readonly FeatureControlFrameSegment[])[], - frameModifiers: frameModifiers ? { - allAround: frameModifiers.allAround(), - allOver: frameModifiers.allOver(), - continuousFeature: frameModifiers.continuousFeature(), - between: frameModifiers.between() ? { start: frameModifiers.between()!.start()!, end: frameModifiers.between()!.end()! } : undefined, - projectedToleranceZone: frameModifiers.projectedToleranceZone() ? toPrecisionValue(frameModifiers.projectedToleranceZone()!.value()) : undefined, - } : undefined, - leaderElementId: element.leaderElementId(), - datumDefinition: datumDef ? { - letter: datumDef.letter()!, - featureBinding: datumDef.featureBinding() ? parsePointBinding(datumDef.featureBinding()!) : undefined, - } : undefined, - }; -} - -function parseDocElement(element: DucDocElementFb): DucDocElement { - const dynamicParts: DucTextDynamicPart[] = []; - for (let i = 0; i < element.dynamicLength(); i++) { - const partFb = element.dynamic(i)!; - const sourceFb = partFb.source()!; - let source: DucTextDynamicSource; - if (sourceFb.textSourceType() === TEXT_FIELD_SOURCE_TYPE.ELEMENT) { - const elementSource = sourceFb.source(new DucTextDynamicElementSourceFb())!; - source = { - sourceType: TEXT_FIELD_SOURCE_TYPE.ELEMENT, - elementId: elementSource.elementId()!, - property: elementSource.property(), - }; - } else { - const dictSource = sourceFb.source(new DucTextDynamicDictionarySourceFb())!; - source = { - sourceType: TEXT_FIELD_SOURCE_TYPE.DICTIONARY, - key: dictSource.key()!, - }; - } - dynamicParts.push({ - tag: partFb.tag()!, - source, - formatting: partFb.formatting() ? parsePrimaryUnits(partFb.formatting()!) : undefined, - cachedValue: partFb.cachedValue()!, - }); - } - const columns = element.columns()!; - const gridConfig = element.gridConfig(); - return { - type: "doc", - ...parseElementBase(element.base()!), - ...parseDocStyle(element.style()!), - text: element.text()!, - dynamic: dynamicParts, - flowDirection: element.flowDirection()!, - columns: { - type: columns.type()!, - definitions: Array.from({ length: columns.definitionsLength() }, (_, i) => { - const col = columns.definitions(i)!; - return { - width: toPrecisionValue(col.width()), - gutter: toPrecisionValue(col.gutter()), - }; - }), - autoHeight: columns.autoHeight(), - }, - autoResize: element.autoResize(), - fileId: element.fileId() as ExternalFileId | null, - gridConfig: gridConfig ? parseDocumentGridConfig(gridConfig) : { - columns: 1, - gapX: 0, - gapY: 0, - alignItems: 'start', - firstPageAlone: false, - scale: 1, - }, - }; -} - -function parseModelElement(element: DucModelElementFb): DucModelElement { - return { - type: "model", - ...parseElementBase(element.base()!), - source: element.source()!, - svgPath: element.svgPath(), - fileIds: Array.from({ length: element.fileIdsLength() }, (_, i) => element.fileIds(i)!) as ExternalFileId[], - }; -} -// #endregion - - -// #region STYLE PARSERS (ELEMENT-LEVEL) - -export function parseTextStyle(style: DucTextStyleFb): DucTextStyle { - const lineSpacing = style.lineSpacing()!; - return { - isLtr: style.isLtr(), - fontFamily: style.fontFamily()! as any, // For now will use as any because this will be a string in the future - bigFontFamily: style.bigFontFamily()!, - textAlign: style.textAlign()!, - verticalAlign: style.verticalAlign()!, - lineHeight: style.lineHeight() as DucTextStyle["lineHeight"], - lineSpacing: { - value: toPrecisionValue(lineSpacing.value()), - type: lineSpacing.type()!, - }, - obliqueAngle: toRadian(style.obliqueAngle()), - fontSize: toPrecisionValue(style.fontSize()), - paperTextHeight: toPrecisionValue(style.paperTextHeight()), - widthFactor: toScaleFactor(style.widthFactor()), - isUpsideDown: style.isUpsideDown(), - isBackwards: style.isBackwards(), - }; -} - -export function parseTableCellStyle(style: DucTableCellStyleFb): DucTableCellStyle { - return { - ...parseElementStylesBase(style.baseStyle()!), - textStyle: parseTextStyle(style.textStyle()!), - margins: parseMargins(style.margins()!), - alignment: style.alignment()!, - }; -} - -export function parseTableStyle(style: DucTableStyleFb): DucTableStyle { - return { - flowDirection: style.flowDirection()!, - headerRowStyle: parseTableCellStyle(style.headerRowStyle()!), - dataRowStyle: parseTableCellStyle(style.dataRowStyle()!), - dataColumnStyle: parseTableCellStyle(style.dataColumnStyle()!), - }; -} - -export function parsePlotStyle(style: DucPlotStyleFb): DucPlotStyle { - return {}; -} - -export function parseViewportStyle(style: DucViewportStyleFb): DucViewportStyle { - return { - scaleIndicatorVisible: style.scaleIndicatorVisible(), - }; -} - -export function parseXRayStyle(style: DucXRayStyleFb): DucXRayStyle { - return { - color: style.color()!, - }; -} - -export function parseLeaderStyle(style: DucLeaderStyleFb): DucLeaderStyle { - return { - headsOverride: style.headsOverrideLength() > 0 ? [parseHead(style.headsOverride(0)!), parseHead(style.headsOverride(1)!)] : undefined, - dogleg: style.dogleg() ? toPrecisionValue(style.dogleg()) : undefined, - textStyle: parseTextStyle(style.textStyle()!), - textAttachment: (style.textAttachment() ?? undefined)!, - blockAttachment: (style.blockAttachment() ?? undefined)!, - }; -} - -export function parseDimensionToleranceStyle(style: DimensionToleranceStyleFb): DucDimensionStyle["tolerance"] { - return { - enabled: style.enabled(), - displayMethod: style.displayMethod()!, - upperValue: style.upperValue(), - lowerValue: style.lowerValue(), - precision: style.precision(), - textStyle: style.textStyle() ? parseTextStyle(style.textStyle()!) : {}, - }; -} - -export function parseDimensionStyle(style: DucDimensionStyleFb): DucDimensionStyle { - const dimLine = style.dimLine()!; - const extLine = style.extLine()!; - const symbols = style.symbols()!; - const centerMark = symbols.centerMarkType() ? { type: symbols.centerMarkType()!, size: toPrecisionValue(symbols.centerMarkSize()) } : undefined; - const fit = style.fit()!; - return { - dimLine: { - stroke: parseElementStroke(dimLine.stroke()!), - textGap: toPrecisionValue(dimLine.textGap()), - }, - extLine: { - stroke: parseElementStroke(extLine.stroke()!), - overshoot: toPrecisionValue(extLine.overshoot()), - offset: toPrecisionValue(extLine.offset()), - }, - textStyle: parseTextStyle(style.textStyle()!), - symbols: { - headsOverride: symbols.headsOverrideLength() > 0 ? [parseHead(symbols.headsOverride(0)!), parseHead(symbols.headsOverride(1)!)] : undefined, - centerMark: centerMark!, - }, - tolerance: parseDimensionToleranceStyle(style.tolerance()!), - fit: { - rule: fit.rule()!, - textPlacement: fit.textPlacement()!, - forceTextInside: fit.forceTextInside(), - }, - }; -} - -export function parseFeatureControlFrameStyle(style: DucFeatureControlFrameStyleFb): DucFeatureControlFrameStyle { - const layout = style.layout()!; - return { - textStyle: parseTextStyle(style.textStyle()!), - layout: { - padding: toPrecisionValue(layout.padding()), - segmentSpacing: toPrecisionValue(layout.segmentSpacing()), - rowSpacing: toPrecisionValue(layout.rowSpacing()), - }, - symbols: { - scale: style.symbols()!.scale(), - }, - datumStyle: { - bracketStyle: style.datumStyle()!.bracketStyle()!, - }, - }; -} - -export function parseDocStyle(style: DucDocStyleFb): DucDocStyle { - const paragraph = style.paragraph()!; - const stackFormat = style.stackFormat()!; - const stackProps = stackFormat.properties()!; - return { - ...parseTextStyle(style.textStyle()!), - paragraph: { - firstLineIndent: toPrecisionValue(paragraph.firstLineIndent()), - hangingIndent: toPrecisionValue(paragraph.hangingIndent()), - leftIndent: toPrecisionValue(paragraph.leftIndent()), - rightIndent: toPrecisionValue(paragraph.rightIndent()), - spaceBefore: toPrecisionValue(paragraph.spaceBefore()), - spaceAfter: toPrecisionValue(paragraph.spaceAfter()), - tabStops: Array.from({ length: paragraph.tabStopsLength() }, (_, i) => toPrecisionValue(paragraph.tabStops(i)!)), - }, - stackFormat: { - autoStack: stackFormat.autoStack(), - stackChars: Array.from({ length: stackFormat.stackCharsLength() }, (_, i) => stackFormat.stackChars(i)!), - properties: { - upperScale: stackProps.upperScale(), - lowerScale: stackProps.lowerScale(), - alignment: stackProps.alignment()!, - }, - }, - }; -} -// #endregion - - -// #region MAIN ELEMENT PARSER - -export function parseElementFromBinary(wrapper: ElementWrapper): DucElement | null { - const elementType = wrapper.elementType(); - - // Skip if no type is set - if (elementType === ElementUnion.NONE || elementType == null) { - return null; - } - - // Request the union only after type is known. Some flatc runtimes return null when the field is absent, - // which previously led to __union being called with invalid state in downstream code. - let element: any = null; - switch (elementType) { - case ElementUnion.DucRectangleElement: - element = wrapper.element(new DucRectangleElementFb()); - break; - case ElementUnion.DucPolygonElement: - element = wrapper.element(new DucPolygonElementFb()); - break; - case ElementUnion.DucEllipseElement: - element = wrapper.element(new DucEllipseElementFb()); - break; - case ElementUnion.DucEmbeddableElement: - element = wrapper.element(new DucEmbeddableElementFb()); - break; - case ElementUnion.DucPdfElement: - element = wrapper.element(new DucPdfElementFb()); - break; - case ElementUnion.DucMermaidElement: - element = wrapper.element(new DucMermaidElementFb()); - break; - case ElementUnion.DucTableElement: - element = wrapper.element(new DucTableElementFb()); - break; - case ElementUnion.DucImageElement: - element = wrapper.element(new DucImageElementFb()); - break; - case ElementUnion.DucTextElement: - element = wrapper.element(new DucTextElementFb()); - break; - case ElementUnion.DucLinearElement: - element = wrapper.element(new DucLinearElementFb()); - break; - case ElementUnion.DucArrowElement: - element = wrapper.element(new DucArrowElementFb()); - break; - case ElementUnion.DucFreeDrawElement: - element = wrapper.element(new DucFreeDrawElementFb()); - break; - case ElementUnion.DucFrameElement: - element = wrapper.element(new DucFrameElementFb()); - break; - case ElementUnion.DucPlotElement: - element = wrapper.element(new DucPlotElementFb()); - break; - case ElementUnion.DucViewportElement: - element = wrapper.element(new DucViewportElementFb()); - break; - case ElementUnion.DucXRayElement: - element = wrapper.element(new DucXRayElementFb()); - break; - case ElementUnion.DucLeaderElement: - element = wrapper.element(new DucLeaderElementFb()); - break; - case ElementUnion.DucDimensionElement: - element = wrapper.element(new DucDimensionElementFb()); - break; - case ElementUnion.DucFeatureControlFrameElement: - element = wrapper.element(new DucFeatureControlFrameElementFb()); - break; - case ElementUnion.DucDocElement: - element = wrapper.element(new DucDocElementFb()); - break; - case ElementUnion.DucModelElement: - element = wrapper.element(new DucModelElementFb()); - break; - default: - return null; - } - - if (!element) { - // Gracefully skip malformed/missing element entries - return null; - } - - switch (elementType) { - case ElementUnion.DucRectangleElement: - return parseRectangleElement(element as DucRectangleElementFb); - case ElementUnion.DucPolygonElement: - return parsePolygonElement(element as DucPolygonElementFb); - case ElementUnion.DucEllipseElement: - return parseEllipseElement(element as DucEllipseElementFb); - case ElementUnion.DucEmbeddableElement: - return parseEmbeddableElement(element as DucEmbeddableElementFb); - case ElementUnion.DucPdfElement: - return parsePdfElement(element as DucPdfElementFb); - case ElementUnion.DucMermaidElement: - return parseMermaidElement(element as DucMermaidElementFb); - case ElementUnion.DucTableElement: - return parseTableElement(element as DucTableElementFb); - case ElementUnion.DucImageElement: - return parseImageElement(element as DucImageElementFb); - case ElementUnion.DucTextElement: - return parseTextElement(element as DucTextElementFb); - case ElementUnion.DucLinearElement: - return parseLinearElement(element as DucLinearElementFb); - case ElementUnion.DucArrowElement: - return parseArrowElement(element as DucArrowElementFb); - case ElementUnion.DucFreeDrawElement: - return parseFreeDrawElement(element as DucFreeDrawElementFb); - case ElementUnion.DucFrameElement: - return parseFrameElement(element as DucFrameElementFb); - case ElementUnion.DucPlotElement: - return parsePlotElement(element as DucPlotElementFb); - case ElementUnion.DucViewportElement: - return parseViewportElement(element as DucViewportElementFb); - case ElementUnion.DucXRayElement: - return parseXRayElement(element as DucXRayElementFb); - case ElementUnion.DucLeaderElement: - return parseLeaderElement(element as DucLeaderElementFb); - case ElementUnion.DucDimensionElement: - return parseDimensionElement(element as DucDimensionElementFb); - case ElementUnion.DucFeatureControlFrameElement: - return parseFeatureControlFrameElement(element as DucFeatureControlFrameElementFb); - case ElementUnion.DucDocElement: - return parseDocElement(element as DucDocElementFb); - case ElementUnion.DucModelElement: - return parseModelElement(element as DucModelElementFb); - default: - return null; - } -} -// #endregion - - -// #region TOP-LEVEL STRUCTURE PARSERS - -export function parseBlockFromBinary(block: DucBlockFb): DucBlock { - const attributeDefinitions: Record = {}; - for (let i = 0; i < block.attributeDefinitionsLength(); i++) { - const entry = block.attributeDefinitions(i)!; - const def = entry.value()!; - attributeDefinitions[entry.key()!] = { - tag: def.tag()!, - prompt: def.prompt() || undefined, - defaultValue: def.defaultValue()!, - isConstant: def.isConstant(), - }; - } - - // Parse metadata if present - const metadata = parseBlockMetadata(block.metadata()); - - // Parse thumbnail if present - const thumbnail = block.thumbnailArray(); - - return { - id: block.id()!, - label: block.label()!, - description: block.description() || undefined, - version: block.version(), - attributeDefinitions, - metadata, - thumbnail: thumbnail || undefined, - }; -} - -export function parseDictionaryFromBinary(data: ExportedDataStateFb): Dictionary { - const dictionary: Dictionary = {}; - for (let i = 0; i < data.dictionaryLength(); i++) { - const entry = data.dictionary(i)!; - dictionary[entry.key()!] = entry.value()!; - } - return dictionary; -} - -export function parseExternalFilesFromBinary(entry: DucExternalFileEntry): DucExternalFiles { - const fileData = entry.value()!; - const data = fileData.dataArray(); - const key = entry.key()!; - const id = fileData.id()! as ExternalFileId; +export type LazyRestoredDataState = RestoredDataState & { + lazyFileStore: LazyExternalFileStore; +}; - return { - [key]: { - id, - mimeType: fileData.mimeType()!, - data, - created: Number(fileData.created()), - lastRetrieved: Number(fileData.lastRetrieved()) || undefined, - } - } as DucExternalFiles; -} +// Re-export from lazy-files for backwards compatibility +import { LazyExternalFileStore } from "./lazy-files"; +export { LazyExternalFileStore }; /** - * Parse only metadata (no binary data) from an external file entry. - * Used by the lazy file store to avoid copying file bytes into JS memory. + * Parse a `.duc` file (Blob/File) into a RestoredDataState. + * + * 1. Read file bytes + * 2. WASM parse (SQLite → Rust → JS via serde-wasm-bindgen) + * 3. Element fixups (stack element flattening) + * 4. restore() for defaults & migrations */ -export function parseExternalFileMetadataFromBinary(entry: DucExternalFileEntry): { - key: string; - metadata: DucExternalFileMetadata; -} | null { - const fileData = entry.value(); - const key = entry.key(); - if (!fileData || !key) return null; - - const id = fileData.id() as ExternalFileId | null; - if (!id) return null; - - return { - key, - metadata: { - id, - mimeType: fileData.mimeType() || "application/octet-stream", - created: Number(fileData.created()), - lastRetrieved: Number(fileData.lastRetrieved()) || undefined, - }, - }; -} - -export function parseGlobalStateFromBinary(state: DucGlobalStateFb): DucGlobalState { - return { - name: state.name(), - viewBackgroundColor: state.viewBackgroundColor()!, - mainScope: state.mainScope()! as Scope, - dashSpacingScale: toScaleFactor(state.dashSpacingScale()), - isDashSpacingAffectedByViewportScale: state.isDashSpacingAffectedByViewportScale(), - scopeExponentThreshold: state.scopeExponentThreshold(), - dimensionsAssociativeByDefault: state.dimensionsAssociativeByDefault(), - useAnnotativeScaling: state.useAnnotativeScaling(), - displayPrecision: { - linear: state.displayPrecisionLinear(), - angular: state.displayPrecisionAngular(), - }, - pruningLevel: state.pruningLevel()!, - }; -} - -export function parseGroupFromBinary(group: DucGroupFb): DucGroup { - return { - id: group.id()!, - ...parseStackBase(group.stackBase()!), - }; -} - -export function parseLayerFromBinary(layer: DucLayerFb): DucLayer { - const overrides = layer.overrides(); - return { - id: layer.id()!, - ...parseStackBase(layer.stackBase()!), - readonly: layer.readonly(), - overrides: overrides ? { - stroke: parseElementStroke(overrides.stroke()!), - background: parseElementBackground(overrides.background()!), - } : null, - }; -} - -export function parseLocalStateFromBinary(state: DucLocalStateFb): DucLocalState { - return { - scope: state.scope()! as Scope, - activeStandardId: state.activeStandardId()!, - scrollX: toPrecisionValue(state.scrollX()), - scrollY: toPrecisionValue(state.scrollY()), - zoom: toZoom(state.zoom()), - activeGridSettings: Array.from({ length: state.activeGridSettingsLength() }, (_, i) => state.activeGridSettings(i)!), - activeSnapSettings: state.activeSnapSettings(), - isBindingEnabled: state.isBindingEnabled(), - currentItemStroke: parseElementStroke(state.currentItemStroke()!), - currentItemBackground: parseElementBackground(state.currentItemBackground()!), - currentItemOpacity: toPercentage(state.currentItemOpacity()), - currentItemFontFamily: state.currentItemFontFamily()! as any, // For now will use as any because this will be a string in the future - currentItemFontSize: toPrecisionValue(state.currentItemFontSize()), - currentItemTextAlign: state.currentItemTextAlign()!, - currentItemStartLineHead: state.currentItemStartLineHead() ? parseHead(state.currentItemStartLineHead()!) as unknown as LineHead : null, - currentItemEndLineHead: state.currentItemEndLineHead() ? parseHead(state.currentItemEndLineHead()!) as unknown as LineHead : null, - currentItemRoundness: toPrecisionValue(state.currentItemRoundness()), - gridSize: 0, // deprecated - gridStep: 0, // deprecated - penMode: state.penMode(), - viewModeEnabled: state.viewModeEnabled(), - objectsSnapModeEnabled: state.objectsSnapModeEnabled(), - gridModeEnabled: state.gridModeEnabled(), - outlineModeEnabled: state.outlineModeEnabled(), - manualSaveMode: state.manualSaveMode(), - }; -} - -export function parseRegionFromBinary(region: DucRegionFb): DucRegion { - return { - id: region.id()!, - ...parseStackBase(region.stackBase()!), - booleanOperation: region.booleanOperation()!, - }; -} - -export function parsePrimaryUnits(units: PrimaryUnitsFb): StandardUnits["primaryUnits"] { - const linear = units.linear()!; - const angular = units.angular()!; - return { - linear: { - format: linear.format()!, - system: linear.base()!.system()!, - precision: linear.base()!.precision(), - suppressLeadingZeros: linear.base()!.suppressLeadingZeros(), - suppressTrailingZeros: linear.base()!.suppressTrailingZeros(), - decimalSeparator: linear.decimalSeparator()!, - suppressZeroFeet: linear.suppressZeroFeet(), - suppressZeroInches: linear.suppressZeroInches(), - }, - angular: { - format: angular.format()!, - system: angular.base()!.system()!, - precision: angular.base()!.precision(), - suppressLeadingZeros: angular.base()!.suppressLeadingZeros(), - suppressTrailingZeros: angular.base()!.suppressTrailingZeros(), - }, - }; -} - -export function parseStandardFromBinary(standard: StandardFb): Standard { - const overrides = standard.overrides(); - const styles = standard.styles(); - const viewSettings = standard.viewSettings(); - const units = standard.units(); - const validation = standard.validation(); - const primaryUnits = units?.primaryUnits(); - const alternateUnits = units?.alternateUnits(); - - return { - id: standard.identifier()!.id()!, - name: standard.identifier()!.name()!, - description: standard.identifier()!.description() || undefined, - version: standard.version()!, - readonly: standard.readonly(), - overrides: overrides ? { - mainScope: (overrides.mainScope() as Scope) || undefined, - elementsStrokeWidthOverride: overrides.elementsStrokeWidthOverride() ? toPrecisionValue(overrides.elementsStrokeWidthOverride()) : undefined, - commonStyleId: overrides.commonStyleId() || undefined, - stackLikeStyleId: overrides.stackLikeStyleId() || undefined, - textStyleId: overrides.textStyleId() || undefined, - dimensionStyleId: overrides.dimensionStyleId() || undefined, - leaderStyleId: overrides.leaderStyleId() || undefined, - featureControlFrameStyleId: overrides.featureControlFrameStyleId() || undefined, - tableStyleId: overrides.tableStyleId() || undefined, - docStyleId: overrides.docStyleId() || undefined, - viewportStyleId: overrides.viewportStyleId() || undefined, - plotStyleId: overrides.plotStyleId() || undefined, - hatchStyleId: overrides.hatchStyleId() || undefined, - activeGridSettingsId: Array.from({ length: overrides.activeGridSettingsIdLength() }, (_, i) => overrides.activeGridSettingsId(i)!), - activeSnapSettingsId: overrides.activeSnapSettingsId() || undefined, - dashLineOverride: overrides.dashLineOverride() || undefined, - unitPrecision: overrides.unitPrecision() ? { - linear: overrides.unitPrecision()!.linear(), - angular: overrides.unitPrecision()!.angular(), - area: overrides.unitPrecision()!.area(), - volume: overrides.unitPrecision()!.volume(), - } : undefined, - } : null, - styles: styles ? { - commonStyles: Array.from({ length: styles.commonStylesLength() }, (_, i) => { - const s = styles.commonStyles(i)!; - return { id: s.id()!.id()!, name: s.id()!.name()!, description: s.id()!.description() || undefined, ...parseCommonStyle(s.style()!) }; - }), - stackLikeStyles: Array.from({ length: styles.stackLikeStylesLength() }, (_, i) => { - const s = styles.stackLikeStyles(i)!; - return { id: s.id()!.id()!, name: s.id()!.name()!, description: s.id()!.description() || undefined, ...parseStackLikeStyles(s.style()!) }; - }), - textStyles: Array.from({ length: styles.textStylesLength() }, (_, i) => { - const s = styles.textStyles(i)!; - return { id: s.id()!.id()!, name: s.id()!.name()!, description: s.id()!.description() || undefined, ...parseTextStyle(s.style()!) }; - }), - dimensionStyles: Array.from({ length: styles.dimensionStylesLength() }, (_, i) => { - const s = styles.dimensionStyles(i)!; - return { id: s.id()!.id()!, name: s.id()!.name()!, description: s.id()!.description() || undefined, ...parseDimensionStyle(s.style()!) }; - }), - leaderStyles: Array.from({ length: styles.leaderStylesLength() }, (_, i) => { - const s = styles.leaderStyles(i)!; - return { id: s.id()!.id()!, name: s.id()!.name()!, description: s.id()!.description() || undefined, ...parseLeaderStyle(s.style()!) }; - }), - featureControlFrameStyles: Array.from({ length: styles.featureControlFrameStylesLength() }, (_, i) => { - const s = styles.featureControlFrameStyles(i)!; - return { id: s.id()!.id()!, name: s.id()!.name()!, description: s.id()!.description() || undefined, ...parseFeatureControlFrameStyle(s.style()!) }; - }), - tableStyles: Array.from({ length: styles.tableStylesLength() }, (_, i) => { - const s = styles.tableStyles(i)!; - return { id: s.id()!.id()!, name: s.id()!.name()!, description: s.id()!.description() || undefined, ...parseTableStyle(s.style()!) }; - }), - docStyles: Array.from({ length: styles.docStylesLength() }, (_, i) => { - const s = styles.docStyles(i)!; - return { id: s.id()!.id()!, name: s.id()!.name()!, description: s.id()!.description() || undefined, ...parseDocStyle(s.style()!) }; - }), - viewportStyles: Array.from({ length: styles.viewportStylesLength() }, (_, i) => { - const s = styles.viewportStyles(i)!; - return { id: s.id()!.id()!, name: s.id()!.name()!, description: s.id()!.description() || undefined, ...parseViewportStyle(s.style()!) }; - }), - hatchStyles: Array.from({ length: styles.hatchStylesLength() }, (_, i) => { - const s = styles.hatchStyles(i)!; - return { id: s.id()!.id()!, name: s.id()!.name()!, description: s.id()!.description() || undefined, ...parseHatchStyle(s.style()!) }; - }), - xrayStyles: Array.from({ length: styles.xrayStylesLength() }, (_, i) => { - const s = styles.xrayStyles(i)!; - return { id: s.id()!.id()!, name: s.id()!.name()!, description: s.id()!.description() || undefined, ...parseXRayStyle(s.style()!) }; - }), - } : null, - viewSettings: viewSettings ? { - views: Array.from({ length: viewSettings.viewsLength() }, (_, i) => { - const v = viewSettings.views(i)!; - return { id: v.id()!.id()!, name: v.id()!.name()!, description: v.id()!.description() || undefined, ...parseView(v.view()!) }; - }), - ucs: Array.from({ length: viewSettings.ucsLength() }, (_, i) => { - const u = viewSettings.ucs(i)!; - return { id: u.id()!.id()!, name: u.id()!.name()!, description: u.id()!.description() || undefined, ...parseUcs(u.ucs()!) }; - }), - gridSettings: Array.from({ length: viewSettings.gridSettingsLength() }, (_, i) => { - const g = viewSettings.gridSettings(i)!; - return { id: g.id()!.id()!, name: g.id()!.name()!, description: g.id()!.description() || undefined, ...parseGridSettings(g.settings()!) }; - }), - snapSettings: Array.from({ length: viewSettings.snapSettingsLength() }, (_, i) => { - const s = viewSettings.snapSettings(i)!; - return { id: s.id()!.id()!, name: s.id()!.name()!, description: s.id()!.description() || undefined, ...parseSnapSettings(s.settings()!) }; - }), - } : null, - units: units && primaryUnits && alternateUnits ? { - primaryUnits: parsePrimaryUnits(primaryUnits), - alternateUnits: { - ...parseUnitSystemBase(alternateUnits.base()!, alternateUnits.format()!), - isVisible: alternateUnits.isVisible(), - multiplier: alternateUnits.multiplier(), - }, - } as StandardUnits : null, - validation: validation ? { - dimensionRules: validation.dimensionRules() ? { - minTextHeight: toPrecisionValue(validation.dimensionRules()!.minTextHeight()), - maxTextHeight: toPrecisionValue(validation.dimensionRules()!.maxTextHeight()), - allowedPrecisions: Array.from({ length: validation.dimensionRules()!.allowedPrecisionsLength() }, (_, i) => validation.dimensionRules()!.allowedPrecisions(i)!), - } : undefined, - layerRules: validation.layerRules() ? { - prohibitedLayerNames: Array.from({ length: validation.layerRules()!.prohibitedLayerNamesLength() }, (_, i) => validation.layerRules()!.prohibitedLayerNames(i)!), - } : undefined, - } : null, - }; -} - -// #region STANDARDS & SETTINGS PARSERS -function parseCommonStyle(style: DucCommonStyleFb): DucCommonStyle { - return { - background: parseElementBackground(style.background()!), - stroke: parseElementStroke(style.stroke()!), - }; -} -// #endregion - -function parseUnitSystemBase(base: any, format: T): _UnitSystemBase { - return { - format, - system: base.system(), - precision: base.precision(), - suppressLeadingZeros: base.suppressLeadingZeros(), - suppressTrailingZeros: base.suppressTrailingZeros(), - }; -} - -function parseView(view: DucViewFb): DucView { - return { - scrollX: toPrecisionValue(view.scrollX()), - scrollY: toPrecisionValue(view.scrollY()), - zoom: toZoom(view.zoom()), - twistAngle: toRadian(view.twistAngle()), - centerPoint: parsePoint(view.centerPoint()!), - scope: view.scope()! as Scope, - }; -} - -function parseUcs(ucs: DucUcsFb): DucUcs { - return { - origin: parseGeometricPoint(ucs.origin()!), - angle: toRadian(ucs.angle()), - }; -} - -function parseGridSettings(settings: GridSettingsFb): GridSettings { - const polar = settings.polarSettings(); - const isometric = settings.isometricSettings(); - return { - type: settings.type()!, - readonly: settings.readonly(), - displayType: settings.displayType()!, - isAdaptive: settings.isAdaptive(), - xSpacing: toPrecisionValue(settings.xSpacing()), - ySpacing: toPrecisionValue(settings.ySpacing()), - subdivisions: settings.subdivisions(), - origin: parseGeometricPoint(settings.origin()!), - rotation: toRadian(settings.rotation()), - followUCS: settings.followUcs(), - majorStyle: { - color: settings.majorStyle()!.color()!, - opacity: toPercentage(settings.majorStyle()!.opacity()), - dashPattern: Array.from(settings.majorStyle()!.dashPatternArray() || []), - }, - minorStyle: { - color: settings.minorStyle()!.color()!, - opacity: toPercentage(settings.minorStyle()!.opacity()), - dashPattern: Array.from(settings.minorStyle()!.dashPatternArray() || []), - }, - showMinor: settings.showMinor(), - minZoom: settings.minZoom(), - maxZoom: settings.maxZoom(), - autoHide: settings.autoHide(), - polarSettings: polar ? { - radialDivisions: polar.radialDivisions(), - radialSpacing: toPrecisionValue(polar.radialSpacing()), - showLabels: polar.showLabels(), - } : undefined, - isometricSettings: isometric ? { - leftAngle: toRadian(isometric.leftAngle()), - rightAngle: toRadian(isometric.rightAngle()), - } : undefined, - enableSnapping: settings.enableSnapping(), - }; -} - -function parseSnapSettings(settings: SnapSettingsFb): SnapSettings { - const polar = settings.polarTracking()!; - const dynamic = settings.dynamicSnap()!; - const markers = settings.snapMarkers()!; - const markerStyles: Record = {} as any; - for (let i = 0; i < markers.stylesLength(); i++) { - const entry = markers.styles(i)!; - markerStyles[entry.key() as ObjectSnapMode] = { - shape: entry.value()!.shape()!, - color: entry.value()!.color()!, - }; - } - return { - readonly: settings.readonly(), - twistAngle: toRadian(settings.twistAngle()), - snapTolerance: settings.snapTolerance(), - objectSnapAperture: settings.objectSnapAperture(), - isOrthoModeOn: settings.isOrthoModeOn(), - polarTracking: { - enabled: polar.enabled(), - angles: Array.from(polar.anglesArray() || []).map(toRadian), - incrementAngle: polar.incrementAngle() ? toRadian(polar.incrementAngle()) : undefined, - trackFromLastPoint: polar.trackFromLastPoint(), - showPolarCoordinates: polar.showPolarCoordinates(), - }, - isObjectSnapOn: settings.isObjectSnapOn(), - activeObjectSnapModes: Array.from(settings.activeObjectSnapModesArray() || []), - snapPriority: Array.from(settings.snapPriorityArray() || []), - showTrackingLines: settings.showTrackingLines(), - trackingLineStyle: settings.trackingLineStyle() ? { - color: settings.trackingLineStyle()!.color()!, - opacity: toPercentage(settings.trackingLineStyle()!.opacity()), - dashPattern: Array.from(settings.trackingLineStyle()!.dashPatternArray() || []), - } : undefined, - dynamicSnap: { - enabledDuringDrag: dynamic.enabledDuringDrag(), - enabledDuringRotation: dynamic.enabledDuringRotation(), - enabledDuringScale: dynamic.enabledDuringScale(), - }, - temporaryOverrides: Array.from({ length: settings.temporaryOverridesLength() }, (_, i) => { - const o = settings.temporaryOverrides(i)!; - return { key: o.key()!, behavior: o.behavior()! }; - }), - incrementalDistance: settings.incrementalDistance(), - magneticStrength: settings.magneticStrength(), - layerSnapFilters: settings.layerSnapFilters() ? { - includeLayers: Array.from({ length: settings.layerSnapFilters()!.includeLayersLength() }, (_, i) => settings.layerSnapFilters()!.includeLayers(i)!), - excludeLayers: Array.from({ length: settings.layerSnapFilters()!.excludeLayersLength() }, (_, i) => settings.layerSnapFilters()!.excludeLayers(i)!), - } : undefined, - elementTypeFilters: Array.from({ length: settings.elementTypeFiltersLength() }, (_, i) => settings.elementTypeFilters(i)!) as DucElement["type"][], - snapMode: settings.snapMode()!, - snapMarkers: { - enabled: markers.enabled(), - size: markers.size(), - duration: markers.duration(), - styles: markerStyles, - }, - constructionSnapEnabled: settings.constructionSnapEnabled(), - snapToGridIntersections: settings.snapToGridIntersections(), - }; -} - -// #region VERSIONING & MISC -export function parseThumbnailFromBinary(data: ExportedDataStateFb): Uint8Array | undefined { - return data.thumbnailArray() || undefined; -} - -export function parseVersionGraphFromBinary(graph: VersionGraphFb | null): VersionGraph | null { - if (!graph) return null; - const metadata = graph.metadata()!; - return { - userCheckpointVersionId: graph.userCheckpointVersionId()!, - latestVersionId: graph.latestVersionId()!, - checkpoints: Array.from({ length: graph.checkpointsLength() }, (_, i) => { - const c = graph.checkpoints(i)!; - const base = c.base()!; - return { - type: "checkpoint", - id: base.id()!, - parentId: base.parentId(), - timestamp: Number(base.timestamp()), - description: base.description() || undefined, - isManualSave: base.isManualSave(), - userId: base.userId() || undefined, - data: c.dataArray()!, - sizeBytes: Number(c.sizeBytes()), - }; - }), - deltas: Array.from({ length: graph.deltasLength() }, (_, i) => { - const d = graph.deltas(i)!; - const base = d.base()!; - return { - type: "delta", - id: base.id()!, - parentId: base.parentId(), - timestamp: Number(base.timestamp()), - description: base.description() || undefined, - isManualSave: base.isManualSave(), - userId: base.userId() || undefined, - patch: parseBinaryToJson(d.patchArray()) as JSONPatch, - }; - }), - metadata: { - lastPruned: Number(metadata.lastPruned()), - totalSize: Number(metadata.totalSize()), - }, - }; -} - -// #endregion - - - -// #region ROOT PARSER -export const parseDuc = async ( +export async function parseDuc( blob: Blob | File, - fileHandle: FileSystemHandle | null = null, - restoreConfig: RestoreConfig = {}, -): Promise => { - const arrayBuffer = await blob.arrayBuffer(); - if (!arrayBuffer || (arrayBuffer as ArrayBuffer).byteLength === 0) { - throw new Error('Invalid DUC buffer: empty file'); - } - - const byteBuffer = new flatbuffers.ByteBuffer(new Uint8Array(arrayBuffer)); - - // Validate that the root can be read; flatbuffers will throw if buffer is not well-formed. - let data: ExportedDataStateFb; - try { - data = ExportedDataState.getRootAsExportedDataState(byteBuffer); - } catch (e) { - throw new Error('Invalid DUC buffer: cannot read root table'); - } - - const legacyVersion = data.versionLegacy(); - if (legacyVersion) { - throw new Error(`Unsupported DUC version: ${legacyVersion}. Please use version ducjs@2.0.1 or lower to support this file.`); - } - - const version = data.version(); - - const localState = data.ducLocalState(); - const parsedLocalState = localState && parseLocalStateFromBinary(localState); - - // Parse global state - const globalState = data.ducGlobalState(); - const parsedGlobalState = globalState && parseGlobalStateFromBinary(globalState); - - // Parse elements - const elements: Partial[] = []; - for (let i = 0; i < data.elementsLength(); i++) { - const e = data.elements(i); - if (e) { - const element = parseElementFromBinary(e); - if (element) { - elements.push(element); - } - } - } - - // Parse files - let parsedFiles: DucExternalFiles = {}; - for (let i = 0; i < data.externalFilesLength(); i++) { - const externalFile = data.externalFiles(i); - if (externalFile) { - const parsedFile: DucExternalFiles = parseExternalFilesFromBinary(externalFile); - parsedFiles = { ...parsedFiles, ...parsedFile }; - } - } + _fileHandle?: FileSystemFileHandle | null, + elementsConfig?: ElementsConfig, + restoreConfig?: RestoreConfig, +): Promise { + await ensureWasm(); - // Parse blocks - const blocks: DucBlock[] = []; - for (let i = 0; i < data.blocksLength(); i++) { - const block = data.blocks(i); - if (block) { - const parsedBlock = parseBlockFromBinary(block); - if (parsedBlock) { - blocks.push(parsedBlock as DucBlock); - } - } - } - - // Parse block instances - const blockInstances: DucBlockInstance[] = []; - for (let i = 0; i < data.blockInstancesLength(); i++) { - const blockInstance = data.blockInstances(i); - if (blockInstance) { - const parsedBlockInstance = parseBlockInstance(blockInstance); - if (parsedBlockInstance) { - blockInstances.push(parsedBlockInstance); - } - } - } - - // Parse block collections - const blockCollections: DucBlockCollection[] = []; - for (let i = 0; i < data.blockCollectionsLength(); i++) { - const blockCollection = data.blockCollections(i); - if (blockCollection) { - const parsedBlockCollection = parseBlockCollection(blockCollection); - if (parsedBlockCollection) { - blockCollections.push(parsedBlockCollection); - } - } - } - - // Parse groups - const groups: DucGroup[] = []; - for (let i = 0; i < data.groupsLength(); i++) { - const group = data.groups(i); - if (group) { - const parsedGroup = parseGroupFromBinary(group); - if (parsedGroup) { - groups.push(parsedGroup as DucGroup); - } - } - } - - // Parse dictionary - const dictionary = parseDictionaryFromBinary(data); - - // Parse thumbnail - const thumbnail = parseThumbnailFromBinary(data); + const buffer = new Uint8Array(await blob.arrayBuffer()); - // Parse version graph - const versionGraphData = data.versionGraph(); - const versionGraph = parseVersionGraphFromBinary(versionGraphData); - - // Parse regions - const regions: DucRegion[] = []; - for (let i = 0; i < data.regionsLength(); i++) { - const region = data.regions(i); - if (region) { - const parsedRegion = parseRegionFromBinary(region); - if (parsedRegion) { - regions.push(parsedRegion); - } - } + if (buffer.byteLength === 0) { + throw new Error(`[parseDuc] buffer too small (${buffer.byteLength} bytes) — not a valid .duc file`); } - // Parse layers - const layers: DucLayer[] = []; - for (let i = 0; i < data.layersLength(); i++) { - const layer = data.layers(i); - if (layer) { - const parsedLayer = parseLayerFromBinary(layer); - if (parsedLayer) { - layers.push(parsedLayer); - } - } - } + const header = new TextDecoder().decode(buffer.slice(0, 15)); - // Parse standards - const standards: Standard[] = []; - for (let i = 0; i < data.standardsLength(); i++) { - const standard = data.standards(i); - if (standard) { - const parsedStandard = parseStandardFromBinary(standard); - if (parsedStandard) { - standards.push(parsedStandard); - } - } + let raw: ExportedDataState; + try { + raw = wasmParseDuc(buffer) as ExportedDataState; + } catch (error) { + const prefixHex = Array.from(buffer.slice(0, 16)) + .map((b) => b.toString(16).padStart(2, "0")) + .join(" "); + throw new Error( + `[parseDuc] wasm parse failed (size=${buffer.byteLength}, header="${header}", prefix=${prefixHex}): ${error instanceof Error ? error.message : String(error)}`, + ); } - const exportData: RestoredDataState = { - thumbnail, - dictionary, - elements: elements as OrderedDucElement[], - localState: parsedLocalState!, - globalState: parsedGlobalState!, - blocks, - blockInstances, - blockCollections, - groups, - regions, - layers, - - standards, - files: parsedFiles, - - versionGraph: versionGraph ?? undefined, - id: data.id() ?? nanoid(), - }; - - const sanitized = restore( - exportData, - { - syncInvalidIndices: (elements) => elements as OrderedDucElement[], - repairBindings: true, - refreshDimensions: false, - }, - restoreConfig, - ); - - return { - thumbnail: sanitized.thumbnail, - dictionary: sanitized.dictionary, - elements: sanitized.elements, - localState: sanitized.localState, - globalState: sanitized.globalState, - files: sanitized.files, - blocks: sanitized.blocks, - blockInstances: sanitized.blockInstances, - groups: sanitized.groups, - regions: sanitized.regions, - layers: sanitized.layers, - blockCollections: sanitized.blockCollections, - standards: sanitized.standards, - versionGraph: sanitized.versionGraph, - id: sanitized.id, - }; -}; -// #endregion + const data = transformFromRust(raw) as ExportedDataState; -// #region LAZY ROOT PARSER - -import { LazyExternalFileStore } from "./lazy-files"; - -export type LazyRestoredDataState = Omit & { - /** Lazy file store: only metadata is in memory, file bytes are read on-demand from the buffer */ - lazyFileStore: LazyExternalFileStore; - /** Legacy `files` field — always empty. Use lazyFileStore instead. */ - files: DucExternalFiles; -}; + return restore(data, elementsConfig ?? { syncInvalidIndices: (els) => els as any }, restoreConfig); +} /** - * Parse a .duc binary with lazy external file loading. - * - * This is identical to `parseDuc` except: - * - External file BYTES are NOT copied into JS memory. - * - Only file metadata (~200 bytes per file) is parsed. - * - A `LazyExternalFileStore` is returned for on-demand data access. - * - The store holds a reference to the original Uint8Array buffer. - * - * Memory comparison for 500 PDFs averaging 5MB each: - * - parseDuc: files field holds 2.5GB of ArrayBuffer data in JS heap - * - parseDucLazy: ~100KB of metadata + the original buffer (referenced, not copied) - * - * @param buffer - The raw .duc file bytes (from storage/IndexedDB/filesystem) - * @param restoreConfig - Optional restore configuration + * Parse a `.duc` file lazily — returns everything EXCEPT external file data blobs. + * Use `LazyExternalFileStore` for on-demand file access. */ -export const parseDucLazy = async ( +export async function parseDucLazy( buffer: Uint8Array, - restoreConfig: RestoreConfig = {}, -): Promise => { - if (!buffer || buffer.byteLength === 0) { - throw new Error('Invalid DUC buffer: empty file'); + elementsConfig?: ElementsConfig, + restoreConfig?: RestoreConfig, +): Promise { + await ensureWasm(); + + if (buffer.byteLength === 0) { + throw new Error(`[parseDucLazy] buffer too small (${buffer.byteLength} bytes) — not a valid .duc file`); } - const byteBuffer = new flatbuffers.ByteBuffer(buffer); + const header = new TextDecoder().decode(buffer.slice(0, 15)); - let data: ExportedDataStateFb; + let raw: ExportedDataState; try { - data = ExportedDataState.getRootAsExportedDataState(byteBuffer); - } catch (e) { - throw new Error('Invalid DUC buffer: cannot read root table'); - } - - const legacyVersion = data.versionLegacy(); - if (legacyVersion) { - throw new Error(`Unsupported DUC version: ${legacyVersion}. Please use version ducjs@2.0.1 or lower to support this file.`); + raw = wasmParseDucLazy(buffer) as ExportedDataState; + } catch (error) { + const prefixHex = Array.from(buffer.slice(0, 16)) + .map((b) => b.toString(16).padStart(2, "0")) + .join(" "); + throw new Error( + `[parseDucLazy] wasm parse failed (size=${buffer.byteLength}, header="${header}", prefix=${prefixHex}): ${error instanceof Error ? error.message : String(error)}`, + ); } - const localState = data.ducLocalState(); - const parsedLocalState = localState && parseLocalStateFromBinary(localState); + const data = transformFromRust(raw) as ExportedDataState; - const globalState = data.ducGlobalState(); - const parsedGlobalState = globalState && parseGlobalStateFromBinary(globalState); - - // Parse elements - const elements: Partial[] = []; - for (let i = 0; i < data.elementsLength(); i++) { - const e = data.elements(i); - if (e) { - const element = parseElementFromBinary(e); - if (element) { - elements.push(element); - } - } - } - - // Create lazy file store — only metadata is parsed, no file bytes copied const lazyFileStore = new LazyExternalFileStore(buffer); + const files: DucExternalFiles = {}; - // Parse blocks - const blocks: DucBlock[] = []; - for (let i = 0; i < data.blocksLength(); i++) { - const block = data.blocks(i); - if (block) { - const parsedBlock = parseBlockFromBinary(block); - if (parsedBlock) { - blocks.push(parsedBlock as DucBlock); - } - } - } - - // Parse block instances - const blockInstances: DucBlockInstance[] = []; - for (let i = 0; i < data.blockInstancesLength(); i++) { - const blockInstance = data.blockInstances(i); - if (blockInstance) { - const parsedBlockInstance = parseBlockInstance(blockInstance); - if (parsedBlockInstance) { - blockInstances.push(parsedBlockInstance); - } - } - } - - // Parse block collections - const blockCollections: DucBlockCollection[] = []; - for (let i = 0; i < data.blockCollectionsLength(); i++) { - const blockCollection = data.blockCollections(i); - if (blockCollection) { - const parsedBlockCollection = parseBlockCollection(blockCollection); - if (parsedBlockCollection) { - blockCollections.push(parsedBlockCollection); - } - } - } - - // Parse groups - const groups: DucGroup[] = []; - for (let i = 0; i < data.groupsLength(); i++) { - const group = data.groups(i); - if (group) { - const parsedGroup = parseGroupFromBinary(group); - if (parsedGroup) { - groups.push(parsedGroup as DucGroup); - } - } - } - - // Parse dictionary - const dictionary = parseDictionaryFromBinary(data); - - // Parse thumbnail - const thumbnail = parseThumbnailFromBinary(data); - - // Parse version graph - const versionGraphData = data.versionGraph(); - const versionGraph = parseVersionGraphFromBinary(versionGraphData); - - // Parse regions - const regions: DucRegion[] = []; - for (let i = 0; i < data.regionsLength(); i++) { - const region = data.regions(i); - if (region) { - const parsedRegion = parseRegionFromBinary(region); - if (parsedRegion) { - regions.push(parsedRegion); - } - } - } - - // Parse layers - const layers: DucLayer[] = []; - for (let i = 0; i < data.layersLength(); i++) { - const layer = data.layers(i); - if (layer) { - const parsedLayer = parseLayerFromBinary(layer); - if (parsedLayer) { - layers.push(parsedLayer); - } - } - } - - // Parse standards - const standards: Standard[] = []; - for (let i = 0; i < data.standardsLength(); i++) { - const standard = data.standards(i); - if (standard) { - const parsedStandard = parseStandardFromBinary(standard); - if (parsedStandard) { - standards.push(parsedStandard); - } - } - } - - const exportData: RestoredDataState = { - thumbnail, - dictionary, - elements: elements as OrderedDucElement[], - localState: parsedLocalState!, - globalState: parsedGlobalState!, - blocks, - blockInstances, - blockCollections, - groups, - regions, - layers, - standards, - files: {}, // empty — use lazyFileStore - versionGraph: versionGraph ?? undefined, - id: data.id() ?? nanoid(), - }; - - const sanitized = restore( - exportData, - { - syncInvalidIndices: (elements) => elements as OrderedDucElement[], - repairBindings: true, - refreshDimensions: false, - }, + const restored = restore( + { ...data, files }, + elementsConfig ?? { syncInvalidIndices: (els) => els as any }, restoreConfig, - ); + ) as LazyRestoredDataState; + restored.lazyFileStore = lazyFileStore; - return { - thumbnail: sanitized.thumbnail, - dictionary: sanitized.dictionary, - elements: sanitized.elements, - localState: sanitized.localState, - globalState: sanitized.globalState, - files: {}, - lazyFileStore, - blocks: sanitized.blocks, - blockInstances: sanitized.blockInstances, - groups: sanitized.groups, - regions: sanitized.regions, - layers: sanitized.layers, - blockCollections: sanitized.blockCollections, - standards: sanitized.standards, - versionGraph: sanitized.versionGraph, - id: sanitized.id, - }; -}; -// #endregion + return restored; +} diff --git a/packages/ducjs/src/restore/index.ts b/packages/ducjs/src/restore/index.ts index 0bba189d..78d89f06 100644 --- a/packages/ducjs/src/restore/index.ts +++ b/packages/ducjs/src/restore/index.ts @@ -1,3 +1,2 @@ export * from "./restoreDataState"; export * from "./restoreElements"; -export * from "./restoreStandards"; \ No newline at end of file diff --git a/packages/ducjs/src/restore/restoreDataState.ts b/packages/ducjs/src/restore/restoreDataState.ts index 03509fc9..92994162 100644 --- a/packages/ducjs/src/restore/restoreDataState.ts +++ b/packages/ducjs/src/restore/restoreDataState.ts @@ -15,7 +15,7 @@ import { STROKE_SIDE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN, -} from "../flatbuffers/duc"; +} from "../enums"; import { getPrecisionScope } from "../technical/measurements"; import { getPrecisionValueFromRaw, @@ -23,7 +23,6 @@ import { NEUTRAL_SCOPE, ScaleFactors } from "../technical/scopes"; -import { PREDEFINED_STANDARDS, Standard } from "../technical/standards"; import type { Checkpoint, Delta, @@ -31,7 +30,6 @@ import type { DucExternalFiles, DucGlobalState, ImportedDataState, - JSONPatch, LibraryItems, PrecisionValue, RawValue, @@ -45,7 +43,6 @@ import type { BezierMirroring, BlockLocalizationMap, DucBlock, - DucBlockAttributeDefinition, DucBlockCollection, DucBlockInstance, DucElement, @@ -93,10 +90,6 @@ import { } from "../utils/constants"; import { getDefaultStackProperties } from "../utils/elements"; import { restoreElements } from "./restoreElements"; -import { - isStandardIdPresent, - restoreStandards, -} from "./restoreStandards"; export type RestoredLocalState = Omit< DucLocalState, @@ -122,7 +115,6 @@ export type RestoredDataState = { regions: DucRegion[]; layers: DucLayer[]; - standards: Standard[]; versionGraph: VersionGraph | undefined; id: string; }; @@ -162,13 +154,11 @@ export const restore = ( elementsConfig: ElementsConfig, restoreConfig: RestoreConfig = {}, ): RestoredDataState => { - const restoredStandards = restoreStandards(data?.standards); const restoredDictionary = restoreDictionary(data?.dictionary); const restoredGlobalState = restoreGlobalState(data?.globalState); const restoredLocalState = restoreLocalState( data?.localState, restoredGlobalState, - restoredStandards, restoreConfig.forceScope ); @@ -214,7 +204,6 @@ export const restore = ( regions: restoredRegions, layers: restoredLayers, - standards: restoredStandards, versionGraph: restoredVersionGraph, localState: restoredLocalState, @@ -340,14 +329,15 @@ export const restoreLayers = ( } ) .map((l): DucLayer => { + const overridesSource = l.overrides && typeof l.overrides === "object" ? l.overrides : null; return { id: l.id as string, ...restoreDucStackProperties(l), readonly: isValidBoolean(l.readonly, false), - overrides: { - stroke: validateStroke(l.overrides.stroke, currentScope, currentScope), - background: validateBackground(l.overrides.background), - }, + overrides: overridesSource ? { + stroke: validateStroke(overridesSource.stroke, currentScope, currentScope), + background: validateBackground(overridesSource.background), + } : null, }; }); }; @@ -414,11 +404,6 @@ export const restoreBlocks = ( label: typeof obj.label === "string" ? obj.label : "", description: typeof obj.description === "string" ? obj.description : undefined, version: typeof obj.version === "number" ? obj.version : 1, - attributes: obj.attributes || undefined, - attributeDefinitions: - obj.attributeDefinitions && typeof obj.attributeDefinitions === "object" - ? (obj.attributeDefinitions as Readonly>) - : {}, metadata, thumbnail: isValidUint8Array(obj.thumbnail), }; @@ -506,29 +491,11 @@ export const restoreBlockInstances = ( } } - // Handle attributeValues - same logic - let attributeValues: Record | undefined; - if (obj.attributeValues && typeof obj.attributeValues === "object") { - if (Array.isArray(obj.attributeValues)) { - // Legacy format: array of {key, value} entries - attributeValues = Object.fromEntries( - obj.attributeValues.map((entry: any) => [ - typeof entry.key === "string" ? entry.key : "", - typeof entry.value === "string" ? entry.value : "", - ]) - ); - } else { - // Current format: already a Record - attributeValues = obj.attributeValues as Record; - } - } - return { id: isValidString(obj.id), blockId: isValidString(obj.blockId), version: isValidNumber(obj.version, 1), elementOverrides, - attributeValues, duplicationArray: dupArray && typeof dupArray === "object" ? { rows: typeof dupArray.rows === "number" ? dupArray.rows : 1, @@ -590,10 +557,6 @@ export const restoreGlobalState = ( ): DucGlobalState => { const defaults = getDefaultGlobalState(); - const linearPrecision = isValidFinitePositiveByteValue( - importedState?.displayPrecision?.linear, - defaults.displayPrecision.linear - ); return { ...defaults, name: importedState?.name ?? defaults.name, @@ -605,22 +568,6 @@ export const restoreGlobalState = ( importedState?.scopeExponentThreshold, defaults.scopeExponentThreshold ), - dashSpacingScale: - importedState?.dashSpacingScale ?? defaults.dashSpacingScale, - isDashSpacingAffectedByViewportScale: - importedState?.isDashSpacingAffectedByViewportScale ?? - defaults.isDashSpacingAffectedByViewportScale, - dimensionsAssociativeByDefault: - importedState?.dimensionsAssociativeByDefault ?? - defaults.dimensionsAssociativeByDefault, - useAnnotativeScaling: - importedState?.useAnnotativeScaling ?? defaults.useAnnotativeScaling, - displayPrecision: { - linear: linearPrecision, - angular: - importedState?.displayPrecision?.angular ?? - defaults.displayPrecision.angular, - }, pruningLevel: importedState?.pruningLevel && Object.values(PRUNING_LEVEL).includes(importedState.pruningLevel) @@ -641,11 +588,16 @@ export const restoreGlobalState = ( export const restoreLocalState = ( importedState: Partial = {}, restoredGlobalState: RestoredDataState["globalState"], - restoredStandards: RestoredDataState["standards"], forceScope?: Scope ): DucLocalState => { const defaults = getDefaultLocalState(); - const zoom = getZoom(importedState?.zoom?.value ?? defaults.zoom.value, restoredGlobalState.mainScope, restoredGlobalState.scopeExponentThreshold); + + // Rust sends zoom as a plain f64, TS stores it as { value, scoped, scaled }. + // Handle both formats. + const rawZoom = typeof importedState?.zoom === "number" + ? importedState.zoom + : importedState?.zoom?.value; + const zoom = getZoom(rawZoom ?? defaults.zoom.value, restoredGlobalState.mainScope, restoredGlobalState.scopeExponentThreshold); const scope = forceScope ? isValidScopeValue(forceScope) : isValidPrecisionScopeValue( @@ -658,43 +610,77 @@ export const restoreLocalState = ( ...defaults, ...importedState, scope, - activeStandardId: isValidStandardId( - importedState?.activeStandardId, - restoredStandards, - defaults.activeStandardId - ), isBindingEnabled: isValidBoolean( importedState?.isBindingEnabled, defaults.isBindingEnabled ), penMode: isValidBoolean(importedState?.penMode, defaults.penMode), - scrollX: importedState?.scrollX + scrollX: importedState?.scrollX != null ? restorePrecisionValue(importedState.scrollX, NEUTRAL_SCOPE, scope) : getPrecisionValueFromRaw(defaults.scrollX.value, NEUTRAL_SCOPE, scope), - scrollY: importedState?.scrollY + scrollY: importedState?.scrollY != null ? restorePrecisionValue(importedState.scrollY, NEUTRAL_SCOPE, scope) : getPrecisionValueFromRaw(defaults.scrollY.value, NEUTRAL_SCOPE, scope), zoom, - activeGridSettings: - importedState?.activeGridSettings ?? defaults.activeGridSettings, - activeSnapSettings: - importedState?.activeSnapSettings ?? defaults.activeSnapSettings, currentItemStroke: validateStroke(importedState?.currentItemStroke, scope, scope) ?? defaults.currentItemStroke, currentItemBackground: validateBackground(importedState?.currentItemBackground) ?? defaults.currentItemBackground, + currentItemFontFamily: + typeof importedState?.currentItemFontFamily === "string" + ? importedState.currentItemFontFamily + : defaults.currentItemFontFamily, + currentItemFontSize: restorePrecisionValue( + importedState?.currentItemFontSize, + scope, + scope, + defaults.currentItemFontSize.value + ), + currentItemTextAlign: isValidTextAlignValue( + importedState?.currentItemTextAlign + ), currentItemOpacity: isValidPercentageValue( importedState?.currentItemOpacity, defaults.currentItemOpacity ), + currentItemRoundness: restorePrecisionValue( + importedState?.currentItemRoundness, + scope, + scope, + defaults.currentItemRoundness.value + ), currentItemStartLineHead: isValidLineHeadValue(importedState?.currentItemStartLineHead) ?? defaults.currentItemStartLineHead, currentItemEndLineHead: isValidLineHeadValue(importedState?.currentItemEndLineHead) ?? defaults.currentItemEndLineHead, + viewModeEnabled: isValidBoolean( + importedState?.viewModeEnabled, + defaults.viewModeEnabled + ), + objectsSnapModeEnabled: isValidBoolean( + importedState?.objectsSnapModeEnabled, + defaults.objectsSnapModeEnabled + ), + gridModeEnabled: isValidBoolean( + importedState?.gridModeEnabled, + defaults.gridModeEnabled + ), + outlineModeEnabled: isValidBoolean( + importedState?.outlineModeEnabled, + defaults.outlineModeEnabled + ), + manualSaveMode: isValidBoolean( + importedState?.manualSaveMode, + defaults.manualSaveMode + ), + decimalPlaces: isValidDecimalPlacesValue( + importedState?.decimalPlaces, + defaults.decimalPlaces + ), }; }; @@ -711,85 +697,31 @@ export const restoreVersionGraph = ( if (!userCheckpointVersionId || !latestVersionId) { return undefined; } - const checkpoints: Checkpoint[] = []; - if (Array.isArray(importedGraph.checkpoints)) { - for (const c of importedGraph.checkpoints) { - if (!c || typeof c !== "object" || c.type !== "checkpoint") { - continue; - } - const id = isValidString(c.id); - if (!id) { - continue; - } - const parentId = typeof c.parentId === "string" ? c.parentId : null; - const timestamp = isFiniteNumber(c.timestamp) ? c.timestamp : 0; - const isManualSave = isValidBoolean(c.isManualSave, false); - const sizeBytes = - isFiniteNumber(c.sizeBytes) && c.sizeBytes >= 0 ? c.sizeBytes : 0; - const data = isValidUint8Array(c.data); - if (!data) { - continue; - } - checkpoints.push({ - type: "checkpoint", - id, - parentId, - timestamp, - isManualSave, - sizeBytes, - data, - description: isValidString(c.description) || undefined, - userId: isValidString(c.userId) || undefined, - }); - } - } - const deltas: Delta[] = []; - if (Array.isArray(importedGraph.deltas)) { - for (const d of importedGraph.deltas) { - if (!d || typeof d !== "object" || d.type !== "delta") { - continue; - } - const id = isValidString(d.id); - if (!id) { - continue; - } - const parentId = typeof d.parentId === "string" ? d.parentId : null; - const timestamp = isFiniteNumber(d.timestamp) ? d.timestamp : 0; - const isManualSave = isValidBoolean(d.isManualSave, false); - if (!Array.isArray(d.patch)) { - continue; - } - const patch: JSONPatch = []; - let isPatchValid = true; - for (const op of d.patch) { - if ( - !op || - typeof op !== "object" || - !isValidString(op.op) || - !isValidString(op.path) - ) { - isPatchValid = false; - break; - } - patch.push({ op: op.op, path: op.path, value: op.value }); - } - if (!isPatchValid) { - continue; - } - deltas.push({ - type: "delta", - id, - parentId, - timestamp, - isManualSave, - patch, - description: isValidString(d.description) || undefined, - userId: isValidString(d.userId) || undefined, - }); - } - } + const checkpoints: Checkpoint[] = Array.isArray(importedGraph.checkpoints) + ? importedGraph.checkpoints + .map((checkpoint: unknown) => restoreCheckpoint(checkpoint)) + .filter((checkpoint: Checkpoint | undefined): checkpoint is Checkpoint => Boolean(checkpoint)) + : []; + + const deltas: Delta[] = Array.isArray(importedGraph.deltas) + ? importedGraph.deltas + .map((delta: unknown) => restoreDelta(delta)) + .filter((delta: Delta | undefined): delta is Delta => Boolean(delta)) + : []; const importedMetadata = importedGraph.metadata; const metadata: VersionGraph["metadata"] = { + currentVersion: + isFiniteNumber(importedMetadata?.currentVersion) && importedMetadata.currentVersion >= 0 + ? importedMetadata.currentVersion + : 0, + currentSchemaVersion: + isFiniteNumber(importedMetadata?.currentSchemaVersion) && importedMetadata.currentSchemaVersion >= 1 + ? importedMetadata.currentSchemaVersion + : 1, + chainCount: + isFiniteNumber(importedMetadata?.chainCount) && importedMetadata.chainCount >= 1 + ? importedMetadata.chainCount + : 1, lastPruned: isFiniteNumber(importedMetadata?.lastPruned) ? importedMetadata.lastPruned : 0, @@ -802,12 +734,88 @@ export const restoreVersionGraph = ( return { userCheckpointVersionId, latestVersionId, + chains: Array.isArray(importedGraph.chains) ? importedGraph.chains : [], checkpoints, deltas, metadata, }; }; +export const restoreCheckpoint = (importedCheckpoint: unknown): Checkpoint | undefined => { + if (!importedCheckpoint || typeof importedCheckpoint !== "object") { + return undefined; + } + const checkpoint = importedCheckpoint as Record; + if (checkpoint.type !== "checkpoint") { + return undefined; + } + + const id = isValidString(checkpoint.id); + const data = isValidUint8Array(checkpoint.data); + if (!id || !data) { + return undefined; + } + + return { + type: "checkpoint", + id, + parentId: typeof checkpoint.parentId === "string" ? checkpoint.parentId : null, + timestamp: isFiniteNumber(checkpoint.timestamp) ? checkpoint.timestamp : 0, + isManualSave: isValidBoolean(checkpoint.isManualSave, false), + versionNumber: isFiniteNumber(checkpoint.versionNumber) ? checkpoint.versionNumber : 0, + schemaVersion: + isFiniteNumber(checkpoint.schemaVersion) && checkpoint.schemaVersion >= 1 + ? checkpoint.schemaVersion + : 1, + isSchemaBoundary: isValidBoolean(checkpoint.isSchemaBoundary, false), + data, + sizeBytes: + isFiniteNumber(checkpoint.sizeBytes) && checkpoint.sizeBytes >= 0 + ? checkpoint.sizeBytes + : data.byteLength, + description: isValidString(checkpoint.description) || undefined, + userId: isValidString(checkpoint.userId) || undefined, + }; +}; + +export const restoreDelta = (importedDelta: unknown): Delta | undefined => { + if (!importedDelta || typeof importedDelta !== "object") { + return undefined; + } + const delta = importedDelta as Record; + if (delta.type !== "delta") { + return undefined; + } + + const id = isValidString(delta.id); + const payload = isValidUint8Array(delta.payload); + const baseCheckpointId = isValidString(delta.baseCheckpointId); + if (!id || !payload || !baseCheckpointId) { + return undefined; + } + + return { + type: "delta", + id, + parentId: typeof delta.parentId === "string" ? delta.parentId : null, + timestamp: isFiniteNumber(delta.timestamp) ? delta.timestamp : 0, + isManualSave: isValidBoolean(delta.isManualSave, false), + versionNumber: isFiniteNumber(delta.versionNumber) ? delta.versionNumber : 0, + schemaVersion: + isFiniteNumber(delta.schemaVersion) && delta.schemaVersion >= 1 + ? delta.schemaVersion + : 1, + baseCheckpointId, + payload, + sizeBytes: + isFiniteNumber(delta.sizeBytes) && delta.sizeBytes >= 0 + ? delta.sizeBytes + : payload.byteLength, + description: isValidString(delta.description) || undefined, + userId: isValidString(delta.userId) || undefined, + }; +}; + /** * Restores common properties for elements leveraging _DucStackBase. */ @@ -829,14 +837,7 @@ export const restoreDucStackProperties = ( defaultStackProperties.isVisible ), isPlot: isValidBoolean(stack.isPlot, defaultStackProperties.isPlot), - opacity: isValidPercentageValue( - stack.opacity, - defaultStackProperties.opacity - ), - labelingColor: isValidColor( - stack.labelingColor, - defaultStackProperties.labelingColor - ), + opacity: isValidPercentageValue(stack.opacity, defaultStackProperties.opacity), }; }; @@ -937,6 +938,22 @@ export const isValidTextAlignValue = ( return value; }; +export const isValidDecimalPlacesValue = ( + value: number | undefined, + fallback: number +): number => { + if (typeof value !== "number" || !Number.isFinite(value)) { + return fallback; + } + + const truncated = Math.trunc(value); + if (truncated < 0 || truncated > 20) { + return fallback; + } + + return truncated; +}; + export const isValidScopeValue = ( value: string | undefined, localState?: Readonly> | null, @@ -1332,20 +1349,6 @@ export const isValidUint8Array = (value: unknown): Uint8Array | undefined => { return undefined; }; -/** - * Validates a Standard id. - * Returns the id if valid and present in standards, otherwise returns the default DUC standard id. - */ -export const isValidStandardId = ( - id: any, - standards: Standard[], - defaultId: string = PREDEFINED_STANDARDS.DUC -): string => { - const validId = isValidString(id); - if (isStandardIdPresent(validId, standards)) return validId; - return defaultId; -}; - /** * Validates a block id. * Returns the id if present in restored blocks, otherwise returns null. diff --git a/packages/ducjs/src/restore/restoreElements.ts b/packages/ducjs/src/restore/restoreElements.ts index dcdb923e..6a440d46 100644 --- a/packages/ducjs/src/restore/restoreElements.ts +++ b/packages/ducjs/src/restore/restoreElements.ts @@ -1,56 +1,23 @@ -import { - ElementsConfig, - isValidBezierMirroringValue, - isValidBlendingValue, - isValidBoolean, - isValidBoolean as isValidBooleanValue, // Renaming to avoid conflict - isValidColor, - isValidDucHead, - isValidEnumValue, - isValidFunction, - isValidImageScaleValue, - isValidImageStatusValue, - isValidPercentageValue, - isValidPolygonSides, - isValidRadianValue, - isValidString, - isValidTextAlignValue, - isValidVerticalAlignValue, - RestoredDataState, - restoreDucStackProperties, - restorePrecisionValue, - validateBackground, - validateStroke -} from "./restoreDataState"; import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, - getScaledZoomValueForScope, getScopedBezierPointFromDucPoint, - getScopedZoomValue, NEUTRAL_SCOPE, - ScaleFactors, + ScaleFactors } from "../technical/scopes"; import { _DucElementBase, _DucStackElementBase, BezierMirroring, - DatumReference, - DimensionDefinitionPoints, DocumentGridConfig, DucBinderElement, - DucDimensionElement, - DucDimensionStyle, DucDocElement, - DucDocStyle, DucElement, - DucFeatureControlFrameElement, DucFrameElement, DucFreeDrawEasing, DucFreeDrawEnds, DucGlobalState, DucHead, - DucLeaderElement, DucLine, DucLinearElement, DucLocalState, @@ -60,25 +27,15 @@ import { DucPoint, DucPointBinding, DucSelectionElement, - DucTableCell, - DucTableColumn, DucTableElement, - DucTableRow, - DucTextDynamicPart, DucTextElement, DucTextStyle, - DucView, - DucViewportElement, - DucXRayElement, - ElementContentBase, ExternalFileId, - FeatureControlFrameSegment, FontFamilyValues, ImportedDataState, isElbowArrow, isLinearElement, isTextElement, - LeaderContent, Mutable, NonDeleted, OrderedDucElement, @@ -89,8 +46,7 @@ import { RawValue, ScaleFactor, Scope, - TextColumn, - ViewportScale, + Viewer3DState, } from "../types"; import { arrayToMap, @@ -103,14 +59,11 @@ import { detectLineHeight, FONT_FAMILY, getContainerElement, - getDefaultLocalState, getDefaultTableData, getNormalizedDimensions, getNormalizedPoints, - getNormalizedZoom, getSizeFromPoints, getUpdatedTimestamp, - isFiniteNumber, isInvisiblySmallElement, LINE_CONFIRM_THRESHOLD, mergeOverlappingPoints, @@ -119,32 +72,38 @@ import { normalizeLink, randomId, refreshTextDimensions, - validateClosedPath, + validateClosedPath } from "../utils"; +import { + ElementsConfig, + isValidBezierMirroringValue, + isValidBlendingValue, + isValidBoolean, + isValidBoolean as isValidBooleanValue, // Renaming to avoid conflict + isValidColor, + isValidDucHead, + isValidFunction, + isValidImageScaleValue, + isValidImageStatusValue, + isValidPercentageValue, + isValidPolygonSides, + isValidRadianValue, + isValidString, + isValidTextAlignValue, + isValidVerticalAlignValue, + RestoredDataState, + restoreDucStackProperties, + restorePrecisionValue, + validateBackground, + validateStroke +} from "./restoreDataState"; import { - AXIS, - BLOCK_ATTACHMENT, - COLUMN_TYPE, - DATUM_BRACKET_STYLE, - DIMENSION_FIT_RULE, - DIMENSION_TEXT_PLACEMENT, - DIMENSION_TYPE, - GDT_SYMBOL, - LEADER_CONTENT_TYPE, LINE_SPACING_TYPE, - MARK_ELLIPSE_CENTER, - MATERIAL_CONDITION, - PARAMETRIC_SOURCE_TYPE, - STACKED_TEXT_ALIGN, - TABLE_CELL_ALIGNMENT, - TABLE_FLOW_DIRECTION, - TEXT_FLOW_DIRECTION, - TOLERANCE_DISPLAY, - TOLERANCE_ZONE_TYPE, - VERTICAL_ALIGN, - VIEWPORT_SHADE_PLOT, -} from "../flatbuffers/duc"; +} from "../enums"; + +const PARAMETRIC_SOURCE_TYPE = { CODE: 10, FILE: 11 } as const; + import tinycolor from "tinycolor2"; const restoreElementWithProperties = < @@ -233,10 +192,6 @@ const restoreElementWithProperties = < DEFAULT_ELEMENT_PROPS.isVisible ), isPlot: isValidBoolean(_element.isPlot, DEFAULT_ELEMENT_PROPS.isPlot), - isAnnotative: isValidBoolean( - _element.isAnnotative, - DEFAULT_ELEMENT_PROPS.isAnnotative - ), layerId: _element.layerId ?? null, regionIds: Array.isArray(_element.regionIds) ? _element.regionIds : [], width: restorePrecisionValue(_element.width, elementScope, currentScope, 0), @@ -248,6 +203,8 @@ const restoreElementWithProperties = < ), seed: _element.seed ?? 1, groupIds: _element.groupIds ?? [], + blockIds: Array.isArray(_element.blockIds) ? _element.blockIds : [], + instanceId: _element.instanceId ?? null, frameId: _element.frameId ?? null, roundness: restorePrecisionValue( _element.roundness, @@ -377,7 +334,6 @@ const restoreElement = ( { // DucTextElement specific text, - dynamic: restoreTextDynamicParts(element.dynamic), autoResize: isValidBooleanValue(element.autoResize, true), containerId: element.containerId ?? null, originalText: element.originalText || text, @@ -391,13 +347,6 @@ const restoreElement = ( lineSpacing: restoredLineSpacing, obliqueAngle: isValidRadianValue(element.obliqueAngle, 0 as Radian), fontSize: finalFontSize, - paperTextHeight: element.paperTextHeight - ? restorePrecisionValue( - element.paperTextHeight, - textElementScope, - currentScope - ) - : undefined, widthFactor: typeof element.widthFactor === "number" ? element.widthFactor @@ -769,101 +718,6 @@ const restoreElement = ( ); } - case "viewport": { - const viewportElement = element as DucViewportElement; - const elementScope = isValidElementScopeValue( - viewportElement.scope, - globalState?.mainScope - ); - - // A viewport has both linear and stack properties - const { points, lines } = restoreLinearElementPointsAndLines({ - points: viewportElement.points as DucPoint[], - lines: viewportElement.lines as DucLine[], - x: viewportElement.x, - y: viewportElement.y, - width: viewportElement.width, - height: viewportElement.height, - elementScope, - currentScope, - skipNormalization: false, // Viewports are typically non-binding polygons - }); - - const stackProperties = restoreStackElementProperties( - viewportElement, - currentScope - ); - const defaults = getDefaultLocalState(); - - const zoomValue = getNormalizedZoom( - isFiniteNumber(localState?.zoom?.value) - ? localState.zoom!.value - : defaults.zoom.value - ); - const scopedZoom = getScopedZoomValue(zoomValue, currentScope); - - const view: DucView = { - scrollX: restorePrecisionValue( - viewportElement.view?.scrollX, - NEUTRAL_SCOPE, - currentScope, - 0 - ), - scrollY: restorePrecisionValue( - viewportElement.view?.scrollY, - NEUTRAL_SCOPE, - currentScope, - 0 - ), - zoom: { - value: zoomValue, - scoped: scopedZoom, - scaled: getScaledZoomValueForScope(scopedZoom, currentScope), - }, - twistAngle: isValidRadianValue( - viewportElement.view?.twistAngle, - 0 as Radian - ), - centerPoint: restorePoint( - viewportElement.view?.centerPoint, - NEUTRAL_SCOPE, - currentScope - )!, // Assuming centerPoint is always present - scope: isValidElementScopeValue( - viewportElement.view?.scope, - globalState?.mainScope - ), - }; - - return restoreElementWithProperties( - viewportElement, - { - ...stackProperties, - points, - lines, - view, - scale: (typeof viewportElement.scale === "number" - ? viewportElement.scale - : 1) as ViewportScale, - shadePlot: isValidEnumValue( - viewportElement.shadePlot, - VIEWPORT_SHADE_PLOT, - VIEWPORT_SHADE_PLOT.AS_DISPLAYED - ), - frozenGroupIds: Array.isArray(viewportElement.frozenGroupIds) - ? viewportElement.frozenGroupIds - : [], - // viewport-specific style - scaleIndicatorVisible: isValidBoolean( - viewportElement.scaleIndicatorVisible, - true - ), - }, - localState, - globalState - ); - } - // Other elements case "pdf": return restoreElementWithProperties( @@ -874,16 +728,6 @@ const restoreElement = ( }, localState ); - case "mermaid": - return restoreElementWithProperties( - element, - { - source: isValidString(element.source), - theme: isValidString(element.theme) || undefined, - svgPath: isValidString(element.svgPath) || null, - }, - localState - ); // Complex elements requiring specific restore logic case "table": { @@ -892,49 +736,8 @@ const restoreElement = ( return restoreElementWithProperties( tableElement, { - columnOrder: Array.isArray(tableElement.columnOrder) - ? tableElement.columnOrder - : defaultData.columnOrder, - rowOrder: Array.isArray(tableElement.rowOrder) - ? tableElement.rowOrder - : defaultData.rowOrder, - columns: restoreTableColumns( - tableElement.columns, - currentScope, - defaultData.columns - ), - rows: restoreTableRows( - tableElement.rows, - currentScope, - defaultData.rows - ), - cells: restoreTableCells(tableElement.cells, defaultData.cells), - headerRowCount: - typeof tableElement.headerRowCount === "number" - ? tableElement.headerRowCount - : defaultData.headerRowCount, - autoSize: tableElement.autoSize || defaultData.autoSize, - // DucTableStyle properties - flowDirection: ( - Object.values(TABLE_FLOW_DIRECTION) - ).includes(tableElement.flowDirection) - ? tableElement.flowDirection - : defaultData.flowDirection, - headerRowStyle: restoreTableCellStyle( - tableElement.headerRowStyle, - currentScope, - defaultData.headerRowStyle - ), - dataRowStyle: restoreTableCellStyle( - tableElement.dataRowStyle, - currentScope, - defaultData.dataRowStyle - ), - dataColumnStyle: restoreTableCellStyle( - tableElement.dataColumnStyle, - currentScope, - defaultData.dataColumnStyle - ), + fileId: (isValidString(tableElement.fileId) as ExternalFileId) || + defaultData.fileId, }, localState ); @@ -945,16 +748,7 @@ const restoreElement = ( return restoreElementWithProperties( element, { - ...restoreDocStyleProperties(docElement, currentScope), text: isValidString(docElement.text), - dynamic: restoreTextDynamicParts(docElement.dynamic), - flowDirection: ( - Object.values(TEXT_FLOW_DIRECTION) - ).includes(docElement.flowDirection) - ? docElement.flowDirection - : TEXT_FLOW_DIRECTION.TOP_TO_BOTTOM, - columns: restoreTextColumns(docElement.columns, currentScope), - autoResize: isValidBooleanValue(docElement.autoResize, true), fileId: (isValidString(docElement.fileId) as ExternalFileId) || null, gridConfig: restoreDocumentGridConfig(docElement.gridConfig), }, @@ -962,218 +756,16 @@ const restoreElement = ( ); } - case "xray": { - const xrayElement = element as DucXRayElement; - const elementScope = isValidElementScopeValue( - xrayElement.scope, - globalState?.mainScope - ); - - return restoreElementWithProperties( - xrayElement, - { - origin: restorePoint(xrayElement.origin, elementScope, currentScope)!, - direction: restorePoint( - xrayElement.direction, - elementScope, - currentScope - )!, - startFromOrigin: isValidBoolean(xrayElement.startFromOrigin, false), - color: isValidColor(xrayElement.color, "#FF00FF"), - }, - localState, - globalState - ); - } - case "model": { const modelElement = element as DucModelElement; return restoreElementWithProperties( modelElement, { - source: isValidString(modelElement.source), + modelType: isValidString(modelElement.modelType) || null, + code: isValidString(modelElement.code) || null, fileIds: modelElement.fileIds || [], svgPath: modelElement.svgPath || null, - }, - localState, - globalState - ); - } - - case "featurecontrolframe": { - const fcfElement = element as DucFeatureControlFrameElement; - const elementScope = isValidElementScopeValue( - fcfElement.scope, - globalState?.mainScope - ); - - return restoreElementWithProperties( - fcfElement, - { - // Restore style properties - textStyle: restoreTextStyle(fcfElement.textStyle, currentScope), - layout: { - padding: restorePrecisionValue( - fcfElement.layout?.padding, - elementScope, - currentScope, - 2 - ), - segmentSpacing: restorePrecisionValue( - fcfElement.layout?.segmentSpacing, - elementScope, - currentScope, - 2 - ), - rowSpacing: restorePrecisionValue( - fcfElement.layout?.rowSpacing, - elementScope, - currentScope, - 2 - ), - }, - symbols: { - scale: fcfElement.symbols?.scale ?? 1, - }, - datumStyle: { - bracketStyle: isValidEnumValue( - fcfElement.datumStyle?.bracketStyle, - DATUM_BRACKET_STYLE, - DATUM_BRACKET_STYLE.SQUARE - ), - }, - // Restore data properties - rows: restoreFcfRows(fcfElement.rows), - frameModifiers: restoreFcfFrameModifiers( - fcfElement.frameModifiers, - elementScope, - currentScope - ), - leaderElementId: isValidString(fcfElement.leaderElementId) || null, - datumDefinition: restoreFcfDatumDefinition( - fcfElement.datumDefinition, - elementScope, - currentScope, - restoredBlocks - ), - }, - localState, - globalState - ); - } - - case "leader": { - const leaderElement = element as DucLeaderElement; - const elementScope = isValidElementScopeValue( - leaderElement.scope, - globalState?.mainScope - ); - - // A leader is a linear element - const { points, lines } = restoreLinearElementPointsAndLines({ - points: leaderElement.points as DucPoint[], - lines: leaderElement.lines as DucLine[], - x: leaderElement.x, - y: leaderElement.y, - width: leaderElement.width, - height: leaderElement.height, - elementScope, - currentScope, - skipNormalization: !!( - leaderElement.startBinding || leaderElement.endBinding - ), - }); - - return restoreElementWithProperties( - leaderElement, - { - points, - lines, - // DucLeaderStyle properties - headsOverride: restoreHeadsOverride( - leaderElement.headsOverride, - restoredBlocks, - elementScope, - currentScope - ), - dogleg: restorePrecisionValue( - leaderElement.dogleg, - elementScope, - currentScope, - 10 - ), - textStyle: restoreTextStyle(leaderElement.textStyle, currentScope), - textAttachment: isValidEnumValue( - leaderElement.textAttachment, - VERTICAL_ALIGN, - VERTICAL_ALIGN.TOP - ), - blockAttachment: isValidEnumValue( - leaderElement.blockAttachment, - BLOCK_ATTACHMENT, - BLOCK_ATTACHMENT.CENTER_EXTENTS - ), - // Leader data - leaderContent: restoreLeaderContent(leaderElement.leaderContent), - contentAnchor: leaderElement.contentAnchor || { x: 0, y: 0 }, - }, - localState, - globalState - ); - } - - case "dimension": { - const dimElement = element as DucDimensionElement; - const elementScope = isValidElementScopeValue( - dimElement.scope, - globalState?.mainScope - ); - - return restoreElementWithProperties( - dimElement, - { - // DucDimensionStyle properties - ...restoreDimensionStyle(dimElement, currentScope), - // Dimension data - dimensionType: isValidEnumValue( - dimElement.dimensionType, - DIMENSION_TYPE, - DIMENSION_TYPE.LINEAR - ), - definitionPoints: restoreDimensionDefinitionPoints( - dimElement.definitionPoints - ), - obliqueAngle: isValidRadianValue( - dimElement.obliqueAngle, - 0 as Radian - ), - ordinateAxis: isValidEnumValue(dimElement.ordinateAxis, AXIS, null), - bindings: restoreDimensionBindings( - dimElement.bindings, - elementScope, - currentScope, - restoredBlocks - ), - textOverride: isValidString(dimElement.textOverride) || null, - textPosition: dimElement.textPosition || null, - toleranceOverride: restoreDimensionToleranceStyle( - dimElement.toleranceOverride, - currentScope - ), - baselineData: dimElement.baselineData - ? { - baseDimensionId: isValidString( - dimElement.baselineData.baseDimensionId - ), - } - : undefined, - continueData: dimElement.continueData - ? { - continueFromDimensionId: isValidString( - dimElement.continueData.continueFromDimensionId - ), - } - : undefined, + viewerState: (modelElement.viewerState || null) as Viewer3DState | null, }, localState, globalState @@ -1562,6 +1154,13 @@ export const restoreElements = ( restoredBlocks, opts?.localState ); + + if (!migratedElement) { + // element failed to restore — skip + } else if (isInvisiblySmallElement(migratedElement)) { + // element too small to be visible — will be filtered below + } + // Allow forced pass-through for specific element ids const isPassThrough = Array.isArray(opts?.passThroughElementIds) && @@ -1710,22 +1309,6 @@ export const isValidElementScopeValue = ( return mainScope; }; -const restoreTextDynamicParts = ( - dynamic: readonly any[] | undefined -): DucTextDynamicPart[] => { - if (!Array.isArray(dynamic)) { - return []; - } - return dynamic - .map((part) => ({ - tag: isValidString(part.tag), - source: part.source, // Assuming source is valid, could be further validated - formatting: part.formatting, // Assuming valid - cachedValue: isValidString(part.cachedValue), - })) - .filter((part) => part.tag); -}; - const restoreLineSpacing = ( lineSpacing: any, legacyLineHeight: number, @@ -1750,203 +1333,6 @@ const restoreLineSpacing = ( }; }; -const restoreTableCellStyle = ( - style: any, - currentScope: Scope, - defaultStyle: any -) => { - if (!style || typeof style !== "object") { - return defaultStyle; - } - return { - ...defaultStyle, - ...style, // Basic override for now, can be deepened - alignment: (Object.values(TABLE_CELL_ALIGNMENT) as string[]).includes( - style.alignment - ) - ? style.alignment - : defaultStyle.alignment, - }; -}; - -const restoreTableColumns = ( - columns: any, - currentScope: Scope, - defaultColumns: any -): Record => { - if (!columns || typeof columns !== "object") { - return defaultColumns; - } - const restored: Record = {}; - for (const id in columns) { - const col = columns[id]; - if (col && typeof col === "object" && isValidString(col.id)) { - restored[id] = { - id: col.id, - width: restorePrecisionValue( - col.width, - currentScope, - currentScope, - 100 - ), - styleOverrides: col.styleOverrides - ? restoreTableCellStyle(col.styleOverrides, currentScope, {}) - : undefined, - }; - } - } - return restored; -}; - -const restoreTableRows = ( - rows: any, - currentScope: Scope, - defaultRows: any -): Record => { - if (!rows || typeof rows !== "object") { - return defaultRows; - } - const restored: Record = {}; - for (const id in rows) { - const row = rows[id]; - if (row && typeof row === "object" && isValidString(row.id)) { - restored[id] = { - id: row.id, - height: restorePrecisionValue( - row.height, - currentScope, - currentScope, - 40 - ), - styleOverrides: row.styleOverrides - ? restoreTableCellStyle(row.styleOverrides, currentScope, {}) - : undefined, - }; - } - } - return restored; -}; - -const restoreTableCells = ( - cells: any, - defaultCells: any -): Record => { - if (!cells || typeof cells !== "object") { - return defaultCells; - } - const restored: Record = {}; - for (const id in cells) { - const cell = cells[id]; - if ( - cell && - typeof cell === "object" && - isValidString(cell.rowId) && - isValidString(cell.columnId) - ) { - restored[id] = { - rowId: cell.rowId, - columnId: cell.columnId, - data: isValidString(cell.data), - locked: isValidBooleanValue(cell.locked, false), - span: cell.span - ? { - columns: - typeof cell.span.columns === "number" ? cell.span.columns : 1, - rows: typeof cell.span.rows === "number" ? cell.span.rows : 1, - } - : undefined, - styleOverrides: cell.styleOverrides, // Not deeply restored for now - }; - } - } - return restored; -}; - -const restoreDocStyleProperties = ( - doc: Partial, - currentScope: Scope -): DucDocStyle => { - const elementScope = isValidElementScopeValue(doc.scope, currentScope); - - // Use the new helper to restore all properties from DucTextStyle - const restoredTextStyle = restoreTextStyle(doc, currentScope); - - // Restore properties specific to DucDocStyle - const paragraph: DucDocStyle['paragraph'] = { - firstLineIndent: restorePrecisionValue(doc.paragraph?.firstLineIndent, elementScope, currentScope, 0), - hangingIndent: restorePrecisionValue(doc.paragraph?.hangingIndent, elementScope, currentScope, 0), - leftIndent: restorePrecisionValue(doc.paragraph?.leftIndent, elementScope, currentScope, 0), - rightIndent: restorePrecisionValue(doc.paragraph?.rightIndent, elementScope, currentScope, 0), - spaceBefore: restorePrecisionValue(doc.paragraph?.spaceBefore, elementScope, currentScope, 0), - spaceAfter: restorePrecisionValue(doc.paragraph?.spaceAfter, elementScope, currentScope, 0), - tabStops: Array.isArray(doc.paragraph?.tabStops) - ? doc.paragraph.tabStops.map(ts => restorePrecisionValue(ts, elementScope, currentScope, 0)) - : [], - }; - - const stackFormat: DucDocStyle['stackFormat'] = { - autoStack: isValidBoolean(doc.stackFormat?.autoStack, false), - stackChars: Array.isArray(doc.stackFormat?.stackChars) ? doc.stackFormat.stackChars.map(String) : [], - properties: { - upperScale: typeof doc.stackFormat?.properties?.upperScale === 'number' ? doc.stackFormat.properties.upperScale : 0.7, - lowerScale: typeof doc.stackFormat?.properties?.lowerScale === 'number' ? doc.stackFormat.properties.lowerScale : 0.7, - alignment: isValidEnumValue(doc.stackFormat?.properties?.alignment, STACKED_TEXT_ALIGN, STACKED_TEXT_ALIGN.CENTER), - }, - }; - - return { - ...restoredTextStyle, - paragraph, - stackFormat, - }; -}; - -const restoreTextColumns = (columns: any, currentScope: Scope) => { - const defaultGutter = getPrecisionValueFromRaw( - 5 as RawValue, - currentScope, - currentScope - ); - const defaultWidth = getPrecisionValueFromRaw( - 100 as RawValue, - currentScope, - currentScope - ); - - if (!columns || typeof columns !== "object") { - return { - type: COLUMN_TYPE.NO_COLUMNS, - definitions: [], - autoHeight: true, - }; - } - - const definitions: TextColumn[] = Array.isArray(columns.definitions) - ? columns.definitions.map((def: any) => ({ - width: restorePrecisionValue( - def?.width, - currentScope, - currentScope, - defaultWidth.value - ), - gutter: restorePrecisionValue( - def?.gutter, - currentScope, - currentScope, - defaultGutter.value - ), - })) - : []; - - return { - type: (Object.values(COLUMN_TYPE) as string[]).includes(columns.type) - ? columns.type - : COLUMN_TYPE.NO_COLUMNS, - definitions, - autoHeight: isValidBooleanValue(columns.autoHeight, true), - }; -}; - const restoreDocumentGridConfig = ( gridConfig: any ): DocumentGridConfig => { @@ -1955,7 +1341,6 @@ const restoreDocumentGridConfig = ( columns: 1, gapX: 0, gapY: 0, - alignItems: "start", firstPageAlone: false, scale: 1, }; @@ -1965,9 +1350,6 @@ const restoreDocumentGridConfig = ( columns: typeof gridConfig.columns === "number" ? gridConfig.columns : 1, gapX: typeof gridConfig.gapX === "number" ? gridConfig.gapX : 0, gapY: typeof gridConfig.gapY === "number" ? gridConfig.gapY : 0, - alignItems: (typeof gridConfig.alignItems === "string" && ["start", "center", "end"].includes(gridConfig.alignItems)) - ? gridConfig.alignItems - : "start", firstPageAlone: typeof gridConfig.firstPageAlone === "boolean" ? gridConfig.firstPageAlone : false, scale: typeof gridConfig.scale === "number" ? gridConfig.scale : 1, }; @@ -2180,7 +1562,7 @@ const createHeadOnlyBinding = ( const validateDeprecatedElementContent = ( color: string, - defaultContent: ElementContentBase + defaultContent: any ) => { const oldContent = tinycolor(color); return { @@ -2206,337 +1588,5 @@ const restoreStackElementProperties = ( ...restoreDucStackProperties(element), clip: isValidBooleanValue(element.clip, false), labelVisible: isValidBooleanValue(element.labelVisible, true), - standardOverride: isValidString(element.standardOverride) || null, - }; -}; - -// --- Dimension Restoration Helpers --- - -const restoreDimensionStyle = ( - dim: Partial, - currentScope: Scope -): DucDimensionStyle => { - const defaultTextStyle = restoreTextStyle(undefined, currentScope); - return { - dimLine: { - stroke: dim.dimLine?.stroke - ? validateStroke(dim.dimLine.stroke, dim.scope!, currentScope) - : DEFAULT_ELEMENT_PROPS.stroke, - textGap: restorePrecisionValue( - dim.dimLine?.textGap, - dim.scope!, - currentScope, - 2 - ), - }, - extLine: { - stroke: dim.extLine?.stroke - ? validateStroke(dim.extLine.stroke, dim.scope!, currentScope) - : DEFAULT_ELEMENT_PROPS.stroke, - overshoot: restorePrecisionValue( - dim.extLine?.overshoot, - dim.scope!, - currentScope, - 2 - ), - offset: restorePrecisionValue( - dim.extLine?.offset, - dim.scope!, - currentScope, - 2 - ), - }, - textStyle: restoreTextStyle(dim.textStyle, currentScope), - symbols: { - headsOverride: restoreHeadsOverride( - dim.symbols?.headsOverride, - [], - dim.scope!, - currentScope - ), // Assuming no blocks initially - centerMark: { - type: isValidEnumValue( - dim.symbols?.centerMark?.type, - MARK_ELLIPSE_CENTER, - MARK_ELLIPSE_CENTER.MARK - ), - size: restorePrecisionValue( - dim.symbols?.centerMark?.size, - dim.scope!, - currentScope, - 5 - ), - }, - }, - tolerance: restoreDimensionToleranceStyle( - dim.tolerance, - currentScope, - defaultTextStyle - ), - fit: { - rule: isValidEnumValue( - dim.fit?.rule, - DIMENSION_FIT_RULE, - DIMENSION_FIT_RULE.BEST_FIT - ), - textPlacement: isValidEnumValue( - dim.fit?.textPlacement, - DIMENSION_TEXT_PLACEMENT, - DIMENSION_TEXT_PLACEMENT.BESIDE_LINE - ), - forceTextInside: isValidBoolean(dim.fit?.forceTextInside, false), - }, - }; -}; - -const restoreDimensionToleranceStyle = ( - tol: Partial | undefined, - currentScope: Scope, - defaultTextStyle?: DucTextStyle -): DucDimensionStyle["tolerance"] => { - return { - enabled: isValidBoolean(tol?.enabled, false), - displayMethod: isValidEnumValue( - tol?.displayMethod, - TOLERANCE_DISPLAY, - TOLERANCE_DISPLAY.NONE - ), - upperValue: tol?.upperValue ?? 0, - lowerValue: tol?.lowerValue ?? 0, - precision: tol?.precision ?? 2, - textStyle: tol?.textStyle - ? restoreTextStyle(tol.textStyle, currentScope) - : defaultTextStyle || restoreTextStyle(undefined, currentScope), - }; -}; - -const restoreDimensionDefinitionPoints = ( - points: Partial | undefined -): DimensionDefinitionPoints => { - return { - origin1: points?.origin1 || { x: 0, y: 0 }, - origin2: points?.origin2, - location: points?.location || { x: 0, y: 0 }, - center: points?.center, - jog: points?.jog, - }; -}; - -const restoreDimensionBindings = ( - bindings: Partial | undefined, - elementScope: Scope, - currentScope: Scope, - restoredBlocks: RestoredDataState["blocks"] -): DucDimensionElement["bindings"] | undefined => { - if (!bindings) return undefined; - return { - origin1: bindings.origin1 - ? repairBinding( - undefined, - bindings.origin1 ?? null, - currentScope, - restoredBlocks - ) - : null, - origin2: bindings.origin2 - ? repairBinding( - undefined, - bindings.origin2 ?? null, - currentScope, - restoredBlocks - ) - : null, - center: bindings.center - ? repairBinding( - undefined, - bindings.center ?? null, - currentScope, - restoredBlocks - ) - : null, - }; -}; - -// --- Leader Restoration Helpers --- - -const restoreLeaderContent = ( - content: LeaderContent | undefined | null -): LeaderContent | null => { - if (!content) return null; - const type = isValidEnumValue(content.type, LEADER_CONTENT_TYPE, null); - if (type === LEADER_CONTENT_TYPE.TEXT) { - // Only access text if type is "text" - if ('text' in content) { - return { type: "text", text: isValidString(content.text) }; - } - } - if (type === LEADER_CONTENT_TYPE.BLOCK) { - // Only access blockId and instanceData if type is "block" - if ('blockId' in content && 'instanceData' in content) { - return { - type: "block", - blockId: isValidString(content.blockId), - instanceData: { - attributeValues: content.instanceData?.attributeValues, - elementOverrides: content.instanceData?.elementOverrides, - }, - }; - } - } - return null; -}; - -// --- FCF Restoration Helpers --- - -const restoreFcfRows = ( - rows: readonly (readonly FeatureControlFrameSegment[])[] | undefined -): readonly (readonly FeatureControlFrameSegment[])[] => { - return rows ? rows.map((row) => - row ? row.map((segment) => ({ - symbol: isValidEnumValue( - segment.symbol, - GDT_SYMBOL, - GDT_SYMBOL.POSITION - ), - tolerance: { - value: isValidString(segment.tolerance?.value), - zoneType: isValidEnumValue( - segment.tolerance?.zoneType, - TOLERANCE_ZONE_TYPE, - undefined - ), - featureModifiers: Array.isArray(segment.tolerance?.featureModifiers) - ? segment.tolerance.featureModifiers - : [], - materialCondition: isValidEnumValue( - segment.tolerance?.materialCondition, - MATERIAL_CONDITION, - undefined - ), - }, - datums: (Array.isArray(segment.datums) - ? segment.datums.map((datum) => ({ - letters: isValidString(datum?.letters), - modifier: isValidEnumValue( - datum?.modifier, - MATERIAL_CONDITION, - undefined - ), - })) - : []) as [DatumReference?, DatumReference?, DatumReference?], - })) - : [] - ) : []; -}; - -const restoreFcfFrameModifiers = ( - mods: Partial | undefined, - elementScope: Scope, - currentScope: Scope -): DucFeatureControlFrameElement["frameModifiers"] | undefined => { - if (!mods) return undefined; - return { - allAround: isValidBoolean(mods.allAround), - allOver: isValidBoolean(mods.allOver), - continuousFeature: isValidBoolean(mods.continuousFeature), - between: mods.between - ? { - start: isValidString(mods.between.start), - end: isValidString(mods.between.end), - } - : undefined, - projectedToleranceZone: mods.projectedToleranceZone - ? restorePrecisionValue( - mods.projectedToleranceZone.value, - elementScope, - currentScope - ) - : undefined, }; }; - -const restoreFcfDatumDefinition = ( - def: Partial | undefined, - elementScope: Scope, - currentScope: Scope, - restoredBlocks: RestoredDataState["blocks"] -): DucFeatureControlFrameElement["datumDefinition"] | undefined => { - if (!def || !isValidString(def.letter)) return undefined; - return { - letter: isValidString(def.letter, ""), - featureBinding: repairBinding( - undefined, - def.featureBinding ?? null, - currentScope, - restoredBlocks - ) ?? undefined, - }; -}; - -// --- Shared & Generic Style Helpers --- - -const restoreTextStyle = ( - style: Partial | undefined, - currentScope: Scope -): DucTextStyle => { - const defaultLineHeight = 1.15 as number & { _brand: "unitlessLineHeight" }; - // Restore condition: if font family is "10", change to DEFAULT_FONT_FAMILY - let fontFamily = style?.fontFamily; - if (fontFamily === "10") { - fontFamily = DEFAULT_FONT_FAMILY; - } - return { - // Text-specific styles - isLtr: isValidBoolean(style?.isLtr, true), - fontFamily: getFontFamilyByName(fontFamily as unknown as string), - bigFontFamily: isValidString(style?.bigFontFamily, "sans-serif"), - textAlign: isValidTextAlignValue(style?.textAlign), - verticalAlign: isValidVerticalAlignValue(style?.verticalAlign), - lineHeight: style?.lineHeight ?? defaultLineHeight, - lineSpacing: restoreLineSpacing( - style?.lineSpacing, - style?.lineHeight ?? defaultLineHeight.valueOf(), - currentScope - ), - obliqueAngle: isValidRadianValue(style?.obliqueAngle, 0 as Radian), - fontSize: restorePrecisionValue( - style?.fontSize, - NEUTRAL_SCOPE, - currentScope, - DEFAULT_FONT_SIZE - ), - paperTextHeight: style?.paperTextHeight - ? restorePrecisionValue( - style.paperTextHeight, - NEUTRAL_SCOPE, - currentScope - ) - : undefined, - widthFactor: style?.widthFactor ?? 1 as ScaleFactor, - isUpsideDown: isValidBoolean(style?.isUpsideDown, false), - isBackwards: isValidBoolean(style?.isBackwards, false), - }; -}; - -const restoreHeadsOverride = ( - heads: [DucHead, DucHead] | undefined, - restoredBlocks: RestoredDataState["blocks"], - elementScope: Scope, - currentScope: Scope -): [DucHead, DucHead] | undefined => { - if (!Array.isArray(heads) || heads.length !== 2) return undefined; - const startHead = isValidDucHead( - heads[0], - restoredBlocks, - elementScope, - currentScope - ); - const endHead = isValidDucHead( - heads[1], - restoredBlocks, - elementScope, - currentScope - ); - if (!startHead || !endHead) return undefined; - return [startHead, endHead]; -}; diff --git a/packages/ducjs/src/restore/restoreStandards.ts b/packages/ducjs/src/restore/restoreStandards.ts deleted file mode 100644 index 899c44a9..00000000 --- a/packages/ducjs/src/restore/restoreStandards.ts +++ /dev/null @@ -1,278 +0,0 @@ -import { - ANGULAR_UNITS_FORMAT, - DECIMAL_SEPARATOR, - DIMENSION_UNITS_FORMAT, - GRID_DISPLAY_TYPE, - GRID_TYPE, - UNIT_SYSTEM, -} from "../flatbuffers/duc"; -import { - isValidBoolean, - isValidEnumValue, - isValidRadianValue, - isValidString, - restorePrecisionValue -} from "./restoreDataState"; -import { - NEUTRAL_SCOPE, - ScaleFactors -} from "../technical"; -import { PREDEFINED_STANDARDS, Standard, StandardOverrides, StandardStyles, StandardUnits, StandardValidation, StandardViewSettings } from "../technical/standards"; -import { - GridSettings, - GridStyle, - Identifier, - Scope -} from "../types"; - - - -export const restoreStandards = ( - standards: any, - // Pass current scope to resolve precision values if needed - currentScope: Scope = NEUTRAL_SCOPE, -): Standard[] => { - if (!Array.isArray(standards) || standards.length === 0) { - // If no standards are provided, return a default set. - return DEFAULT_STANDARDS; - } - - const restoredStandards: Standard[] = []; - const restoredIds = new Set(); - - for (const s of standards) { - if (!s || typeof s !== 'object') continue; - - const identifier = restoreIdentifier(s); - if (!identifier || restoredIds.has(identifier.id)) { - continue; // Skip if no valid ID or if ID is a duplicate - } - - restoredStandards.push({ - ...identifier, - version: isValidString(s.version, "1.0.0"), - readonly: isValidBoolean(s.readonly, false), - overrides: restoreStandardOverrides(s.overrides, currentScope), - styles: restoreStandardStyles(s.styles, currentScope), - viewSettings: restoreStandardViewSettings(s.viewSettings, currentScope), - units: restoreStandardUnits(s.units, currentScope), - validation: restoreStandardValidation(s.validation, currentScope), - }); - restoredIds.add(identifier.id); - } - - // Ensure the default standard is always present if it was missed - if (!restoredIds.has(PREDEFINED_STANDARDS.DUC)) { - restoredStandards.unshift(getDefaultStandard()); - } - - return restoredStandards; -}; - -// This would typically be defined in a central place with other default objects -const getDefaultStandard = (): Standard => ({ - id: PREDEFINED_STANDARDS.DUC, - name: "DUC", - version: "1.0.0", - readonly: true, - overrides: null, - styles: null, - viewSettings: null, - units: null, - validation: null, -}); - -const DEFAULT_STANDARDS: Standard[] = [ - getDefaultStandard(), - // Potentially add other predefined standards here if they should always be present -]; - - -/** - * Checks if a given id is present in the standards array. - * @returns true if found, false otherwise. - */ -export const isStandardIdPresent = (id: string, standards: Standard[]): boolean => { - if (!Array.isArray(standards) || typeof id !== "string") return false; - return standards.some(s => typeof s.id === "string" && s.id === id); -}; - -// --- Helper Functions for Restoration --- - -const restoreIdentifier = (ident: any): Identifier | null => { - if (!ident || typeof ident !== 'object' || !isValidString(ident.id)) { - return null; - } - return { - id: ident.id, - name: isValidString(ident.name, ident.id), - description: isValidString(ident.description) || undefined, - }; -}; - -const restoreStandardUnits = (units: any, currentScope: Scope): StandardUnits | null => { - if (!units || typeof units !== 'object') return null; - - const primary = units.primaryUnits; - const alternate = units.alternateUnits; - - if (!primary || !alternate) return null; - - return { - primaryUnits: { - linear: { - format: isValidEnumValue(primary.linear?.format, DIMENSION_UNITS_FORMAT, DIMENSION_UNITS_FORMAT.DECIMAL), - system: isValidEnumValue(primary.linear?.system, UNIT_SYSTEM, UNIT_SYSTEM.METRIC), - precision: primary.linear?.precision ?? 2, - suppressLeadingZeros: isValidBoolean(primary.linear?.suppressLeadingZeros, false), - suppressTrailingZeros: isValidBoolean(primary.linear?.suppressTrailingZeros, false), - decimalSeparator: isValidEnumValue(primary.linear?.decimalSeparator, DECIMAL_SEPARATOR, DECIMAL_SEPARATOR.DOT), - suppressZeroFeet: isValidBoolean(primary.linear?.suppressZeroFeet, false), - suppressZeroInches: isValidBoolean(primary.linear?.suppressZeroInches, false), - }, - angular: { - format: isValidEnumValue(primary.angular?.format, ANGULAR_UNITS_FORMAT, ANGULAR_UNITS_FORMAT.DECIMAL_DEGREES), - system: isValidEnumValue(primary.angular?.system, UNIT_SYSTEM, UNIT_SYSTEM.METRIC), - precision: primary.angular?.precision ?? 2, - suppressLeadingZeros: isValidBoolean(primary.angular?.suppressLeadingZeros, false), - suppressTrailingZeros: isValidBoolean(primary.angular?.suppressTrailingZeros, false), - }, - }, - alternateUnits: { - format: isValidEnumValue(alternate?.format, DIMENSION_UNITS_FORMAT, DIMENSION_UNITS_FORMAT.DECIMAL), - system: isValidEnumValue(alternate?.system, UNIT_SYSTEM, UNIT_SYSTEM.METRIC), - precision: alternate?.precision ?? 2, - suppressLeadingZeros: isValidBoolean(alternate?.suppressLeadingZeros, false), - suppressTrailingZeros: isValidBoolean(alternate?.suppressTrailingZeros, false), - isVisible: isValidBoolean(alternate?.isVisible, false), - multiplier: typeof alternate?.multiplier === 'number' ? alternate.multiplier : 1, - } - }; -}; - -const restoreStandardOverrides = (overrides: any, currentScope: Scope): StandardOverrides | null => { - if (!overrides || typeof overrides !== 'object') return null; - - return { - mainScope: isValidEnumValue(overrides.mainScope, ScaleFactors, undefined), - elementsStrokeWidthOverride: overrides.elementsStrokeWidthOverride ? restorePrecisionValue(overrides.elementsStrokeWidthOverride, NEUTRAL_SCOPE, currentScope) : undefined, - commonStyleId: isValidString(overrides.commonStyleId) || undefined, - stackLikeStyleId: isValidString(overrides.stackLikeStyleId) || undefined, - textStyleId: isValidString(overrides.textStyleId) || undefined, - dimensionStyleId: isValidString(overrides.dimensionStyleId) || undefined, - leaderStyleId: isValidString(overrides.leaderStyleId) || undefined, - featureControlFrameStyleId: isValidString(overrides.featureControlFrameStyleId) || undefined, - tableStyleId: isValidString(overrides.tableStyleId) || undefined, - docStyleId: isValidString(overrides.docStyleId) || undefined, - viewportStyleId: isValidString(overrides.viewportStyleId) || undefined, - plotStyleId: isValidString(overrides.plotStyleId) || undefined, - hatchStyleId: isValidString(overrides.hatchStyleId) || undefined, - activeGridSettingsId: Array.isArray(overrides.activeGridSettingsId) ? overrides.activeGridSettingsId.map(String) : undefined, - activeSnapSettingsId: isValidString(overrides.activeSnapSettingsId) || undefined, - dashLineOverride: isValidString(overrides.dashLineOverride) || undefined, - unitPrecision: overrides.unitPrecision ? { - linear: typeof overrides.unitPrecision.linear === 'number' ? overrides.unitPrecision.linear : undefined, - angular: typeof overrides.unitPrecision.angular === 'number' ? overrides.unitPrecision.angular : undefined, - area: typeof overrides.unitPrecision.area === 'number' ? overrides.unitPrecision.area : undefined, - volume: typeof overrides.unitPrecision.volume === 'number' ? overrides.unitPrecision.volume : undefined, - } : undefined, - }; -}; - -const restoreStandardStyles = (styles: any, currentScope: Scope): StandardStyles | null => { - if (!styles || typeof styles !== 'object') return null; - // This is a simplified restoration. A full implementation would deeply restore each style object. - return { - commonStyles: styles.commonStyles || [], - stackLikeStyles: styles.stackLikeStyles || [], - textStyles: styles.textStyles || [], - dimensionStyles: styles.dimensionStyles || [], - leaderStyles: styles.leaderStyles || [], - featureControlFrameStyles: styles.featureControlFrameStyles || [], - tableStyles: styles.tableStyles || [], - docStyles: styles.docStyles || [], - viewportStyles: styles.viewportStyles || [], - hatchStyles: styles.hatchStyles || [], - xrayStyles: styles.xrayStyles || [], - }; -}; - -const restoreGridSettings = (settings: any, currentScope: Scope): GridSettings | null => { - if (!settings || typeof settings !== 'object') return null; - const defaultGridStyle: GridStyle = { color: '#000000', opacity: 0.2 as any, dashPattern: [] }; - return { - type: isValidEnumValue(settings.type, GRID_TYPE, GRID_TYPE.RECTANGULAR), - readonly: isValidBoolean(settings.readonly, false), - displayType: isValidEnumValue(settings.displayType, GRID_DISPLAY_TYPE, GRID_DISPLAY_TYPE.LINES), - isAdaptive: isValidBoolean(settings.isAdaptive, true), - xSpacing: restorePrecisionValue(settings.xSpacing, NEUTRAL_SCOPE, currentScope, 100), - ySpacing: restorePrecisionValue(settings.ySpacing, NEUTRAL_SCOPE, currentScope, 100), - subdivisions: typeof settings.subdivisions === 'number' ? settings.subdivisions : 10, - origin: settings.origin || { x: 0, y: 0 }, - rotation: isValidRadianValue(settings.rotation, 0 as any), - followUCS: isValidBoolean(settings.followUCS, false), - majorStyle: settings.majorStyle || defaultGridStyle, - minorStyle: settings.minorStyle || defaultGridStyle, - showMinor: isValidBoolean(settings.showMinor, true), - minZoom: typeof settings.minZoom === 'number' ? settings.minZoom : 0.1, - maxZoom: typeof settings.maxZoom === 'number' ? settings.maxZoom : 100, - autoHide: isValidBoolean(settings.autoHide, true), - polarSettings: settings.polarSettings, - isometricSettings: settings.isometricSettings, - enableSnapping: isValidBoolean(settings.enableSnapping, true), - }; -}; - -const restoreStandardViewSettings = (viewSettings: any, currentScope: Scope): StandardViewSettings | null => { - if (!viewSettings || typeof viewSettings !== 'object') return null; - - const restoredViews = (Array.isArray(viewSettings.views) ? viewSettings.views : []) - .map((v: any) => { - const identifier = restoreIdentifier(v); - // ... deep restore of DucView ... - return identifier ? { ...identifier, ...v } : null; // simplified for now - }).filter(Boolean); - - const restoredUcs = (Array.isArray(viewSettings.ucs) ? viewSettings.ucs : []) - .map((u: any) => { - const identifier = restoreIdentifier(u); - // ... deep restore of DucUcs ... - return identifier ? { ...identifier, ...u } : null; // simplified for now - }).filter(Boolean); - - const restoredGrids = (Array.isArray(viewSettings.gridSettings) ? viewSettings.gridSettings : []) - .map((g: any) => { - const identifier = restoreIdentifier(g); - const settings = restoreGridSettings(g, currentScope); - return (identifier && settings) ? { ...identifier, ...settings } : null; - }).filter(Boolean); - - const restoredSnaps = (Array.isArray(viewSettings.snapSettings) ? viewSettings.snapSettings : []) - .map((s: any) => { - const identifier = restoreIdentifier(s); - // ... deep restore of SnapSettings ... - return identifier ? { ...identifier, ...s } : null; // simplified for now - }).filter(Boolean); - - return { - views: restoredViews, - ucs: restoredUcs, - gridSettings: restoredGrids as (Identifier & GridSettings)[], - snapSettings: restoredSnaps, - }; -}; - -const restoreStandardValidation = (validation: any, currentScope: Scope): StandardValidation | null => { - if (!validation || typeof validation !== 'object') return null; - - return { - dimensionRules: validation.dimensionRules ? { - minTextHeight: validation.dimensionRules.minTextHeight ? restorePrecisionValue(validation.dimensionRules.minTextHeight, NEUTRAL_SCOPE, currentScope) : undefined, - maxTextHeight: validation.dimensionRules.maxTextHeight ? restorePrecisionValue(validation.dimensionRules.maxTextHeight, NEUTRAL_SCOPE, currentScope) : undefined, - allowedPrecisions: Array.isArray(validation.dimensionRules.allowedPrecisions) ? validation.dimensionRules.allowedPrecisions.map(Number) : undefined, - } : undefined, - layerRules: validation.layerRules ? { - prohibitedLayerNames: Array.isArray(validation.layerRules.prohibitedLayerNames) ? validation.layerRules.prohibitedLayerNames.map(String) : undefined, - } : undefined, - }; -}; diff --git a/packages/ducjs/src/serialize.ts b/packages/ducjs/src/serialize.ts index 1f70fb96..614adb45 100644 --- a/packages/ducjs/src/serialize.ts +++ b/packages/ducjs/src/serialize.ts @@ -1,2674 +1,110 @@ -/* eslint-disable @typescript-eslint/consistent-type-definitions */ -/* IMPORTANT: - - Single-file serializer for DUC FlatBuffers schema. - - No enum remapping tables: use enums directly from ducjs/flatbuffers/duc. - - No defaults added: only write what's present in TS objects. - - PrecisionValue, Radian, Percentage, ScaleFactor, etc. are branded numbers: - cast to number at the final write site (e.g. pv.value). - - Keep args strongly typed. Never use any for function args. -*/ -import * as flatbuffers from "flatbuffers"; -import * as Duc from "./flatbuffers/duc"; -import { zlibSync, strToU8 } from "fflate"; +import { restore, type ElementsConfig, type RestoreConfig } from "./restore"; +import { transformToRust } from "./transform"; +import type { ExportedDataState } from "./types"; +import { ensureWasm, wasmGetCurrentSchemaVersion, wasmSerializeDuc } from "./wasm"; -import { - _DucElementStylesBase, - _DucLinearElementBase, - _DucStackBase, - _DucStackElementBase, - BoundElement, - Checkpoint, - CustomHatchPattern, - DatumReference, - Delta, - Dictionary, - DimensionDefinitionPoints, - DocumentGridConfig, - DucArrowElement, - DucBlock, - DucBlockAttributeDefinition, - DucBlockCollection, - DucBlockInstance, - DucBlockMetadata, - DucDimensionElement, - DucDimensionStyle, - DucDocElement, - DucDocStyle, - DucElement, - DucEllipseElement, - DucEmbeddableElement, - DucExternalFiles, - DucFeatureControlFrameElement, - DucFeatureControlFrameStyle, - DucFrameElement, - DucFreeDrawElement, - DucFreeDrawEnds, - DucGlobalState, - DucGroup, - DucHatchStyle, - DucHead, - DucImageElement, - DucImageFilter, - DucLayer, - DucLeaderElement, - DucLeaderStyle, - DucLine, - DucLinearElement, - DucLineReference, - DucLocalState, - DucMermaidElement, - DucModelElement, - DucPath, - DucPdfElement, - DucPlotElement, - DucPoint, - DucPointBinding, - DucPolygonElement, - DucRectangleElement, - DucRegion, - DucStackLikeStyles, - DucTableCellStyle, - DucTableElement, - DucTableStyle, - DucTextDynamicPart, - DucTextDynamicSource, - DucTextElement, - DucTextStyle, - DucUcs, - DucView, - DucViewportElement, - DucViewportStyle, - DucXRayElement, - DucXRayStyle, - DynamicSnapSettings, - ElementBackground, - ElementContentBase, - ElementStroke, - FeatureControlFrameSegment, - GeometricPoint, - GridSettings, - GridStyle, - HatchPatternLine, - Identifier, - ImageCrop, - ImportedDataState, - IsometricGridSettings, - JSONPatch, - LayerSnapFilters, - LeaderContent, - OrderedDucElement, - PlotLayout, - PolarGridSettings, - PolarTrackingSettings, - PrecisionValue, - SnapMarkerSettings, - SnapOverride, - SnapSettings, - StrokeSides, - StrokeStyle, - TextColumn, - ToleranceClause, - TrackingLineStyle, - VersionBase, - VersionGraph -} from "./types"; +const getSchemaVersionFromEnv = (): string | undefined => { + const maybeProcess = (globalThis as { + process?: { env?: Record }; + }).process; -import { restore, RestoreConfig } from "./restore"; -import { encodeFunctionString, EXPORT_DATA_TYPES } from "./utils"; - -/** - * Basic helpers - */ -const str = (b: flatbuffers.Builder, v: string | Uint8Array | null | undefined): number | undefined => - v == null ? undefined : b.createString(v); - -function writeString(builder: flatbuffers.Builder, str: string | null | undefined): number | undefined { - if (str === null || str === undefined) return undefined; - return builder.createString(str); -} - -function getPrecisionValue(value: PrecisionValue, useScopedValues: boolean): number { - return useScopedValues ? value.scoped : value.value; -} - -function writeStringVector(builder: flatbuffers.Builder, items: (string | null | undefined)[] | ReadonlyArray | null | undefined): number | undefined { - if (!items || items.length === 0) return undefined; - const arr = Array.isArray(items) ? items.slice() : Array.from(items); - const offsets = arr.map(item => (item ? builder.createString(item) : 0)).filter((offset): offset is number => offset !== 0); - if (offsets.length === 0) return undefined; - // This helper is used for multiple vector fields; return a builder vector; caller decides which create*Vector to use. - // For current callers that expect createGroupIdsVector specifically, fallback to generic createVector via builder.start/endVector - builder.startVector(4, offsets.length, 4); - for (let i = offsets.length - 1; i >= 0; i--) { - builder.addOffset(offsets[i]); - } - return builder.endVector(); -} - -/** - * Element style/content serializers - */ -function writeTiling(b: flatbuffers.Builder, t: ElementContentBase["tiling"], usv: boolean): number | undefined { - if (!t) return undefined; - Duc.TilingProperties.startTilingProperties(b); - Duc.TilingProperties.addSizeInPercent(b, t.sizeInPercent); - Duc.TilingProperties.addAngle(b, t.angle); - if (t.spacing !== undefined) Duc.TilingProperties.addSpacing(b, t.spacing); - if (t.offsetX !== undefined) Duc.TilingProperties.addOffsetX(b, t.offsetX); - if (t.offsetY !== undefined) Duc.TilingProperties.addOffsetY(b, t.offsetY); - return Duc.TilingProperties.endTilingProperties(b); -} - -function writeHatchPatternLine(b: flatbuffers.Builder, l: HatchPatternLine, usv: boolean): number { - const origin = writeDucPoint(b, l.origin, usv); - const offsetVec = Duc.HatchPatternLine.createOffsetVector(b, [getPrecisionValue(l.offset[0], usv), getPrecisionValue(l.offset[1], usv)]); - const dashVec = Duc.HatchPatternLine.createDashPatternVector(b, l.dashPattern.map(Number)); - Duc.HatchPatternLine.startHatchPatternLine(b); - Duc.HatchPatternLine.addAngle(b, l.angle); - if (origin) Duc.HatchPatternLine.addOrigin(b, origin); - Duc.HatchPatternLine.addOffset(b, offsetVec); - if (dashVec) Duc.HatchPatternLine.addDashPattern(b, dashVec); - return Duc.HatchPatternLine.endHatchPatternLine(b); -} - -function writeCustomHatch(b: flatbuffers.Builder, p: CustomHatchPattern | null | undefined, usv: boolean): number | undefined { - if (!p) return undefined; - const name = str(b, p.name); - const desc = str(b, p.description); - const lines = Duc.CustomHatchPattern.createLinesVector(b, p.lines.map((ln) => writeHatchPatternLine(b, ln, usv))); - Duc.CustomHatchPattern.startCustomHatchPattern(b); - if (name) Duc.CustomHatchPattern.addName(b, name); - if (desc) Duc.CustomHatchPattern.addDescription(b, desc); - Duc.CustomHatchPattern.addLines(b, lines); - return Duc.CustomHatchPattern.endCustomHatchPattern(b); -} - -function writeHatchStyle(b: flatbuffers.Builder, h: DucHatchStyle | null | undefined, usv: boolean): number | undefined { - if (!h) return undefined; - const pattName = str(b, h.pattern.name); - const pattOrigin = writeDucPoint(b, h.pattern.origin, usv); - const custom = writeCustomHatch(b, h.customPattern, usv); - Duc.DucHatchStyle.startDucHatchStyle(b); - if (h.hatchStyle !== undefined) Duc.DucHatchStyle.addHatchStyle(b, h.hatchStyle); - if (pattName) Duc.DucHatchStyle.addPatternName(b, pattName); - Duc.DucHatchStyle.addPatternScale(b, h.pattern.scale); - Duc.DucHatchStyle.addPatternAngle(b, h.pattern.angle); - if (pattOrigin) Duc.DucHatchStyle.addPatternOrigin(b, pattOrigin); - Duc.DucHatchStyle.addPatternDouble(b, h.pattern.double); - if (custom) Duc.DucHatchStyle.addCustomPattern(b, custom); - return Duc.DucHatchStyle.endDucHatchStyle(b); -} - -function writeImageFilter(b: flatbuffers.Builder, f: DucImageFilter | null | undefined, usv: boolean): number | undefined { - if (!f) return undefined; - Duc.DucImageFilter.startDucImageFilter(b); - Duc.DucImageFilter.addBrightness(b, f.brightness); - Duc.DucImageFilter.addContrast(b, f.contrast); - return Duc.DucImageFilter.endDucImageFilter(b); -} - -function writeContentBase(b: flatbuffers.Builder, c: ElementContentBase | null | undefined, usv: boolean): number | undefined { - if (!c) return undefined; - const s = str(b, c.src); - const til = writeTiling(b, c.tiling, usv); - const hatch = writeHatchStyle(b, c.hatch, usv); - const filt = writeImageFilter(b, c.imageFilter, usv); - - Duc.ElementContentBase.startElementContentBase(b); - if (c.preference !== undefined) Duc.ElementContentBase.addPreference(b, c.preference); - if (s) Duc.ElementContentBase.addSrc(b, s); - Duc.ElementContentBase.addVisible(b, c.visible); - Duc.ElementContentBase.addOpacity(b, c.opacity); - if (til) Duc.ElementContentBase.addTiling(b, til); - if (hatch) Duc.ElementContentBase.addHatch(b, hatch); - if (filt) Duc.ElementContentBase.addImageFilter(b, filt); - return Duc.ElementContentBase.endElementContentBase(b); -} - -function writeStrokeStyle(b: flatbuffers.Builder, s: StrokeStyle | null | undefined, usv: boolean): number | undefined { - if (!s) return undefined; - const dashVec = s.dash?.length ? Duc.StrokeStyle.createDashVector(b, s.dash) : undefined; - const dashLineOverride = str(b, s.dashLineOverride); - Duc.StrokeStyle.startStrokeStyle(b); - if (s.preference !== undefined) Duc.StrokeStyle.addPreference(b, s.preference); - if (s.cap != null) Duc.StrokeStyle.addCap(b, s.cap); - if (s.join != null) Duc.StrokeStyle.addJoin(b, s.join); - if (dashVec) Duc.StrokeStyle.addDash(b, dashVec); - if (dashLineOverride) Duc.StrokeStyle.addDashLineOverride(b, dashLineOverride); - if (s.dashCap != null) Duc.StrokeStyle.addDashCap(b, s.dashCap); - if (s.miterLimit !== undefined) Duc.StrokeStyle.addMiterLimit(b, s.miterLimit); - return Duc.StrokeStyle.endStrokeStyle(b); -} - -function writeStrokeSides(b: flatbuffers.Builder, ss: StrokeSides | null | undefined, usv: boolean): number | undefined { - if (!ss) return undefined; - const valuesVec = ss.values?.length ? Duc.StrokeSides.createValuesVector(b, ss.values) : undefined; - Duc.StrokeSides.startStrokeSides(b); - if (ss.preference !== undefined) Duc.StrokeSides.addPreference(b, ss.preference); - if (valuesVec) Duc.StrokeSides.addValues(b, valuesVec); - return Duc.StrokeSides.endStrokeSides(b); -} - -function writeElementStroke(b: flatbuffers.Builder, s: ElementStroke | null | undefined, usv: boolean): number | undefined { - if (!s) return undefined; - const c = writeContentBase(b, s.content, usv); - const st = writeStrokeStyle(b, s.style, usv); - const sides = writeStrokeSides(b, s.strokeSides, usv); - Duc.ElementStroke.startElementStroke(b); - if (c) Duc.ElementStroke.addContent(b, c); - if (s.width) { - Duc.ElementStroke.addWidth(b, getPrecisionValue(s.width, usv)); - } - if (st) Duc.ElementStroke.addStyle(b, st); - if (s.placement) Duc.ElementStroke.addPlacement(b, s.placement); - if (sides) Duc.ElementStroke.addStrokeSides(b, sides); - return Duc.ElementStroke.endElementStroke(b); -} - -function writeElementBackground(b: flatbuffers.Builder, bg: ElementBackground | null | undefined, usv: boolean): number | undefined { - if (!bg) return undefined; - const c = writeContentBase(b, bg.content, usv); - Duc.ElementBackground.startElementBackground(b); - if (c) Duc.ElementBackground.addContent(b, c); - return Duc.ElementBackground.endElementBackground(b); -} - -function writeStylesBase(b: flatbuffers.Builder, s: _DucElementStylesBase | undefined, usv: boolean): number | null { - if (!s) return null; - - const bgArrRaw = s.background; - const stArrRaw = s.stroke; - - if (bgArrRaw === undefined || stArrRaw === undefined) { - return null; - } - - const bgArr: ReadonlyArray = - Array.isArray(bgArrRaw) - ? bgArrRaw - : (bgArrRaw ? [bgArrRaw as ElementBackground] : []); - const stArr: ReadonlyArray = - Array.isArray(stArrRaw) - ? stArrRaw - : (stArrRaw ? [stArrRaw as ElementStroke] : []); - - const bgOffsets = bgArr - .map((x) => (x ? writeElementBackground(b, x, usv) : undefined)) - .filter((o): o is number => o !== undefined); - const stOffsets = stArr - .map((x) => (x ? writeElementStroke(b, x, usv) : undefined)) - .filter((o): o is number => o !== undefined); - - const bgs = Duc._DucElementStylesBase.createBackgroundVector(b, bgOffsets); - const strokes = Duc._DucElementStylesBase.createStrokeVector(b, stOffsets); - - Duc._DucElementStylesBase.start_DucElementStylesBase(b); - if (s.roundness) { - Duc._DucElementStylesBase.addRoundness(b, getPrecisionValue(s.roundness, usv)); - } - if (s.blending) Duc._DucElementStylesBase.addBlending(b, s.blending); - Duc._DucElementStylesBase.addBackground(b, bgs); - Duc._DucElementStylesBase.addStroke(b, strokes); - if (s.opacity) { - Duc._DucElementStylesBase.addOpacity(b, s.opacity); - } - return Duc._DucElementStylesBase.end_DucElementStylesBase(b); -} - -/** - * Generic helpers - */ -function writeStringEntry(b: flatbuffers.Builder, k: string, v: string): number { - const ko = b.createString(k); - const vo = b.createString(v); - Duc.StringValueEntry.startStringValueEntry(b); - Duc.StringValueEntry.addKey(b, ko); - Duc.StringValueEntry.addValue(b, vo); - return Duc.StringValueEntry.endStringValueEntry(b); -} - -function writeIdentifier(b: flatbuffers.Builder, id: Identifier): number { - const io = b.createString(id.id); - const no = b.createString(id.name); - const doff = b.createString(id.description ?? ""); - Duc.Identifier.startIdentifier(b); - Duc.Identifier.addId(b, io); - Duc.Identifier.addName(b, no); - Duc.Identifier.addDescription(b, doff); - return Duc.Identifier.endIdentifier(b); -} - -/** - * Geometry and bindings - */ -function writeDucPoint(b: flatbuffers.Builder, p: DucPoint | null | undefined, usv: boolean): number | undefined { - if (!p) return undefined; - Duc.DucPoint.startDucPoint(b); - Duc.DucPoint.addX(b, getPrecisionValue(p.x, usv)); - Duc.DucPoint.addY(b, getPrecisionValue(p.y, usv)); - if (p.mirroring != null) Duc.DucPoint.addMirroring(b, p.mirroring); - return Duc.DucPoint.endDucPoint(b); -} - -function writeGeomPoint(b: flatbuffers.Builder, p: GeometricPoint | null | undefined, usv: boolean): number | undefined { - if (!p) return undefined; - return Duc.GeometricPoint.createGeometricPoint(b, p.x, p.y); -} - -function writeHead(b: flatbuffers.Builder, h: DucHead | null | undefined, usv: boolean): number | undefined { - if (!h) return undefined; - const blockId = str(b, h.blockId); - Duc.DucHead.startDucHead(b); - Duc.DucHead.addType(b, h.type); - if (blockId) Duc.DucHead.addBlockId(b, blockId); - Duc.DucHead.addSize(b, getPrecisionValue(h.size, usv)); - return Duc.DucHead.endDucHead(b); -} - -function writeBindingPoint(b: flatbuffers.Builder, p: { index: number; offset: number } | null | undefined, usv: boolean): number | undefined { - if (!p) return undefined; - Duc.PointBindingPoint.startPointBindingPoint(b); - Duc.PointBindingPoint.addIndex(b, p.index); - Duc.PointBindingPoint.addOffset(b, p.offset); - return Duc.PointBindingPoint.endPointBindingPoint(b); -} - -function writePointBinding(b: flatbuffers.Builder, pb: DucPointBinding | null | undefined, usv: boolean): number | undefined { - if (!pb) return undefined; - const el = str(b, pb.elementId); - const fixed = pb.fixedPoint ? writeGeomPoint(b, pb.fixedPoint, usv) : undefined; - const point = writeBindingPoint(b, pb.point, usv); - const head = writeHead(b, pb.head, usv); - Duc.DucPointBinding.startDucPointBinding(b); - if (el) Duc.DucPointBinding.addElementId(b, el); - Duc.DucPointBinding.addFocus(b, pb.focus); - Duc.DucPointBinding.addGap(b, getPrecisionValue(pb.gap, usv)); - if (fixed) Duc.DucPointBinding.addFixedPoint(b, fixed); - if (point) Duc.DucPointBinding.addPoint(b, point); - if (head) Duc.DucPointBinding.addHead(b, head); - return Duc.DucPointBinding.endDucPointBinding(b); -} - -function writeLineRef(b: flatbuffers.Builder, r: DucLineReference, usv: boolean): number { - Duc.DucLineReference.startDucLineReference(b); - Duc.DucLineReference.addIndex(b, r.index); - if (r.handle) { - const hx = getPrecisionValue(r.handle.x, usv); - const hy = getPrecisionValue(r.handle.y, usv); - const gp = Duc.GeometricPoint.createGeometricPoint(b, hx, hy); - Duc.DucLineReference.addHandle(b, gp); - } - return Duc.DucLineReference.endDucLineReference(b); -} - -function writeLine(b: flatbuffers.Builder, l: DucLine, usv: boolean): number { - const s = writeLineRef(b, l[0], usv); - const e = writeLineRef(b, l[1], usv); - Duc.DucLine.startDucLine(b); - Duc.DucLine.addStart(b, s); - Duc.DucLine.addEnd(b, e); - return Duc.DucLine.endDucLine(b); -} - -function writePath(b: flatbuffers.Builder, p: DucPath, usv: boolean): number { - const lineIndices = Duc.DucPath.createLineIndicesVector(b, p.lineIndices.map((x) => x)); - const bg = p.background ? writeElementBackground(b, p.background, usv) : undefined; - const st = p.stroke ? writeElementStroke(b, p.stroke, usv) : undefined; - Duc.DucPath.startDucPath(b); - Duc.DucPath.addLineIndices(b, lineIndices); - if (bg) Duc.DucPath.addBackground(b, bg); - if (st) Duc.DucPath.addStroke(b, st); - return Duc.DucPath.endDucPath(b); -} - -/** - * DucElement bases - */ -function writeBoundElement(b: flatbuffers.Builder, be: BoundElement, usv: boolean): number { - const id = str(b, be.id)!; - const type = str(b, be.type)!; - Duc.BoundElement.startBoundElement(b); - Duc.BoundElement.addId(b, id); - Duc.BoundElement.addType(b, type); - return Duc.BoundElement.endBoundElement(b); -} - -function writeElementBase(b: flatbuffers.Builder, e: _DucElementStylesBase & _DucStackElementBase & _DucStackBase, usv: boolean): number { - const id = str(b, e.id); - const styles = writeStylesBase(b, e, usv); - const scope = str(b, e.scope); - const label = str(b, e.label ?? undefined); - const desc = str(b, e.description ?? undefined); - const index = str(b, e.index ?? undefined); - const groupIds = e.groupIds?.length ? Duc._DucElementBase.createGroupIdsVector(b, e.groupIds.map((g) => b.createString(g))) : undefined; - const blockIds = e.blockIds?.length ? Duc._DucElementBase.createBlockIdsVector(b, e.blockIds.map((blockId) => b.createString(blockId))) : undefined; - const regionIds = e.regionIds?.length ? Duc._DucElementBase.createRegionIdsVector(b, e.regionIds.map((r) => b.createString(r))) : undefined; - const instanceId = str(b, e.instanceId ?? undefined); - const layerId = str(b, e.layerId ?? undefined); - const frameId = str(b, e.frameId ?? undefined); - const bound = e.boundElements?.length ? Duc._DucElementBase.createBoundElementsVector(b, e.boundElements.map((x) => writeBoundElement(b, x, usv))) : undefined; - const link = str(b, e.link ?? undefined); - const custom = e.customData != null ? Duc._DucElementBase.createCustomDataVector(b, zlibSync(strToU8(JSON.stringify(e.customData)))) : undefined; - - Duc._DucElementBase.start_DucElementBase(b); - if (id) Duc._DucElementBase.addId(b, id); - if (styles) Duc._DucElementBase.addStyles(b, styles); - Duc._DucElementBase.addX(b, getPrecisionValue(e.x, usv)); - Duc._DucElementBase.addY(b, getPrecisionValue(e.y, usv)); - Duc._DucElementBase.addWidth(b, getPrecisionValue(e.width, usv)); - Duc._DucElementBase.addHeight(b, getPrecisionValue(e.height, usv)); - Duc._DucElementBase.addAngle(b, e.angle); - if (scope) Duc._DucElementBase.addScope(b, scope); - if (label) Duc._DucElementBase.addLabel(b, label); - if (desc) Duc._DucElementBase.addDescription(b, desc); - Duc._DucElementBase.addIsVisible(b, e.isVisible); - Duc._DucElementBase.addSeed(b, e.seed); - Duc._DucElementBase.addVersion(b, e.version); - Duc._DucElementBase.addVersionNonce(b, e.versionNonce); - Duc._DucElementBase.addUpdated(b, BigInt(e.updated)); - if (index) Duc._DucElementBase.addIndex(b, index); - Duc._DucElementBase.addIsPlot(b, e.isPlot); - Duc._DucElementBase.addIsAnnotative(b, e.isAnnotative); - Duc._DucElementBase.addIsDeleted(b, e.isDeleted); - if (groupIds) Duc._DucElementBase.addGroupIds(b, groupIds); - if (blockIds) Duc._DucElementBase.addBlockIds(b, blockIds); - if (regionIds) Duc._DucElementBase.addRegionIds(b, regionIds); - if (instanceId) Duc._DucElementBase.addInstanceId(b, instanceId); - if (layerId) Duc._DucElementBase.addLayerId(b, layerId); - if (frameId) Duc._DucElementBase.addFrameId(b, frameId); - if (bound) Duc._DucElementBase.addBoundElements(b, bound); - Duc._DucElementBase.addZIndex(b, e.zIndex); - if (link) Duc._DucElementBase.addLink(b, link); - Duc._DucElementBase.addLocked(b, e.locked); - if (custom) Duc._DucElementBase.addCustomData(b, custom); - return Duc._DucElementBase.end_DucElementBase(b); -} - -function writeLinearBase(b: flatbuffers.Builder, e: _DucLinearElementBase, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - - // Type-safe guards without using any: default to empty arrays if undefined - const pointsArr: ReadonlyArray = e.points ?? []; - const linesArr: ReadonlyArray = e.lines ?? []; - const pathOverridesArr: ReadonlyArray = e.pathOverrides ?? []; - - const points = Duc._DucLinearElementBase.createPointsVector( - b, - pointsArr.map((p) => writeDucPoint(b, p, usv)!).filter((v): v is number => v !== undefined) - ); - const lines = Duc._DucLinearElementBase.createLinesVector( - b, - linesArr.map((ln) => writeLine(b, ln, usv)) - ); - const pathOverrides = pathOverridesArr.length - ? Duc._DucLinearElementBase.createPathOverridesVector(b, pathOverridesArr.map((p) => writePath(b, p, usv))) - : undefined; - - const lastCommitted = writeDucPoint(b, e.lastCommittedPoint, usv); - const startBinding = writePointBinding(b, e.startBinding, usv); - const endBinding = writePointBinding(b, e.endBinding, usv); - - Duc._DucLinearElementBase.start_DucLinearElementBase(b); - Duc._DucLinearElementBase.addBase(b, base); - Duc._DucLinearElementBase.addPoints(b, points); - Duc._DucLinearElementBase.addLines(b, lines); - if (pathOverrides) Duc._DucLinearElementBase.addPathOverrides(b, pathOverrides); - if (lastCommitted) Duc._DucLinearElementBase.addLastCommittedPoint(b, lastCommitted); - if (startBinding) Duc._DucLinearElementBase.addStartBinding(b, startBinding); - if (endBinding) Duc._DucLinearElementBase.addEndBinding(b, endBinding); - return Duc._DucLinearElementBase.end_DucLinearElementBase(b); -} - -/** - * Elements - */ -function writeRect(b: flatbuffers.Builder, e: DucRectangleElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - Duc.DucRectangleElement.startDucRectangleElement(b); - Duc.DucRectangleElement.addBase(b, base); - return Duc.DucRectangleElement.endDucRectangleElement(b); -} - -function writePolygon(b: flatbuffers.Builder, e: DucPolygonElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - Duc.DucPolygonElement.startDucPolygonElement(b); - Duc.DucPolygonElement.addBase(b, base); - Duc.DucPolygonElement.addSides(b, e.sides); - return Duc.DucPolygonElement.endDucPolygonElement(b); -} - -function writeEllipse(b: flatbuffers.Builder, e: DucEllipseElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - Duc.DucEllipseElement.startDucEllipseElement(b); - Duc.DucEllipseElement.addBase(b, base); - Duc.DucEllipseElement.addRatio(b, e.ratio); - Duc.DucEllipseElement.addStartAngle(b, e.startAngle); - Duc.DucEllipseElement.addEndAngle(b, e.endAngle); - Duc.DucEllipseElement.addShowAuxCrosshair(b, e.showAuxCrosshair); - return Duc.DucEllipseElement.endDucEllipseElement(b); -} - -function writeLinear(b: flatbuffers.Builder, e: DucLinearElement, usv: boolean): number { - const base = writeLinearBase(b, e as unknown as any, usv); - Duc.DucLinearElement.startDucLinearElement(b); - Duc.DucLinearElement.addLinearBase(b, base); - Duc.DucLinearElement.addWipeoutBelow(b, e.wipeoutBelow); - return Duc.DucLinearElement.endDucLinearElement(b); -} - -function writeArrow(b: flatbuffers.Builder, e: DucArrowElement, usv: boolean): number { - const base = writeLinearBase(b, e as unknown as any, usv); - Duc.DucArrowElement.startDucArrowElement(b); - Duc.DucArrowElement.addLinearBase(b, base); - Duc.DucArrowElement.addElbowed(b, e.elbowed); - return Duc.DucArrowElement.endDucArrowElement(b); -} - -function writeFreeDrawEnds(b: flatbuffers.Builder, ends: DucFreeDrawEnds | null | undefined, usv: boolean): number | undefined { - if (!ends) return undefined; - const easing = str(b, encodeFunctionString(ends.easing)); - Duc.DucFreeDrawEnds.startDucFreeDrawEnds(b); - Duc.DucFreeDrawEnds.addCap(b, ends.cap); - Duc.DucFreeDrawEnds.addTaper(b, ends.taper); - if (easing) Duc.DucFreeDrawEnds.addEasing(b, easing); - return Duc.DucFreeDrawEnds.endDucFreeDrawEnds(b); -} - -function writeImageCrop(b: flatbuffers.Builder, c: ImageCrop | null | undefined): number | undefined { - if (!c) return undefined; - Duc.ImageCrop.startImageCrop(b); - Duc.ImageCrop.addX(b, c.x); - Duc.ImageCrop.addY(b, c.y); - Duc.ImageCrop.addWidth(b, c.width); - Duc.ImageCrop.addHeight(b, c.height); - Duc.ImageCrop.addNaturalWidth(b, c.naturalWidth); - Duc.ImageCrop.addNaturalHeight(b, c.naturalHeight); - return Duc.ImageCrop.endImageCrop(b); -} - -function writeImage(b: flatbuffers.Builder, e: DucImageElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - const fileId = str(b, e.fileId); - const scaleVec = e.scaleFlip ? Duc.DucImageElement.createScaleVector(b, [e.scaleFlip[0], e.scaleFlip[1]]) : undefined; - const crop = writeImageCrop(b, e.crop); - const filter = writeImageFilter(b, e.filter, usv); - - Duc.DucImageElement.startDucImageElement(b); - Duc.DucImageElement.addBase(b, base); - if (fileId) Duc.DucImageElement.addFileId(b, fileId); - if (e.status) Duc.DucImageElement.addStatus(b, e.status); - if (scaleVec) Duc.DucImageElement.addScale(b, scaleVec); - if (crop) Duc.DucImageElement.addCrop(b, crop); - if (filter) Duc.DucImageElement.addFilter(b, filter); - return Duc.DucImageElement.endDucImageElement(b); -} - -function writeFreeDraw(b: flatbuffers.Builder, e: DucFreeDrawElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - - const pointsVec = e.points && e.points.length - ? Duc.DucFreeDrawElement.createPointsVector( - b, - e.points.map((p) => writeDucPoint(b, p, usv)!).filter((v): v is number => v !== undefined) - ) - : Duc.DucFreeDrawElement.createPointsVector(b, []); - - const pressuresVec = e.pressures && e.pressures.length - ? Duc.DucFreeDrawElement.createPressuresVector(b, e.pressures as number[]) - : undefined; - - const easing = b.createString(encodeFunctionString(e.easing)); - const startEnds = writeFreeDrawEnds(b, e.start, usv); - const endEnds = writeFreeDrawEnds(b, e.end, usv); - const lcp = e.lastCommittedPoint ? writeDucPoint(b, e.lastCommittedPoint, usv) : undefined; - const svgPath = e.svgPath ? b.createString(e.svgPath) : undefined; - - Duc.DucFreeDrawElement.startDucFreeDrawElement(b); - Duc.DucFreeDrawElement.addBase(b, base); - Duc.DucFreeDrawElement.addPoints(b, pointsVec); - - Duc.DucFreeDrawElement.addSize(b, getPrecisionValue(e.size, usv)); - Duc.DucFreeDrawElement.addThinning(b, e.thinning); - Duc.DucFreeDrawElement.addSmoothing(b, e.smoothing); - Duc.DucFreeDrawElement.addStreamline(b, e.streamline); - - if (easing) Duc.DucFreeDrawElement.addEasing(b, easing); - if (startEnds) Duc.DucFreeDrawElement.addStart(b, startEnds); - if (endEnds) Duc.DucFreeDrawElement.addEnd(b, endEnds); - if (pressuresVec) Duc.DucFreeDrawElement.addPressures(b, pressuresVec); - Duc.DucFreeDrawElement.addSimulatePressure(b, !!e.simulatePressure); - if (lcp) Duc.DucFreeDrawElement.addLastCommittedPoint(b, lcp); - if (svgPath) Duc.DucFreeDrawElement.addSvgPath(b, svgPath); - - return Duc.DucFreeDrawElement.endDucFreeDrawElement(b); -} - -/** - * Text - */ -function writeLineSpacing(b: flatbuffers.Builder, ls: DucTextStyle["lineSpacing"] | undefined, usv: boolean): number | undefined { - if (!ls) return undefined; - Duc.LineSpacing.startLineSpacing(b); - if (typeof ls.value === "number") { - Duc.LineSpacing.addValue(b, ls.value); - } else { - Duc.LineSpacing.addValue(b, getPrecisionValue(ls.value, usv)); - } - - Duc.LineSpacing.addType(b, ls.type); - return Duc.LineSpacing.endLineSpacing(b); -} - -function writeTextStyle(b: flatbuffers.Builder, s: DucTextStyle, usv: boolean): number { - const lineSpacing = writeLineSpacing(b, s.lineSpacing, usv); - const fontFamily = str(b, s.fontFamily.toString()); - const bigFont = str(b, s.bigFontFamily); - Duc.DucTextStyle.startDucTextStyle(b); - Duc.DucTextStyle.addIsLtr(b, s.isLtr); - if (fontFamily) Duc.DucTextStyle.addFontFamily(b, fontFamily); - if (bigFont) Duc.DucTextStyle.addBigFontFamily(b, bigFont); - if (s.textAlign !== undefined) Duc.DucTextStyle.addTextAlign(b, s.textAlign); - if (s.verticalAlign !== undefined) Duc.DucTextStyle.addVerticalAlign(b, s.verticalAlign); - Duc.DucTextStyle.addLineHeight(b, s.lineHeight); - if (lineSpacing) Duc.DucTextStyle.addLineSpacing(b, lineSpacing); - Duc.DucTextStyle.addObliqueAngle(b, s.obliqueAngle); - Duc.DucTextStyle.addFontSize(b, getPrecisionValue(s.fontSize, usv)); - if (s.paperTextHeight !== undefined) Duc.DucTextStyle.addPaperTextHeight(b, getPrecisionValue(s.paperTextHeight, usv)); - Duc.DucTextStyle.addWidthFactor(b, s.widthFactor); - Duc.DucTextStyle.addIsUpsideDown(b, s.isUpsideDown); - Duc.DucTextStyle.addIsBackwards(b, s.isBackwards); - return Duc.DucTextStyle.endDucTextStyle(b); -} - -function writePrimaryUnits(b: flatbuffers.Builder, units: StandardUnits["primaryUnits"] | undefined, usv: boolean): number | undefined { - if (!units) return undefined; - - // Linear - Duc._UnitSystemBase.start_UnitSystemBase(b); - Duc._UnitSystemBase.addSystem(b, units.linear.system); - Duc._UnitSystemBase.addPrecision(b, units.linear.precision); - Duc._UnitSystemBase.addSuppressLeadingZeros(b, units.linear.suppressLeadingZeros); - Duc._UnitSystemBase.addSuppressTrailingZeros(b, units.linear.suppressTrailingZeros); - const baseLinear = Duc._UnitSystemBase.end_UnitSystemBase(b); - - Duc.LinearUnitSystem.startLinearUnitSystem(b); - Duc.LinearUnitSystem.addBase(b, baseLinear); - Duc.LinearUnitSystem.addFormat(b, units.linear.format); - Duc.LinearUnitSystem.addDecimalSeparator(b, units.linear.decimalSeparator); - Duc.LinearUnitSystem.addSuppressZeroFeet(b, units.linear.suppressZeroFeet); - Duc.LinearUnitSystem.addSuppressZeroInches(b, units.linear.suppressZeroInches); - const linear = Duc.LinearUnitSystem.endLinearUnitSystem(b); - - // Angular - Duc._UnitSystemBase.start_UnitSystemBase(b); - Duc._UnitSystemBase.addSystem(b, units.angular.system); - Duc._UnitSystemBase.addPrecision(b, units.angular.precision); - Duc._UnitSystemBase.addSuppressLeadingZeros(b, units.angular.suppressLeadingZeros); - Duc._UnitSystemBase.addSuppressTrailingZeros(b, units.angular.suppressTrailingZeros); - const baseAngular = Duc._UnitSystemBase.end_UnitSystemBase(b); - - Duc.AngularUnitSystem.startAngularUnitSystem(b); - Duc.AngularUnitSystem.addBase(b, baseAngular); - Duc.AngularUnitSystem.addFormat(b, units.angular.format); - const angular = Duc.AngularUnitSystem.endAngularUnitSystem(b); - - Duc.PrimaryUnits.startPrimaryUnits(b); - Duc.PrimaryUnits.addLinear(b, linear); - Duc.PrimaryUnits.addAngular(b, angular); - return Duc.PrimaryUnits.endPrimaryUnits(b); -} - -function writeTextDynamicSource(b: flatbuffers.Builder, s: DucTextDynamicSource, usv: boolean): number { - // discriminate by sourceType union ("element" | "dictionary") - if (s.sourceType === Duc.TEXT_FIELD_SOURCE_TYPE.ELEMENT) { - const el = str(b, s.elementId); - const prop = s.property; - Duc.DucTextDynamicElementSource.startDucTextDynamicElementSource(b); - if (el) Duc.DucTextDynamicElementSource.addElementId(b, el); - Duc.DucTextDynamicElementSource.addProperty(b, prop); - const elem = Duc.DucTextDynamicElementSource.endDucTextDynamicElementSource(b); - - Duc.DucTextDynamicSource.startDucTextDynamicSource(b); - Duc.DucTextDynamicSource.addTextSourceType(b, Duc.TEXT_FIELD_SOURCE_TYPE.ELEMENT); - Duc.DucTextDynamicSource.addSourceType(b, Duc.DucTextDynamicSourceData.DucTextDynamicElementSource); - Duc.DucTextDynamicSource.addSource(b, elem); - return Duc.DucTextDynamicSource.endDucTextDynamicSource(b); - } - const key = str(b, s.key); - Duc.DucTextDynamicDictionarySource.startDucTextDynamicDictionarySource(b); - if (key) Duc.DucTextDynamicDictionarySource.addKey(b, key); - const dict = Duc.DucTextDynamicDictionarySource.endDucTextDynamicDictionarySource(b); - - Duc.DucTextDynamicSource.startDucTextDynamicSource(b); - Duc.DucTextDynamicSource.addTextSourceType(b, Duc.TEXT_FIELD_SOURCE_TYPE.DICTIONARY); - Duc.DucTextDynamicSource.addSourceType(b, Duc.DucTextDynamicSourceData.DucTextDynamicDictionarySource); - Duc.DucTextDynamicSource.addSource(b, dict); - return Duc.DucTextDynamicSource.endDucTextDynamicSource(b); -} - -function writeTextDynamicPart(b: flatbuffers.Builder, p: DucTextDynamicPart, usv: boolean): number { - const tag = str(b, p.tag); - const src = writeTextDynamicSource(b, p.source, usv); - const fmt = writePrimaryUnits(b, p.formatting as any, usv); - const cached = str(b, p.cachedValue); - Duc.DucTextDynamicPart.startDucTextDynamicPart(b); - if (tag) Duc.DucTextDynamicPart.addTag(b, tag); - Duc.DucTextDynamicPart.addSource(b, src); - if (fmt) Duc.DucTextDynamicPart.addFormatting(b, fmt); - if (cached) Duc.DucTextDynamicPart.addCachedValue(b, cached); - return Duc.DucTextDynamicPart.endDucTextDynamicPart(b); -} - -function writeTextColumn(b: flatbuffers.Builder, c: TextColumn, usv: boolean): number { - Duc.TextColumn.startTextColumn(b); - Duc.TextColumn.addWidth(b, getPrecisionValue(c.width, usv)); - Duc.TextColumn.addGutter(b, getPrecisionValue(c.gutter, usv)); - return Duc.TextColumn.endTextColumn(b); -} - -function writeParagraphFormatting(b: flatbuffers.Builder, p: DucDocStyle["paragraph"], usv: boolean): number { - const tabs = Duc.ParagraphFormatting.createTabStopsVector(b, p.tabStops.map((t) => getPrecisionValue(t, usv))); - Duc.ParagraphFormatting.startParagraphFormatting(b); - Duc.ParagraphFormatting.addFirstLineIndent(b, getPrecisionValue(p.firstLineIndent, usv)); - Duc.ParagraphFormatting.addHangingIndent(b, getPrecisionValue(p.hangingIndent, usv)); - Duc.ParagraphFormatting.addLeftIndent(b, getPrecisionValue(p.leftIndent, usv)); - Duc.ParagraphFormatting.addRightIndent(b, getPrecisionValue(p.rightIndent, usv)); - Duc.ParagraphFormatting.addSpaceBefore(b, getPrecisionValue(p.spaceBefore, usv)); - Duc.ParagraphFormatting.addSpaceAfter(b, getPrecisionValue(p.spaceAfter, usv)); - Duc.ParagraphFormatting.addTabStops(b, tabs); - return Duc.ParagraphFormatting.endParagraphFormatting(b); -} - -function writeStackFormat(b: flatbuffers.Builder, s: DucDocStyle["stackFormat"], usv: boolean): number { - const chars = Duc.StackFormat.createStackCharsVector(b, [...s.stackChars].map((c) => b.createString(c))); - Duc.StackFormatProperties.startStackFormatProperties(b); - Duc.StackFormatProperties.addUpperScale(b, s.properties.upperScale); - Duc.StackFormatProperties.addLowerScale(b, s.properties.lowerScale); - Duc.StackFormatProperties.addAlignment(b, s.properties.alignment); - const props = Duc.StackFormatProperties.endStackFormatProperties(b); - Duc.StackFormat.startStackFormat(b); - Duc.StackFormat.addAutoStack(b, s.autoStack); - Duc.StackFormat.addStackChars(b, chars); - Duc.StackFormat.addProperties(b, props); - return Duc.StackFormat.endStackFormat(b); -} - -function writeDocStyle(b: flatbuffers.Builder, s: DucDocStyle, usv: boolean): number { - const text = writeTextStyle(b, s, usv); - const para = writeParagraphFormatting(b, s.paragraph, usv); - const stack = writeStackFormat(b, s.stackFormat, usv); - Duc.DucDocStyle.startDucDocStyle(b); - Duc.DucDocStyle.addTextStyle(b, text); - Duc.DucDocStyle.addParagraph(b, para); - Duc.DucDocStyle.addStackFormat(b, stack); - return Duc.DucDocStyle.endDucDocStyle(b); -} - -function writeColumnLayout(b: flatbuffers.Builder, c: DucDocElement["columns"], usv: boolean): number { - const defs = Duc.ColumnLayout.createDefinitionsVector(b, c.definitions.map((d) => writeTextColumn(b, d, usv))); - Duc.ColumnLayout.startColumnLayout(b); - Duc.ColumnLayout.addType(b, c.type); - Duc.ColumnLayout.addDefinitions(b, defs); - Duc.ColumnLayout.addAutoHeight(b, c.autoHeight); - return Duc.ColumnLayout.endColumnLayout(b); -} + return maybeProcess?.env?.DUC_SCHEMA_VERSION; +}; -function writeDocumentGridConfig(b: flatbuffers.Builder, config: DocumentGridConfig, usv: boolean): number { - Duc.DocumentGridConfig.startDocumentGridConfig(b); - Duc.DocumentGridConfig.addColumns(b, config.columns); - Duc.DocumentGridConfig.addGapX(b, config.gapX); - Duc.DocumentGridConfig.addGapY(b, config.gapY); - const alignItems = (() => { - if (config.alignItems === 'start') return Duc.DOCUMENT_GRID_ALIGN_ITEMS.START; - if (config.alignItems === 'center') return Duc.DOCUMENT_GRID_ALIGN_ITEMS.CENTER; - if (config.alignItems === 'end') return Duc.DOCUMENT_GRID_ALIGN_ITEMS.END; - return Duc.DOCUMENT_GRID_ALIGN_ITEMS.START; - })(); - Duc.DocumentGridConfig.addAlignItems(b, alignItems); - Duc.DocumentGridConfig.addFirstPageAlone(b, config.firstPageAlone); - Duc.DocumentGridConfig.addScale(b, config.scale); - return Duc.DocumentGridConfig.endDocumentGridConfig(b); -} +const decodeUserVersionToSemver = (userVersion: number): string => { + const major = Math.floor(userVersion / 1_000_000); + const minor = Math.floor((userVersion % 1_000_000) / 1_000); + const patch = userVersion % 1_000; + return `${major}.${minor}.${patch}`; +}; -function writeText(b: flatbuffers.Builder, e: DucTextElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - const style = writeTextStyle(b, e, usv); - const text = str(b, e.text); - const dynamic = Duc.DucTextElement.createDynamicVector(b, e.dynamic.map((d) => writeTextDynamicPart(b, d, usv))); - const containerId = str(b, e.containerId ?? undefined); - const original = str(b, e.originalText); - Duc.DucTextElement.startDucTextElement(b); - Duc.DucTextElement.addBase(b, base); - Duc.DucTextElement.addStyle(b, style); - if (text) Duc.DucTextElement.addText(b, text); - Duc.DucTextElement.addDynamic(b, dynamic); - Duc.DucTextElement.addAutoResize(b, e.autoResize); - if (containerId) Duc.DucTextElement.addContainerId(b, containerId); - if (original) Duc.DucTextElement.addOriginalText(b, original); - return Duc.DucTextElement.endDucTextElement(b); -} +export const DUC_SCHEMA_VERSION = getSchemaVersionFromEnv(); /** - * Blocks + * Serialize an ExportedDataState into `.duc` bytes (Uint8Array). + * + * 1. restore() for defaults & migrations + * 2. Element fixups (re-wrap stack elements) + * 3. WASM serialize (JS → Rust via serde-wasm-bindgen → SQLite → bytes) */ -function writeBlockAttrDef(b: flatbuffers.Builder, d: DucBlockAttributeDefinition, usv: boolean): number { - const tag = b.createString(d.tag); - const prompt = b.createString(d.prompt); - const defVal = b.createString(d.defaultValue); - Duc.DucBlockAttributeDefinition.startDucBlockAttributeDefinition(b); - Duc.DucBlockAttributeDefinition.addTag(b, tag); - Duc.DucBlockAttributeDefinition.addPrompt(b, prompt); - Duc.DucBlockAttributeDefinition.addDefaultValue(b, defVal); - Duc.DucBlockAttributeDefinition.addIsConstant(b, d.isConstant); - return Duc.DucBlockAttributeDefinition.endDucBlockAttributeDefinition(b); -} +export async function serializeDuc( + data: Partial, + elementsConfig?: ElementsConfig, + restoreConfig?: RestoreConfig, +): Promise { + await ensureWasm(); -function writeBlockMetadata(b: flatbuffers.Builder, metadata: DucBlockMetadata): number { - const source = b.createString(metadata.source); - const localization = metadata.localization ? Duc.DucBlockMetadata.createLocalizationVector(b, zlibSync(strToU8(JSON.stringify(metadata.localization)))) : undefined; - - Duc.DucBlockMetadata.startDucBlockMetadata(b); - Duc.DucBlockMetadata.addSource(b, source); - Duc.DucBlockMetadata.addUsageCount(b, metadata.usageCount); - Duc.DucBlockMetadata.addCreatedAt(b, BigInt(metadata.createdAt)); - Duc.DucBlockMetadata.addUpdatedAt(b, BigInt(metadata.updatedAt)); - if (localization) { - Duc.DucBlockMetadata.addLocalization(b, localization); - } - return Duc.DucBlockMetadata.endDucBlockMetadata(b); -} - -function writeBlock(b: flatbuffers.Builder, bl: DucBlock, usv: boolean): number { - const id = b.createString(bl.id); - const label = b.createString(bl.label); - const desc = b.createString(bl.description ?? ""); - const defs = Duc.DucBlock.createAttributeDefinitionsVector( - b, - Object.entries(bl.attributeDefinitions ?? {}).map(([k, v]) => { - const key = b.createString(k); - const val = writeBlockAttrDef(b, v, usv); - Duc.DucBlockAttributeDefinitionEntry.startDucBlockAttributeDefinitionEntry(b); - Duc.DucBlockAttributeDefinitionEntry.addKey(b, key); - Duc.DucBlockAttributeDefinitionEntry.addValue(b, val); - return Duc.DucBlockAttributeDefinitionEntry.endDucBlockAttributeDefinitionEntry(b); - }), + const restored = restore( + data as any, + elementsConfig ?? { syncInvalidIndices: (els) => els as any }, + restoreConfig, ); - // Write metadata if present - let metadataOffset: number | undefined; - if (bl.metadata) { - metadataOffset = writeBlockMetadata(b, bl.metadata); - } - - // Write thumbnail if present - let thumbnailOffset: number | undefined; - if (bl.thumbnail && bl.thumbnail.length > 0) { - thumbnailOffset = Duc.DucBlock.createThumbnailVector(b, bl.thumbnail); - } - - Duc.DucBlock.startDucBlock(b); - Duc.DucBlock.addId(b, id); - Duc.DucBlock.addLabel(b, label); - Duc.DucBlock.addDescription(b, desc); - Duc.DucBlock.addVersion(b, bl.version); - Duc.DucBlock.addAttributeDefinitions(b, defs); - if (metadataOffset) { - Duc.DucBlock.addMetadata(b, metadataOffset); - } - if (thumbnailOffset) { - Duc.DucBlock.addThumbnail(b, thumbnailOffset); - } - return Duc.DucBlock.endDucBlock(b); -} - -function writeBlockInstance(b: flatbuffers.Builder, i: DucBlockInstance, usv: boolean): number { - const id = b.createString(i.id); - const blockId = b.createString(i.blockId); - const overrides = Duc.DucBlockInstance.createElementOverridesVector( - b, - Object.entries(i.elementOverrides ?? {}).map(([k, v]) => writeStringEntry(b, k, v)), - ); - const attrs = Duc.DucBlockInstance.createAttributeValuesVector( - b, - Object.entries(i.attributeValues ?? {}).map(([k, v]) => writeStringEntry(b, k, v)), + const shouldDropLegacyVersionGraph = hasLegacyVersionGraphShape( + (data as any)?.versionGraph, ); - const dup = i.duplicationArray - ? (() => { - Duc.DucBlockDuplicationArray.startDucBlockDuplicationArray(b); - Duc.DucBlockDuplicationArray.addRows(b, i.duplicationArray.rows); - Duc.DucBlockDuplicationArray.addCols(b, i.duplicationArray.cols); - const rSpacing = typeof i.duplicationArray.rowSpacing === 'number' - ? i.duplicationArray.rowSpacing - : getPrecisionValue(i.duplicationArray.rowSpacing, usv); + const payloadForRust = { + type: data.type ?? "duc", + version: data.version ?? DUC_SCHEMA_VERSION ?? decodeUserVersionToSemver(wasmGetCurrentSchemaVersion()), + source: data.source ?? "ducjs", + ...restored, + versionGraph: shouldDropLegacyVersionGraph + ? undefined + : restored.versionGraph, + }; - const cSpacing = typeof i.duplicationArray.colSpacing === 'number' - ? i.duplicationArray.colSpacing - : getPrecisionValue(i.duplicationArray.colSpacing, usv); + const prepared = transformToRust(payloadForRust); - Duc.DucBlockDuplicationArray.addRowSpacing(b, rSpacing); - Duc.DucBlockDuplicationArray.addColSpacing(b, cSpacing); - return Duc.DucBlockDuplicationArray.endDucBlockDuplicationArray(b); - })() - : undefined; - - Duc.DucBlockInstance.startDucBlockInstance(b); - Duc.DucBlockInstance.addId(b, id); - Duc.DucBlockInstance.addBlockId(b, blockId); - Duc.DucBlockInstance.addVersion(b, i.version); - if (overrides) Duc.DucBlockInstance.addElementOverrides(b, overrides); - if (attrs) Duc.DucBlockInstance.addAttributeValues(b, attrs); - if (dup) Duc.DucBlockInstance.addDuplicationArray(b, dup); - return Duc.DucBlockInstance.endDucBlockInstance(b); + return wasmSerializeDuc(prepared); } -function writeBlockCollection(b: flatbuffers.Builder, c: DucBlockCollection): number { - const id = b.createString(c.id); - const label = b.createString(c.label); - - // Serialize children array - const children = c.children.map(child => { - const childId = b.createString(child.id); - Duc.DucBlockCollectionEntry.startDucBlockCollectionEntry(b); - Duc.DucBlockCollectionEntry.addId(b, childId); - Duc.DucBlockCollectionEntry.addIsCollection(b, child.isCollection); - return Duc.DucBlockCollectionEntry.endDucBlockCollectionEntry(b); - }); - const childrenOffset = Duc.DucBlockCollection.createChildrenVector(b, children); - - // Serialize metadata if present - let metadataOffset: number | undefined; - if (c.metadata) { - const metadata = c.metadata; - let localizationOffset: number | undefined; - if (metadata.localization) { - // localization is stored as compressed binary JSON data - const localizationBin = zlibSync(strToU8(JSON.stringify(metadata.localization))); - localizationOffset = Duc.DucBlockMetadata.createLocalizationVector(b, localizationBin); - } - - const source = b.createString(metadata.source); - - Duc.DucBlockMetadata.startDucBlockMetadata(b); - Duc.DucBlockMetadata.addSource(b, source); - Duc.DucBlockMetadata.addUsageCount(b, metadata.usageCount); - // Convert to BigInt as expected by FlatBuffers - Duc.DucBlockMetadata.addCreatedAt(b, BigInt(metadata.createdAt)); - Duc.DucBlockMetadata.addUpdatedAt(b, BigInt(metadata.updatedAt)); - if (localizationOffset) Duc.DucBlockMetadata.addLocalization(b, localizationOffset); - metadataOffset = Duc.DucBlockMetadata.endDucBlockMetadata(b); +function hasLegacyVersionGraphShape(versionGraph: any): boolean { + if (!versionGraph || typeof versionGraph !== "object") { + return false; } - // Serialize thumbnail if present - let thumbnailOffset: number | undefined; - if (c.thumbnail) { - thumbnailOffset = b.createByteVector(c.thumbnail); + const metadata = versionGraph.metadata; + if (!metadata || typeof metadata !== "object") { + return true; } - Duc.DucBlockCollection.startDucBlockCollection(b); - Duc.DucBlockCollection.addId(b, id); - Duc.DucBlockCollection.addLabel(b, label); - Duc.DucBlockCollection.addChildren(b, childrenOffset); - if (metadataOffset) Duc.DucBlockCollection.addMetadata(b, metadataOffset); - if (thumbnailOffset) Duc.DucBlockCollection.addThumbnail(b, thumbnailOffset); - - return Duc.DucBlockCollection.endDucBlockCollection(b); -} - -/** - * Stack containers - */ -function writeStackLikeStyles(b: flatbuffers.Builder, s: DucStackLikeStyles, usv: boolean): number { - const color = b.createString(s.labelingColor); - Duc.DucStackLikeStyles.startDucStackLikeStyles(b); - Duc.DucStackLikeStyles.addOpacity(b, s.opacity); - Duc.DucStackLikeStyles.addLabelingColor(b, color); - return Duc.DucStackLikeStyles.endDucStackLikeStyles(b); -} - -function writeStackBase(b: flatbuffers.Builder, s: _DucStackBase, usv: boolean): number { - const label = b.createString(s.label); - const desc = str(b, s.description ?? undefined); - const styles = writeStackLikeStyles(b, s, usv); - Duc._DucStackBase.start_DucStackBase(b); - Duc._DucStackBase.addLabel(b, label); - if (desc) Duc._DucStackBase.addDescription(b, desc); - Duc._DucStackBase.addIsCollapsed(b, s.isCollapsed); - Duc._DucStackBase.addIsPlot(b, s.isPlot); - Duc._DucStackBase.addIsVisible(b, s.isVisible); - Duc._DucStackBase.addLocked(b, s.locked); - Duc._DucStackBase.addStyles(b, styles); - return Duc._DucStackBase.end_DucStackBase(b); -} - -function writeStackElementBase(b: flatbuffers.Builder, s: _DucStackElementBase & _DucStackBase, usv: boolean): number { - const base = writeElementBase(b, s as unknown as any, usv); - const stackBase = writeStackBase(b, s, usv); - const std = str(b, s.standardOverride); - Duc._DucStackElementBase.start_DucStackElementBase(b); - Duc._DucStackElementBase.addBase(b, base); - Duc._DucStackElementBase.addStackBase(b, stackBase); - Duc._DucStackElementBase.addClip(b, s.clip); - Duc._DucStackElementBase.addLabelVisible(b, s.labelVisible); - if (std) Duc._DucStackElementBase.addStandardOverride(b, std); - return Duc._DucStackElementBase.end_DucStackElementBase(b); -} - -function writeFrame(b: flatbuffers.Builder, e: DucFrameElement, usv: boolean): number { - const base = writeStackElementBase(b, e as unknown as any, usv); - Duc.DucFrameElement.startDucFrameElement(b); - Duc.DucFrameElement.addStackElementBase(b, base); - return Duc.DucFrameElement.endDucFrameElement(b); -} - -function writePlotLayout(b: flatbuffers.Builder, l: PlotLayout, usv: boolean): number { - Duc.Margins.startMargins(b); - Duc.Margins.addTop(b, getPrecisionValue(l.margins.top, usv)); - Duc.Margins.addRight(b, getPrecisionValue(l.margins.right, usv)); - Duc.Margins.addBottom(b, getPrecisionValue(l.margins.bottom, usv)); - Duc.Margins.addLeft(b, getPrecisionValue(l.margins.left, usv)); - const margins = Duc.Margins.endMargins(b); - Duc.PlotLayout.startPlotLayout(b); - Duc.PlotLayout.addMargins(b, margins); - return Duc.PlotLayout.endPlotLayout(b); -} - -function writePlot(b: flatbuffers.Builder, e: DucPlotElement, usv: boolean): number { - const stackBase = writeStackElementBase(b, e as unknown as any, usv); - const plotStyle = (() => { - Duc.DucPlotStyle.startDucPlotStyle(b); - return Duc.DucPlotStyle.endDucPlotStyle(b); - })(); - const layout = writePlotLayout(b, e.layout, usv); - Duc.DucPlotElement.startDucPlotElement(b); - Duc.DucPlotElement.addStackElementBase(b, stackBase); - Duc.DucPlotElement.addStyle(b, plotStyle); - Duc.DucPlotElement.addLayout(b, layout); - return Duc.DucPlotElement.endDucPlotElement(b); -} - -/** - * Views / Viewports / XRay - */ -function writeView(b: flatbuffers.Builder, v: DucView, usv: boolean): number { - const center = writeDucPoint(b, v.centerPoint, usv); - const scope = b.createString(v.scope); - Duc.DucView.startDucView(b); - Duc.DucView.addScrollX(b, getPrecisionValue(v.scrollX, usv)); - Duc.DucView.addScrollY(b, getPrecisionValue(v.scrollY, usv)); - Duc.DucView.addZoom(b, v.zoom.value); - Duc.DucView.addTwistAngle(b, v.twistAngle); - if (center) Duc.DucView.addCenterPoint(b, center); - Duc.DucView.addScope(b, scope); - return Duc.DucView.endDucView(b); -} - -function writeViewportStyle(b: flatbuffers.Builder, s: DucViewportStyle, usv: boolean): number { - Duc.DucViewportStyle.startDucViewportStyle(b); - Duc.DucViewportStyle.addScaleIndicatorVisible(b, s.scaleIndicatorVisible); - return Duc.DucViewportStyle.endDucViewportStyle(b); -} - -function writeViewport(b: flatbuffers.Builder, e: DucViewportElement, usv: boolean): number { - const linear = writeLinearBase(b, e as unknown as any, usv); - const stackBase = writeStackBase(b, e as unknown as any, usv); - const style = writeViewportStyle(b, e, usv); - const view = writeView(b, e.view, usv); - const frozen = e.frozenGroupIds?.length ? Duc.DucViewportElement.createFrozenGroupIdsVector(b, e.frozenGroupIds.map((id) => b.createString(id))) : undefined; - const std = str(b, e.standardOverride); - Duc.DucViewportElement.startDucViewportElement(b); - Duc.DucViewportElement.addLinearBase(b, linear); - Duc.DucViewportElement.addStackBase(b, stackBase); - Duc.DucViewportElement.addStyle(b, style); - Duc.DucViewportElement.addView(b, view); - Duc.DucViewportElement.addScale(b, e.scale); - if (e.shadePlot !== undefined) Duc.DucViewportElement.addShadePlot(b, e.shadePlot); - if (frozen) Duc.DucViewportElement.addFrozenGroupIds(b, frozen); - if (std) Duc.DucViewportElement.addStandardOverride(b, std); - return Duc.DucViewportElement.endDucViewportElement(b); -} - -function writeXRayStyle(b: flatbuffers.Builder, s: DucXRayStyle, usv: boolean): number { - const color = b.createString(s.color); - Duc.DucXRayStyle.startDucXRayStyle(b); - Duc.DucXRayStyle.addColor(b, color); - return Duc.DucXRayStyle.endDucXRayStyle(b); -} - -function writeXRay(b: flatbuffers.Builder, e: DucXRayElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - const style = writeXRayStyle(b, e, usv); - const origin = writeDucPoint(b, e.origin, usv); - const direction = writeDucPoint(b, e.direction, usv); - Duc.DucXRayElement.startDucXRayElement(b); - Duc.DucXRayElement.addBase(b, base); - Duc.DucXRayElement.addStyle(b, style); - if (origin) Duc.DucXRayElement.addOrigin(b, origin); - if (direction) Duc.DucXRayElement.addDirection(b, direction); - Duc.DucXRayElement.addStartFromOrigin(b, e.startFromOrigin); - return Duc.DucXRayElement.endDucXRayElement(b); -} - -/** - * Leader & Dimension & FCF - */ -function writeLeaderContent(b: flatbuffers.Builder, c: LeaderContent | null, usv: boolean): number | undefined { - if (!c) return undefined; - let contentOffset: number; - let contentType: Duc.LeaderContentData; + const hasModernMetadata = + typeof metadata.currentVersion === "number" && + typeof metadata.currentSchemaVersion === "number" && + typeof metadata.chainCount === "number"; - if (c.type === "text") { - const text = b.createString(c.text); - Duc.LeaderTextBlockContent.startLeaderTextBlockContent(b); - Duc.LeaderTextBlockContent.addText(b, text); - contentOffset = Duc.LeaderTextBlockContent.endLeaderTextBlockContent(b); - contentType = Duc.LeaderContentData.LeaderTextBlockContent; - } else { - const attrs = Duc.LeaderBlockContent.createAttributeValuesVector(b, Object.entries(c.instanceData.attributeValues ?? {}).map(([k, v]) => writeStringEntry(b, k, v))); - const overrides = Duc.LeaderBlockContent.createElementOverridesVector(b, Object.entries(c.instanceData.elementOverrides ?? {}).map(([k, v]) => writeStringEntry(b, k, v))); - const blockId = b.createString(c.blockId); - Duc.LeaderBlockContent.startLeaderBlockContent(b); - Duc.LeaderBlockContent.addBlockId(b, blockId); - if (attrs) Duc.LeaderBlockContent.addAttributeValues(b, attrs); - if (overrides) Duc.LeaderBlockContent.addElementOverrides(b, overrides); - contentOffset = Duc.LeaderBlockContent.endLeaderBlockContent(b); - contentType = Duc.LeaderContentData.LeaderBlockContent; + if (!hasModernMetadata) { + return true; } - Duc.LeaderContent.startLeaderContent(b); - Duc.LeaderContent.addLeaderContentType(b, Duc.LEADER_CONTENT_TYPE[c.type.toUpperCase() as keyof typeof Duc.LEADER_CONTENT_TYPE] as Duc.LEADER_CONTENT_TYPE); - Duc.LeaderContent.addContentType(b, contentType); - Duc.LeaderContent.addContent(b, contentOffset); - return Duc.LeaderContent.endLeaderContent(b); -} - -function writeLeaderStyle(b: flatbuffers.Builder, s: DucLeaderStyle, usv: boolean): number { - const text = writeTextStyle(b, s.textStyle, usv); - const heads = s.headsOverride ? Duc.DucLeaderStyle.createHeadsOverrideVector(b, s.headsOverride.map((h) => writeHead(b, h, usv)!)) : undefined; - Duc.DucLeaderStyle.startDucLeaderStyle(b); - if (heads) Duc.DucLeaderStyle.addHeadsOverride(b, heads); - if (s.dogleg !== undefined) Duc.DucLeaderStyle.addDogleg(b, getPrecisionValue(s.dogleg, usv)); - Duc.DucLeaderStyle.addTextStyle(b, text); - if (s.textAttachment !== undefined) Duc.DucLeaderStyle.addTextAttachment(b, s.textAttachment); - if (s.blockAttachment !== undefined) Duc.DucLeaderStyle.addBlockAttachment(b, s.blockAttachment); - return Duc.DucLeaderStyle.endDucLeaderStyle(b); -} - -function writeLeader(b: flatbuffers.Builder, e: DucLeaderElement, usv: boolean): number { - const linear = writeLinearBase(b, e as unknown as any, usv); - const style = writeLeaderStyle(b, e, usv); - const content = writeLeaderContent(b, e.leaderContent, usv); - const anchor = writeGeomPoint(b, e.contentAnchor, usv); - Duc.DucLeaderElement.startDucLeaderElement(b); - Duc.DucLeaderElement.addLinearBase(b, linear); - Duc.DucLeaderElement.addStyle(b, style); - if (content) Duc.DucLeaderElement.addContent(b, content); - if (anchor) Duc.DucLeaderElement.addContentAnchor(b, anchor); - return Duc.DucLeaderElement.endDucLeaderElement(b); -} - -function writeDimDefPoints(b: flatbuffers.Builder, d: DimensionDefinitionPoints, usv: boolean): number { - const o1 = writeGeomPoint(b, d.origin1, usv); - const o2 = d.origin2 ? writeGeomPoint(b, d.origin2, usv) : undefined; - const loc = writeGeomPoint(b, d.location, usv); - const center = d.center ? writeGeomPoint(b, d.center, usv) : undefined; - const jog = d.jog ? writeGeomPoint(b, d.jog, usv) : undefined; - Duc.DimensionDefinitionPoints.startDimensionDefinitionPoints(b); - if (o1) Duc.DimensionDefinitionPoints.addOrigin1(b, o1); - if (o2) Duc.DimensionDefinitionPoints.addOrigin2(b, o2); - if (loc) Duc.DimensionDefinitionPoints.addLocation(b, loc); - if (center) Duc.DimensionDefinitionPoints.addCenter(b, center); - if (jog) Duc.DimensionDefinitionPoints.addJog(b, jog); - return Duc.DimensionDefinitionPoints.endDimensionDefinitionPoints(b); -} - -function writeDimBindings(b: flatbuffers.Builder, d: DucDimensionElement["bindings"] | undefined, usv: boolean): number | undefined { - if (!d) return undefined; - const o1 = d.origin1 ? writePointBinding(b, d.origin1, usv) : undefined; - const o2 = d.origin2 ? writePointBinding(b, d.origin2, usv) : undefined; - const c = d.center ? writePointBinding(b, d.center, usv) : undefined; - Duc.DimensionBindings.startDimensionBindings(b); - if (o1) Duc.DimensionBindings.addOrigin1(b, o1); - if (o2) Duc.DimensionBindings.addOrigin2(b, o2); - if (c) Duc.DimensionBindings.addCenter(b, c); - return Duc.DimensionBindings.endDimensionBindings(b); -} - -function writeDimTolStyle(b: flatbuffers.Builder, t: DucDimensionStyle["tolerance"], usv: boolean): number { - const textStyle = writeTextStyle(b, t.textStyle as DucTextStyle, usv); - Duc.DimensionToleranceStyle.startDimensionToleranceStyle(b); - Duc.DimensionToleranceStyle.addEnabled(b, t.enabled); - Duc.DimensionToleranceStyle.addDisplayMethod(b, t.displayMethod); - Duc.DimensionToleranceStyle.addUpperValue(b, t.upperValue); - Duc.DimensionToleranceStyle.addLowerValue(b, t.lowerValue); - Duc.DimensionToleranceStyle.addPrecision(b, t.precision); - Duc.DimensionToleranceStyle.addTextStyle(b, textStyle); - return Duc.DimensionToleranceStyle.endDimensionToleranceStyle(b); -} - -function writeDimLineStyle(b: flatbuffers.Builder, s: DucDimensionStyle["dimLine"], usv: boolean): number { - const st = writeElementStroke(b, s.stroke, usv); - Duc.DimensionLineStyle.startDimensionLineStyle(b); - if (st) Duc.DimensionLineStyle.addStroke(b, st); - Duc.DimensionLineStyle.addTextGap(b, getPrecisionValue(s.textGap, usv)); - return Duc.DimensionLineStyle.endDimensionLineStyle(b); -} - -function writeExtLineStyle(b: flatbuffers.Builder, s: DucDimensionStyle["extLine"], usv: boolean): number { - const st = writeElementStroke(b, s.stroke, usv); - Duc.DimensionExtLineStyle.startDimensionExtLineStyle(b); - if (st) Duc.DimensionExtLineStyle.addStroke(b, st); - Duc.DimensionExtLineStyle.addOvershoot(b, getPrecisionValue(s.overshoot, usv)); - Duc.DimensionExtLineStyle.addOffset(b, getPrecisionValue(s.offset, usv)); - return Duc.DimensionExtLineStyle.endDimensionExtLineStyle(b); -} - -function writeDimSymbolStyle(b: flatbuffers.Builder, s: DucDimensionStyle["symbols"], usv: boolean): number { - const heads = s.headsOverride ? Duc.DimensionSymbolStyle.createHeadsOverrideVector(b, s.headsOverride.map((h) => writeHead(b, h, usv)!)) : undefined; - Duc.DimensionSymbolStyle.startDimensionSymbolStyle(b); - if (heads) Duc.DimensionSymbolStyle.addHeadsOverride(b, heads); - Duc.DimensionSymbolStyle.addCenterMarkType(b, s.centerMark.type); - Duc.DimensionSymbolStyle.addCenterMarkSize(b, getPrecisionValue(s.centerMark.size, usv)); - return Duc.DimensionSymbolStyle.endDimensionSymbolStyle(b); -} - -function writeDimStyle(b: flatbuffers.Builder, s: DucDimensionStyle, usv: boolean): number { - const dim = writeDimLineStyle(b, s.dimLine, usv); - const ext = writeExtLineStyle(b, s.extLine, usv); - const text = writeTextStyle(b, s.textStyle, usv); - const sym = writeDimSymbolStyle(b, s.symbols, usv); - const tol = writeDimTolStyle(b, s.tolerance, usv); - const fit = (() => { - Duc.DimensionFitStyle.startDimensionFitStyle(b); - Duc.DimensionFitStyle.addRule(b, s.fit.rule); - Duc.DimensionFitStyle.addTextPlacement(b, s.fit.textPlacement); - Duc.DimensionFitStyle.addForceTextInside(b, s.fit.forceTextInside); - return Duc.DimensionFitStyle.endDimensionFitStyle(b); - })(); - Duc.DucDimensionStyle.startDucDimensionStyle(b); - Duc.DucDimensionStyle.addDimLine(b, dim); - Duc.DucDimensionStyle.addExtLine(b, ext); - Duc.DucDimensionStyle.addTextStyle(b, text); - Duc.DucDimensionStyle.addSymbols(b, sym); - Duc.DucDimensionStyle.addTolerance(b, tol); - Duc.DucDimensionStyle.addFit(b, fit); - return Duc.DucDimensionStyle.endDucDimensionStyle(b); -} - -function writeDimension(b: flatbuffers.Builder, e: DucDimensionElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - const style = writeDimStyle(b, e, usv); - const def = writeDimDefPoints(b, e.definitionPoints, usv); - const bindings = writeDimBindings(b, e.bindings, usv); - const textOverride = e.textOverride != null ? b.createString(e.textOverride) : undefined; - const textPos = e.textPosition ? writeGeomPoint(b, e.textPosition, usv) : undefined; - const tolOverride = e.toleranceOverride ? writeDimTolStyle(b, e.toleranceOverride as any, usv) : undefined; - const baseline = e.baselineData - ? (() => { - Duc.DimensionBaselineData.startDimensionBaselineData(b); - Duc.DimensionBaselineData.addBaseDimensionId(b, b.createString(e.baselineData.baseDimensionId)); - return Duc.DimensionBaselineData.endDimensionBaselineData(b); - })() - : undefined; - const cont = e.continueData - ? (() => { - Duc.DimensionContinueData.startDimensionContinueData(b); - Duc.DimensionContinueData.addContinueFromDimensionId(b, b.createString(e.continueData.continueFromDimensionId)); - return Duc.DimensionContinueData.endDimensionContinueData(b); - })() - : undefined; - - Duc.DucDimensionElement.startDucDimensionElement(b); - Duc.DucDimensionElement.addBase(b, base); - Duc.DucDimensionElement.addStyle(b, style); - Duc.DucDimensionElement.addDimensionType(b, e.dimensionType); - Duc.DucDimensionElement.addDefinitionPoints(b, def); - Duc.DucDimensionElement.addObliqueAngle(b, e.obliqueAngle); - if (e.ordinateAxis) Duc.DucDimensionElement.addOrdinateAxis(b, e.ordinateAxis); - if (bindings) Duc.DucDimensionElement.addBindings(b, bindings); - if (textOverride) Duc.DucDimensionElement.addTextOverride(b, textOverride); - if (textPos) Duc.DucDimensionElement.addTextPosition(b, textPos); - if (tolOverride) Duc.DucDimensionElement.addToleranceOverride(b, tolOverride); - if (baseline) Duc.DucDimensionElement.addBaselineData(b, baseline); - if (cont) Duc.DucDimensionElement.addContinueData(b, cont); - return Duc.DucDimensionElement.endDucDimensionElement(b); -} - -function writeDatumRef(b: flatbuffers.Builder, d: DatumReference, usv: boolean): number { - const letters = b.createString(d.letters); - Duc.DatumReference.startDatumReference(b); - Duc.DatumReference.addLetters(b, letters); - if (d.modifier) Duc.DatumReference.addModifier(b, d.modifier); - return Duc.DatumReference.endDatumReference(b); -} - -function writeToleranceClause(b: flatbuffers.Builder, t: ToleranceClause, usv: boolean): number { - const value = b.createString(t.value); - const featureMods = t.featureModifiers?.length - ? Duc.ToleranceClause.createFeatureModifiersVector(b, t.featureModifiers.map((f) => f)) - : undefined; - Duc.ToleranceClause.startToleranceClause(b); - Duc.ToleranceClause.addValue(b, value); - if (t.zoneType) Duc.ToleranceClause.addZoneType(b, t.zoneType); - if (featureMods) Duc.ToleranceClause.addFeatureModifiers(b, featureMods); - if (t.materialCondition) Duc.ToleranceClause.addMaterialCondition(b, t.materialCondition); - return Duc.ToleranceClause.endToleranceClause(b); -} - -function writeFcfSegment(b: flatbuffers.Builder, s: FeatureControlFrameSegment, usv: boolean): number { - const tol = writeToleranceClause(b, s.tolerance, usv); - const datums = s.datums?.length ? Duc.FeatureControlFrameSegment.createDatumsVector(b, s.datums.filter(Boolean).map((d) => writeDatumRef(b, d!, usv))) : undefined; - Duc.FeatureControlFrameSegment.startFeatureControlFrameSegment(b); - Duc.FeatureControlFrameSegment.addSymbol(b, s.symbol); - Duc.FeatureControlFrameSegment.addTolerance(b, tol); - if (datums) Duc.FeatureControlFrameSegment.addDatums(b, datums); - return Duc.FeatureControlFrameSegment.endFeatureControlFrameSegment(b); -} - -function writeFcfSegmentRow(b: flatbuffers.Builder, row: readonly FeatureControlFrameSegment[], usv: boolean): number { - const segs = Duc.FCFSegmentRow.createSegmentsVector(b, row.map((s) => writeFcfSegment(b, s, usv))); - Duc.FCFSegmentRow.startFCFSegmentRow(b); - Duc.FCFSegmentRow.addSegments(b, segs); - return Duc.FCFSegmentRow.endFCFSegmentRow(b); -} - -function writeFcfBetween(b: flatbuffers.Builder, v: { start: string; end: string }, usv: boolean): number { - const s = b.createString(v.start); - const e = b.createString(v.end); - Duc.FCFBetweenModifier.startFCFBetweenModifier(b); - Duc.FCFBetweenModifier.addStart(b, s); - Duc.FCFBetweenModifier.addEnd(b, e); - return Duc.FCFBetweenModifier.endFCFBetweenModifier(b); -} - -function writeProjectedZone(b: flatbuffers.Builder, v: PrecisionValue, usv: boolean): number { - Duc.FCFProjectedZoneModifier.startFCFProjectedZoneModifier(b); - Duc.FCFProjectedZoneModifier.addValue(b, getPrecisionValue(v, usv)); - return Duc.FCFProjectedZoneModifier.endFCFProjectedZoneModifier(b); -} - -function writeFcfFrameModifiers(b: flatbuffers.Builder, m: DucFeatureControlFrameElement["frameModifiers"] | undefined, usv: boolean): number | undefined { - if (!m) return undefined; - Duc.FCFFrameModifiers.startFCFFrameModifiers(b); - if (m.allAround !== undefined) Duc.FCFFrameModifiers.addAllAround(b, m.allAround); - if (m.allOver !== undefined) Duc.FCFFrameModifiers.addAllOver(b, m.allOver); - if (m.continuousFeature !== undefined) Duc.FCFFrameModifiers.addContinuousFeature(b, m.continuousFeature); - if (m.between) Duc.FCFFrameModifiers.addBetween(b, writeFcfBetween(b, m.between, usv)); - if (m.projectedToleranceZone) Duc.FCFFrameModifiers.addProjectedToleranceZone(b, writeProjectedZone(b, m.projectedToleranceZone, usv)); - return Duc.FCFFrameModifiers.endFCFFrameModifiers(b); -} - -function writeFcfDatumDefinition(b: flatbuffers.Builder, d: DucFeatureControlFrameElement["datumDefinition"] | undefined, usv: boolean): number | undefined { - if (!d) return undefined; - const letter = b.createString(d.letter); - const binding = d.featureBinding ? writePointBinding(b, d.featureBinding, usv) : undefined; - Duc.FCFDatumDefinition.startFCFDatumDefinition(b); - Duc.FCFDatumDefinition.addLetter(b, letter); - if (binding) Duc.FCFDatumDefinition.addFeatureBinding(b, binding); - return Duc.FCFDatumDefinition.endFCFDatumDefinition(b); -} - -function writeFcfStyle(b: flatbuffers.Builder, s: DucFeatureControlFrameStyle, usv: boolean): number { - const text = writeTextStyle(b, s.textStyle, usv); - const layout = (() => { - Duc.FCFLayoutStyle.startFCFLayoutStyle(b); - Duc.FCFLayoutStyle.addPadding(b, getPrecisionValue(s.layout.padding, usv)); - Duc.FCFLayoutStyle.addSegmentSpacing(b, getPrecisionValue(s.layout.segmentSpacing, usv)); - Duc.FCFLayoutStyle.addRowSpacing(b, getPrecisionValue(s.layout.rowSpacing, usv)); - return Duc.FCFLayoutStyle.endFCFLayoutStyle(b); - })(); - const sym = (() => { - Duc.FCFSymbolStyle.startFCFSymbolStyle(b); - Duc.FCFSymbolStyle.addScale(b, s.symbols.scale); - return Duc.FCFSymbolStyle.endFCFSymbolStyle(b); - })(); - const datum = (() => { - Duc.FCFDatumStyle.startFCFDatumStyle(b); - Duc.FCFDatumStyle.addBracketStyle(b, s.datumStyle.bracketStyle); - return Duc.FCFDatumStyle.endFCFDatumStyle(b); - })(); - Duc.DucFeatureControlFrameStyle.startDucFeatureControlFrameStyle(b); - Duc.DucFeatureControlFrameStyle.addTextStyle(b, text); - Duc.DucFeatureControlFrameStyle.addLayout(b, layout); - Duc.DucFeatureControlFrameStyle.addSymbols(b, sym); - Duc.DucFeatureControlFrameStyle.addDatumStyle(b, datum); - return Duc.DucFeatureControlFrameStyle.endDucFeatureControlFrameStyle(b); -} - -function writeFcf(b: flatbuffers.Builder, e: DucFeatureControlFrameElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - const style = writeFcfStyle(b, e, usv); - const rows = Duc.DucFeatureControlFrameElement.createRowsVector(b, e.rows.map((r) => writeFcfSegmentRow(b, r, usv))); - const mods = writeFcfFrameModifiers(b, e.frameModifiers, usv); - const leaderId = e.leaderElementId ? b.createString(e.leaderElementId) : undefined; - const datumDef = writeFcfDatumDefinition(b, e.datumDefinition, usv); - Duc.DucFeatureControlFrameElement.startDucFeatureControlFrameElement(b); - Duc.DucFeatureControlFrameElement.addBase(b, base); - Duc.DucFeatureControlFrameElement.addStyle(b, style); - Duc.DucFeatureControlFrameElement.addRows(b, rows); - if (mods) Duc.DucFeatureControlFrameElement.addFrameModifiers(b, mods); - if (leaderId) Duc.DucFeatureControlFrameElement.addLeaderElementId(b, leaderId); - if (datumDef) Duc.DucFeatureControlFrameElement.addDatumDefinition(b, datumDef); - return Duc.DucFeatureControlFrameElement.endDucFeatureControlFrameElement(b); -} - -/** - * Doc element - */ -function writeDoc(b: flatbuffers.Builder, e: DucDocElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - const style = writeDocStyle(b, e, usv); - const text = b.createString(e.text); - const dynamic = Duc.DucDocElement.createDynamicVector(b, e.dynamic.map((d) => writeTextDynamicPart(b, d, usv))); - const columns = (() => { - const col = e.columns; - const defs = Duc.ColumnLayout.createDefinitionsVector(b, col.definitions.map((d) => writeTextColumn(b, d, usv))); - Duc.ColumnLayout.startColumnLayout(b); - Duc.ColumnLayout.addType(b, col.type); - Duc.ColumnLayout.addDefinitions(b, defs); - Duc.ColumnLayout.addAutoHeight(b, col.autoHeight); - return Duc.ColumnLayout.endColumnLayout(b); - })(); - const fileId = e.fileId ? b.createString(e.fileId) : undefined; - const gridConfig = writeDocumentGridConfig(b, e.gridConfig, usv); - Duc.DucDocElement.startDucDocElement(b); - Duc.DucDocElement.addBase(b, base); - Duc.DucDocElement.addStyle(b, style); - Duc.DucDocElement.addText(b, text); - Duc.DucDocElement.addDynamic(b, dynamic); - Duc.DucDocElement.addFlowDirection(b, e.flowDirection); - Duc.DucDocElement.addColumns(b, columns); - Duc.DucDocElement.addAutoResize(b, e.autoResize); - if (fileId) Duc.DucDocElement.addFileId(b, fileId); - Duc.DucDocElement.addGridConfig(b, gridConfig); - return Duc.DucDocElement.endDucDocElement(b); -} - -/** - * PDF, Mermaid, Embeddable - */ -function writePdf(b: flatbuffers.Builder, e: DucPdfElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - const fileId = e.fileId ? b.createString(e.fileId) : undefined; - const gridConfig = writeDocumentGridConfig(b, e.gridConfig, usv); - Duc.DucPdfElement.startDucPdfElement(b); - Duc.DucPdfElement.addBase(b, base); - if (fileId) Duc.DucPdfElement.addFileId(b, fileId); - Duc.DucPdfElement.addGridConfig(b, gridConfig); - return Duc.DucPdfElement.endDucPdfElement(b); -} - -function writeMermaid(b: flatbuffers.Builder, e: DucMermaidElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - const src = b.createString(e.source); - const theme = e.theme ? b.createString(e.theme) : undefined; - const svg = e.svgPath ? b.createString(e.svgPath) : undefined; - Duc.DucMermaidElement.startDucMermaidElement(b); - Duc.DucMermaidElement.addBase(b, base); - Duc.DucMermaidElement.addSource(b, src); - if (theme) Duc.DucMermaidElement.addTheme(b, theme); - if (svg) Duc.DucMermaidElement.addSvgPath(b, svg); - return Duc.DucMermaidElement.endDucMermaidElement(b); -} - -function writeModel(b: flatbuffers.Builder, e: DucModelElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - const src = b.createString(e.source); - const svg = e.svgPath ? b.createString(e.svgPath) : undefined; - const fileIds = e.fileIds?.length ? Duc.DucModelElement.createFileIdsVector(b, e.fileIds.map((id) => b.createString(id))) : undefined; - Duc.DucModelElement.startDucModelElement(b); - Duc.DucModelElement.addBase(b, base); - Duc.DucModelElement.addSource(b, src); - if (svg) Duc.DucModelElement.addSvgPath(b, svg); - if (fileIds) Duc.DucModelElement.addFileIds(b, fileIds); - return Duc.DucModelElement.endDucModelElement(b); -} - -function writeEmbeddable(b: flatbuffers.Builder, e: DucEmbeddableElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - Duc.DucEmbeddableElement.startDucEmbeddableElement(b); - Duc.DucEmbeddableElement.addBase(b, base); - return Duc.DucEmbeddableElement.endDucEmbeddableElement(b); -} - -/** - * Table - */ -function writeTableCellStyle(b: flatbuffers.Builder, s: DucTableCellStyle, usv: boolean): number { - const base = writeStylesBase(b, s, usv); - const text = writeTextStyle(b, s.textStyle, usv); - Duc.Margins.startMargins(b); - Duc.Margins.addTop(b, getPrecisionValue(s.margins.top, usv)); - Duc.Margins.addRight(b, getPrecisionValue(s.margins.right, usv)); - Duc.Margins.addBottom(b, getPrecisionValue(s.margins.bottom, usv)); - Duc.Margins.addLeft(b, getPrecisionValue(s.margins.left, usv)); - const margins = Duc.Margins.endMargins(b); - Duc.DucTableCellStyle.startDucTableCellStyle(b); - if (base) { - Duc.DucTableCellStyle.addBaseStyle(b, base); + if (metadata.currentSchemaVersion < 1 || metadata.chainCount < 1) { + return true; } - Duc.DucTableCellStyle.addTextStyle(b, text); - Duc.DucTableCellStyle.addMargins(b, margins); - Duc.DucTableCellStyle.addAlignment(b, s.alignment); - return Duc.DucTableCellStyle.endDucTableCellStyle(b); -} -function writeTableStyle(b: flatbuffers.Builder, s: DucTableStyle, usv: boolean): number { - const header = writeTableCellStyle(b, s.headerRowStyle, usv); - const dataRow = writeTableCellStyle(b, s.dataRowStyle, usv); - const dataCol = writeTableCellStyle(b, s.dataColumnStyle, usv); - Duc.DucTableStyle.startDucTableStyle(b); - Duc.DucTableStyle.addFlowDirection(b, s.flowDirection); - Duc.DucTableStyle.addHeaderRowStyle(b, header); - Duc.DucTableStyle.addDataRowStyle(b, dataRow); - Duc.DucTableStyle.addDataColumnStyle(b, dataCol); - return Duc.DucTableStyle.endDucTableStyle(b); -} + const checkpoints = Array.isArray(versionGraph.checkpoints) + ? versionGraph.checkpoints + : []; + const deltas = Array.isArray(versionGraph.deltas) ? versionGraph.deltas : []; -function writeTable(b: flatbuffers.Builder, e: DucTableElement, usv: boolean): number { - const base = writeElementBase(b, e as unknown as any, usv); - const style = writeTableStyle(b, e, usv); - const colOrder = Duc.DucTableElement.createColumnOrderVector(b, e.columnOrder.map((id) => b.createString(id))); - const rowOrder = Duc.DucTableElement.createRowOrderVector(b, e.rowOrder.map((id) => b.createString(id))); - const columns = Duc.DucTableElement.createColumnsVector( - b, - Object.entries(e.columns).map(([k, v]) => { - const key = b.createString(k); - const val = (() => { - const id = b.createString(v.id); - Duc.DucTableColumn.startDucTableColumn(b); - Duc.DucTableColumn.addId(b, id); - Duc.DucTableColumn.addWidth(b, getPrecisionValue(v.width, usv)); - const styleOverrides = v.styleOverrides ? writeTableCellStyle(b, v.styleOverrides as DucTableCellStyle, usv) : undefined; - if (styleOverrides) Duc.DucTableColumn.addStyleOverrides(b, styleOverrides); - return Duc.DucTableColumn.endDucTableColumn(b); - })(); - Duc.DucTableColumnEntry.startDucTableColumnEntry(b); - Duc.DucTableColumnEntry.addKey(b, key); - Duc.DucTableColumnEntry.addValue(b, val); - return Duc.DucTableColumnEntry.endDucTableColumnEntry(b); - }), - ); - const rows = Duc.DucTableElement.createRowsVector( - b, - Object.entries(e.rows).map(([k, v]) => { - const key = b.createString(k); - const val = (() => { - const id = b.createString(v.id); - Duc.DucTableRow.startDucTableRow(b); - Duc.DucTableRow.addId(b, id); - Duc.DucTableRow.addHeight(b, getPrecisionValue(v.height, usv)); - const styleOverrides = v.styleOverrides ? writeTableCellStyle(b, v.styleOverrides as DucTableCellStyle, usv) : undefined; - if (styleOverrides) Duc.DucTableRow.addStyleOverrides(b, styleOverrides); - return Duc.DucTableRow.endDucTableRow(b); - })(); - Duc.DucTableRowEntry.startDucTableRowEntry(b); - Duc.DucTableRowEntry.addKey(b, key); - Duc.DucTableRowEntry.addValue(b, val); - return Duc.DucTableRowEntry.endDucTableRowEntry(b); - }), - ); - const cells = Duc.DucTableElement.createCellsVector( - b, - Object.entries(e.cells).map(([k, v]) => { - const key = b.createString(k); - const val = (() => { - const row = b.createString(v.rowId); - const col = b.createString(v.columnId); - const data = b.createString(v.data); - const span = v.span - ? (() => { - Duc.DucTableCellSpan.startDucTableCellSpan(b); - Duc.DucTableCellSpan.addColumns(b, v.span!.columns); - Duc.DucTableCellSpan.addRows(b, v.span!.rows); - return Duc.DucTableCellSpan.endDucTableCellSpan(b); - })() - : undefined; - const styleOverrides = v.styleOverrides ? writeTableCellStyle(b, v.styleOverrides as DucTableCellStyle, usv) : undefined; - Duc.DucTableCell.startDucTableCell(b); - Duc.DucTableCell.addRowId(b, row); - Duc.DucTableCell.addColumnId(b, col); - Duc.DucTableCell.addData(b, data); - if (span !== undefined) Duc.DucTableCell.addSpan(b, span); - Duc.DucTableCell.addLocked(b, v.locked); - if (styleOverrides) Duc.DucTableCell.addStyleOverrides(b, styleOverrides); - return Duc.DucTableCell.endDucTableCell(b); - })(); - Duc.DucTableCellEntry.startDucTableCellEntry(b); - Duc.DucTableCellEntry.addKey(b, key); - Duc.DucTableCellEntry.addValue(b, val); - return Duc.DucTableCellEntry.endDucTableCellEntry(b); - }), + const hasLegacyCheckpoint = checkpoints.some( + (cp: any) => + typeof cp?.versionNumber !== "number" || + typeof cp?.schemaVersion !== "number", ); - const autoSize = (() => { - Duc.DucTableAutoSize.startDucTableAutoSize(b); - Duc.DucTableAutoSize.addColumns(b, e.autoSize.columns); - Duc.DucTableAutoSize.addRows(b, e.autoSize.rows); - return Duc.DucTableAutoSize.endDucTableAutoSize(b); - })(); - - Duc.DucTableElement.startDucTableElement(b); - Duc.DucTableElement.addBase(b, base); - Duc.DucTableElement.addStyle(b, style); - Duc.DucTableElement.addColumnOrder(b, colOrder); - Duc.DucTableElement.addRowOrder(b, rowOrder); - Duc.DucTableElement.addColumns(b, columns); - Duc.DucTableElement.addRows(b, rows); - Duc.DucTableElement.addCells(b, cells); - Duc.DucTableElement.addHeaderRowCount(b, e.headerRowCount); - Duc.DucTableElement.addAutoSize(b, autoSize); - return Duc.DucTableElement.endDucTableElement(b); -} - -/** - * Element wrapper - */ -function writeElementWrapper(b: flatbuffers.Builder, e: DucElement, usv: boolean): number { - let elem: number; - let type: Duc.Element; - - switch (e.type) { - case "rectangle": - type = Duc.Element.DucRectangleElement; - elem = writeRect(b, e, usv); - break; - case "polygon": - type = Duc.Element.DucPolygonElement; - elem = writePolygon(b, e, usv); - break; - case "ellipse": - type = Duc.Element.DucEllipseElement; - elem = writeEllipse(b, e, usv); - break; - case "line": - type = Duc.Element.DucLinearElement; - elem = writeLinear(b, e, usv); - break; - case "text": - type = Duc.Element.DucTextElement; - elem = writeText(b, e, usv); - break; - case "arrow": - type = Duc.Element.DucArrowElement; - elem = writeArrow(b, e, usv); - break; - case "freedraw": - type = Duc.Element.DucFreeDrawElement; - elem = writeFreeDraw(b, e, usv); - break; - case "image": - type = Duc.Element.DucImageElement; - elem = writeImage(b, e, usv); - break; - case "table": - type = Duc.Element.DucTableElement; - elem = writeTable(b, e, usv); - break; - case "frame": - type = Duc.Element.DucFrameElement; - elem = writeFrame(b, e, usv); - break; - case "plot": - type = Duc.Element.DucPlotElement; - elem = writePlot(b, e, usv); - break; - case "viewport": - type = Duc.Element.DucViewportElement; - elem = writeViewport(b, e, usv); - break; - case "xray": - type = Duc.Element.DucXRayElement; - elem = writeXRay(b, e, usv); - break; - case "leader": - type = Duc.Element.DucLeaderElement; - elem = writeLeader(b, e, usv); - break; - case "dimension": - type = Duc.Element.DucDimensionElement; - elem = writeDimension(b, e, usv); - break; - case "featurecontrolframe": - type = Duc.Element.DucFeatureControlFrameElement; - elem = writeFcf(b, e, usv); - break; - case "doc": - type = Duc.Element.DucDocElement; - elem = writeDoc(b, e, usv); - break; - case "model": - type = Duc.Element.DucModelElement; - elem = writeModel(b, e, usv); - break; - case "embeddable": - type = Duc.Element.DucEmbeddableElement; - elem = writeEmbeddable(b, e, usv); - break; - case "pdf": - type = Duc.Element.DucPdfElement; - elem = writePdf(b, e, usv); - break; - case "mermaid": - type = Duc.Element.DucMermaidElement; - elem = writeMermaid(b, e, usv); - break; - default: - throw new Error(`Unknown element type: ${(e as any).type}`); + if (hasLegacyCheckpoint) { + return true; } - // Safety check to ensure elem is defined - if (elem === undefined) { - throw new Error(`Failed to serialize element of type ${e.type}`); - } - - Duc.ElementWrapper.startElementWrapper(b); - Duc.ElementWrapper.addElementType(b, type); - Duc.ElementWrapper.addElement(b, elem); - return Duc.ElementWrapper.endElementWrapper(b); -} -function writeGridStyle(b: flatbuffers.Builder, s: GridStyle, usv: boolean): number { - const color = b.createString(s.color); - const dash = Duc.GridStyle.createDashPatternVector(b, s.dashPattern); - Duc.GridStyle.startGridStyle(b); - Duc.GridStyle.addColor(b, color); - Duc.GridStyle.addOpacity(b, s.opacity); - Duc.GridStyle.addDashPattern(b, dash); - return Duc.GridStyle.endGridStyle(b); -} - -function writePolarGridSettings(b: flatbuffers.Builder, p: PolarGridSettings, usv: boolean): number { - Duc.PolarGridSettings.startPolarGridSettings(b); - Duc.PolarGridSettings.addRadialDivisions(b, p.radialDivisions); - Duc.PolarGridSettings.addRadialSpacing(b, getPrecisionValue(p.radialSpacing, usv)); - Duc.PolarGridSettings.addShowLabels(b, p.showLabels); - return Duc.PolarGridSettings.endPolarGridSettings(b); -} - -function writeIsometricGridSettings(b: flatbuffers.Builder, i: IsometricGridSettings, usv: boolean): number { - Duc.IsometricGridSettings.startIsometricGridSettings(b); - Duc.IsometricGridSettings.addLeftAngle(b, i.leftAngle); - Duc.IsometricGridSettings.addRightAngle(b, i.rightAngle); - return Duc.IsometricGridSettings.endIsometricGridSettings(b); -} - -function writeGridSettings(b: flatbuffers.Builder, g: GridSettings, usv: boolean): number { - const origin = Duc.GeometricPoint.createGeometricPoint(b, g.origin.x, g.origin.y); - const major = writeGridStyle(b, g.majorStyle, usv); - const minor = writeGridStyle(b, g.minorStyle, usv); - const polar = g.polarSettings ? writePolarGridSettings(b, g.polarSettings, usv) : undefined; - const iso = g.isometricSettings ? writeIsometricGridSettings(b, g.isometricSettings, usv) : undefined; - - Duc.GridSettings.startGridSettings(b); - Duc.GridSettings.addType(b, g.type); - Duc.GridSettings.addReadonly(b, g.readonly); - Duc.GridSettings.addDisplayType(b, g.displayType); - Duc.GridSettings.addIsAdaptive(b, g.isAdaptive); - Duc.GridSettings.addXSpacing(b, getPrecisionValue(g.xSpacing, usv)); - Duc.GridSettings.addYSpacing(b, getPrecisionValue(g.ySpacing, usv)); - Duc.GridSettings.addSubdivisions(b, g.subdivisions); - Duc.GridSettings.addOrigin(b, origin); - Duc.GridSettings.addRotation(b, g.rotation); - Duc.GridSettings.addFollowUcs(b, g.followUCS); - Duc.GridSettings.addMajorStyle(b, major); - Duc.GridSettings.addMinorStyle(b, minor); - Duc.GridSettings.addShowMinor(b, g.showMinor); - Duc.GridSettings.addMinZoom(b, g.minZoom); - Duc.GridSettings.addMaxZoom(b, g.maxZoom); - Duc.GridSettings.addAutoHide(b, g.autoHide); - if (polar) Duc.GridSettings.addPolarSettings(b, polar); - if (iso) Duc.GridSettings.addIsometricSettings(b, iso); - Duc.GridSettings.addEnableSnapping(b, g.enableSnapping); - return Duc.GridSettings.endGridSettings(b); -} - -function writeSnapMarkerSettings(b: flatbuffers.Builder, s: SnapMarkerSettings, usv: boolean): number { - const styles = Duc.SnapMarkerSettings.createStylesVector( - b, - Object.entries(s.styles).map(([k, v]) => { - Duc.SnapMarkerStyleEntry.startSnapMarkerStyleEntry(b); - Duc.SnapMarkerStyleEntry.addKey(b, Number(k)); - const color = b.createString(v.color); - Duc.SnapMarkerStyle.startSnapMarkerStyle(b); - Duc.SnapMarkerStyle.addShape(b, v.shape); - Duc.SnapMarkerStyle.addColor(b, color); - const val = Duc.SnapMarkerStyle.endSnapMarkerStyle(b); - Duc.SnapMarkerStyleEntry.addValue(b, val); - return Duc.SnapMarkerStyleEntry.endSnapMarkerStyleEntry(b); - }) + const hasLegacyDelta = deltas.some( + (d: any) => + typeof d?.versionNumber !== "number" || + typeof d?.schemaVersion !== "number" || + typeof d?.baseCheckpointId !== "string", ); - - Duc.SnapMarkerSettings.startSnapMarkerSettings(b); - Duc.SnapMarkerSettings.addEnabled(b, s.enabled); - Duc.SnapMarkerSettings.addSize(b, s.size); - if (s.duration !== undefined) Duc.SnapMarkerSettings.addDuration(b, s.duration); - Duc.SnapMarkerSettings.addStyles(b, styles); - return Duc.SnapMarkerSettings.endSnapMarkerSettings(b); -} - -function writeTrackingLineStyle(b: flatbuffers.Builder, t: TrackingLineStyle | undefined, usv: boolean): number | undefined { - if (!t) return undefined; - const color = b.createString(t.color); - const dash = t.dashPattern ? Duc.TrackingLineStyle.createDashPatternVector(b, t.dashPattern) : undefined; - Duc.TrackingLineStyle.startTrackingLineStyle(b); - Duc.TrackingLineStyle.addColor(b, color); - Duc.TrackingLineStyle.addOpacity(b, t.opacity); - if (dash) Duc.TrackingLineStyle.addDashPattern(b, dash); - return Duc.TrackingLineStyle.endTrackingLineStyle(b); -} - -function writeDynamicSnapSettings(b: flatbuffers.Builder, d: DynamicSnapSettings, usv: boolean): number { - Duc.DynamicSnapSettings.startDynamicSnapSettings(b); - Duc.DynamicSnapSettings.addEnabledDuringDrag(b, d.enabledDuringDrag); - Duc.DynamicSnapSettings.addEnabledDuringRotation(b, d.enabledDuringRotation); - Duc.DynamicSnapSettings.addEnabledDuringScale(b, d.enabledDuringScale); - return Duc.DynamicSnapSettings.endDynamicSnapSettings(b); -} - -function writeSnapOverride(b: flatbuffers.Builder, o: SnapOverride, usv: boolean): number { - const key = b.createString(o.key); - Duc.SnapOverride.startSnapOverride(b); - Duc.SnapOverride.addKey(b, key); - Duc.SnapOverride.addBehavior(b, o.behavior); - return Duc.SnapOverride.endSnapOverride(b); -} - -function writePolarTrackingSettings(b: flatbuffers.Builder, p: PolarTrackingSettings, usv: boolean): number { - const angles = Duc.PolarTrackingSettings.createAnglesVector(b, p.angles.map(a => a)); - Duc.PolarTrackingSettings.startPolarTrackingSettings(b); - Duc.PolarTrackingSettings.addEnabled(b, p.enabled); - Duc.PolarTrackingSettings.addAngles(b, angles); - if (p.incrementAngle !== undefined) Duc.PolarTrackingSettings.addIncrementAngle(b, p.incrementAngle); - Duc.PolarTrackingSettings.addTrackFromLastPoint(b, p.trackFromLastPoint); - Duc.PolarTrackingSettings.addShowPolarCoordinates(b, p.showPolarCoordinates); - return Duc.PolarTrackingSettings.endPolarTrackingSettings(b); -} - -function writeLayerSnapFilters(b: flatbuffers.Builder, f: LayerSnapFilters | undefined, usv: boolean): number | undefined { - if (!f) return undefined; - const include = f.includeLayers ? Duc.LayerSnapFilters.createIncludeLayersVector(b, f.includeLayers.map(id => b.createString(id))) : undefined; - const exclude = f.excludeLayers ? Duc.LayerSnapFilters.createExcludeLayersVector(b, f.excludeLayers.map(id => b.createString(id))) : undefined; - Duc.LayerSnapFilters.startLayerSnapFilters(b); - if (include) Duc.LayerSnapFilters.addIncludeLayers(b, include); - if (exclude) Duc.LayerSnapFilters.addExcludeLayers(b, exclude); - return Duc.LayerSnapFilters.endLayerSnapFilters(b); -} - -function writeSnapSettings(b: flatbuffers.Builder, s: SnapSettings, usv: boolean): number { - const overridesArray = s.temporaryOverrides ?? []; - const overridesVec = overridesArray.length - ? Duc.SnapSettings.createTemporaryOverridesVector(b, overridesArray.map(o => writeSnapOverride(b, o, usv))) - : undefined; - const tracking = writeTrackingLineStyle(b, s.trackingLineStyle, usv); - const dynamic = writeDynamicSnapSettings(b, s.dynamicSnap, usv); - // Always build PolarTrackingSettings (constructor ensures required fields); no defaults introduced. - const polar = writePolarTrackingSettings(b, s.polarTracking as PolarTrackingSettings, usv); - const layers = writeLayerSnapFilters(b, s.layerSnapFilters, usv); - const markers = writeSnapMarkerSettings(b, s.snapMarkers, usv); - const types = s.elementTypeFilters ? Duc.SnapSettings.createElementTypeFiltersVector(b, s.elementTypeFilters.map(t => { - // element type enum is Duc.Element (wrapper), but here it's a string union. - // The schema likely stores raw strings; we store as strings. - return b.createString(t); - })) : undefined; - - Duc.SnapSettings.startSnapSettings(b); - Duc.SnapSettings.addReadonly(b, s.readonly); - Duc.SnapSettings.addTwistAngle(b, s.twistAngle); - Duc.SnapSettings.addSnapTolerance(b, s.snapTolerance); - Duc.SnapSettings.addObjectSnapAperture(b, s.objectSnapAperture); - Duc.SnapSettings.addIsOrthoModeOn(b, s.isOrthoModeOn); - if (polar !== undefined) Duc.SnapSettings.addPolarTracking(b, polar); - Duc.SnapSettings.addIsObjectSnapOn(b, s.isObjectSnapOn); - Duc.SnapSettings.addActiveObjectSnapModes(b, Duc.SnapSettings.createActiveObjectSnapModesVector(b, s.activeObjectSnapModes)); - Duc.SnapSettings.addSnapPriority(b, Duc.SnapSettings.createSnapPriorityVector(b, s.snapPriority)); - Duc.SnapSettings.addShowTrackingLines(b, s.showTrackingLines); - if (tracking) Duc.SnapSettings.addTrackingLineStyle(b, tracking); - Duc.SnapSettings.addDynamicSnap(b, dynamic); - if (overridesVec) Duc.SnapSettings.addTemporaryOverrides(b, overridesVec); - if (s.incrementalDistance !== undefined) Duc.SnapSettings.addIncrementalDistance(b, s.incrementalDistance); - if (s.magneticStrength !== undefined) Duc.SnapSettings.addMagneticStrength(b, s.magneticStrength); - if (layers) Duc.SnapSettings.addLayerSnapFilters(b, layers); - if (types) Duc.SnapSettings.addElementTypeFilters(b, types); - Duc.SnapSettings.addSnapMode(b, s.snapMode); - Duc.SnapSettings.addSnapMarkers(b, markers); - Duc.SnapSettings.addConstructionSnapEnabled(b, s.constructionSnapEnabled); - if (s.snapToGridIntersections !== undefined) Duc.SnapSettings.addSnapToGridIntersections(b, s.snapToGridIntersections); - return Duc.SnapSettings.endSnapSettings(b); -} - -function writeUcs(b: flatbuffers.Builder, u: DucUcs): number { - const origin = Duc.GeometricPoint.createGeometricPoint(b, u.origin.x, u.origin.y); - Duc.DucUcs.startDucUcs(b); - Duc.DucUcs.addOrigin(b, origin); - Duc.DucUcs.addAngle(b, u.angle); - return Duc.DucUcs.endDucUcs(b); -} - - -/** - * Standards - */ -import type { Standard, StandardOverrides, StandardStyles, StandardUnits, StandardValidation, StandardViewSettings } from "./technical/standards"; - -function serializeStandardOverrides(b: flatbuffers.Builder, o: StandardOverrides, usv: boolean): number { - const activeGrid = o.activeGridSettingsId ? Duc.StandardOverrides.createActiveGridSettingsIdVector(b, o.activeGridSettingsId.map(id => b.createString(id))) : undefined; - const dashOverride = o.dashLineOverride ? b.createString(o.dashLineOverride) : undefined; - - Duc.StandardOverrides.startStandardOverrides(b); - if (o.mainScope) Duc.StandardOverrides.addMainScope(b, b.createString(o.mainScope)); - if (o.elementsStrokeWidthOverride) Duc.StandardOverrides.addElementsStrokeWidthOverride(b, getPrecisionValue(o.elementsStrokeWidthOverride, usv)); - if (o.commonStyleId) Duc.StandardOverrides.addCommonStyleId(b, b.createString(o.commonStyleId)); - if (o.stackLikeStyleId) Duc.StandardOverrides.addStackLikeStyleId(b, b.createString(o.stackLikeStyleId)); - if (o.textStyleId) Duc.StandardOverrides.addTextStyleId(b, b.createString(o.textStyleId)); - if (o.dimensionStyleId) Duc.StandardOverrides.addDimensionStyleId(b, b.createString(o.dimensionStyleId)); - if (o.leaderStyleId) Duc.StandardOverrides.addLeaderStyleId(b, b.createString(o.leaderStyleId)); - if (o.featureControlFrameStyleId) Duc.StandardOverrides.addFeatureControlFrameStyleId(b, b.createString(o.featureControlFrameStyleId)); - if (o.tableStyleId) Duc.StandardOverrides.addTableStyleId(b, b.createString(o.tableStyleId)); - if (o.docStyleId) Duc.StandardOverrides.addDocStyleId(b, b.createString(o.docStyleId)); - if (o.viewportStyleId) Duc.StandardOverrides.addViewportStyleId(b, b.createString(o.viewportStyleId)); - if (o.plotStyleId) Duc.StandardOverrides.addPlotStyleId(b, b.createString(o.plotStyleId)); - if (o.hatchStyleId) Duc.StandardOverrides.addHatchStyleId(b, b.createString(o.hatchStyleId)); - if (activeGrid) Duc.StandardOverrides.addActiveGridSettingsId(b, activeGrid); - if (o.activeSnapSettingsId) Duc.StandardOverrides.addActiveSnapSettingsId(b, b.createString(o.activeSnapSettingsId)); - if (dashOverride) Duc.StandardOverrides.addDashLineOverride(b, dashOverride); - if (o.unitPrecision) { - Duc.UnitPrecision.startUnitPrecision(b); - if (o.unitPrecision.linear !== undefined) Duc.UnitPrecision.addLinear(b, o.unitPrecision.linear); - if (o.unitPrecision.angular !== undefined) Duc.UnitPrecision.addAngular(b, o.unitPrecision.angular); - if (o.unitPrecision.area !== undefined) Duc.UnitPrecision.addArea(b, o.unitPrecision.area); - if (o.unitPrecision.volume !== undefined) Duc.UnitPrecision.addVolume(b, o.unitPrecision.volume); - const up = Duc.UnitPrecision.endUnitPrecision(b); - Duc.StandardOverrides.addUnitPrecision(b, up); - } - return Duc.StandardOverrides.endStandardOverrides(b); -} - -function serializeStandardUnits(b: flatbuffers.Builder, u: StandardUnits, usv: boolean): number { - const primary = writePrimaryUnits(b, { - linear: { - system: u.primaryUnits.linear.system, - precision: u.primaryUnits.linear.precision, - suppressLeadingZeros: u.primaryUnits.linear.suppressLeadingZeros, - suppressTrailingZeros: u.primaryUnits.linear.suppressTrailingZeros, - format: u.primaryUnits.linear.format, - decimalSeparator: u.primaryUnits.linear.decimalSeparator, - suppressZeroFeet: u.primaryUnits.linear.suppressZeroFeet, - suppressZeroInches: u.primaryUnits.linear.suppressZeroInches, - }, - angular: { - system: u.primaryUnits.angular.system, - precision: u.primaryUnits.angular.precision, - suppressLeadingZeros: u.primaryUnits.angular.suppressLeadingZeros, - suppressTrailingZeros: u.primaryUnits.angular.suppressTrailingZeros, - format: u.primaryUnits.angular.format, - }, - } as any, usv); - - Duc.AlternateUnits.startAlternateUnits(b); - Duc.AlternateUnits.addIsVisible(b, u.alternateUnits.isVisible); - Duc.AlternateUnits.addMultiplier(b, u.alternateUnits.multiplier); - Duc.AlternateUnits.addFormat(b, u.alternateUnits.format); - // AlternateUnits in schema may not have these fields; only write those that exist - if ("addSystem" in Duc.AlternateUnits) { - // @ts-expect-error guarded by runtime check - Duc.AlternateUnits.addSystem(b, u.alternateUnits.system); - } - if ("addPrecision" in Duc.AlternateUnits) { - // @ts-expect-error guarded by runtime check - Duc.AlternateUnits.addPrecision(b, u.alternateUnits.precision); - } - if ("addSuppressLeadingZeros" in Duc.AlternateUnits) { - // @ts-expect-error guarded by runtime check - Duc.AlternateUnits.addSuppressLeadingZeros(b, u.alternateUnits.suppressLeadingZeros); - } - if ("addSuppressTrailingZeros" in Duc.AlternateUnits) { - // @ts-expect-error guarded by runtime check - Duc.AlternateUnits.addSuppressTrailingZeros(b, u.alternateUnits.suppressTrailingZeros); - } - const alt = Duc.AlternateUnits.endAlternateUnits(b); - - Duc.StandardUnits.startStandardUnits(b); - if (primary !== undefined) Duc.StandardUnits.addPrimaryUnits(b, primary); - Duc.StandardUnits.addAlternateUnits(b, alt); - return Duc.StandardUnits.endStandardUnits(b); -} - -function writeIdentifiedCommonStyle(b: flatbuffers.Builder, entry: StandardStyles["commonStyles"][number], usv: boolean): number { - const idOff = writeIdentifier(b, entry); - const bg = writeElementBackground(b, entry.background, usv); - const st = writeElementStroke(b, entry.stroke, usv); - Duc.DucCommonStyle.startDucCommonStyle(b); - if (bg) Duc.DucCommonStyle.addBackground(b, bg); - if (st) Duc.DucCommonStyle.addStroke(b, st); - const style = Duc.DucCommonStyle.endDucCommonStyle(b); - - Duc.IdentifiedCommonStyle.startIdentifiedCommonStyle(b); - Duc.IdentifiedCommonStyle.addId(b, idOff); - Duc.IdentifiedCommonStyle.addStyle(b, style); - return Duc.IdentifiedCommonStyle.endIdentifiedCommonStyle(b); -} - -function writeIdentifiedStackLikeStyle(b: flatbuffers.Builder, entry: StandardStyles["stackLikeStyles"][number], usv: boolean): number { - const idOff = writeIdentifier(b, entry); - const s = (() => { - Duc.DucStackLikeStyles.startDucStackLikeStyles(b); - Duc.DucStackLikeStyles.addOpacity(b, entry.opacity); - Duc.DucStackLikeStyles.addLabelingColor(b, b.createString(entry.labelingColor)); - return Duc.DucStackLikeStyles.endDucStackLikeStyles(b); - })(); - - Duc.IdentifiedStackLikeStyle.startIdentifiedStackLikeStyle(b); - Duc.IdentifiedStackLikeStyle.addId(b, idOff); - Duc.IdentifiedStackLikeStyle.addStyle(b, s); - return Duc.IdentifiedStackLikeStyle.endIdentifiedStackLikeStyle(b); -} - -function writeIdentifiedTextStyle(b: flatbuffers.Builder, entry: StandardStyles["textStyles"][number], usv: boolean): number { - const idOff = writeIdentifier(b, entry); - const style = writeTextStyle(b, entry, usv); - Duc.IdentifiedTextStyle.startIdentifiedTextStyle(b); - Duc.IdentifiedTextStyle.addId(b, idOff); - Duc.IdentifiedTextStyle.addStyle(b, style); - return Duc.IdentifiedTextStyle.endIdentifiedTextStyle(b); -} - -function writeIdentifiedDimensionStyle(b: flatbuffers.Builder, entry: StandardStyles["dimensionStyles"][number], usv: boolean): number { - const idOff = writeIdentifier(b, entry); - const style = writeDimStyle(b, entry, usv); - Duc.IdentifiedDimensionStyle.startIdentifiedDimensionStyle(b); - Duc.IdentifiedDimensionStyle.addId(b, idOff); - Duc.IdentifiedDimensionStyle.addStyle(b, style); - return Duc.IdentifiedDimensionStyle.endIdentifiedDimensionStyle(b); -} - -function writeIdentifiedLeaderStyle(b: flatbuffers.Builder, entry: StandardStyles["leaderStyles"][number], usv: boolean): number { - const idOff = writeIdentifier(b, entry); - const style = writeLeaderStyle(b, entry, usv); - Duc.IdentifiedLeaderStyle.startIdentifiedLeaderStyle(b); - Duc.IdentifiedLeaderStyle.addId(b, idOff); - Duc.IdentifiedLeaderStyle.addStyle(b, style); - return Duc.IdentifiedLeaderStyle.endIdentifiedLeaderStyle(b); -} - -function writeIdentifiedFCFStyle(b: flatbuffers.Builder, entry: StandardStyles["featureControlFrameStyles"][number], usv: boolean): number { - const idOff = writeIdentifier(b, entry); - const style = writeFcfStyle(b, entry, usv); - Duc.IdentifiedFCFStyle.startIdentifiedFCFStyle(b); - Duc.IdentifiedFCFStyle.addId(b, idOff); - Duc.IdentifiedFCFStyle.addStyle(b, style); - return Duc.IdentifiedFCFStyle.endIdentifiedFCFStyle(b); -} - -function writeIdentifiedTableStyle(b: flatbuffers.Builder, entry: StandardStyles["tableStyles"][number], usv: boolean): number { - const idOff = writeIdentifier(b, entry); - const style = writeTableStyle(b, entry, usv); - Duc.IdentifiedTableStyle.startIdentifiedTableStyle(b); - Duc.IdentifiedTableStyle.addId(b, idOff); - Duc.IdentifiedTableStyle.addStyle(b, style); - return Duc.IdentifiedTableStyle.endIdentifiedTableStyle(b); -} - -function writeIdentifiedDocStyle(b: flatbuffers.Builder, entry: StandardStyles["docStyles"][number], usv: boolean): number { - const idOff = writeIdentifier(b, entry); - const style = writeDocStyle(b, entry, usv); - Duc.IdentifiedDocStyle.startIdentifiedDocStyle(b); - Duc.IdentifiedDocStyle.addId(b, idOff); - Duc.IdentifiedDocStyle.addStyle(b, style); - return Duc.IdentifiedDocStyle.endIdentifiedDocStyle(b); -} - -function writeIdentifiedViewportStyle(b: flatbuffers.Builder, entry: StandardStyles["viewportStyles"][number], usv: boolean): number { - const idOff = writeIdentifier(b, entry); - const style = writeViewportStyle(b, entry, usv); - Duc.IdentifiedViewportStyle.startIdentifiedViewportStyle(b); - Duc.IdentifiedViewportStyle.addId(b, idOff); - Duc.IdentifiedViewportStyle.addStyle(b, style); - return Duc.IdentifiedViewportStyle.endIdentifiedViewportStyle(b); -} - -function writeIdentifiedHatchStyle(b: flatbuffers.Builder, entry: StandardStyles["hatchStyles"][number], usv: boolean): number { - const idOff = writeIdentifier(b, entry); - const style = writeHatchStyle(b, entry, usv); - Duc.IdentifiedHatchStyle.startIdentifiedHatchStyle(b); - Duc.IdentifiedHatchStyle.addId(b, idOff); - if (style) Duc.IdentifiedHatchStyle.addStyle(b, style); - return Duc.IdentifiedHatchStyle.endIdentifiedHatchStyle(b); -} - -function writeIdentifiedXRayStyle(b: flatbuffers.Builder, entry: StandardStyles["xrayStyles"][number], usv: boolean): number { - const idOff = writeIdentifier(b, entry); - const style = writeXRayStyle(b, entry, usv); - Duc.IdentifiedXRayStyle.startIdentifiedXRayStyle(b); - Duc.IdentifiedXRayStyle.addId(b, idOff); - Duc.IdentifiedXRayStyle.addStyle(b, style); - return Duc.IdentifiedXRayStyle.endIdentifiedXRayStyle(b); -} - -function serializeStandardStyles(b: flatbuffers.Builder, s: StandardStyles, usv: boolean): number { - const commonVec = s.commonStyles.length - ? Duc.StandardStyles.createCommonStylesVector(b, s.commonStyles.map(cs => writeIdentifiedCommonStyle(b, cs, usv))) - : undefined; - const stackLikeVec = s.stackLikeStyles.length - ? Duc.StandardStyles.createStackLikeStylesVector(b, s.stackLikeStyles.map(st => writeIdentifiedStackLikeStyle(b, st, usv))) - : undefined; - const textVec = s.textStyles.length - ? Duc.StandardStyles.createTextStylesVector(b, s.textStyles.map(ts => writeIdentifiedTextStyle(b, ts, usv))) - : undefined; - const dimVec = s.dimensionStyles.length - ? Duc.StandardStyles.createDimensionStylesVector(b, s.dimensionStyles.map(ds => writeIdentifiedDimensionStyle(b, ds, usv))) - : undefined; - const leaderVec = s.leaderStyles.length - ? Duc.StandardStyles.createLeaderStylesVector(b, s.leaderStyles.map(ls => writeIdentifiedLeaderStyle(b, ls, usv))) - : undefined; - const fcfVec = s.featureControlFrameStyles.length - ? Duc.StandardStyles.createFeatureControlFrameStylesVector(b, s.featureControlFrameStyles.map(fs => writeIdentifiedFCFStyle(b, fs, usv))) - : undefined; - const tableVec = s.tableStyles.length - ? Duc.StandardStyles.createTableStylesVector(b, s.tableStyles.map(ts => writeIdentifiedTableStyle(b, ts, usv))) - : undefined; - const docVec = s.docStyles.length - ? Duc.StandardStyles.createDocStylesVector(b, s.docStyles.map(ds => writeIdentifiedDocStyle(b, ds, usv))) - : undefined; - const viewportVec = s.viewportStyles.length - ? Duc.StandardStyles.createViewportStylesVector(b, s.viewportStyles.map(vs => writeIdentifiedViewportStyle(b, vs, usv))) - : undefined; - const hatchVec = s.hatchStyles.length - ? Duc.StandardStyles.createHatchStylesVector(b, s.hatchStyles.map(hs => writeIdentifiedHatchStyle(b, hs, usv))) - : undefined; - const xrayVec = s.xrayStyles.length - ? Duc.StandardStyles.createXrayStylesVector(b, s.xrayStyles.map(xs => writeIdentifiedXRayStyle(b, xs, usv))) - : undefined; - - Duc.StandardStyles.startStandardStyles(b); - if (commonVec) Duc.StandardStyles.addCommonStyles(b, commonVec); - if (stackLikeVec) Duc.StandardStyles.addStackLikeStyles(b, stackLikeVec); - if (textVec) Duc.StandardStyles.addTextStyles(b, textVec); - if (dimVec) Duc.StandardStyles.addDimensionStyles(b, dimVec); - if (leaderVec) Duc.StandardStyles.addLeaderStyles(b, leaderVec); - if (fcfVec) Duc.StandardStyles.addFeatureControlFrameStyles(b, fcfVec); - if (tableVec) Duc.StandardStyles.addTableStyles(b, tableVec); - if (docVec) Duc.StandardStyles.addDocStyles(b, docVec); - if (viewportVec) Duc.StandardStyles.addViewportStyles(b, viewportVec); - if (hatchVec) Duc.StandardStyles.addHatchStyles(b, hatchVec); - if (xrayVec) Duc.StandardStyles.addXrayStyles(b, xrayVec); - return Duc.StandardStyles.endStandardStyles(b); -} - -function serializeStandardViewSettings(b: flatbuffers.Builder, v: StandardViewSettings, usv: boolean): number { - const viewsVec = v.views && v.views.length - ? Duc.StandardViewSettings.createViewsVector( - b, - v.views.map((entry) => { - const id = writeIdentifier(b, entry); - const view = writeView(b, entry, usv); - Duc.IdentifiedView.startIdentifiedView(b); - Duc.IdentifiedView.addId(b, id); - Duc.IdentifiedView.addView(b, view); - return Duc.IdentifiedView.endIdentifiedView(b); - }), - ) - : undefined; - - const ucsVec = v.ucs && v.ucs.length - ? Duc.StandardViewSettings.createUcsVector( - b, - v.ucs.map((entry) => { - const id = writeIdentifier(b, entry); - const ucs = writeUcs(b, entry); - Duc.IdentifiedUcs.startIdentifiedUcs(b); - Duc.IdentifiedUcs.addId(b, id); - Duc.IdentifiedUcs.addUcs(b, ucs); - return Duc.IdentifiedUcs.endIdentifiedUcs(b); - }), - ) - : undefined; - - const gridsVec = v.gridSettings && v.gridSettings.length - ? Duc.StandardViewSettings.createGridSettingsVector( - b, - v.gridSettings.map((entry) => { - const id = writeIdentifier(b, entry); - const settings = writeGridSettings(b, entry, usv); - Duc.IdentifiedGridSettings.startIdentifiedGridSettings(b); - Duc.IdentifiedGridSettings.addId(b, id); - Duc.IdentifiedGridSettings.addSettings(b, settings); - return Duc.IdentifiedGridSettings.endIdentifiedGridSettings(b); - }), - ) - : undefined; - - const snapsVec = v.snapSettings && v.snapSettings.length - ? Duc.StandardViewSettings.createSnapSettingsVector( - b, - v.snapSettings.map((entry) => { - const id = writeIdentifier(b, entry); - const settings = writeSnapSettings(b, entry, usv); - Duc.IdentifiedSnapSettings.startIdentifiedSnapSettings(b); - Duc.IdentifiedSnapSettings.addId(b, id); - Duc.IdentifiedSnapSettings.addSettings(b, settings); - return Duc.IdentifiedSnapSettings.endIdentifiedSnapSettings(b); - }), - ) - : undefined; - - Duc.StandardViewSettings.startStandardViewSettings(b); - if (viewsVec) Duc.StandardViewSettings.addViews(b, viewsVec); - if (ucsVec) Duc.StandardViewSettings.addUcs(b, ucsVec); - if (gridsVec) Duc.StandardViewSettings.addGridSettings(b, gridsVec); - if (snapsVec) Duc.StandardViewSettings.addSnapSettings(b, snapsVec); - return Duc.StandardViewSettings.endStandardViewSettings(b); -} - -function serializeStandardValidation(b: flatbuffers.Builder, val: StandardValidation, usv: boolean): number { - Duc.StandardValidation.startStandardValidation(b); - if (val.dimensionRules) { - Duc.DimensionValidationRules.startDimensionValidationRules(b); - if (val.dimensionRules.minTextHeight !== undefined) Duc.DimensionValidationRules.addMinTextHeight(b, getPrecisionValue(val.dimensionRules.minTextHeight, usv)); - if (val.dimensionRules.maxTextHeight !== undefined) Duc.DimensionValidationRules.addMaxTextHeight(b, getPrecisionValue(val.dimensionRules.maxTextHeight, usv)); - if (val.dimensionRules.allowedPrecisions) { - Duc.DimensionValidationRules.addAllowedPrecisions(b, Duc.DimensionValidationRules.createAllowedPrecisionsVector(b, val.dimensionRules.allowedPrecisions)); - } - const dr = Duc.DimensionValidationRules.endDimensionValidationRules(b); - Duc.StandardValidation.addDimensionRules(b, dr); - } - if (val.layerRules) { - const prohibited = val.layerRules.prohibitedLayerNames - ? Duc.LayerValidationRules.createProhibitedLayerNamesVector(b, val.layerRules.prohibitedLayerNames.map(s => b.createString(s))) - : undefined; - Duc.LayerValidationRules.startLayerValidationRules(b); - if (prohibited) Duc.LayerValidationRules.addProhibitedLayerNames(b, prohibited); - const lr = Duc.LayerValidationRules.endLayerValidationRules(b); - Duc.StandardValidation.addLayerRules(b, lr); + if (hasLegacyDelta) { + return true; } - return Duc.StandardValidation.endStandardValidation(b); -} - -function serializeStandard(b: flatbuffers.Builder, s: Standard, usv: boolean): number { - const ident = writeIdentifier(b, s); - const version = b.createString(s.version); - const overrides = s.overrides ? serializeStandardOverrides(b, s.overrides, usv) : undefined; - const styles = s.styles ? serializeStandardStyles(b, s.styles, usv) : undefined; - const view = s.viewSettings ? serializeStandardViewSettings(b, s.viewSettings, usv) : undefined; - const units = s.units ? serializeStandardUnits(b, s.units, usv) : undefined; - const validation = s.validation ? serializeStandardValidation(b, s.validation, usv) : undefined; - - Duc.Standard.startStandard(b); - Duc.Standard.addIdentifier(b, ident); - Duc.Standard.addVersion(b, version); - Duc.Standard.addReadonly(b, s.readonly); - if (overrides) Duc.Standard.addOverrides(b, overrides); - if (styles) Duc.Standard.addStyles(b, styles); - if (view) Duc.Standard.addViewSettings(b, view); - if (units) Duc.Standard.addUnits(b, units); - if (validation) Duc.Standard.addValidation(b, validation); - return Duc.Standard.endStandard(b); -} - -/** - * VersionGraph - */ -function serializeVersionBase(b: flatbuffers.Builder, v: VersionBase): number { - const id = b.createString(v.id); - const parent = v.parentId ? b.createString(v.parentId) : undefined; - const desc = v.description ? b.createString(v.description) : undefined; - const user = v.userId ? b.createString(v.userId) : undefined; - - Duc.VersionBase.startVersionBase(b); - Duc.VersionBase.addId(b, id); - if (parent) Duc.VersionBase.addParentId(b, parent); - Duc.VersionBase.addTimestamp(b, BigInt(v.timestamp)); - if (desc) Duc.VersionBase.addDescription(b, desc); - Duc.VersionBase.addIsManualSave(b, v.isManualSave); - if (user) Duc.VersionBase.addUserId(b, user); - return Duc.VersionBase.endVersionBase(b); -} - -function serializeCheckpoint(b: flatbuffers.Builder, c: Checkpoint): number { - const base = serializeVersionBase(b, c); - const data = b.createByteVector(c.data); - Duc.Checkpoint.startCheckpoint(b); - Duc.Checkpoint.addBase(b, base); - Duc.Checkpoint.addData(b, data); - Duc.Checkpoint.addSizeBytes(b, BigInt(c.sizeBytes)); - return Duc.Checkpoint.endCheckpoint(b); -} - -function writeJsonPatch(b: flatbuffers.Builder, p: JSONPatch): { offset: number; sizeBytes: number } { - // Compress the JSON patch data - const patchData = zlibSync(strToU8(JSON.stringify(p))); - const offset = Duc.Delta.createPatchVector(b, patchData); - return { offset, sizeBytes: patchData.length }; -} - -function serializeDelta(b: flatbuffers.Builder, d: Delta): number { - const base = serializeVersionBase(b, d); - const { offset: patch, sizeBytes } = writeJsonPatch(b, d.patch); - Duc.Delta.startDelta(b); - Duc.Delta.addBase(b, base); - Duc.Delta.addPatch(b, patch); - Duc.Delta.addSizeBytes(b, BigInt(sizeBytes)); - return Duc.Delta.endDelta(b); -} - -function serializeDucVersionGraph(b: flatbuffers.Builder, vg: VersionGraph): number { - const userCheckpoint = b.createString(vg.userCheckpointVersionId); - const latest = b.createString(vg.latestVersionId); - const checkpoints = Duc.VersionGraph.createCheckpointsVector(b, vg.checkpoints.map(c => serializeCheckpoint(b, c))); - const deltas = Duc.VersionGraph.createDeltasVector(b, vg.deltas.map(d => serializeDelta(b, d))); - Duc.VersionGraphMetadata.startVersionGraphMetadata(b); - Duc.VersionGraphMetadata.addLastPruned(b, BigInt(vg.metadata.lastPruned)); - Duc.VersionGraphMetadata.addTotalSize(b, BigInt(vg.metadata.totalSize)); - const meta = Duc.VersionGraphMetadata.endVersionGraphMetadata(b); - - Duc.VersionGraph.startVersionGraph(b); - Duc.VersionGraph.addUserCheckpointVersionId(b, userCheckpoint); - Duc.VersionGraph.addLatestVersionId(b, latest); - Duc.VersionGraph.addCheckpoints(b, checkpoints); - Duc.VersionGraph.addDeltas(b, deltas); - Duc.VersionGraph.addMetadata(b, meta); - return Duc.VersionGraph.endVersionGraph(b); -} -// #endregion - -// #region STATE SERIALIZERS -function serializeDucGlobalState(builder: flatbuffers.Builder, state: DucGlobalState, usv: boolean): number { - const nameOffset = writeString(builder, state.name); - const viewBackgroundColorOffset = writeString(builder, state.viewBackgroundColor); - const mainScopeOffset = writeString(builder, state.mainScope); - - Duc.DucGlobalState.startDucGlobalState(builder); - if (nameOffset) Duc.DucGlobalState.addName(builder, nameOffset); - if (viewBackgroundColorOffset) Duc.DucGlobalState.addViewBackgroundColor(builder, viewBackgroundColorOffset); - if (mainScopeOffset) Duc.DucGlobalState.addMainScope(builder, mainScopeOffset); - Duc.DucGlobalState.addDashSpacingScale(builder, state.dashSpacingScale); - Duc.DucGlobalState.addIsDashSpacingAffectedByViewportScale(builder, state.isDashSpacingAffectedByViewportScale); - Duc.DucGlobalState.addScopeExponentThreshold(builder, state.scopeExponentThreshold); - if (state.pruningLevel) Duc.DucGlobalState.addPruningLevel(builder, state.pruningLevel); - Duc.DucGlobalState.addDimensionsAssociativeByDefault(builder, state.dimensionsAssociativeByDefault); - Duc.DucGlobalState.addUseAnnotativeScaling(builder, state.useAnnotativeScaling); - Duc.DucGlobalState.addDisplayPrecisionLinear(builder, state.displayPrecision.linear); - Duc.DucGlobalState.addDisplayPrecisionAngular(builder, state.displayPrecision.angular); - return Duc.DucGlobalState.endDucGlobalState(builder); -} - -function serializeDucLocalState(builder: flatbuffers.Builder, state: DucLocalState, usv: boolean): number { - const scopeOffset = writeString(builder, state.scope); - const activeStandardIdOffset = writeString(builder, state.activeStandardId); - const activeGridSettingsVector = writeStringVector(builder, state.activeGridSettings); - const activeSnapSettingsOffset = writeString(builder, state.activeSnapSettings); - const currentItemStrokeOffset = writeElementStroke(builder, state.currentItemStroke, usv); - const currentItemBackgroundOffset = writeElementBackground(builder, state.currentItemBackground, usv); - const currentItemFontFamilyOffset = state.currentItemFontFamily && writeString(builder, state.currentItemFontFamily.toString()); - - Duc.DucLocalState.startDucLocalState(builder); - if (scopeOffset) Duc.DucLocalState.addScope(builder, scopeOffset); - if (activeStandardIdOffset) Duc.DucLocalState.addActiveStandardId(builder, activeStandardIdOffset); - if (state.scrollX) Duc.DucLocalState.addScrollX(builder, getPrecisionValue(state.scrollX, usv)); - if (state.scrollY) Duc.DucLocalState.addScrollY(builder, getPrecisionValue(state.scrollY, usv)); - if (state.zoom) Duc.DucLocalState.addZoom(builder, state.zoom.value); - if (activeGridSettingsVector) Duc.DucLocalState.addActiveGridSettings(builder, activeGridSettingsVector); - if (activeSnapSettingsOffset) Duc.DucLocalState.addActiveSnapSettings(builder, activeSnapSettingsOffset); - Duc.DucLocalState.addIsBindingEnabled(builder, state.isBindingEnabled); - if (currentItemStrokeOffset) Duc.DucLocalState.addCurrentItemStroke(builder, currentItemStrokeOffset); - if (currentItemBackgroundOffset) Duc.DucLocalState.addCurrentItemBackground(builder, currentItemBackgroundOffset); - - Duc.DucLocalState.addCurrentItemOpacity(builder, state.currentItemOpacity); - if (currentItemFontFamilyOffset) Duc.DucLocalState.addCurrentItemFontFamily(builder, currentItemFontFamilyOffset); - - if (state.currentItemFontSize) Duc.DucLocalState.addCurrentItemFontSize(builder, getPrecisionValue(state.currentItemFontSize, usv)); - if (state.currentItemTextAlign) Duc.DucLocalState.addCurrentItemTextAlign(builder, state.currentItemTextAlign); - - if (state.currentItemRoundness) Duc.DucLocalState.addCurrentItemRoundness(builder, getPrecisionValue(state.currentItemRoundness, usv)); - Duc.DucLocalState.addPenMode(builder, state.penMode); - Duc.DucLocalState.addViewModeEnabled(builder, state.viewModeEnabled); - Duc.DucLocalState.addObjectsSnapModeEnabled(builder, state.objectsSnapModeEnabled); - Duc.DucLocalState.addGridModeEnabled(builder, state.gridModeEnabled); - Duc.DucLocalState.addOutlineModeEnabled(builder, state.outlineModeEnabled); - Duc.DucLocalState.addManualSaveMode(builder, state.manualSaveMode); - return Duc.DucLocalState.endDucLocalState(builder); -} - -function serializeDictionary(builder: flatbuffers.Builder, dictionary: Dictionary | null | undefined): number | undefined { - if (!dictionary) return undefined; - const entries = Object.entries(dictionary).map(([key, value]) => { - const keyOffset = builder.createString(key); - const valueOffset = builder.createString(value); - Duc.DictionaryEntry.startDictionaryEntry(builder); - Duc.DictionaryEntry.addKey(builder, keyOffset); - Duc.DictionaryEntry.addValue(builder, valueOffset); - return Duc.DictionaryEntry.endDictionaryEntry(builder); - }); - return Duc.ExportedDataState.createDictionaryVector(builder, entries); -} - -// #endregion - -function serializeDucGroup(builder: flatbuffers.Builder, g: DucGroup, usv: boolean): number { - const id = builder.createString(g.id); - const stack = writeStackBase(builder, g, usv); - Duc.DucGroup.startDucGroup(builder); - Duc.DucGroup.addId(builder, id); - Duc.DucGroup.addStackBase(builder, stack); - return Duc.DucGroup.endDucGroup(builder); -} - -function serializeDucRegion(builder: flatbuffers.Builder, r: DucRegion, usv: boolean): number { - const id = builder.createString(r.id); - const stack = writeStackBase(builder, r, usv); - Duc.DucRegion.startDucRegion(builder); - Duc.DucRegion.addId(builder, id); - Duc.DucRegion.addStackBase(builder, stack); - Duc.DucRegion.addBooleanOperation(builder, r.booleanOperation); - return Duc.DucRegion.endDucRegion(builder); -} - -function serializeDucLayer(builder: flatbuffers.Builder, l: DucLayer, usv: boolean): number { - const id = builder.createString(l.id); - const stack = writeStackBase(builder, l, usv); - const overrides = l.overrides ? (() => { - const stroke = writeElementStroke(builder, l.overrides!.stroke, usv); - const bg = writeElementBackground(builder, l.overrides!.background, usv); - Duc.DucLayerOverrides.startDucLayerOverrides(builder); - if (stroke) Duc.DucLayerOverrides.addStroke(builder, stroke); - if (bg) Duc.DucLayerOverrides.addBackground(builder, bg); - return Duc.DucLayerOverrides.endDucLayerOverrides(builder); - })() : undefined; - Duc.DucLayer.startDucLayer(builder); - Duc.DucLayer.addId(builder, id); - Duc.DucLayer.addStackBase(builder, stack); - Duc.DucLayer.addReadonly(builder, l.readonly); - if (overrides) Duc.DucLayer.addOverrides(builder, overrides); - return Duc.DucLayer.endDucLayer(builder); -} - -/** - * External files map serializer: returns vector offset or undefined - */ -function serializeExternalFiles(builder: flatbuffers.Builder, files: DucExternalFiles | undefined, usv: boolean): number | undefined { - if (!files) return undefined; - - const entries = Object.entries(files).map(([key, value]) => { - const keyOff = builder.createString(key); - const mt = builder.createString(value.mimeType); - const idOff = builder.createString(value.id); - - let dataVectorOffset: number | undefined = undefined; - if (value.data) { - dataVectorOffset = Duc.DucExternalFileData.createDataVector(builder, value.data); - } - - - Duc.DucExternalFileData.startDucExternalFileData(builder); - Duc.DucExternalFileData.addMimeType(builder, mt); - Duc.DucExternalFileData.addId(builder, idOff); - if (dataVectorOffset) Duc.DucExternalFileData.addData(builder, dataVectorOffset); - Duc.DucExternalFileData.addCreated(builder, BigInt(value.created)); - if (value.lastRetrieved !== undefined) Duc.DucExternalFileData.addLastRetrieved(builder, BigInt(value.lastRetrieved)); - - const dataOff = Duc.DucExternalFileData.endDucExternalFileData(builder); - - Duc.DucExternalFileEntry.startDucExternalFileEntry(builder); - Duc.DucExternalFileEntry.addKey(builder, keyOff); - Duc.DucExternalFileEntry.addValue(builder, dataOff); - return Duc.DucExternalFileEntry.endDucExternalFileEntry(builder); - }); - // Build vector of entries - builder.startVector(4, entries.length, 4); - for (let i = entries.length - 1; i >= 0; i--) builder.addOffset(entries[i]); - return builder.endVector(); + return false; } - - -export const DUC_SCHEMA_VERSION = - (typeof process !== "undefined" && (process as any).env && (process as any).env.DUC_SCHEMA_VERSION) || - (typeof import.meta !== "undefined" && (import.meta as any).env && (import.meta as any).env.DUC_SCHEMA_VERSION) || - "0.0.0"; - -export const serializeDuc = async ( - data: ImportedDataState, - useScopedValues: boolean = false, - passThroughElementIds: string[] = [], - restoreConfig: RestoreConfig = {}, -): Promise => { - const builder = new flatbuffers.Builder(1024); - - const sanitized = restore( - data, - { - refreshDimensions: false, - syncInvalidIndices: (elements) => elements as OrderedDucElement[], - passThroughElementIds - }, - restoreConfig - ); - - const typeOffset = builder.createString(EXPORT_DATA_TYPES.duc); - const sourceOffset = builder.createString(typeof window !== "undefined" ? window.location.origin : "unknown"); - - const versionOffset = builder.createString(DUC_SCHEMA_VERSION); - - // Serialize elements - const elementOffsets = sanitized.elements.map((element) => { - return writeElementWrapper(builder, element, useScopedValues); - }); - const elementsOffset = Duc.ExportedDataState.createElementsVector(builder, elementOffsets); - - // Serialize localState - const localStateOffset = serializeDucLocalState(builder, sanitized.localState, useScopedValues); - - // Serialize files - const externalFilesOffset = serializeExternalFiles(builder, sanitized.files, useScopedValues); - - // Serialize blocks - const blocksOffset = sanitized.blocks.length > 0 - ? Duc.ExportedDataState.createBlocksVector(builder, sanitized.blocks.map(block => writeBlock(builder, block, useScopedValues))) - : null; - - // Serialize block instances - const blockInstancesOffset = sanitized.blockInstances.length > 0 - ? Duc.ExportedDataState.createBlockInstancesVector(builder, sanitized.blockInstances.map(instance => writeBlockInstance(builder, instance, useScopedValues))) - : null; - - // Serialize block collections - const blockCollectionsOffset = sanitized.blockCollections.length > 0 - ? Duc.ExportedDataState.createBlockCollectionsVector(builder, sanitized.blockCollections.map(collection => writeBlockCollection(builder, collection))) - : null; - - // Serialize groups - const groupsOffset = sanitized.groups.length > 0 - ? Duc.ExportedDataState.createGroupsVector(builder, sanitized.groups.map(group => serializeDucGroup(builder, group, useScopedValues))) - : null; - - // Serialize regions - const regionsOffset = (sanitized.regions && sanitized.regions.length > 0) - ? Duc.ExportedDataState.createRegionsVector(builder, sanitized.regions.map(region => serializeDucRegion(builder, region, useScopedValues))) - : null; - - // Serialize layers - const layersOffset = (sanitized.layers && sanitized.layers.length > 0) - ? Duc.ExportedDataState.createLayersVector(builder, sanitized.layers.map(layer => serializeDucLayer(builder, layer, useScopedValues))) - : null; - - // Serialize standards - const standardsOffset = (sanitized.standards && sanitized.standards.length > 0) - ? Duc.ExportedDataState.createStandardsVector(builder, sanitized.standards.map(standard => serializeStandard(builder, standard, useScopedValues))) - : null; - - // Serialize dictionary - const dictionaryOffset = (sanitized.dictionary && Object.keys(sanitized.dictionary).length > 0) - ? serializeDictionary(builder, sanitized.dictionary) - : null; - - // Serialize duc_global_state - const ducGlobalStateOffset = sanitized.globalState - ? serializeDucGlobalState(builder, sanitized.globalState, useScopedValues) - : null; - - // Serialize version_graph - const versionGraphOffset = sanitized.versionGraph - ? serializeDucVersionGraph(builder, sanitized.versionGraph) - : null; - - // Serialize thumbnail (as byte vector if present) - const thumbnailOffset = sanitized.thumbnail - ? builder.createByteVector(sanitized.thumbnail) - : null; - - // Serialize id (as string if present) - const idOffset = sanitized.id - ? builder.createString(sanitized.id) - : null; - - Duc.ExportedDataState.startExportedDataState(builder); - Duc.ExportedDataState.addType(builder, typeOffset); - Duc.ExportedDataState.addVersion(builder, versionOffset); - Duc.ExportedDataState.addSource(builder, sourceOffset); - Duc.ExportedDataState.addElements(builder, elementsOffset); - Duc.ExportedDataState.addDucLocalState(builder, localStateOffset); - - if (externalFilesOffset) { - Duc.ExportedDataState.addExternalFiles(builder, externalFilesOffset); - } - if (blocksOffset) { - Duc.ExportedDataState.addBlocks(builder, blocksOffset); - } - if (blockInstancesOffset) { - Duc.ExportedDataState.addBlockInstances(builder, blockInstancesOffset); - } - if (blockCollectionsOffset) { - Duc.ExportedDataState.addBlockCollections(builder, blockCollectionsOffset); - } - if (groupsOffset) { - Duc.ExportedDataState.addGroups(builder, groupsOffset); - } - if (regionsOffset) { - Duc.ExportedDataState.addRegions(builder, regionsOffset); - } - if (layersOffset) { - Duc.ExportedDataState.addLayers(builder, layersOffset); - } - if (standardsOffset) { - Duc.ExportedDataState.addStandards(builder, standardsOffset); - } - if (dictionaryOffset) { - Duc.ExportedDataState.addDictionary(builder, dictionaryOffset); - } - if (ducGlobalStateOffset) { - Duc.ExportedDataState.addDucGlobalState(builder, ducGlobalStateOffset); - } - if (versionGraphOffset) { - Duc.ExportedDataState.addVersionGraph(builder, versionGraphOffset); - } - if (thumbnailOffset) { - Duc.ExportedDataState.addThumbnail(builder, thumbnailOffset); - } - if (idOffset) { - Duc.ExportedDataState.addId(builder, idOffset); - } - const exportedDataStateOffset = Duc.ExportedDataState.endExportedDataState(builder); - - builder.finish(exportedDataStateOffset, "DUC_"); - - return builder.asUint8Array(); -}; -// #endregion diff --git a/packages/ducjs/src/technical/index.ts b/packages/ducjs/src/technical/index.ts index 7fcfb094..a04a576e 100644 --- a/packages/ducjs/src/technical/index.ts +++ b/packages/ducjs/src/technical/index.ts @@ -1,3 +1,2 @@ -export * from "./standards"; export * from "./measurements"; -export * from "./scopes"; \ No newline at end of file +export * from "./scopes"; diff --git a/packages/ducjs/src/technical/scopes.ts b/packages/ducjs/src/technical/scopes.ts index 151080e3..58ea96b3 100644 --- a/packages/ducjs/src/technical/scopes.ts +++ b/packages/ducjs/src/technical/scopes.ts @@ -1,4 +1,4 @@ -import { UNIT_SYSTEM } from "../flatbuffers/duc"; +import { UNIT_SYSTEM } from "../enums"; import { PrecisionValue, RawValue, ScaledZoom, Scope, ScopedValue, ScopedZoomValue, ValueOf } from "../types"; import { DucPoint } from "../types/elements"; import { GeometricPoint } from "../types/geometryTypes"; diff --git a/packages/ducjs/src/technical/standards.ts b/packages/ducjs/src/technical/standards.ts deleted file mode 100644 index 8f647344..00000000 --- a/packages/ducjs/src/technical/standards.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { ANGULAR_UNITS_FORMAT, DECIMAL_SEPARATOR, DIMENSION_UNITS_FORMAT } from "../flatbuffers/duc"; -import { UnitSystem } from "./scopes"; -import { DucCommonStyle, DucDimensionStyle, DucDocStyle, DucFeatureControlFrameStyle, DucHatchStyle, DucLeaderStyle, DucPlotElement, DucStackLikeStyles, DucTableStyle, DucTextStyle, DucUcs, DucView, DucViewportStyle, DucXRayStyle, GridSettings, Identifier, PrecisionValue, ScaleFactor, Scope, SnapSettings, StrokeStyle } from "../types"; -import { ValueOf } from "../types/utility-types"; - - -export const PREDEFINED_STANDARDS = { - DUC: "duc", // DUC (default) - ISO_25300: "iso-25300-2013", // International Organization for Standardization - ANSI_Y14_5: "ansi-y14.5-2018", // American National Standards Institute - DIN_406: "din-406-2017", // German Institute for Standardization - JIS_B0001: "jis-b0001-2019", // Japanese Industrial Standards - BS_8888: "bs-8888-2020", // British Standards Institution - ABNT: "abnt", // Brazilian Association of Technical Standards - GB: "gb", // Chinese National Standards -} as const; - -/** - * The Standard for the given technical design - * https://en.wikipedia.org/wiki/List_of_technical_standard_organizations - */ -export type Standard = Identifier & { - /** Version of the standard */ - version: string; - /** Whether this is a built-in standard (read-only) */ - readonly: boolean; - - /** Overrides for all elements projected to this standard */ - overrides: StandardOverrides | null; - - /** Styles */ - styles: StandardStyles | null; - - /** Views and canvas interaction settings */ - viewSettings: StandardViewSettings | null; - - /** Units */ - units: StandardUnits | null; - - /** Validation rules */ - validation: StandardValidation | null; -}; - - -export type DimensionUnitsFormat = ValueOf; -export type AngularUnitsFormat = ValueOf; -export type DecimalSeparator = ValueOf; - -export type _UnitSystemBase = { - /** Unit format */ - format: T; - /** Unit system */ - system: UnitSystem; - /** Precision (decimal places) */ - precision: number; - /** Suppress leading zeros */ - suppressLeadingZeros: boolean; - /** Suppress trailing zeros */ - suppressTrailingZeros: boolean; -} - - -export type StandardUnits = { - primaryUnits: { - /** Linear units */ - linear: _UnitSystemBase & { - /** Decimal separator character */ - decimalSeparator: DecimalSeparator; - /** Suppress zero feet */ - suppressZeroFeet: boolean; - /** Suppress zero inches */ - suppressZeroInches: boolean; - }; - - /** Angular units */ - angular: _UnitSystemBase; - }; - - alternateUnits: _UnitSystemBase & { - /** Whether to display alternate units */ - isVisible: boolean; - /** Multiplier for alternate units */ - multiplier: number; - }; -} - - -export type StandardOverrides = { - mainScope?: Scope; - elementsStrokeWidthOverride?: PrecisionValue; - commonStyleId?: Identifier["id"]; - stackLikeStyleId?: Identifier["id"]; - textStyleId?: Identifier["id"]; - dimensionStyleId?: Identifier["id"]; - leaderStyleId?: Identifier["id"]; - featureControlFrameStyleId?: Identifier["id"]; - tableStyleId?: Identifier["id"]; - docStyleId?: Identifier["id"]; - viewportStyleId?: Identifier["id"]; - plotStyleId?: Identifier["id"]; - hatchStyleId?: Identifier["id"]; - activeGridSettingsId?: Identifier["id"][]; - activeSnapSettingsId?: Identifier["id"]; - dashLineOverride?: StrokeStyle["dashLineOverride"]; - /** Default precision for various dimension types */ - unitPrecision?: { - linear?: number; - angular?: number; - area?: number; - volume?: number; - }; -}; - -export type StandardStyles = { - commonStyles: Array; - stackLikeStyles: Array; - textStyles: Array; - dimensionStyles: Array; - leaderStyles: Array; - featureControlFrameStyles: Array; - tableStyles: Array; - docStyles: Array; - viewportStyles: Array; - hatchStyles: Array; - xrayStyles: Array; -} - -export type StandardViewSettings = { - views: Array; - ucs: Array; - gridSettings: Array; - snapSettings: Array; -} - - -export type StandardValidation = { - dimensionRules?: { - minTextHeight?: PrecisionValue; - maxTextHeight?: PrecisionValue; - allowedPrecisions?: number[]; - }; - layerRules?: { - prohibitedLayerNames?: string[]; - }; -} \ No newline at end of file diff --git a/packages/ducjs/src/transform.ts b/packages/ducjs/src/transform.ts new file mode 100644 index 00000000..c1633316 --- /dev/null +++ b/packages/ducjs/src/transform.ts @@ -0,0 +1,502 @@ +/** + * Post-parse transformation: fix stack element nesting + * (move stackBase fields to top level for frame/plot elements). + * + * Also adds `type` discriminator to version graph entries. + */ +export function transformFromRust(data: any): any { + if (!data) return data; + + if (data.elements) { + data.elements = data.elements.map(fixElementFromRust); + } + + if (data.versionGraph) { + const vg = data.versionGraph; + if (vg.checkpoints) { + vg.checkpoints = vg.checkpoints.map((c: any) => ({ ...c, type: "checkpoint" })); + } + if (vg.deltas) { + vg.deltas = vg.deltas.map((d: any) => ({ ...d, type: "delta" })); + } + } + + if (data.layers) { + data.layers = data.layers.map((layer: any) => { + if (layer?.overrides) { + layer = { ...layer, overrides: fixLayerOverridesHatch(layer.overrides, true) }; + } + return layer; + }); + } + + if (data.blockInstances) { + data.blockInstances = data.blockInstances.map((bi: any) => { + if (Array.isArray(bi?.elementOverrides)) { + const record: Record = {}; + for (const entry of bi.elementOverrides) { + if (entry?.key !== undefined) record[entry.key] = entry.value; + } + return { ...bi, elementOverrides: record }; + } + return bi; + }); + } + + if (data.blocks) { + data.blocks = data.blocks.map((block: any) => { + if (block?.metadata) fixLocalizationFromRust(block.metadata); + return block; + }); + } + + if (data.blockCollections) { + data.blockCollections = data.blockCollections.map((collection: any) => { + if (collection?.metadata) fixLocalizationFromRust(collection.metadata); + return collection; + }); + } + + return data; +} + +/** + * Pre-serialize transformation: re-wrap stack element fields + * and flatten PrecisionValue objects to plain numbers for Rust. + */ +export function transformToRust(data: any): any { + if (!data) return data; + + const result = { ...data }; + + if (result.elements) { + result.elements = result.elements.map((el: any) => + coerceElementIntegerFields(flattenPrecisionValues(fixElementToRust(el))), + ); + } + + if (result.localState) { + result.localState = normalizeLocalStateForRust(result.localState); + } + + if (result.globalState) { + result.globalState = normalizeGlobalStateForRust(result.globalState); + } + + if (result.versionGraph) { + const vg = { ...result.versionGraph }; + if (vg.checkpoints) { + vg.checkpoints = vg.checkpoints.map(({ type: _, ...rest }: any) => rest); + } + if (vg.deltas) { + vg.deltas = vg.deltas.map(({ type: _, ...rest }: any) => rest); + } + result.versionGraph = vg; + } + + if (result.layers) { + result.layers = result.layers.map((layer: any) => { + let l = { ...layer }; + if (l.overrides) { + l.overrides = fixLayerOverridesHatch(l.overrides, false); + } + return flattenPrecisionValues(l); + }); + } + + if (result.blockInstances) { + result.blockInstances = result.blockInstances.map((bi: any) => { + let b = { ...bi }; + if (b.elementOverrides && !Array.isArray(b.elementOverrides) && typeof b.elementOverrides === "object") { + b.elementOverrides = Object.entries(b.elementOverrides).map(([key, value]) => ({ key, value: String(value) })); + } + return flattenPrecisionValues(b); + }); + } + + if (result.blocks) { + result.blocks = result.blocks.map((block: any) => { + let b = { ...block }; + if (b.metadata) { + b.metadata = { ...b.metadata }; + fixLocalizationToRust(b.metadata); + } + return b; + }); + } + + if (result.blockCollections) { + result.blockCollections = result.blockCollections.map((collection: any) => { + let c = { ...collection }; + if (c.metadata) { + c.metadata = { ...c.metadata }; + fixLocalizationToRust(c.metadata); + } + return c; + }); + } + + return result; +} + +import { FREEDRAW_EASINGS } from "./utils/constants"; + +const STACK_ELEMENT_TYPES = new Set(["frame", "plot"]); +const LINEAR_ELEMENT_TYPES = new Set(["line", "arrow", "freedraw"]); + +const EASING_FN_TO_NAME = new Map( + Object.entries(FREEDRAW_EASINGS).map(([name, fn]) => [fn, name]), +); + +const TEXT_STYLE_FIELDS = new Set([ + "isLtr", "fontFamily", "bigFontFamily", "textAlign", "verticalAlign", + "lineHeight", "lineSpacing", "obliqueAngle", "fontSize", "widthFactor", + "isUpsideDown", "isBackwards", +]); + +// --- Hatch pattern: Rust flat fields ↔ TS nested `pattern` object --- + +function fixHatchFromRust(hatch: any): any { + if (!hatch || typeof hatch !== "object" || hatch.pattern) return hatch; + const { patternName, patternScale, patternAngle, patternOrigin, patternDouble, ...rest } = hatch; + if (patternName === undefined) return hatch; + return { ...rest, pattern: { name: patternName, scale: patternScale, angle: patternAngle, origin: patternOrigin, double: patternDouble } }; +} + +function fixHatchToRust(hatch: any): any { + if (!hatch?.pattern) return hatch; + const { pattern, ...rest } = hatch; + return { ...rest, patternName: pattern.name, patternScale: pattern.scale, patternAngle: pattern.angle, patternOrigin: pattern.origin, patternDouble: pattern.double }; +} + +function fixContentHatch(content: any, fromRust: boolean): any { + if (!content?.hatch) return content; + return { ...content, hatch: fromRust ? fixHatchFromRust(content.hatch) : fixHatchToRust(content.hatch) }; +} + +function fixStylesHatch(el: any, fromRust: boolean): void { + if (Array.isArray(el?.background)) { + for (let i = 0; i < el.background.length; i++) { + if (el.background[i]?.content?.hatch) { + el.background[i] = { ...el.background[i], content: fixContentHatch(el.background[i].content, fromRust) }; + } + } + } + if (Array.isArray(el?.stroke)) { + for (let i = 0; i < el.stroke.length; i++) { + if (el.stroke[i]?.content?.hatch) { + el.stroke[i] = { ...el.stroke[i], content: fixContentHatch(el.stroke[i].content, fromRust) }; + } + } + } +} + +function fixLayerOverridesHatch(overrides: any, fromRust: boolean): any { + if (!overrides) return overrides; + let result = overrides; + if (result.stroke?.content?.hatch) { + result = { ...result, stroke: { ...result.stroke, content: fixContentHatch(result.stroke.content, fromRust) } }; + } + if (result.background?.content?.hatch) { + result = { ...result, background: { ...result.background, content: fixContentHatch(result.background.content, fromRust) } }; + } + return result; +} + +// --- Viewer3DGrid: Rust `value` key ↔ TS `planes` key for perPlane variant --- + +function fixViewer3DGridFromRust(grid: any): any { + if (grid?.type === "perPlane" && "value" in grid && !("planes" in grid)) { + const { value, ...rest } = grid; + return { ...rest, planes: value }; + } + return grid; +} + +function fixViewer3DGridToRust(grid: any): any { + if (grid?.type === "perPlane" && "planes" in grid) { + const { planes, ...rest } = grid; + return { ...rest, value: planes }; + } + return grid; +} + +// --- customData: Rust `Option` (JSON) ↔ TS `Record` --- + +function fixCustomDataFromRust(el: any): void { + if (typeof el?.customData === "string") { + try { el.customData = JSON.parse(el.customData); } catch { /* keep as string */ } + } +} + +function fixCustomDataToRust(el: any): void { + if (el?.customData != null && typeof el.customData !== "string") { + el.customData = JSON.stringify(el.customData); + } +} + +// --- Block metadata localization: Rust `Option` (JSON) ↔ TS Record --- + +function fixLocalizationFromRust(metadata: any): void { + if (typeof metadata?.localization === "string") { + try { metadata.localization = JSON.parse(metadata.localization); } catch { /* keep as string */ } + } +} + +function fixLocalizationToRust(metadata: any): void { + if (metadata?.localization != null && typeof metadata.localization !== "string") { + metadata.localization = JSON.stringify(metadata.localization); + } +} + +function fixElementFromRust(el: any): any { + if (!el) return el; + + fixStylesHatch(el, true); + fixCustomDataFromRust(el); + if (el.type === "model" && el.viewerState?.display?.grid) { + el.viewerState = { + ...el.viewerState, + display: { ...el.viewerState.display, grid: fixViewer3DGridFromRust(el.viewerState.display.grid) }, + }; + } + + // Convert Rust DucLine structs { start, end } → TypeScript tuples [start, end] + if (LINEAR_ELEMENT_TYPES.has(el.type) && Array.isArray(el.lines)) { + el.lines = el.lines.map((line: any) => { + if (Array.isArray(line)) return line; + if (line && line.start !== undefined && line.end !== undefined) { + return [line.start, line.end]; + } + return line; + }); + } + + // Convert easing string key → function for freedraw elements + if (el.type === "freedraw") { + el = convertEasingFromRust(el); + } + + // Unwrap nested text style → flat fields for TS + if (el.type === "text" && el.style && typeof el.style === "object") { + const { style, ...rest } = el; + return { ...rest, ...style }; + } + + // Remove empty style from table/doc elements + if ((el.type === "table" || el.type === "doc") && "style" in el) { + const { style: _, ...rest } = el; + return rest; + } + + if (!STACK_ELEMENT_TYPES.has(el.type)) return el; + + // Stack elements (frame, plot) — unwrap stackBase, remove empty plot style + const { stackBase, style: _plotStyle, ...rest } = el; + if (!stackBase) return el; + + return { + ...rest, + isCollapsed: stackBase.isCollapsed ?? false, + }; +} + +function fixElementToRust(el: any): any { + if (!el) return el; + + fixStylesHatch(el, false); + fixCustomDataToRust(el); + if (el.type === "model" && el.viewerState?.display?.grid) { + el.viewerState = { + ...el.viewerState, + display: { ...el.viewerState.display, grid: fixViewer3DGridToRust(el.viewerState.display.grid) }, + }; + } + + // Convert TypeScript DucLine tuples [start, end] → Rust structs { start, end } + if (LINEAR_ELEMENT_TYPES.has(el.type) && Array.isArray(el.lines)) { + el.lines = el.lines.map((line: any) => { + if (Array.isArray(line)) { + return { start: line[0], end: line[1] }; + } + return line; + }); + } + + // Convert easing function → string key for freedraw elements + if (el.type === "freedraw") { + el = convertEasingToRust(el); + } + + // Wrap flat text style fields into nested `style` object for Rust serde + if (el.type === "text") { + const style: Record = {}; + const rest: Record = {}; + for (const key of Object.keys(el)) { + if (TEXT_STYLE_FIELDS.has(key)) { + style[key] = el[key]; + } else { + rest[key] = el[key]; + } + } + return { ...rest, style }; + } + + // Add empty style for table/doc elements + if (el.type === "table" || el.type === "doc") { + return { ...el, style: {} }; + } + + if (!STACK_ELEMENT_TYPES.has(el.type)) return el; + + const { + isCollapsed, + ...rest + } = el; + + return { + ...rest, + ...(el.type === "plot" ? { style: {} } : {}), + stackBase: { + label: el.label ?? "", + description: el.description ?? null, + isCollapsed: isCollapsed ?? false, + isPlot: el.isPlot ?? false, + isVisible: el.isVisible ?? true, + locked: el.locked ?? false, + opacity: el.opacity ?? 1.0, + }, + }; +} + +/** + * Recursively convert PrecisionValue objects ({value, scoped}) to plain + * numbers (extracting `.value` — the raw/unscoped value) so Rust's serde + * can deserialize them as f64. + */ +function flattenPrecisionValues(obj: any): any { + if (obj === null || obj === undefined) return obj; + + if (isPrecisionValueLike(obj)) return obj.value; + + if (Array.isArray(obj)) return obj.map(flattenPrecisionValues); + + if (typeof obj === "object") { + const out: Record = {}; + for (const key in obj) { + if (!Object.prototype.hasOwnProperty.call(obj, key)) continue; + out[key] = flattenPrecisionValues(obj[key]); + } + return out; + } + + return obj; +} + +function isPrecisionValueLike(v: any): v is { value: number; scoped: number } { + return ( + v !== null && + typeof v === "object" && + !Array.isArray(v) && + typeof v.value === "number" && + typeof v.scoped === "number" && + Object.keys(v).length === 2 + ); +} + +function toNumberFromPrecisionLike(value: any, fallback: number): number { + const flattened = flattenPrecisionValues(value); + if (typeof flattened === "number" && Number.isFinite(flattened)) { + return flattened; + } + return fallback; +} + +function toInteger(value: any, fallback: number): number { + if (typeof value !== "number" || !Number.isFinite(value)) return fallback; + return Math.trunc(value); +} + +function coerceElementIntegerFields(el: any): any { + if (!el || typeof el !== "object") return el; + + return { + ...el, + seed: toInteger(el.seed, 1), + version: toInteger(el.version, 1), + versionNonce: toInteger(el.versionNonce, 0), + }; +} + +function normalizeLocalStateForRust(localState: any): any { + if (!localState || typeof localState !== "object") return localState; + + return { + ...localState, + scrollX: toNumberFromPrecisionLike(localState.scrollX, 0), + scrollY: toNumberFromPrecisionLike(localState.scrollY, 0), + zoom: + localState.zoom && typeof localState.zoom === "object" + ? toNumberFromPrecisionLike(localState.zoom.value, 1) + : toNumberFromPrecisionLike(localState.zoom, 1), + currentItemStroke: flattenPrecisionValues(localState.currentItemStroke), + currentItemBackground: flattenPrecisionValues(localState.currentItemBackground), + currentItemFontSize: toNumberFromPrecisionLike(localState.currentItemFontSize, 16), + currentItemRoundness: toNumberFromPrecisionLike(localState.currentItemRoundness, 0), + currentItemTextAlign: toInteger(localState.currentItemTextAlign, 10), + decimalPlaces: toInteger(localState.decimalPlaces, 2), + }; +} + +function normalizeGlobalStateForRust(globalState: any): any { + if (!globalState || typeof globalState !== "object") return globalState; + + return { + ...globalState, + scopeExponentThreshold: toInteger(globalState.scopeExponentThreshold, 4), + pruningLevel: toInteger(globalState.pruningLevel, 20), + }; +} + +function easingFnToName(fn: any): string { + if (typeof fn === "string") return fn; + if (typeof fn === "function") { + return EASING_FN_TO_NAME.get(fn) ?? "easeOutSine"; + } + return "easeOutSine"; +} + +function easingNameToFn(name: any): (t: number) => number { + if (typeof name === "function") return name; + if (typeof name === "string" && name in FREEDRAW_EASINGS) { + return (FREEDRAW_EASINGS as any)[name]; + } + return FREEDRAW_EASINGS.easeOutSine; +} + +function convertEasingToRust(el: any): any { + const result = { ...el }; + if (result.easing != null) { + result.easing = easingFnToName(result.easing); + } + if (result.start?.easing != null) { + result.start = { ...result.start, easing: easingFnToName(result.start.easing) }; + } + if (result.end?.easing != null) { + result.end = { ...result.end, easing: easingFnToName(result.end.easing) }; + } + return result; +} + +function convertEasingFromRust(el: any): any { + if (typeof el.easing === "string") { + el.easing = easingNameToFn(el.easing); + } + if (el.start && typeof el.start.easing === "string") { + el.start = { ...el.start, easing: easingNameToFn(el.start.easing) }; + } + if (el.end && typeof el.end.easing === "string") { + el.end = { ...el.end, easing: easingNameToFn(el.end.easing) }; + } + return el; +} diff --git a/packages/ducjs/src/types/elements/index.ts b/packages/ducjs/src/types/elements/index.ts index 167d4fd8..3ee9e13c 100644 --- a/packages/ducjs/src/types/elements/index.ts +++ b/packages/ducjs/src/types/elements/index.ts @@ -1,13 +1,13 @@ export * from "./typeChecks"; -import { DucView, PrecisionValue, Scope } from ".."; -import { BEZIER_MIRRORING, BLENDING, BLOCK_ATTACHMENT, BOOLEAN_OPERATION, COLUMN_TYPE, DATUM_BRACKET_STYLE, DATUM_TARGET_TYPE, DIMENSION_FIT_RULE, DIMENSION_TEXT_PLACEMENT, DIMENSION_TYPE, ELEMENT_CONTENT_PREFERENCE, FEATURE_MODIFIER, GDT_SYMBOL, HATCH_STYLE, IMAGE_STATUS, LINE_HEAD, LINE_SPACING_TYPE, MARK_ELLIPSE_CENTER, MATERIAL_CONDITION, PARAMETRIC_SOURCE_TYPE, STACKED_TEXT_ALIGN, STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, STROKE_SIDE_PREFERENCE, TABLE_CELL_ALIGNMENT, TABLE_FLOW_DIRECTION, TEXT_ALIGN, TEXT_FIELD_SOURCE_PROPERTY, TEXT_FIELD_SOURCE_TYPE, TEXT_FLOW_DIRECTION, TOLERANCE_DISPLAY, TOLERANCE_TYPE, TOLERANCE_ZONE_TYPE, VERTICAL_ALIGN, VIEWPORT_SHADE_PLOT } from "../../flatbuffers/duc"; -import { Standard, StandardUnits } from "../../technical/standards"; +import { PrecisionValue, Scope } from ".."; +import { BEZIER_MIRRORING, BLENDING, BOOLEAN_OPERATION, ELEMENT_CONTENT_PREFERENCE, HATCH_STYLE, IMAGE_STATUS, LINE_HEAD, LINE_SPACING_TYPE, STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, STROKE_SIDE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN } from "../../enums"; + import { FONT_FAMILY, FREEDRAW_EASINGS, } from "../../utils/constants"; -import { Axis, GeometricPoint, Percentage, Radian, ScaleFactor } from "../geometryTypes"; +import { GeometricPoint, Percentage, Radian, ScaleFactor } from "../geometryTypes"; import { MakeBrand, MarkNonNullable, MarkOptional, Merge, ValueOf } from "../utility-types"; @@ -67,8 +67,6 @@ export type _DucElementBase = Readonly<_DucElementStylesBase & { versionNonce: number; /** Whether the element is a plot (i.e. visible on plotting) */ isPlot: boolean; - /** Whether the element is annotative (scales with DucViewport) */ - isAnnotative: boolean; /** Whether the element is deleted */ isDeleted: boolean; /** @@ -173,14 +171,8 @@ export type DucElement = | DucEllipseElement | DucPolygonElement | DucModelElement - | DucFeatureControlFrameElement - | DucLeaderElement - | DucDimensionElement - | DucViewportElement | DucPlotElement - | DucXRayElement | DucPdfElement - | DucMermaidElement export type DucElementTypes = DucElement["type"]; @@ -194,9 +186,7 @@ export type NonDeletedDucElement = NonDeleted & { export type DucBinderElement = | DucLinearElement - | DucDimensionElement - | DucFeatureControlFrameElement - | DucLeaderElement; + | DucArrowElement; export type DucBindableElement = | DucRectangleElement @@ -208,10 +198,8 @@ export type DucBindableElement = | DucFrameElement | DucTableElement | DucDocElement - | DucFeatureControlFrameElement | DucLinearElement - | DucPdfElement - | DucMermaidElement; + | DucPdfElement; export type DucTextContainer = | DucRectangleElement @@ -235,20 +223,16 @@ export type RectangularElement = | DucSelectionElement | DucDocElement | DucTableElement - | DucFeatureControlFrameElement - | DucViewportElement | DucPlotElement | DucPdfElement; export type DucStackLikeElement = | DucPlotElement - | DucViewportElement | DucFrameElement; export type DucLinearLikeElement = | DucLinearElement - | DucViewportElement | DucArrowElement; export type DucFrameLikeElement = @@ -287,7 +271,6 @@ export type ElementConstructorOpts = MarkOptional< | "scope" | "blending" | "isPlot" - | "isAnnotative" | "regionIds" | "layerId" >; @@ -526,12 +509,20 @@ export type DucEmbeddableElement = _DucElementBase & { * Configuration for PDF grid layout */ export type DocumentGridConfig = { - columns: number; // 1 = single, 2 = two-up, n = grid - gapX: number; // horizontal spacing (px) - gapY: number; // vertical spacing (px) - alignItems: 'start' | 'center' | 'end'; // vertical alignment within row - firstPageAlone: boolean; // cover page behavior for 2+ columns - scale: number; // drawing units / real world units + /** 1 = single, 2 = two-up, n = grid */ + columns: number; + /** Horizontal spacing (px) */ + gapX: number; + /** Vertical spacing (px) */ + gapY: number; + /** Cover page behavior for 2+ columns */ + firstPageAlone: boolean; + /** + * The scale factor of the element (Drawing Units / Real World Units). + * The scale factor is strictly a ratio and is unitless. + * Example: 1:300 => 0.00333, 1:1 => 1, 5:1 => 5 + */ + scale: number; } export type DucPdfElement = _DucElementBase & { @@ -542,136 +533,13 @@ export type DucPdfElement = _DucElementBase & { gridConfig: DocumentGridConfig; }; -export type DucMermaidElement = _DucElementBase & { - type: "mermaid"; - source: string; // Mermaid syntax - /** if not provided, the theme will be the same as the document's theme, or default to 'default' - * we decided to go with a string type because of the unpredictably of having different themes - */ - theme?: string; - svgPath: string | null;// optional cached SVG string -}; - //// === TABLE ELEMENTS === -export type TableCellAlignment = ValueOf; -export type TableFlowDirection = ValueOf; - - -/** - * Defines the styling for an individual cell or a default for all cells. - * These properties can be overridden at the row, column, and individual cell levels. - */ -export type DucTableCellStyle = _DucElementStylesBase & { - /** The text style for content within the cell */ - textStyle: DucTextStyle; - /** Margin space inside the cell, between the content and the border */ - margins: { - top: PrecisionValue; - right: PrecisionValue; - bottom: PrecisionValue; - left: PrecisionValue; - }; - /** The alignment of content within the cell */ - alignment: TableCellAlignment; -}; - -/** - * Defines the overall style for a DucTableElement. - * It sets the defaults for rows, columns, and cells, which can be - * individually overridden. - */ -export type DucTableStyle = { - /** The direction in which new rows are added */ - flowDirection: TableFlowDirection; - /** Default style for the header row(s) */ - headerRowStyle: DucTableCellStyle; - /** Default style for the data row(s) */ - dataRowStyle: DucTableCellStyle; - /** Default style for the data column(s) */ - dataColumnStyle: DucTableCellStyle; -}; - -export type DucTableColumn = { - id: string; - width: PrecisionValue; - /** Style overrides for this column */ - styleOverrides?: Partial; -}; - -export type DucTableRow = { - id: string; - height: PrecisionValue; - /** Style overrides for this row */ - styleOverrides?: Partial; -}; - -export type DucTableCell = { - rowId: string; - columnId: string; - - /** - * The content of the cell, stored as a Markdown string. This allows for rich text - * within cells without complicating the table's main data structure. - */ - data: string; - - /** - * Defines if and how this cell merges with adjacent cells. - * A span of 1 means no merging. - * The root cell of a merge (top-left) holds the content and span data. - * Other cells covered by the span are effectively hidden. - */ - span?: { - /** Number of columns this cell spans to the right */ - columns: number; // Default: 1 - /** Number of rows this cell spans downwards */ - rows: number; // Default: 1 - }; - - /** Whether the content of this cell can be edited */ - locked: boolean; - - /** - * Style overrides for this specific cell. - * Any property set here will take precedence over row, column, and table styles. - */ - styleOverrides?: Partial; -}; - -/** - * A structured table element composed of rows, columns, and cells. - * Its data is normalized for efficient updates, and styling is applied - * hierarchically. The element's base `stroke` and `background` style the - * outer border and fill. - */ -export type DucTableElement = _DucElementBase & DucTableStyle & { +/** Source of truth is the linked xlsx file */ +export type DucTableElement = _DucElementBase & { type: "table"; - - /** An ordered list of column IDs, defining the horizontal layout */ - columnOrder: readonly string[]; - /** An ordered list of row IDs, defining the vertical layout */ - rowOrder: readonly string[]; - - /** A record of all column definitions, keyed by their ID */ - columns: Record; - /** A record of all row definitions, keyed by their ID */ - rows: Record; - /** - * A record of all cell data, keyed by a composite "rowId:columnId" string. - * This flat structure is efficient for lookups and updates. - */ - cells: Record; - - /** Number of top rows to be treated as headers, using the headerRowStyle */ - headerRowCount: number; - - /** Whether table auto-sizes to content */ - autoSize: { - columns: boolean; - rows: boolean; - }; + fileId: ExternalFileId | null; }; //// === IMAGE ELEMENTS === @@ -717,7 +585,6 @@ export type FontString = string; export type TextAlign = ValueOf; export type VerticalAlign = ValueOf; export type LineSpacingType = ValueOf; -export type TextFieldSourceProperty = ValueOf; export type DucTextStyle = { /** @@ -783,8 +650,6 @@ export type DucTextStyle = { * This determines the height of capital letters */ fontSize: PrecisionValue; - /** Desired height on printed page (for annotative text) */ - paperTextHeight?: PrecisionValue; /** * Character width as a ratio of text height * Controls horizontal spacing and character proportions @@ -811,13 +676,6 @@ export type DucTextElement = _DucElementBase & DucTextStyle & { */ text: string; - /** - * An array of metadata objects that define the behavior of the placeholders - * found in the `text` property. If this is empty, the text is treated - * as purely static. - */ - dynamic: readonly DucTextDynamicPart[]; - /** * Text sizing behavior: * - `true`: Width adjusts to fit text content (single line or natural wrapping) @@ -834,47 +692,6 @@ export type DucTextElement = _DucElementBase & DucTextStyle & { }; -/** - * A discriminated union that precisely defines the source of a dynamic part's data. - * This structure is highly extensible. - */ -export type DucTextDynamicSource = - | { - sourceType: TEXT_FIELD_SOURCE_TYPE.ELEMENT; - /** The unique ID of the source element. */ - elementId: DucElement["id"]; - /** The specific property to retrieve from the source element. */ - property: TextFieldSourceProperty; - } - | { - sourceType: TEXT_FIELD_SOURCE_TYPE.DICTIONARY; - /** The key to look up in the global drawing dictionary. */ - key: string; - }; - -/** - * Defines a single dynamic component within a text string. - * This object contains all the metadata needed to resolve and format a placeholder. - */ -export type DucTextDynamicPart = { - /** - * A unique key for this part, which matches the placeholder in the text string. - * E.g., for a placeholder `{{PartNumber}}`, the tag would be "PartNumber". - */ - tag: string; - - /** The source of the data for this dynamic part. */ - source: DucTextDynamicSource; - - /** Formatting rules for displaying the final value. */ - formatting?: StandardUnits["primaryUnits"]; - - /** The last known value, used as a fallback or for initial display. */ - cachedValue: string; -}; - - - export type DucTextElementWithContainer = { containerId: DucTextContainer["id"]; } & DucTextElement; @@ -1053,20 +870,6 @@ export type DucBlockDuplicationArray = { colSpacing: PrecisionValue; } -/** - * Defines the schema for a single attribute within a block definition. - */ -export type DucBlockAttributeDefinition = { - /** The unique identifier for this attribute within the block (e.g., "PART_NUMBER"). */ - tag: string; - /** The prompt displayed to the user when inserting the block (e.g., "Enter the part number:"). */ - prompt?: string; - /** The default value for this attribute. */ - defaultValue: string; - /** If true, the attribute's value is fixed and cannot be changed after insertion. */ - isConstant: boolean; -}; - /** * Indicates the source drawing of a block. */ @@ -1117,12 +920,6 @@ export type DucBlock = { description?: string; version: number; - /** - * A record of attribute definitions for this block, keyed by their tag. - * This defines the "slots" for data that each instance can fill. - */ - attributeDefinitions: Readonly>; - /** Block metadata including source, usage count, timestamps, and localization */ metadata?: DucBlockMetadata; @@ -1145,12 +942,6 @@ export type DucBlockInstance = { //Instance of a block definition */ elementOverrides?: Record; - /** - * A record of the actual values for the attributes of this specific instance, - * keyed by the attribute tag defined in the DucBlock. - */ - attributeValues?: Readonly>; - duplicationArray: DucBlockDuplicationArray | null; }; @@ -1191,15 +982,11 @@ export type _DucStackBase = DucStackLikeStyles & { export type DucStackLikeStyles = { opacity: _DucElementBase["opacity"]; - labelingColor: string; } export type _DucStackElementBase = _DucElementBase & _DucStackBase & { clip: boolean; labelVisible: boolean; - - /** Everything inside the stack will use this standard */ - standardOverride: Standard["id"] | null; }; export type DucFrameElement = _DucStackElementBase & { @@ -1240,70 +1027,6 @@ export type DucLayer = _DucStackBase & { -//// === VIEWPORT ELEMENTS === - -/** - * Viewport scale represents how model space is displayed in a viewport. - * For a scale notation A:B, this represents the ratio A/B. - * - * Examples: - * - 1:200 viewport → ViewportScale = 1/200 = 0.005 - * - 1:50 viewport → ViewportScale = 1/50 = 0.02 - * - 1:1 viewport → ViewportScale = 1/1 = 1 - * - 2:1 viewport → ViewportScale = 2/1 = 2 - * - 10:1 viewport → ViewportScale = 10/1 = 10 - * - * This represents how much model space is "zoomed" in the viewport. - */ -export type ViewportScale = number & { _brand: "viewportScale" }; - -/** - * Annotation scale represents the factor by which annotative objects - * are scaled to maintain consistent appearance across different viewport scales. - * For a scale notation A:B, this represents B/A. - * - * Examples: - * - 1:200 drawing → AnnotationScale = 200/1 = 200 - * - 1:50 drawing → AnnotationScale = 50/1 = 50 - * - 1:1 drawing → AnnotationScale = 1/1 = 1 - * - 2:1 drawing → AnnotationScale = 1/2 = 0.5 - * - 10:1 drawing → AnnotationScale = 1/10 = 0.1 - * - * This is typically the inverse of the viewport scale. - */ -export type AnnotationScale = number & { _brand: "annotationScale" }; - - -export type ViewportShadePlot = ValueOf; - - -/** - * This is the style for the viewport element - * Grid settings, UCS, Snapping and more can be overridden through the overrideStandard property from the _DucStackElementBase - */ -export type DucViewportStyle = { - scaleIndicatorVisible: boolean; -}; -export type DucViewportElement = _DucLinearElementBase & _DucStackBase & DucViewportStyle & { - type: "viewport"; - - /** View configuration */ - view: DucView; - - /** Viewport scale settings */ - scale: ViewportScale; - - /** Shade plot setting */ - shadePlot: ViewportShadePlot; - - /** Frozen layers in this viewport */ - frozenGroupIds: GroupId[]; - - /** Everything inside the viewport will use this standard */ - standardOverride: Standard["id"] | null; -}; - - //// === PLOT ELEMENTS === /** @@ -1333,565 +1056,136 @@ export type DucPlotElement = _DucStackElementBase & DucPlotStyle & { }; -//// === XRAY ELEMENTS === -export type DucXRayStyle = { - /** - * The color of the x-ray - */ - color: string; -}; -export type DucXRayElement = _DucElementBase & DucXRayStyle & { - type: "xray" - origin: DucPoint; - direction: DucPoint; - /** - * If true, the x-ray will start from the origin. - * If false, the x-ray will be a full infinite line. - * @default false - */ - startFromOrigin: boolean; -} - - -//// === LEADER ELEMENTS === - -export type BlockAttachment = ValueOf; - -/** - * Defines the visual appearance and behavior of a leader. - */ -export type DucLeaderStyle = { - /** - * Override the heads of the leader - * The tuple represents [startHead, endHead] - */ - headsOverride?: [DucHead, DucHead]; - - /** The "dogleg" or "landing" segment that connects the leader line to the content. */ - dogleg?: PrecisionValue; - - /** Default styling for text content. */ - textStyle: DucTextStyle; +//// === Doc Element === - /** - * How the text content attaches to the leader's landing line. - * 'top': Text is below the line. 'middle': Text is centered on the line. - */ - textAttachment: VerticalAlign; +export type DucDocStyle = {}; - /** How the block content attaches to the leader's landing line. */ - blockAttachment: BlockAttachment; +export type DucDocElement = _DucElementBase & { + type: "doc"; + text: string; + fileId: ExternalFileId | null; + /** Configuration for rendering the document in a grid layout */ + gridConfig: DocumentGridConfig; }; -/** - * Defines the content attached to a leader. The leader is atomic, so its - * content is defined within it, not as a separate scene element. - */ -export type LeaderContent = - | { - type: "text"; - /** The rich text or markdown string for the content. */ - text: DucTextElement["text"]; - } - | { - type: "block"; - /** The ID of the DucBlock definition to use as content. */ - blockId: InstanceId; - /** - * The attribute values and element overrides for this specific block instance. - * This is a subset of the properties from DucBlockInstance. - */ - instanceData: { - attributeValues?: DucBlockInstance["attributeValues"]; - elementOverrides?: DucBlockInstance["elementOverrides"]; - }; - }; -/** - * A leader element that connects an annotation (text or a block) to a point - * or feature in the drawing. It is a single, atomic entity that manages its - * own geometry and content. It is designed to be compatible with the modern - */ -export type DucLeaderElement = _DucLinearElementBase & DucLeaderStyle & { - type: "leader"; - /** - * The content attached to the leader. Stored internally to keep the element atomic. - */ - leaderContent: LeaderContent | null; - - /** - * The anchor point for the content block, in world coordinates. - * The leader's dogleg/landing connects to this point. - */ - contentAnchor: GeometricPoint; -}; -//// === DIMENSION ELEMENTS === -export type DimensionType = ValueOf; -export type MarkEllipseCenter = ValueOf; -export type ToleranceDisplay = ValueOf; -export type DimensionFitRule = ValueOf; -export type DimensionTextPlacement = ValueOf; -/** - * The key geometric points that define a dimension's measurement. - * The meaning of each point depends on the dimensionType. - */ -export type DimensionDefinitionPoints = { - /** - * Primary origin point (e.g., start of a linear dimension, point on a circle for radius). - * DXF DefPoint1 - */ - origin1: GeometricPoint; - - /** - * Secondary origin point (e.g., end of a linear dimension, end of an arc). - * DXF DefPoint2 - */ - origin2?: GeometricPoint; - - /** - * A point that defines the position of the dimension line or arc. - * DXF DefPoint3 - */ - location: GeometricPoint; - - /** - * Center point (for radial/angular/diameter) or vertex (for angular). - * DXF DefPoint4 - */ - center?: GeometricPoint; +//// === 3D Model Element === - /** - * A point defining a jog in the dimension line. - * DXF DefPoint5 - */ - jog?: GeometricPoint; +export type Viewer3DClipPlane = { + enabled: boolean; + value: number; + normal: [number, number, number] | null; }; -/** - * Defines the complete visual appearance of a dimension. - * This style can be stored in a library and applied to many dimension instances. - */ -export type DucDimensionStyle = { - /** Style for the main dimension line and its arrowheads */ - dimLine: { - stroke: ElementStroke; - /** Gap between the dimension line and the text when text is placed inside */ - textGap: PrecisionValue; - }; - - /** Style for the extension lines that connect the dimension to the feature */ - extLine: { - stroke: ElementStroke; - /** Distance to extend the line beyond the dimension line */ - overshoot: PrecisionValue; - /** Gap between the feature origin and the start of the extension line */ - offset: PrecisionValue; - }; - - /** The text style used for the dimension's measurement and annotations */ - textStyle: DucTextStyle; - /** Configuration for arrowheads and other symbols */ - symbols: { - /** - * Override the arrow heads for each dimension line - * The tuple represents [startHead, endHead] - */ - headsOverride?: [DucHead, DucHead]; - /** Center mark configuration for radial/diameter dimensions */ - centerMark: { - type: MarkEllipseCenter; - size: PrecisionValue; - }; - }; - - /** Default settings for dimensional tolerances */ - tolerance: { - /** Whether to display tolerances by default */ - enabled: boolean; - /** Default display method (e.g., Symmetrical, Limits) */ - displayMethod: ToleranceDisplay; - /** Default upper tolerance value */ - upperValue: number; - /** Default lower tolerance value */ - lowerValue: number; - /** Decimal places for tolerance values */ - precision: number; - /** The text style for the tolerance values, inheriting from the main textStyle */ - textStyle: Partial; - }; - - /** Rules for how to arrange text and arrows when space is limited */ - fit: { - /** Determines what to move when text and arrows don't fit between extension lines */ - rule: DimensionFitRule; - /** If text is moved, determines its placement relative to the dimension line */ - textPlacement: DimensionTextPlacement; - /** Forces text to always be placed between extension lines */ - forceTextInside: boolean; - }; +export type Viewer3DMaterial = { + metalness: number; + roughness: number; + defaultOpacity: number; + /** Packed RGB color (e.g. 0xFFFFFF) */ + edgeColor: number; + ambientIntensity: number; + directIntensity: number; }; -/** - * A dimension element is an atomic annotation that measures and displays the - * distance or angle between points. It renders its own lines, arrows, and text - * based on its definition points and style, ensuring a clean and robust data model. - */ -export type DucDimensionElement = _DucElementBase & DucDimensionStyle & { - type: "dimension"; - - /** The type of dimension, which determines how definition points are interpreted */ - dimensionType: DimensionType; - /** The core geometric points that define what is being measured */ - definitionPoints: DimensionDefinitionPoints; - - /** - * The oblique angle for the extension lines, used for isometric-style dimensions. - * An angle of 0 means they are perpendicular to the dimension line. - */ - obliqueAngle: Radian; - - /** - * For 'ordinate' dimensions, specifies whether it measures the X or Y coordinate. - */ - ordinateAxis: Axis | null; - - /** - * Defines how the definition points are associated with other elements when `isAssociative` is true. - * The keys correspond to the keys in `definitionPoints`. - */ - bindings?: { - origin1: DucPointBinding | null; - origin2: DucPointBinding | null; - center: DucPointBinding | null; - }; - - /** - * User-override for the dimension text content. - * - If `null`, the measured value is automatically calculated and displayed. - * - If a string, this value is displayed instead. - * Use `<>` within the string (e.g., "R<>") to include the calculated measurement. - */ - textOverride: string | null; - - /** - * User-override for the text position. - * - If `null`, the position is automatically determined by the 'fit' rules in the style. - * - If a point, the text is moved to this exact location. - */ - textPosition: GeometricPoint | null; - - /** Instance-specific overrides for tolerance, taking precedence over the style's defaults */ - toleranceOverride?: Partial; - - /** If this is a baseline dimension, contains data linking it to the base */ - baselineData?: { - baseDimensionId: string; - }; - - /** If this is a continued dimension, contains data linking it to the previous one */ - continueData?: { - continueFromDimensionId: string; - }; - - /** Calculated measurement value (read-only, for inspection/API use) */ - readonly calculatedValue: PrecisionValue; -}; - - - - -//// === Feature Control Frame === - -export type GDTSymbol = ValueOf; -export type MaterialCondition = ValueOf; -export type FeatureModifier = ValueOf; -export type ToleranceZoneType = ValueOf; -export type DatumTargetType = ValueOf; -export type ToleranceType = ValueOf; -export type DatumBracketStyle = ValueOf; - - -// --- Component Data Structures --- - -/** - * Represents a single datum reference in a datum reference frame (e.g., "| A(M) |"). - */ -export type DatumReference = { - /** The datum letter or letters (e.g., "A", "B", "A-B") */ - letters: string; - /** Material condition modifier, if any (e.g., Maximum, Least) */ - modifier?: MaterialCondition; +export type Viewer3DZebra = { + active: boolean; + stripeCount: number; + stripeDirection: number; + /** Available: "blackwhite" | "colorful" | "grayscale" */ + colorScheme: string; + opacity: number; + /** Available: "reflection" | "normal" */ + mappingMode: string; }; -/** - * Defines the tolerance value and its related specifications within a segment. - */ -export type ToleranceClause = { - /** The primary tolerance value, represented as a string to support various formats */ - value: string; - /** The type of tolerance zone (e.g., Cylindrical, Spherical) */ - zoneType?: ToleranceZoneType; - /** A list of modifiers that apply directly to the feature, like Diameter or Projected Zone */ - featureModifiers: readonly FeatureModifier[]; - /** Material condition modifier for the tolerance itself */ - materialCondition?: MaterialCondition; +export type Viewer3DCamera = { + /** Available: "orbit" | "trackball" */ + control: string; + ortho: boolean; + /** Available: "Z" | "Y" */ + up: string; + position: [number, number, number]; + /** Camera rotation as quaternion [x, y, z, w] */ + quaternion: [number, number, number, number]; + /** The point the camera orbits around / looks at */ + target: [number, number, number]; + zoom: number; + panSpeed: number; + rotateSpeed: number; + zoomSpeed: number; + holroyd: boolean; }; -/** - * A single segment within a Feature Control Frame row. - * Typically contains a geometric symbol, a tolerance clause, and datum references. - */ -export type FeatureControlFrameSegment = { - /** The geometric characteristic symbol (e.g., Position, Flatness, Profile) */ - symbol: GDTSymbol; - /** The tolerance specification for this segment */ - tolerance: ToleranceClause; - /** The datum reference frame, ordered by priority */ - datums: readonly [ - primary?: DatumReference, - secondary?: DatumReference, - tertiary?: DatumReference, - ]; +export type Viewer3DGridPlanes = { + xy: boolean; + xz: boolean; + yz: boolean; }; - -// --- Style and Element Definitions --- - -/** - * Defines the visual appearance of a Feature Control Frame. - * This can be stored in a style library and reused. - */ -export type DucFeatureControlFrameStyle = { - /** The base text style for numbers and letters within the frame */ - textStyle: DucTextStyle; - - /** Layout and spacing properties */ - layout: { - /** Padding between the content and the outer frame border */ - padding: PrecisionValue; - /** Spacing between segments (vertical lines) in a row */ - segmentSpacing: PrecisionValue; - /** Spacing between rows in a composite frame */ - rowSpacing: PrecisionValue; - }; - - /** Configuration for GD&T symbols */ - symbols: { - /** Scale factor for symbols relative to the text height */ - scale: number; - }; - - /** Styling for datum references */ - datumStyle: { - /** The style of bracket to draw around datum letters */ - bracketStyle: DatumBracketStyle; - }; +export type Viewer3DGrid = + | { type: "uniform"; value: boolean } + | { type: "perPlane"; planes: Viewer3DGridPlanes }; + +export type Viewer3DDisplay = { + wireframe: boolean; + transparent: boolean; + blackEdges: boolean; + grid: Viewer3DGrid; + /** Whether to show the XYZ axes indicator */ + axesVisible: boolean; + /** If true, axes are positioned at world origin (0,0,0); if false, at object center */ + axesAtOrigin: boolean; }; -/** - * A Geometric Dimensioning and Tolerancing (GD&T) Feature Control Frame element. - * This element can represent a tolerance specification or define a datum feature. - */ -export type DucFeatureControlFrameElement = _DucElementBase & DucFeatureControlFrameStyle & { - type: "featurecontrolframe"; - - /** - * An array of rows. Most FCFs have one row. Composite frames have multiple rows. - * Each row is an array of segments that are drawn horizontally. - */ - rows: readonly (readonly FeatureControlFrameSegment[])[]; - - /** - * Modifiers that apply to the entire feature control frame. - */ - frameModifiers?: { - allAround?: boolean; - allOver?: boolean; - continuousFeature?: boolean; - between?: { - start: string; // Identifier for start point, e.g., "A" - end: string; // Identifier for end point, e.g., "B" - }; - projectedToleranceZone?: PrecisionValue; - }; - - /** - * A reference to a leader element that points to this FCF. - * The leader element itself holds the geometry and start/end bindings. - * This provides a simple, one-way link. - */ - leaderElementId: DucLeaderElement["id"] | null; - - /** - * If present, this element acts as a **Datum Feature Symbol**, defining the specified - * datum letter and attached to a feature. The `rows` property would be empty. - */ - datumDefinition?: { - /** The datum letter this symbol defines (e.g., "A", "B") */ - letter: string; - /** - * An optional binding directly to a point on the feature being identified as the datum. - * Used when a leader is not present. - */ - featureBinding?: DucPointBinding; - }; +export type Viewer3DClipping = { + x: Viewer3DClipPlane; + y: Viewer3DClipPlane; + z: Viewer3DClipPlane; + intersection: boolean; + showPlanes: boolean; + objectColorCaps: boolean; }; - - - - - -//// === Doc Element === - - -export type TextFlowDirection = ValueOf; -export type ColumnType = ValueOf; -export type StackedTextAlign = ValueOf; - -/** - * Defines advanced styling for a DucDocElement, extending the base text styles. - * These properties control the overall layout and appearance of the document block. - */ -export type DucDocStyle = DucTextStyle & { - - - // === PARAGRAPH FORMATTING === - paragraph: { - /** Indentation for the first line of each paragraph */ - firstLineIndent: PrecisionValue; - /** Indentation for all lines except the first (hanging indent) */ - hangingIndent: PrecisionValue; - /** Indentation from the left edge of the element's bounding box */ - leftIndent: PrecisionValue; - /** Indentation from the right edge of the element's bounding box */ - rightIndent: PrecisionValue; - /** Extra spacing added before each paragraph */ - spaceBefore: PrecisionValue; - /** Extra spacing added after each paragraph */ - spaceAfter: PrecisionValue; - /** A list of tab stop positions from the left indent */ - tabStops: PrecisionValue[]; - }; - - // === AUTOMATIC STACK/FRACTION FORMATTING === - stackFormat: { - /** Enable automatic stacking of text around specified characters */ - autoStack: boolean; - /** Characters that trigger stacking (e.g., "/", "#", "^") */ - stackChars: string[]; - /** Properties for how stacked text is rendered */ - properties: { - /** Scale of the upper text relative to the main font size */ - upperScale: number; // e.g., 0.7 - /** Scale of the lower text relative to the main font size */ - lowerScale: number; // e.g., 0.7 - /** Alignment of stacked text (e.g., center, decimal) */ - alignment: StackedTextAlign; - }; - }; +export type Viewer3DExplode = { + active: boolean; + value: number; }; -/** - * Defines the properties of a single column within a multi-column DucDocElement. - * The collection of these definitions dictates the overall column layout. - */ -export type TextColumn = { - /** The width of the column in drawing units. */ - width: PrecisionValue; - /** The space between this column and the next, also known as the gutter. */ - gutter: PrecisionValue; -}; -/** - * A rich text document element - * It supports complex formatting through its style properties and uses a Markdown - * string for inline text styling, which can be edited with a rich text editor. - */ -export type DucDocElement = _DucElementBase & DucDocStyle & { - type: "doc"; - - /** - * The content of the document, stored as a code string. - * This approach allows to use a rich text editor that can compile to PDF using Typst code - * - * It can also contain wildcards like `{@fieldname}` for dynamic data insertion. - * Example: "This is **bold text** and this is a {color:red}red word{/color}." - * - * It can also contain zero or more placeholders in the format `{{tag}}`. - * Example: "This document was last saved on {{SaveDate}} by {{Author}}." - */ - text: string; - fileId: ExternalFileId | null; - - - /** Configuration for rendering the document in a grid layout */ - gridConfig: DocumentGridConfig; - - - /** - * An array of metadata objects that define the behavior of the placeholders - * found in the `text` property. If this is empty, the text is treated - * as purely static. - */ - dynamic: readonly DucTextDynamicPart[]; - - /** Direction of text flow for multi-column layouts */ - flowDirection: TextFlowDirection; - - /** - * Defines the structural properties of the columns. - */ - columns: { - /** - * - `none`: A single column. - * - `static`: A fixed number of columns with defined widths/heights. - * - `dynamic`: Text flows automatically between columns based on height. - */ - type: ColumnType; - /** An array defining each column's properties */ - definitions: TextColumn[]; - /** Whether column height adjusts automatically in dynamic mode */ - autoHeight: boolean; - }; - /** - * Text sizing behavior: - * - `true`: Width and/or height adjust to fit text content. - * - `false`: Text wraps or is clipped to fit the element's fixed bounds. - * @default true - */ - autoResize: boolean; +export type Viewer3DState = { + camera: Viewer3DCamera; + display: Viewer3DDisplay; + material: Viewer3DMaterial; + clipping: Viewer3DClipping; + explode: Viewer3DExplode; + zebra: Viewer3DZebra; }; - - - - - - - -//// === 3D Model Element === -// TODO: Add camera and view config - /** - * An element that embeds a 3D model on the 2D canvas, defined by build123d python code. + * An element that embeds a 3D model on the 2D canvas. * It includes its own 3D view and display controls. */ export type DucModelElement = _DucElementBase & { type: "model"; - /** Defines the source of the model using build123d python code */ - source: string; + /** The specific type of 3D model, e.g., "PYTHON", "DXF", "IFC", "STL", "OBJ", "STEP", etc. */ + modelType: string | null; + + /** Defines the source code of the model using build123d python code */ + code: string | null; /** The last known SVG path representation of the 3D model for quick rendering on the canvas */ svgPath: string | null; - /** Possibly connected external files, such as STEP, STL or other reference models */ + /** Possibly connected external files, such as STEP, STL, DXF, etc. */ fileIds: ExternalFileId[]; + + /** The last known 3D viewer state for the model */ + viewerState: Viewer3DState | null; }; \ No newline at end of file diff --git a/packages/ducjs/src/types/elements/typeChecks.ts b/packages/ducjs/src/types/elements/typeChecks.ts index 83fbc72c..79c1ea99 100644 --- a/packages/ducjs/src/types/elements/typeChecks.ts +++ b/packages/ducjs/src/types/elements/typeChecks.ts @@ -1,35 +1,35 @@ import type { ElementOrToolType } from ".."; -import type { MarkNonNullable } from "../utility-types"; import { assertNever } from "../../utils"; import { Bounds, LineSegment, TuplePoint } from "../geometryTypes"; +import type { MarkNonNullable } from "../utility-types"; import type { - DucArrowElement, - DucBindableElement, - DucDocElement, - DucElbowArrowElement, - DucElement, - DucElementType, - DucEmbeddableElement, - DucFlowchartNodeElement, - DucFrameElement, - DucFrameLikeElement, - DucFreeDrawElement, - DucImageElement, - DucLinearElement, - DucPdfElement, - DucPlotElement, - DucTableElement, - DucPointBinding, - DucTextContainer, - DucTextElement, - DucTextElementWithContainer, - FixedPointBinding, - InitializedDucImageElement, - DucNonSelectionElement, - DucEllipseElement, - DucPolygonElement, - NonDeleted, - DucIframeLikeElement + DucArrowElement, + DucBindableElement, + DucDocElement, + DucElbowArrowElement, + DucElement, + DucElementType, + DucEllipseElement, + DucEmbeddableElement, + DucFlowchartNodeElement, + DucFrameElement, + DucFrameLikeElement, + DucFreeDrawElement, + DucIframeLikeElement, + DucImageElement, + DucLinearElement, + DucNonSelectionElement, + DucPdfElement, + DucPlotElement, + DucPointBinding, + DucPolygonElement, + DucTableElement, + DucTextContainer, + DucTextElement, + DucTextElementWithContainer, + FixedPointBinding, + InitializedDucImageElement, + NonDeleted } from "./"; export const isInitializedImageElement = ( @@ -279,17 +279,12 @@ export const isDucElement = ( case "frame": case "image": case "table": - case "dimension": - case "leader": case "doc": case "selection": case "model": - case "featurecontrolframe": - case "viewport": case "plot": - case "xray": case "pdf": - case "mermaid": { + { return true; } default: { diff --git a/packages/ducjs/src/types/geometryTypes.ts b/packages/ducjs/src/types/geometryTypes.ts index e0db0b79..4a837da9 100644 --- a/packages/ducjs/src/types/geometryTypes.ts +++ b/packages/ducjs/src/types/geometryTypes.ts @@ -1,4 +1,4 @@ -import { AXIS } from "../flatbuffers/duc"; +import { AXIS } from "../enums"; import { ScopedValue, ValueOf } from "./"; /** diff --git a/packages/ducjs/src/types/index.ts b/packages/ducjs/src/types/index.ts index 694a4c8f..218a89fc 100644 --- a/packages/ducjs/src/types/index.ts +++ b/packages/ducjs/src/types/index.ts @@ -3,16 +3,8 @@ export * from "./geometryTypes"; export * from "./typeChecks"; export * from "./utility-types"; -import { OBJECT_SNAP_MODE, PRUNING_LEVEL } from "../flatbuffers/duc"; +import { PRUNING_LEVEL } from "../enums"; import { SupportedMeasures } from "../technical/scopes"; -import { Standard } from "../technical/standards"; -import type { - GRID_DISPLAY_TYPE, - GRID_TYPE, - SNAP_MARKER_SHAPE, - SNAP_MODE, - SNAP_OVERRIDE_BEHAVIOR -} from "../utils/constants"; import { DucBindableElement, DucBlock, @@ -39,9 +31,8 @@ import { GeometricPoint, Percentage, Radian, - ScaleFactor, } from "./geometryTypes"; -import { MakeBrand, MarkOptional, MaybePromise, ValueOf } from "./utility-types"; +import { MarkOptional, MaybePromise, ValueOf } from "./utility-types"; /** * Root data structure for the stored data state @@ -67,8 +58,6 @@ export interface ExportedDataState { groups: readonly DucGroup[]; regions: readonly DucRegion[]; layers: readonly DucLayer[]; - standards: readonly Standard[]; - files: DucExternalFiles | undefined; /** In case it is needed to embed the version control into the file format */ @@ -214,52 +203,12 @@ export type DucGlobalState = { */ mainScope: Scope; - /** - * The global linetype scale for the entire drawing. - */ - dashSpacingScale: ScaleFactor; - - /** - * Governs if linetype scale is affected by paper space viewport scale. - */ - isDashSpacingAffectedByViewportScale: boolean; - /** * Exponent threshold for determining when to change measurement scope (up or down). * This value defines a +/- tolerance range around the exponent of the current scope. - * A scope change is triggered if the exponent of *either* the calculated real viewport width - * or the calculated real viewport height falls outside this tolerance range relative to the current scope's exponent. - * - * Example scenario: - * appState.scopeExponentThreshold = 2 - * appState.scope = "mm" // (approximately 1e-3 relative to reference unit (meter)) - * appState.zoom = dynamic value representing the current zoom level - * - * The real viewport size is calculated as: viewportSize * zoom - * - * This system ensures measurements remain representable with appropriate precision - * as users zoom in and out, automatically adjusting between units like mm, μm, nm, etc. */ scopeExponentThreshold: number; - /** - * A rule for whether newly created dimensions should be associative by default. - */ - dimensionsAssociativeByDefault: boolean; - - /** - * A fundamental choice for the drawing's scaling architecture. - */ - useAnnotativeScaling: boolean; - /** - * Default display precision for various unit types. The user can override - * this temporarily in their session state (DucState). - */ - displayPrecision: { - linear: number; - angular: number; - }; - /** The level of pruning to the versions from the version graph. */ pruningLevel: PruningLevel; }; @@ -270,19 +219,11 @@ export type DucLocalState = { * mm, cm, m, in, ft, yd, mi, etc... */ scope: Scope; - /** The active standard for the design */ - activeStandardId: Standard["id"]; scrollX: PrecisionValue; scrollY: PrecisionValue; zoom: Zoom; - /** - * list of active grids ordered by z index, most on top is first - * */ - activeGridSettings: Identifier["id"][] | null; - activeSnapSettings: Identifier["id"] | null; - isBindingEnabled: boolean; // Current item is usually a quick access state to apply as default to certain things when drawing @@ -296,16 +237,6 @@ export type DucLocalState = { currentItemEndLineHead: LineHead | null; currentItemRoundness: DucElement["roundness"]; - /** - * grid cell px size - * @deprecated use activeGridSettings instead - * */ - gridSize: number; - /** - * @deprecated use activeGridSettings instead - * */ - gridStep: number; - /** * Pen mode is enabled, creates a better experience for drawing with a pen */ @@ -328,6 +259,7 @@ export type DucLocalState = { outlineModeEnabled: boolean; /** When enabled, the version graph is not updated automatically. The user needs to manually update the graph for new versions to be saved in version control. */ manualSaveMode: boolean; + decimalPlaces: number; }; export type NormalizedZoomValue = number & { _brand: "normalizedZoom" }; @@ -439,300 +371,8 @@ export type ElementsPendingErasure = Set; export type PendingDucElements = DucElement[]; -export type GridDisplayType = ValueOf; -export type GridType = ValueOf; - -/** - * Unified grid styling (works for lines, dots, crosses) - */ -export type GridStyle = { - color: string; - opacity: Percentage; - dashPattern: number[]; // for dashed lines -}; - -/** - * Polar grid specific settings - */ -export type PolarGridSettings = { - /** Number of radial divisions (spokes) */ - radialDivisions: number; - /** Radial spacing between concentric circles */ - radialSpacing: PrecisionValue; - /** Whether to show angle labels */ - showLabels: boolean; -}; - -/** - * Isometric grid specific settings - */ -export type IsometricGridSettings = { - /** Left plane angle (typically 30 degrees) */ - leftAngle: Radian; - /** Right plane angle (typically 30 degrees) */ - rightAngle: Radian; -}; - -/** - * Grid settings configuration - */ -export type GridSettings = { - /** Grid coordinate system type */ - type: GridType; - - /** Whether this grid is read-only */ - readonly: boolean; - - /** How the grid is displayed */ - displayType: GridDisplayType; - - /** - * Whether the grid spacing is adaptive (changes with zoom level) or fixed. - */ - isAdaptive: boolean; - - /** Spacing between major grid lines along X-axis */ - xSpacing: PrecisionValue; - - /** Spacing between major grid lines along Y-axis */ - ySpacing: PrecisionValue; - - /** Number of minor divisions between major lines */ - subdivisions: number; - - /** Grid origin point */ - origin: GeometricPoint; - - /** Grid rotation angle */ - rotation: Radian; - - /** Whether grid follows the active UCS */ - followUCS: boolean; - - /** Major grid line/dot styling */ - majorStyle: GridStyle; - - /** Minor grid line/dot styling */ - minorStyle: GridStyle; - - /** Show minor subdivisions */ - showMinor: boolean; - - /** Minimum zoom level where grid becomes visible */ - minZoom: number; - - /** Maximum zoom level where grid remains visible */ - maxZoom: number; - - /** Whether to auto-hide when too dense */ - autoHide: boolean; - - /** Polar grid settings (when type is POLAR) */ - polarSettings?: PolarGridSettings; - - /** Isometric grid settings (when type is ISOMETRIC) */ - isometricSettings?: IsometricGridSettings; - - /** Whether this grid affects snapping */ - enableSnapping: boolean; -}; - -export type ObjectSnapMode = ValueOf; -export type SnapOverrideBehavior = ValueOf; -export type SnapMarkerShape = ValueOf; -export type SnapMode = ValueOf; - -/** - * Temporary snap override settings - */ -export type SnapOverride = { - key: string; // keyboard key - behavior: SnapOverrideBehavior; -}; - -/** - * Dynamic snap behavior configuration - */ -export type DynamicSnapSettings = { - enabledDuringDrag: boolean; - enabledDuringRotation: boolean; - enabledDuringScale: boolean; -}; - -/** - * Polar tracking configuration - */ -export type PolarTrackingSettings = { - enabled: boolean; - angles: Radian[]; - /** - * Additional increment angle for polar tracking - */ - incrementAngle?: Radian; - /** - * Whether to track from last point or from base - */ - trackFromLastPoint: boolean; - /** - * Display polar distance and angle - */ - showPolarCoordinates: boolean; -}; - -/** - * Tracking line display settings - */ -export type TrackingLineStyle = { - color: string; - opacity: Percentage; - dashPattern?: number[]; -}; - -/** - * Layer-specific snap filters - */ -export type LayerSnapFilters = { - includeLayers?: string[]; - excludeLayers?: string[]; -}; - -/** - * Snap marker configuration for each snap mode - */ -export type SnapMarkerStyle = { - shape: SnapMarkerShape; - color: string; -}; - -/** - * Visual feedback settings for snap markers - */ -export type SnapMarkerSettings = { - enabled: boolean; - size: number; - duration?: number; // for temporary markers (ms) - styles: Record; -}; - -/** - * Defines the properties of the drawing snap mode. - */ -export type SnapSettings = { - /** Whether this snap settings is read-only */ - readonly: boolean; - - /** - * The snap angle for rotated snap grids (e.g., for isometric snapping). - * In radians. Default is 0. - */ - twistAngle: Radian; - - /** - * Snap tolerance in pixels - how close cursor must be to trigger snap - */ - snapTolerance: number; - - /** - * Aperture size for object snap detection (in pixels) - */ - objectSnapAperture: number; - - /** - * Whether orthogonal mode is enabled (constrains to 0/90 degrees) - */ - isOrthoModeOn: boolean; - - /** - * Polar tracking configuration - */ - polarTracking: PolarTrackingSettings; - - /** - * Whether object snap (Osnap) is enabled. - * Osnap allows snapping to geometric points on existing objects. - */ - isObjectSnapOn: boolean; - - /** - * Set of active object snap modes - */ - activeObjectSnapModes: ObjectSnapMode[]; - - /** - * Priority order when multiple snaps are available at cursor position - */ - snapPriority: ObjectSnapMode[]; - - /** - * Whether to show tracking lines/vectors - */ - showTrackingLines: boolean; - - /** - * Tracking line display settings - */ - trackingLineStyle?: TrackingLineStyle; - - /** - * Snap behavior during element creation/modification - */ - dynamicSnap: DynamicSnapSettings; - - /** - * Temporary snap override settings (e.g., holding shift) - */ - temporaryOverrides?: SnapOverride[]; - - /** - * Incremental snap distance (for relative movements) - */ - incrementalDistance?: number; - - /** - * Magnetic snap strength (0-100) - */ - magneticStrength?: number; - - /** - * Layer-specific snap settings - */ - layerSnapFilters?: LayerSnapFilters; - - /** - * Element type filters for object snap - */ - elementTypeFilters?: DucElementType[]; - - /** - * Running object snap vs single pick mode - */ - snapMode: SnapMode; - - /** - * Visual feedback settings - */ - snapMarkers: SnapMarkerSettings; - - /** - * Construction/guide line snapping - */ - constructionSnapEnabled: boolean; - - /** - * Snap to grid intersections only - */ - snapToGridIntersections?: boolean; -}; - -/** Runtime gridSize value. Null indicates disabled grid. */ -export type NullableGridSize = - | (DucLocalState["gridSize"] & MakeBrand<"NullableGridSize">) - | null; - //// VERSION CONTROL export type VersionId = string; -/** JSON Patch RFC6902 */ -export type JSONPatch = Array<{ op: string; path: string; from?: string; value?: any }>; export type PruningLevel = ValueOf; export interface VersionBase { @@ -746,22 +386,54 @@ export interface VersionBase { export interface Checkpoint extends VersionBase { type: "checkpoint"; + versionNumber: number; + schemaVersion: number; + isSchemaBoundary: boolean; data: Uint8Array; sizeBytes: number; } export interface Delta extends VersionBase { type: "delta"; - patch: JSONPatch; + versionNumber: number; + schemaVersion: number; + baseCheckpointId: VersionId; + /** Compressed binary data for the delta (zlib). */ + payload: Uint8Array; + sizeBytes: number; +} + +export interface SchemaMigration { + fromSchemaVersion: number; + toSchemaVersion: number; + migrationName: string; + migrationChecksum?: string; + appliedAt: number; + boundaryCheckpointId?: string; +} + +export interface VersionChain { + id: string; + schemaVersion: number; + startVersion: number; + endVersion?: number; + migration?: SchemaMigration; + rootCheckpointId?: string; +} + +export interface VersionGraphMetadata { + currentVersion: number; + currentSchemaVersion: number; + chainCount: number; + lastPruned: number; + totalSize: number; } export interface VersionGraph { userCheckpointVersionId: VersionId; latestVersionId: VersionId; + chains: VersionChain[]; checkpoints: Checkpoint[]; deltas: Delta[]; - metadata: { - lastPruned: number; - totalSize: number; - }; + metadata: VersionGraphMetadata; } diff --git a/packages/ducjs/src/utils/constants.ts b/packages/ducjs/src/utils/constants.ts index 31645ad6..9fc4e550 100644 --- a/packages/ducjs/src/utils/constants.ts +++ b/packages/ducjs/src/utils/constants.ts @@ -1,8 +1,8 @@ -import { ELEMENT_CONTENT_PREFERENCE, HATCH_STYLE, OBJECT_SNAP_MODE, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN } from "../flatbuffers/duc"; -import { GridSettings, RawValue, ScopedValue, SnapSettings } from "../types"; +import { ELEMENT_CONTENT_PREFERENCE, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN } from "../enums"; +import { MAX_ZOOM, MIN_ZOOM, NEUTRAL_SCOPE } from "../technical/scopes"; +import { RawValue, ScopedValue } from "../types"; import { DucElement, DucEllipseElement, DucFreeDrawElement, DucTextElement, ElementBackground, ElementStroke, FontFamilyValues } from "../types/elements"; import { Percentage, Radian } from "../types/geometryTypes"; -import { MAX_ZOOM, MIN_ZOOM, NEUTRAL_SCOPE } from "../technical/scopes"; export const COLOR_PALETTE = { @@ -290,7 +290,6 @@ export const DEFAULT_FRAME_STYLE: { export const DEFAULT_ELEMENT_PROPS: { isVisible: DucElement["isVisible"]; isPlot: DucElement["isPlot"]; - isAnnotative: DucElement["isAnnotative"]; stroke: ElementStroke; background: ElementBackground; roundness: DucElement["roundness"]; @@ -331,7 +330,6 @@ export const DEFAULT_ELEMENT_PROPS: { }, isVisible: true, isPlot: true, - isAnnotative: false, roundness: { value: 0 as RawValue, scoped: 0 as ScopedValue }, opacity: 1 as Percentage, locked: false, @@ -399,225 +397,6 @@ export const DEFAULT_ELLIPSE_ELEMENT: { } - - -/** - * Grid display types - */ -export const GRID_DISPLAY_TYPE = { - LINES: 10, - DOTS: 11, - CROSSES: 12, - ADAPTIVE: 13, // Changes based on zoom level -} as const; - -/** - * Grid coordinate system types - */ -export const GRID_TYPE = { - RECTANGULAR: 10, - ISOMETRIC: 11, - POLAR: 12, - TRIANGULAR: 13, - CUSTOM: 14, -} as const; - - -/** - * Default grid configurations - */ -export const DEFAULT_GRID_SETTINGS: GridSettings = { - readonly: true, - isAdaptive: true, - type: GRID_TYPE.RECTANGULAR, - displayType: GRID_DISPLAY_TYPE.LINES, - - xSpacing: { value: 10 as RawValue, scoped: 10 as ScopedValue }, - ySpacing: { value: 10 as RawValue, scoped: 10 as ScopedValue }, - subdivisions: 5, - - origin: { x: 0, y: 0 }, - rotation: 0 as Radian, - followUCS: true, - - majorStyle: { - color: "#CCCCCC", - opacity: 0.5 as Percentage, - dashPattern: [1, 1], - }, - minorStyle: { - color: "#EEEEEE", - opacity: 0.3 as Percentage, - dashPattern: [0.5, 0.5], - }, - - showMinor: true, - minZoom: 0.1, - maxZoom: 100, - autoHide: true, - - enableSnapping: true, -}; - -/** - * Predefined grid configurations - */ -export const PREDEFINED_GRIDS = { - ARCHITECTURAL_IMPERIAL: "arch-imperial", - ARCHITECTURAL_METRIC: "arch-metric", - ENGINEERING_IMPERIAL: "eng-imperial", - ENGINEERING_METRIC: "eng-metric", - ISOMETRIC_30: "iso-30", - POLAR_DEGREES: "polar-deg", - FINE_DETAIL: "fine-detail", -} as const; - -/** - * Snap behavior modes - */ -export const SNAP_MODE = { - RUNNING: 10, - SINGLE: 11, -} as const; -/** - * Snap override behaviors - */ -export const SNAP_OVERRIDE_BEHAVIOR = { - DISABLE: 10, - FORCE_GRID: 11, - FORCE_OBJECT: 12, -} as const; - -/** - * Snap marker shapes - */ -export const SNAP_MARKER_SHAPE = { - SQUARE: 10, - CIRCLE: 11, - TRIANGLE: 12, - X: 13, -} as const; - - - - -/** - * Default snap settings configuration - */ -export const DEFAULT_SNAP_SETTINGS: SnapSettings = { - readonly: true, - twistAngle: 0 as Radian, - snapTolerance: 10, - objectSnapAperture: 8, - isOrthoModeOn: false, - polarTracking: { - enabled: false, - angles: [ - 0 as Radian, - Math.PI / 4 as Radian, - Math.PI / 2 as Radian, - 3 * Math.PI / 4 as Radian, - Math.PI as Radian, - 5 * Math.PI / 4 as Radian, - 3 * Math.PI / 2 as Radian, - 7 * Math.PI / 4 as Radian - ], - trackFromLastPoint: true, - showPolarCoordinates: true, - }, - isObjectSnapOn: true, - activeObjectSnapModes: [ - OBJECT_SNAP_MODE.ENDPOINT, - OBJECT_SNAP_MODE.MIDPOINT, - OBJECT_SNAP_MODE.CENTER, - OBJECT_SNAP_MODE.INTERSECTION, - ], - snapPriority: [ - OBJECT_SNAP_MODE.ENDPOINT, - OBJECT_SNAP_MODE.INTERSECTION, - OBJECT_SNAP_MODE.MIDPOINT, - OBJECT_SNAP_MODE.CENTER, - OBJECT_SNAP_MODE.QUADRANT, - OBJECT_SNAP_MODE.TANGENT, - OBJECT_SNAP_MODE.PERPENDICULAR, - OBJECT_SNAP_MODE.NEAREST, - ], - showTrackingLines: true, - trackingLineStyle: { - color: "#00FF00", - opacity: 0.7 as Percentage, - dashPattern: [2, 2], - }, - dynamicSnap: { - enabledDuringDrag: true, - enabledDuringRotation: true, - enabledDuringScale: true, - }, - temporaryOverrides: [ - { key: "Shift", behavior: SNAP_OVERRIDE_BEHAVIOR.DISABLE }, - { key: "F9", behavior: SNAP_OVERRIDE_BEHAVIOR.FORCE_GRID }, - ], - magneticStrength: 50, - snapMode: SNAP_MODE.RUNNING, - snapMarkers: { - enabled: true, - size: 8, - duration: 2000, - styles: { - [OBJECT_SNAP_MODE.NONE]: { shape: SNAP_MARKER_SHAPE.SQUARE, color: "#FFFFFF" }, - [OBJECT_SNAP_MODE.ENDPOINT]: { shape: SNAP_MARKER_SHAPE.SQUARE, color: "#FF0000" }, - [OBJECT_SNAP_MODE.MIDPOINT]: { shape: SNAP_MARKER_SHAPE.TRIANGLE, color: "#00FF00" }, - [OBJECT_SNAP_MODE.INTERSECTION]: { shape: SNAP_MARKER_SHAPE.X, color: "#FF00FF" }, - [OBJECT_SNAP_MODE.EXTENSION]: { shape: SNAP_MARKER_SHAPE.CIRCLE, color: "#FFA500" }, - [OBJECT_SNAP_MODE.PERPENDICULAR]: { shape: SNAP_MARKER_SHAPE.SQUARE, color: "#800080" }, - [OBJECT_SNAP_MODE.TANGENT]: { shape: SNAP_MARKER_SHAPE.CIRCLE, color: "#008080" }, - [OBJECT_SNAP_MODE.NEAREST]: { shape: SNAP_MARKER_SHAPE.SQUARE, color: "#808080" }, - [OBJECT_SNAP_MODE.NODE]: { shape: SNAP_MARKER_SHAPE.CIRCLE, color: "#FFB6C1" }, - [OBJECT_SNAP_MODE.INSERT]: { shape: SNAP_MARKER_SHAPE.TRIANGLE, color: "#90EE90" }, - [OBJECT_SNAP_MODE.PARALLEL]: { shape: SNAP_MARKER_SHAPE.SQUARE, color: "#F0E68C" }, - [OBJECT_SNAP_MODE.APPARENT]: { shape: SNAP_MARKER_SHAPE.X, color: "#DDA0DD" }, - [OBJECT_SNAP_MODE.FROM]: { shape: SNAP_MARKER_SHAPE.CIRCLE, color: "#20B2AA" }, - [OBJECT_SNAP_MODE.POINT_FILTER]: { shape: SNAP_MARKER_SHAPE.SQUARE, color: "#F4A460" }, - [OBJECT_SNAP_MODE.TEMPORARY]: { shape: SNAP_MARKER_SHAPE.CIRCLE, color: "#32CD32" }, - [OBJECT_SNAP_MODE.BETWEEN_TWO_POINTS]: { shape: SNAP_MARKER_SHAPE.TRIANGLE, color: "#FF6347" }, - [OBJECT_SNAP_MODE.POINT_ON_CURVE]: { shape: SNAP_MARKER_SHAPE.CIRCLE, color: "#4169E1" }, - [OBJECT_SNAP_MODE.GEOMETRIC]: { shape: SNAP_MARKER_SHAPE.SQUARE, color: "#DC143C" }, - [OBJECT_SNAP_MODE.CENTER]: { shape: SNAP_MARKER_SHAPE.CIRCLE, color: "#0000FF" }, - [OBJECT_SNAP_MODE.QUADRANT]: { shape: SNAP_MARKER_SHAPE.SQUARE, color: "#FFFF00" }, - }, - }, - constructionSnapEnabled: true, - snapToGridIntersections: false, -}; - - -export const PAPER_SIZE = { - // ISO A Series - A0: "A0", - A1: "A1", - A2: "A2", - A3: "A3", - A4: "A4", - A5: "A5", - - // ANSI Series - ANSI_A: "ANSI_A", // 8.5 x 11 - ANSI_B: "ANSI_B", // 11 x 17 - ANSI_C: "ANSI_C", // 17 x 22 - ANSI_D: "ANSI_D", // 22 x 34 - ANSI_E: "ANSI_E", // 34 x 44 - - // Architectural - ARCH_A: "ARCH_A", // 9 x 12 - ARCH_B: "ARCH_B", // 12 x 18 - ARCH_C: "ARCH_C", // 18 x 24 - ARCH_D: "ARCH_D", // 24 x 36 - ARCH_E: "ARCH_E", // 36 x 48 - - CUSTOM: "CUSTOM", -} as const; - - export const PREDEFINED_HATCH_PATTERNS = { // Solid Fill SOLID: "SOLID", diff --git a/packages/ducjs/src/utils/elements/index.ts b/packages/ducjs/src/utils/elements/index.ts index d0f8e823..8a5e0f44 100644 --- a/packages/ducjs/src/utils/elements/index.ts +++ b/packages/ducjs/src/utils/elements/index.ts @@ -1,24 +1,19 @@ -export * from "./newElement"; +export * from "./frameElement"; export * from "./freedrawElement"; export * from "./linearElement"; +export * from "./newElement"; export * from "./textElement"; -export * from "./frameElement"; -export * from "./viewportElement"; -import { LINE_SPACING_TYPE, TABLE_CELL_ALIGNMENT, TABLE_FLOW_DIRECTION } from "../../flatbuffers/duc"; -import { Scope, RawValue } from "../../types"; -import { _DucStackBase, _DucStackElementBase, DucElement, DucNonSelectionElement, DucStackLikeElement, DucTableColumn, DucTableElement, DucTableRow, DucTextContainer, DucTextElement, DucTextStyle, ElementConstructorOpts, ElementsMap, NonDeleted } from "../../types/elements"; +import { getUpdatedTimestamp } from ".."; +import { LINE_SPACING_TYPE } from "../../enums"; +import { getPrecisionValueFromRaw } from "../../technical/scopes"; +import { RawValue, Scope } from "../../types"; +import { _DucStackBase, DucElement, DucNonSelectionElement, DucTableElement, DucTextStyle, ElementConstructorOpts, NonDeleted } from "../../types/elements"; import { isFreeDrawElement, isLinearElement } from "../../types/elements/typeChecks"; import { GeometricPoint, Percentage, Radian, ScaleFactor, TuplePoint } from "../../types/geometryTypes"; import { Mutable } from "../../types/utility-types"; -import { getUpdatedTimestamp } from ".."; -import { getElementAbsoluteCoords, getResizedElementAbsoluteCoords } from "../bounds"; -import { DEFAULT_ELEMENT_PROPS, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_TEXT_ALIGN, DEFAULT_VERTICAL_ALIGN, FONT_FAMILY } from "../constants"; -import { getBoundTextMaxWidth, getFontString, getTextElementPositionOffsets, measureText, wrapText } from "./textElement"; -import { adjustXYWithRotation } from "../math"; +import { DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_TEXT_ALIGN, DEFAULT_VERTICAL_ALIGN } from "../constants"; import { randomInteger } from "../math/random"; -import { normalizeText } from "../normalize"; -import { getPrecisionValueFromRaw } from "../../technical/scopes"; /** * Returns a default DucTextStyle object for the given scope. @@ -34,7 +29,6 @@ export function getDefaultTextStyle(currentScope: Scope): DucTextStyle { lineSpacing: { type: LINE_SPACING_TYPE.MULTIPLE, value: 1.2 as any }, obliqueAngle: 0 as Radian, fontSize: getPrecisionValueFromRaw(DEFAULT_FONT_SIZE as RawValue, currentScope, currentScope), - paperTextHeight: undefined, widthFactor: 1 as ScaleFactor, isUpsideDown: false, isBackwards: false, @@ -65,7 +59,6 @@ export const getDefaultStackProperties = (): _DucStackBase => { isVisible: true, isPlot: true, opacity: 1 as Percentage, - labelingColor: "transparent", }; }; @@ -75,129 +68,10 @@ export const getDefaultStackProperties = (): _DucStackBase => { * which are added during element creation. */ export const getDefaultTableData = (currentScope: Scope): { - columnOrder: DucTableElement["columnOrder"]; - rowOrder: DucTableElement["rowOrder"]; - columns: DucTableElement["columns"]; - rows: DucTableElement["rows"]; - cells: DucTableElement["cells"]; - // Properties from DucTableStyle - flowDirection: DucTableElement["flowDirection"]; - headerRowStyle: DucTableElement["headerRowStyle"]; - dataRowStyle: DucTableElement["dataRowStyle"]; - dataColumnStyle: DucTableElement["dataColumnStyle"]; - // Other table-specific properties - headerRowCount: DucTableElement["headerRowCount"]; - autoSize: DucTableElement["autoSize"]; + fileId: DucTableElement["fileId"]; } => { - // Default structure - const columnCount = 3; - const headerRowCount = 1; - const dataRowCount = 3; // header + 3 data rows - const totalRows = headerRowCount + dataRowCount; - - const columnIds = Array.from({ length: columnCount }, (_, i) => `col${i + 1}`); - const rowIds = Array.from({ length: totalRows }, (_, i) => `row${i + 1}`); - - // Spacing and sizing - const hMargin = getPrecisionValueFromRaw(8 as RawValue, currentScope, currentScope); - const vMargin = getPrecisionValueFromRaw(6 as RawValue, currentScope, currentScope); - const defaultFontSize = getPrecisionValueFromRaw( - DEFAULT_FONT_SIZE as RawValue, - currentScope, - currentScope - ); - - // Slightly taller header row for visual hierarchy - const dataRowHeight = (defaultFontSize.value * 1.2) + (vMargin.value * 2); - const headerRowHeight = (defaultFontSize.value * 1.4) + (vMargin.value * 2); - - // A practical starting column width - const defaultColumnWidth = getPrecisionValueFromRaw(140 as RawValue, currentScope, currentScope); - - // Base/default styling for cells - const baseCellStyle: DucTableElement["dataRowStyle"] = { - stroke: [DEFAULT_ELEMENT_PROPS.stroke], - background: [DEFAULT_ELEMENT_PROPS.background], - roundness: DEFAULT_ELEMENT_PROPS.roundness, - opacity: DEFAULT_ELEMENT_PROPS.opacity, - textStyle: { - isLtr: true, - fontFamily: FONT_FAMILY.Virgil, - bigFontFamily: "sans-serif", - textAlign: DEFAULT_TEXT_ALIGN, - verticalAlign: DEFAULT_VERTICAL_ALIGN, - lineHeight: 1.2 as DucTextStyle["lineHeight"], - lineSpacing: { type: LINE_SPACING_TYPE.MULTIPLE, value: 1.2 as ScaleFactor }, - obliqueAngle: 0 as Radian, - fontSize: defaultFontSize, - paperTextHeight: undefined, - widthFactor: 1 as ScaleFactor, - isUpsideDown: false, - isBackwards: false, - }, - margins: { - top: vMargin, - right: hMargin, - bottom: vMargin, - left: hMargin, - }, - // Left + middle is a great general-purpose default for tables - alignment: TABLE_CELL_ALIGNMENT.MIDDLE_LEFT, - }; - - // Create default columns - const columns: Record = Object.fromEntries( - columnIds.map((id) => [id, { id, width: defaultColumnWidth }]) - ); - - // Create default rows (taller header row) - const rows: Record = Object.fromEntries( - rowIds.map((id, idx) => [ - id, - { - id, - height: idx < headerRowCount - ? getPrecisionValueFromRaw(headerRowHeight as RawValue, currentScope, currentScope) - : getPrecisionValueFromRaw(dataRowHeight as RawValue, currentScope, currentScope) - }, - ]) - ); - - // Create default cells - const cells: Record = Object.create(null); - - // Friendly header labels via Markdown (bold) - const headerLabels = ["Column A", "Column B", "Column C"]; - - rowIds.forEach((rowId, rIdx) => { - columnIds.forEach((colId, cIdx) => { - const cellId = `${rowId}:${colId}`; - const isHeaderRow = rIdx < headerRowCount; - - cells[cellId] = { - rowId, - columnId: colId, - data: isHeaderRow ? `**${headerLabels[cIdx] ?? `Column ${cIdx + 1}` }**` : "", - locked: false, - }; - }); - }); - return { - // Data Structure - columnOrder: columnIds, - rowOrder: rowIds, - columns, - rows, - cells, - // Style & Behavior - flowDirection: TABLE_FLOW_DIRECTION.DOWN, - headerRowStyle: baseCellStyle, - dataRowStyle: baseCellStyle, - dataColumnStyle: baseCellStyle, - headerRowCount, - // Let rows grow to fit content; keep columns fixed unless user opts in - autoSize: { columns: false, rows: true }, + fileId: null, }; }; @@ -209,7 +83,6 @@ export const getBaseElementProps = (element: DucNonSelectionElement): ElementCon label: element.label, isVisible: element.isVisible, isPlot: element.isPlot, - isAnnotative: element.isAnnotative, layerId: element.layerId, regionIds: element.regionIds, blockIds: element.blockIds, diff --git a/packages/ducjs/src/utils/elements/linearElement.ts b/packages/ducjs/src/utils/elements/linearElement.ts index 0686481a..bfb4cbe1 100644 --- a/packages/ducjs/src/utils/elements/linearElement.ts +++ b/packages/ducjs/src/utils/elements/linearElement.ts @@ -1,19 +1,19 @@ -import { HANDLE_TYPE } from "../../flatbuffers/duc"; import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, getScopedBezierPointFromDucPoint } from "../../technical/scopes"; import type { PrecisionValue, RawValue, Scope, ScopedValue } from "../../types"; -import type { DucArrowElement, DucLine, DucLinearElement, DucLinearLikeElement, DucPoint, DucTextElementWithContainer, ElementsMap, NonDeleted } from "../../types/elements"; +import type { DucLine, DucLinearElement, DucLinearLikeElement, DucPoint, DucTextElementWithContainer, ElementsMap, NonDeleted } from "../../types/elements"; import { Bounds, GeometricPoint } from "../../types/geometryTypes"; import type { ValueOf } from "../../types/utility-types"; import { ElementAbsoluteCoords, getBoundTextElement, getElementAbsoluteCoords, getElementPointsCoords } from "../bounds"; import { LINE_CONFIRM_THRESHOLD } from "../constants"; import { centerPoint, getBezierXY, getControlPointsForBezierCurve, getCubicBezierBoundingBox, getQuadraticBezierBoundingBox, mapIntervalToBezierT, rotate, rotatePoint } from "../math"; +import { HANDLE_TYPE } from "../../enums"; type SV = ScopedValue; export type HandleType = ValueOf | null; export type HandleInfo = { pointIndex: number; - handleType: HandleInfo; + handleType: HandleType; lineIndex: number; handle: DucPoint; }; diff --git a/packages/ducjs/src/utils/elements/newElement.ts b/packages/ducjs/src/utils/elements/newElement.ts index 50e07edc..f8aaf192 100644 --- a/packages/ducjs/src/utils/elements/newElement.ts +++ b/packages/ducjs/src/utils/elements/newElement.ts @@ -1,64 +1,51 @@ -import { getUpdatedTimestamp, getZoom } from ".."; +import { getUpdatedTimestamp } from ".."; import { - BLOCK_ATTACHMENT, - COLUMN_TYPE, - DATUM_BRACKET_STYLE, - IMAGE_STATUS, - LINE_SPACING_TYPE, - STACKED_TEXT_ALIGN, - TEXT_FLOW_DIRECTION, - VERTICAL_ALIGN, - VIEWPORT_SHADE_PLOT -} from "../../flatbuffers/duc"; + IMAGE_STATUS, + LINE_SPACING_TYPE, +} from "../../enums"; + import { getPrecisionValueFromRaw } from "../../technical/scopes"; import { RawValue, Scope } from "../../types"; import { - DucArrowElement, - DucDimensionElement, - DucDocElement, - DucElement, - DucEllipseElement, - DucEmbeddableElement, - DucFeatureControlFrameElement, - DucFrameElement, - DucFreeDrawElement, - DucGenericElement, - DucImageElement, - DucLeaderElement, - DucLinearElement, - DucMermaidElement, - DucModelElement, - DucPdfElement, - DucPlotElement, - DucPolygonElement, - DucTableElement, - DucTextElement, - DucViewportElement, - DucXRayElement, - ElementConstructorOpts, - ElementUpdate, - NonDeleted, - ViewportScale + DucArrowElement, + DucDocElement, + DucElement, + DucEllipseElement, + DucEmbeddableElement, + DucFrameElement, + DucFreeDrawElement, + DucGenericElement, + DucImageElement, + DucLinearElement, + DucModelElement, + DucPdfElement, + DucPlotElement, + DucPolygonElement, + DucTableElement, + DucTextElement, + ElementConstructorOpts, + ElementUpdate, + NonDeleted } from "../../types/elements"; import { Radian, ScaleFactor } from "../../types/geometryTypes"; import { Merge, Mutable } from "../../types/utility-types"; import { - DEFAULT_ELEMENT_PROPS, - DEFAULT_ELLIPSE_ELEMENT, - DEFAULT_FONT_FAMILY, - DEFAULT_FONT_SIZE, - DEFAULT_FREEDRAW_ELEMENT, - DEFAULT_POLYGON_SIDES, - DEFAULT_TEXT_ALIGN, - DEFAULT_VERTICAL_ALIGN + DEFAULT_ELEMENT_PROPS, + DEFAULT_ELLIPSE_ELEMENT, + DEFAULT_FONT_FAMILY, + DEFAULT_FONT_SIZE, + DEFAULT_FREEDRAW_ELEMENT, + DEFAULT_POLYGON_SIDES, + DEFAULT_TEXT_ALIGN, + DEFAULT_VERTICAL_ALIGN } from "../constants"; import { randomId, randomInteger } from "../math/random"; import { normalizeText } from "../normalize"; -import { getDefaultStackProperties, getDefaultTableData, getDefaultTextStyle } from "./"; +import { getDefaultStackProperties } from "./"; import { - getFontString, - getTextElementPositionOffsets, - measureText, + getFontString, + getTextElementPositionOffsets, + measureText, } from "./textElement"; export const newElementWith = ( @@ -107,7 +94,6 @@ const _newElementBase = ( label, isVisible = DEFAULT_ELEMENT_PROPS.isVisible, isPlot = DEFAULT_ELEMENT_PROPS.isPlot, - isAnnotative = DEFAULT_ELEMENT_PROPS.isAnnotative, stroke = [DEFAULT_ELEMENT_PROPS.stroke], background = [DEFAULT_ELEMENT_PROPS.background], opacity = DEFAULT_ELEMENT_PROPS.opacity, @@ -161,7 +147,6 @@ const _newElementBase = ( description, customData: rest.customData, isPlot, - isAnnotative, regionIds, layerId, }; @@ -199,7 +184,6 @@ export const newFrameElement = ( ...getDefaultStackProperties(), clip: false, labelVisible: true, - standardOverride: null, ..._newElementBase("frame", currentScope, opts), type: "frame", }); @@ -211,7 +195,6 @@ export const newPlotElement = ( ...getDefaultStackProperties(), clip: false, labelVisible: true, - standardOverride: null, layout: { margins: { top: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope), @@ -224,41 +207,6 @@ export const newPlotElement = ( type: "plot", }); -export const newViewportElement = ( - currentScope: Scope, - opts: { - zoom?: number; - scopeExponentThreshold?: number; - mainScope?: Scope; - } & ElementConstructorOpts, -): NonDeleted => ({ - ...getDefaultStackProperties(), - points: [], - lines: [], - pathOverrides: [], - lastCommittedPoint: null, - startBinding: null, - endBinding: null, - standardOverride: null, - view: { - scrollX: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope), - scrollY: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope), - zoom: getZoom(opts.zoom ?? 1, opts.mainScope ?? currentScope, opts.scopeExponentThreshold ?? 2), - twistAngle: 0 as Radian, - centerPoint: { - x: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope), - y: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope), - }, - scope: currentScope, - }, - scale: 1 as ViewportScale, - shadePlot: VIEWPORT_SHADE_PLOT.AS_DISPLAYED, - frozenGroupIds: [], - scaleIndicatorVisible: true, - ..._newElementBase("viewport", currentScope, opts), - type: "viewport", -}); - export const newEllipseElement = ( currentScope: Scope, opts: { @@ -340,11 +288,9 @@ export const newTextElement = ( bigFontFamily: opts.bigFontFamily || "sans-serif", lineSpacing: opts.lineSpacing || { type: LINE_SPACING_TYPE.MULTIPLE, value: lineHeight as unknown as ScaleFactor }, obliqueAngle: opts.obliqueAngle || (0 as Radian), - paperTextHeight: opts.paperTextHeight, widthFactor: opts.widthFactor || (1 as ScaleFactor), isUpsideDown: opts.isUpsideDown ?? false, isBackwards: opts.isBackwards ?? false, - dynamic: opts.dynamic || [], }; }; @@ -421,7 +367,7 @@ export const newTableElement = ( opts: Partial & ElementConstructorOpts, ): NonDeleted => ({ ..._newElementBase("table", currentScope, opts), - ...getDefaultTableData(currentScope), + fileId: opts.fileId ?? null, type: "table", }); @@ -432,114 +378,29 @@ export const newDocElement = ( ..._newElementBase("doc", currentScope, opts), type: "doc", text: opts.text || "", - dynamic: opts.dynamic || [], - flowDirection: opts.flowDirection || TEXT_FLOW_DIRECTION.TOP_TO_BOTTOM, - columns: opts.columns || { type: COLUMN_TYPE.NO_COLUMNS, definitions: [], autoHeight: true }, - autoResize: opts.autoResize ?? true, - fileId: null, - gridConfig: { columns: 1, gapX: 0, gapY: 0, alignItems: 'start', firstPageAlone: false, scale: 1 }, - // DucDocStyle properties - isLtr: opts.isLtr ?? true, - fontFamily: opts.fontFamily || DEFAULT_FONT_FAMILY, - bigFontFamily: opts.bigFontFamily || "sans-serif", - textAlign: opts.textAlign || DEFAULT_TEXT_ALIGN, - verticalAlign: opts.verticalAlign || DEFAULT_VERTICAL_ALIGN, - lineHeight: opts.lineHeight || (1.2 as DucTextElement["lineHeight"]), - lineSpacing: opts.lineSpacing || { type: LINE_SPACING_TYPE.MULTIPLE, value: 1.2 as ScaleFactor }, - obliqueAngle: opts.obliqueAngle || (0 as Radian), - fontSize: opts.fontSize || getPrecisionValueFromRaw(DEFAULT_FONT_SIZE as RawValue, currentScope, currentScope), - paperTextHeight: opts.paperTextHeight, - widthFactor: opts.widthFactor || (1 as ScaleFactor), - isUpsideDown: opts.isUpsideDown ?? false, - isBackwards: opts.isBackwards ?? false, - paragraph: opts.paragraph || { firstLineIndent: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope), hangingIndent: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope), leftIndent: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope), rightIndent: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope), spaceBefore: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope), spaceAfter: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope), tabStops: [] }, - stackFormat: opts.stackFormat || { autoStack: false, stackChars: [], properties: { upperScale: 0.7, lowerScale: 0.7, alignment: STACKED_TEXT_ALIGN.CENTER } }, + fileId: opts.fileId ?? null, + gridConfig: { + columns: opts.gridConfig?.columns ?? 1, + gapX: opts.gridConfig?.gapX ?? 0, + gapY: opts.gridConfig?.gapY ?? 0, + firstPageAlone: opts.gridConfig?.firstPageAlone ?? false, + scale: opts.gridConfig?.scale ?? 1, + }, }); export const newPdfElement = (currentScope: Scope, opts: ElementConstructorOpts): NonDeleted => ({ fileId: null, - gridConfig: { columns: 1, gapX: 0, gapY: 0, alignItems: 'start', firstPageAlone: false, scale: 1 }, + gridConfig: { columns: 1, gapX: 0, gapY: 0, firstPageAlone: false, scale: 1 }, ..._newElementBase("pdf", currentScope, opts), type: "pdf", }); -export const newMermaidElement = (currentScope: Scope, opts: ElementConstructorOpts): NonDeleted => ({ - source: "", - theme: undefined, - svgPath: null, - ..._newElementBase("mermaid", currentScope, opts), - type: "mermaid", -}); - -export const newXRayElement = (currentScope: Scope, opts: ElementConstructorOpts): NonDeleted => ({ - origin: { x: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope), y: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope) }, - direction: { x: getPrecisionValueFromRaw(1 as RawValue, currentScope, currentScope), y: getPrecisionValueFromRaw(0 as RawValue, currentScope, currentScope) }, - startFromOrigin: false, - color: '#FF00FF', - ..._newElementBase("xray", currentScope, opts), - type: "xray", -}); - -export const newLeaderElement = ( - currentScope: Scope, - opts: Partial & ElementConstructorOpts -): NonDeleted => { - return { - points: [], - lines: [], - pathOverrides: [], - lastCommittedPoint: null, - startBinding: null, - endBinding: null, - headsOverride: undefined, - dogleg: getPrecisionValueFromRaw(10 as RawValue, currentScope, currentScope), - textStyle: opts.textStyle || getDefaultTextStyle(currentScope), - textAttachment: opts.textAttachment || VERTICAL_ALIGN.TOP, - blockAttachment: opts.blockAttachment || BLOCK_ATTACHMENT.CENTER_EXTENTS, - leaderContent: opts.leaderContent ?? null, - contentAnchor: opts.contentAnchor ?? - { - x: 0, - y: 0, - }, - ..._newElementBase("leader", currentScope, opts), - type: "leader", - }; -}; - -export const newDimensionElement = (currentScope: Scope, opts: ElementConstructorOpts): NonDeleted => ({ - ..._newElementBase("dimension", currentScope, opts), - type: 'dimension', -} as NonDeleted); - -export const newFeatureControlFrameElement = ( - currentScope: Scope, - opts: ElementConstructorOpts -): NonDeleted => { - return { - rows: [], - leaderElementId: null, - textStyle: getDefaultTextStyle(currentScope), - layout: { - padding: getPrecisionValueFromRaw(4 as RawValue, currentScope, currentScope), - segmentSpacing: getPrecisionValueFromRaw(4 as RawValue, currentScope, currentScope), - rowSpacing: getPrecisionValueFromRaw(2 as RawValue, currentScope, currentScope), - }, - symbols: { - scale: 1, - }, - datumStyle: { - bracketStyle: DATUM_BRACKET_STYLE.SQUARE - }, - ..._newElementBase("featurecontrolframe", currentScope, opts), - type: "featurecontrolframe", - }; -}; - -export const newParametricElement = (currentScope: Scope, opts: ElementConstructorOpts): NonDeleted => ({ - source: "", +export const newModelElement = (currentScope: Scope, opts: ElementConstructorOpts): NonDeleted => ({ + modelType: null, + code: null, svgPath: null, fileIds: [], + viewerState: null, ..._newElementBase("model", currentScope, opts), type: 'model', }); diff --git a/packages/ducjs/src/utils/elements/textElement.ts b/packages/ducjs/src/utils/elements/textElement.ts index 573b5302..f792f7eb 100644 --- a/packages/ducjs/src/utils/elements/textElement.ts +++ b/packages/ducjs/src/utils/elements/textElement.ts @@ -1,4 +1,4 @@ -import { TEXT_ALIGN, VERTICAL_ALIGN } from "../../flatbuffers/duc"; +import { TEXT_ALIGN, VERTICAL_ALIGN } from "../../enums"; import { SupportedMeasures, getPrecisionValueFromRaw, getScopedBezierPointFromDucPoint } from "../../technical/scopes"; import { DucLocalState, RawValue, Scope, ScopedValue } from "../../types"; import { DucElement, DucElementType, DucPoint, DucTextContainer, DucTextElement, DucTextElementWithContainer, ElementsMap, FontFamilyValues, FontString, NonDeletedDucElement } from "../../types/elements"; @@ -853,6 +853,6 @@ export const getAdjustedDimensions = ( export { - getBoundTextElementPosition + getBoundTextElementPosition }; diff --git a/packages/ducjs/src/utils/elements/viewportElement.ts b/packages/ducjs/src/utils/elements/viewportElement.ts deleted file mode 100644 index 5e02def2..00000000 --- a/packages/ducjs/src/utils/elements/viewportElement.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { AnnotationScale, ViewportScale } from "../../types"; - -/** - * Utility functions to convert between the two scales - */ -export const viewportToAnnotationScale = (viewportScale: ViewportScale): AnnotationScale => { - return (1 / viewportScale) as AnnotationScale; -}; - -export const annotationToViewportScale = (annotationScale: AnnotationScale): ViewportScale => { - return (1 / annotationScale) as ViewportScale; -}; diff --git a/packages/ducjs/src/utils/math/index.ts b/packages/ducjs/src/utils/math/index.ts index 5d66986a..5573775a 100644 --- a/packages/ducjs/src/utils/math/index.ts +++ b/packages/ducjs/src/utils/math/index.ts @@ -1,13 +1,13 @@ -export * from "./geometry"; -export * from "./bbox"; export * from "./algebra"; +export * from "./bbox"; +export * from "./geometry"; export * from "./random"; +import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, getScopedBezierPointFromDucPoint, SupportedMeasures } from "../../technical/scopes"; import type { - NullableGridSize, - RawValue, - ScopedZoomValue, - Zoom + RawValue, + ScopedZoomValue, + Zoom } from "../../types"; import { Scope, ScopedValue } from "../../types"; import type { DucElement, DucLine, DucLinearElement, DucLinearLikeElement, DucLineReference, DucPoint, NonDeleted } from "../../types/elements"; @@ -15,12 +15,12 @@ import type { Bounds, GeometricPoint, GeometricVector, Percentage, Radian } from import { Heading } from "../../types/geometryTypes"; import { Mutable } from "../../types/utility-types"; import { - LINE_CONFIRM_THRESHOLD + LINE_CONFIRM_THRESHOLD } from "../constants"; import { pointFrom } from "./geometry"; -import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, getScopedBezierPointFromDucPoint, SupportedMeasures } from "../../technical/scopes"; type SV = ScopedValue; +export type NullableGridSize = number | null; diff --git a/packages/ducjs/src/utils/shape.ts b/packages/ducjs/src/utils/shape.ts index 70c7ccf9..ea5d79ec 100644 --- a/packages/ducjs/src/utils/shape.ts +++ b/packages/ducjs/src/utils/shape.ts @@ -1,4 +1,5 @@ -import { BEZIER_MIRRORING } from "../flatbuffers/duc"; +import { BEZIER_MIRRORING } from "../enums"; +import { getPrecisionValueFromRaw, getPrecisionValueFromScoped } from "../technical/scopes"; import { RawValue, Scope, ScopedValue } from "../types"; import { DucElement, DucFreeDrawElement, DucLine, DucLinearElement, DucNonSelectionElement, DucPath, DucPoint, NonDeletedDucElement } from "../types/elements"; import { isArrowElement, isEllipseElement, isFreeDrawElement, isLinearElement, isPolygonElement } from "../types/elements/typeChecks"; @@ -7,7 +8,6 @@ import { getBaseElementProps } from "./elements"; import { getNormalizedPoints, mergeOverlappingPoints } from "./elements/linearElement"; import { newLinearElement } from "./elements/newElement"; import { rotatePoint } from "./math"; -import { getPrecisionValueFromRaw, getPrecisionValueFromScoped } from "../technical/scopes"; /** * Converts a shape (rectangle, polygon, ellipse) to a linear element diff --git a/packages/ducjs/src/utils/state/grid.ts b/packages/ducjs/src/utils/state/grid.ts deleted file mode 100644 index a2ac0d0c..00000000 --- a/packages/ducjs/src/utils/state/grid.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { GRID_TYPE, GRID_DISPLAY_TYPE } from "../../flatbuffers/duc"; -import { getPrecisionValueFromRaw } from "../../technical"; -import { GridSettings, Radian, RawValue, Scope } from "../../types"; -import { DEFAULT_GRID_SETTINGS } from "../constants"; - -/** - * Factory functions for common grid types - */ -export const createRectangularGrid = (spacing: number, name: string, scope: Scope): GridSettings => ({ - ...DEFAULT_GRID_SETTINGS, - // id: `rect-${spacing}`, - // name, - xSpacing: getPrecisionValueFromRaw(spacing as RawValue, scope, scope), - ySpacing: getPrecisionValueFromRaw(spacing as RawValue, scope, scope), -}); - -export const createIsometricGrid = (spacing: number, name: string, scope: Scope): GridSettings => ({ - ...DEFAULT_GRID_SETTINGS, - // id: `iso-${spacing}`, - // name, - type: GRID_TYPE.ISOMETRIC, - xSpacing: getPrecisionValueFromRaw(spacing as RawValue, scope, scope), - ySpacing: getPrecisionValueFromRaw(spacing as RawValue, scope, scope), - isometricSettings: { - leftAngle: Math.PI / 6 as Radian, // 30 degrees - rightAngle: Math.PI / 6 as Radian, // 30 degrees - } -}); - -export const createPolarGrid = (radialSpacing: number, divisions: number, name: string, scope: Scope): GridSettings => ({ - ...DEFAULT_GRID_SETTINGS, - // id: `polar-${radialSpacing}-${divisions}`, - // name, - type: GRID_TYPE.POLAR, - displayType: GRID_DISPLAY_TYPE.LINES, - xSpacing: getPrecisionValueFromRaw(radialSpacing as RawValue, scope, scope), // Used as radial spacing - ySpacing: getPrecisionValueFromRaw(radialSpacing as RawValue, scope, scope), // Not used for polar - polarSettings: { - radialDivisions: divisions, - radialSpacing: getPrecisionValueFromRaw(radialSpacing as RawValue, scope, scope), - showLabels: false - } -}); \ No newline at end of file diff --git a/packages/ducjs/src/utils/state/index.ts b/packages/ducjs/src/utils/state/index.ts index 92616ac9..95f147f6 100644 --- a/packages/ducjs/src/utils/state/index.ts +++ b/packages/ducjs/src/utils/state/index.ts @@ -1,9 +1,6 @@ -export * from "./grid"; - - - -import { PRUNING_LEVEL, TEXT_ALIGN } from "../../flatbuffers/duc"; -import { PREDEFINED_STANDARDS } from "../../technical"; +import { isFiniteNumber } from ".."; +import { PRUNING_LEVEL, TEXT_ALIGN } from "../../enums"; +import { isValidPrecisionScopeValue } from "../../restore/restoreDataState"; import { getPrecisionValueFromRaw, getScaledZoomValueForScope, @@ -14,7 +11,6 @@ import { DucGlobalState, DucLocalState, RawValue, - ScaleFactor, Scope, Zoom, } from "../../types"; @@ -25,65 +21,6 @@ import { DEFAULT_FONT_SIZE, } from "../constants"; import { getNormalizedZoom } from "../normalize"; -import { isFiniteNumber } from ".."; -import { isValidPrecisionScopeValue } from "../../restore/restoreDataState"; - -// appState - -// export const updateActiveTool = ( -// appState: Pick, -// data: (( -// | { -// type: ToolType; -// } -// | { type: "custom"; customType: string } -// ) & { locked?: boolean; fromSelection?: boolean }) & { -// lastActiveToolBeforeEraser?: ActiveTool | null; -// }, -// ): DucLocalState["activeTool"] => { -// if (data.type === "custom") { -// return { -// ...appState.activeTool, -// type: "custom", -// customType: data.customType, -// locked: data.locked ?? appState.activeTool.locked, -// }; -// } - -// return { -// ...appState.activeTool, -// lastActiveTool: -// data.lastActiveToolBeforeEraser === undefined -// ? appState.activeTool.lastActiveTool -// : data.lastActiveToolBeforeEraser, -// type: data.type, -// customType: null, -// locked: data.locked ?? appState.activeTool.locked, -// fromSelection: data.fromSelection ?? false, -// }; -// }; -// activeTool: { -// type: "selection", -// customType: null, -// locked: DEFAULT_ELEMENT_PROPS.locked, -// fromSelection: false, -// lastActiveTool: null, -// }, - - -// duconfig -// displayAllPointDistances: false, -// displayDistanceOnDrawing: true, -// displayAllPointInfoSelected: false, -// displayAllPointCoordinates: false, -// displayRootAxis: false, -// showHyperlinkPopup: false, -// antiAliasing: ANTI_ALIASING.ANALYTIC, -// vSync: true, -// zoomStep: 0, -// scaleRatioLocked: false, -// theme: THEME.LIGHT, -// debugRendering: false, /** * Returns the zoom object with value, scoped, and scaled properties, @@ -118,14 +55,6 @@ export const getDefaultGlobalState = (): DucGlobalState => { viewBackgroundColor: typeof window !== "undefined" ? (window.matchMedia("(prefers-color-scheme: dark)").matches ? COLOR_PALETTE.night : COLOR_PALETTE.white) : COLOR_PALETTE.white, scopeExponentThreshold: 3, mainScope: NEUTRAL_SCOPE, - dashSpacingScale: 1 as ScaleFactor, - isDashSpacingAffectedByViewportScale: false, - dimensionsAssociativeByDefault: false, - useAnnotativeScaling: false, - displayPrecision: { - linear: 2, - angular: 1, - }, pruningLevel: PRUNING_LEVEL.BALANCED, }; }; @@ -142,7 +71,6 @@ export const getDefaultLocalState = (): Omit< return { scope, - activeStandardId: PREDEFINED_STANDARDS.DUC, isBindingEnabled: true, scrollX: getPrecisionValueFromRaw( @@ -175,16 +103,12 @@ export const getDefaultLocalState = (): Omit< currentItemOpacity: DEFAULT_ELEMENT_PROPS.opacity, currentItemRoundness: getPrecisionValueFromRaw(0 as RawValue, scope, scope), - activeGridSettings: [], - activeSnapSettings: "", - penMode: false, viewModeEnabled: false, objectsSnapModeEnabled: true, gridModeEnabled: false, outlineModeEnabled: false, manualSaveMode: false, - gridSize: 10, - gridStep: 10, + decimalPlaces: 2, }; }; diff --git a/packages/ducjs/src/utils/traverse.ts b/packages/ducjs/src/utils/traverse.ts index 7f36846e..2093c762 100644 --- a/packages/ducjs/src/utils/traverse.ts +++ b/packages/ducjs/src/utils/traverse.ts @@ -108,4 +108,68 @@ export const traverseAndUpdatePrecisionValues = ( } return result; +}; + +/** + * Traverses an object and normalizes it for serialization in `targetScope`. + * + * - Converts all PrecisionValue fields so `scoped` is in `targetScope` + * - Rewrites PrecisionValue `value` from the computed `scoped` value + * - Rewrites `scope` / `mainScope` string fields to `targetScope` + */ +export const normalizeForSerializationScope = ( + obj: T, + targetScope: Scope, + providedScope?: Scope, +): T => { + const converted = traverseAndUpdatePrecisionValues( + obj, + targetScope, + providedScope, + ); + + return rewriteScopeAndPrecisionValues(converted, targetScope); +}; + +const rewriteScopeAndPrecisionValues = ( + obj: T, + targetScope: Scope, + visited = new WeakSet(), +): T => { + if (obj == null || typeof obj !== "object") return obj; + + if (isPrecisionValue(obj)) { + return { + ...obj, + value: obj.scoped, + } as T; + } + + if (Array.isArray(obj)) { + return obj.map((item) => + rewriteScopeAndPrecisionValues(item, targetScope, visited), + ) as T; + } + + if (visited.has(obj)) return obj; + visited.add(obj); + + if ((obj as any).constructor !== Object) { + return obj; + } + + const result: Record = {}; + for (const [key, value] of Object.entries(obj as Record)) { + if ( + (key === "scope" || key === "mainScope") && + typeof value === "string" + ) { + result[key] = targetScope; + continue; + } + + result[key] = rewriteScopeAndPrecisionValues(value, targetScope, visited); + } + + return result as T; }; \ No newline at end of file diff --git a/packages/ducjs/src/version-control.ts b/packages/ducjs/src/version-control.ts new file mode 100644 index 00000000..0f715d84 --- /dev/null +++ b/packages/ducjs/src/version-control.ts @@ -0,0 +1,122 @@ +import type { VersionGraph } from "./types"; +import { + ensureWasm, + wasmGetCurrentSchemaVersion, + wasmListVersions, + wasmReadVersionGraph, + wasmRestoreCheckpoint, + wasmRestoreVersion, + wasmRevertToVersion, +} from "./wasm"; + +export interface RestoredVersion { + versionNumber: number; + schemaVersion: number; + data: Uint8Array; + fromCheckpoint: boolean; +} + +export interface VersionEntry { + id: string; + versionNumber: number; + schemaVersion: number; + timestamp: number; + description?: string; + isManualSave: boolean; + userId?: string; + versionType: "checkpoint" | "delta"; + sizeBytes: number; +} + +/** + * Restore the full document state at a specific version number. + * + * If the version corresponds to a checkpoint, the raw data is returned directly. + * Otherwise, the nearest preceding checkpoint is loaded and deltas are replayed + * on top of it to reconstruct the state. + * + * All heavy lifting (SQLite access, decompression, delta replay) happens in + * Rust/WASM. + */ +export const restoreVersion = async ( + ducBuffer: Uint8Array, + versionNumber: number, +): Promise => { + await ensureWasm(); + const result = wasmRestoreVersion(ducBuffer, versionNumber); + if (!result) { + throw new Error(`Failed to restore version ${versionNumber}`); + } + return result as RestoredVersion; +}; + +/** + * Restore a specific checkpoint by its ID. + */ +export const restoreCheckpoint = async ( + ducBuffer: Uint8Array, + checkpointId: string, +): Promise => { + await ensureWasm(); + const result = wasmRestoreCheckpoint(ducBuffer, checkpointId); + if (!result) { + throw new Error(`Failed to restore checkpoint ${checkpointId}`); + } + return result as RestoredVersion; +}; + +/** + * List all versions (checkpoints and deltas) in the .duc file, + * ordered by version number descending. Does not load data blobs. + */ +export const listVersions = async ( + ducBuffer: Uint8Array, +): Promise => { + await ensureWasm(); + const result = wasmListVersions(ducBuffer); + return (result ?? []) as VersionEntry[]; +}; + +/** + * Read the full version graph from the .duc file, including all + * checkpoints, deltas, chains, and metadata. + */ +export const readVersionGraph = async ( + ducBuffer: Uint8Array, +): Promise => { + await ensureWasm(); + return wasmReadVersionGraph(ducBuffer) as VersionGraph | undefined; +}; + +/** + * Revert the document to a specific version, deleting all versions + * newer than the target. Returns the restored state at that version. + * + * **Warning**: This mutates the .duc buffer in-place (via the WASM + * SQLite connection). The returned `RestoredVersion.data` contains the + * full document state at the target version. + */ +export const revertToVersion = async ( + ducBuffer: Uint8Array, + targetVersion: number, +): Promise => { + await ensureWasm(); + const result = wasmRevertToVersion(ducBuffer, targetVersion); + if (!result) { + throw new Error(`Failed to revert to version ${targetVersion}`); + } + return result as RestoredVersion; +}; + +/** + * Returns the current version-control schema version from Rust. + * + * This is the single source of truth for the schema version number, + * generated from `schema/duc.sql` (`PRAGMA user_version`) at build time. + * The version control system handles migration bookkeeping automatically + * on the next checkpoint or delta creation. + */ +export const getCurrentSchemaVersion = async (): Promise => { + await ensureWasm(); + return wasmGetCurrentSchemaVersion(); +}; diff --git a/packages/ducjs/src/wasm.ts b/packages/ducjs/src/wasm.ts new file mode 100644 index 00000000..c6f27afb --- /dev/null +++ b/packages/ducjs/src/wasm.ts @@ -0,0 +1,55 @@ +import init, { + getCurrentSchemaVersion as _getCurrentSchemaVersion, + getExternalFile as _getExternalFile, + listExternalFiles as _listExternalFiles, + listVersions as _listVersions, + parseDuc as _parseDuc, + parseDucLazy as _parseDucLazy, + readVersionGraph as _readVersionGraph, + restoreCheckpoint as _restoreCheckpoint, + restoreVersion as _restoreVersion, + revertToVersion as _revertToVersion, + serializeDuc as _serializeDuc, +} from "../pkg/ducjs_wasm"; + +let initialized = false; +let initPromise: Promise | null = null; + +export async function ensureWasm(wasmUrl?: string | URL | BufferSource): Promise { + if (initialized) return; + if (!initPromise) { + const arg = wasmUrl !== undefined ? { module_or_path: wasmUrl } : undefined; + initPromise = init(arg).then(() => { + initialized = true; + }); + } + return initPromise; +} + +/** + * Fetch the raw WASM binary as an ArrayBuffer. + * Must be called from the main thread (where the bundler resolves `import.meta.url`). + * Useful for transferring the binary to a web worker that needs to init WASM + * without being able to resolve the file URL itself. + */ +export async function getWasmBinary(): Promise { + const url = new URL('../pkg/ducjs_wasm_bg.wasm', import.meta.url); + const resp = await fetch(url); + if (!resp.ok) { + throw new Error(`Failed to fetch WASM binary: ${resp.status} ${resp.statusText}`); + } + return resp.arrayBuffer(); +} + +export const wasmParseDuc = _parseDuc; +export const wasmParseDucLazy = _parseDucLazy; +export const wasmSerializeDuc = _serializeDuc; +export const wasmGetExternalFile = _getExternalFile; +export const wasmListExternalFiles = _listExternalFiles; + +export const wasmRestoreVersion = _restoreVersion; +export const wasmRestoreCheckpoint = _restoreCheckpoint; +export const wasmListVersions = _listVersions; +export const wasmReadVersionGraph = _readVersionGraph; +export const wasmRevertToVersion = _revertToVersion; +export const wasmGetCurrentSchemaVersion = _getCurrentSchemaVersion; diff --git a/packages/ducpdf/package.json b/packages/ducpdf/package.json index b2b5bf2b..e4129b72 100644 --- a/packages/ducpdf/package.json +++ b/packages/ducpdf/package.json @@ -40,7 +40,7 @@ "build": "bun run clean && bun run build:wasm && bun run copy:wasm-to-dist && bun run build:ts", "build:ts": "tsc -p tsconfig.json", "build:rs": "cd src/duc2pdf && cargo build", - "build:wasm": "cd src/duc2pdf && wasm-pack build --target web --out-dir ../../pkg --release", + "build:wasm": "node scripts/build-wasm.mjs", "copy:wasm-to-dist": "mkdir -p dist && cp pkg/duc2pdf_bg.wasm dist/ && cp pkg/duc2pdf.js dist/ && cp pkg/duc2pdf.d.ts dist/ && cp pkg/duc2pdf_bg.wasm.d.ts dist/", "clean": "rm -rf dist pkg && cd src/duc2pdf && cargo clean", "test": "bun run build:wasm && bun test", diff --git a/packages/ducpdf/scripts/build-wasm.mjs b/packages/ducpdf/scripts/build-wasm.mjs new file mode 100644 index 00000000..8ac42d20 --- /dev/null +++ b/packages/ducpdf/scripts/build-wasm.mjs @@ -0,0 +1,64 @@ +import { spawn, spawnSync } from "node:child_process"; +import { existsSync } from "node:fs"; + +const isWindows = process.platform === "win32"; + +const hasCompilerOverride = + Boolean(process.env.CC_wasm32_unknown_unknown) || + Boolean(process.env["CC_wasm32-unknown-unknown"]); + +const tryResolveCompiler = (candidates) => { + for (const candidate of candidates) { + if (!candidate) continue; + + if (candidate.includes("/") || candidate.includes("\\")) { + if (!existsSync(candidate)) continue; + const probe = spawnSync(candidate, ["--version"], { stdio: "ignore" }); + if (probe.status === 0) return candidate; + continue; + } + + const probe = spawnSync(candidate, ["--version"], { stdio: "ignore" }); + if (probe.status === 0) return candidate; + } + + return null; +}; + +const compilerCandidates = isWindows + ? ["clang-cl", "clang"] + : [ + "/opt/homebrew/opt/llvm/bin/clang", + "/usr/local/opt/llvm/bin/clang", + "/usr/bin/clang", + "clang", + ]; + +const resolvedCompiler = hasCompilerOverride + ? null + : tryResolveCompiler(compilerCandidates); + +const env = { ...process.env }; +if (!hasCompilerOverride && resolvedCompiler) { + env.CC_wasm32_unknown_unknown = resolvedCompiler; + env["CC_wasm32-unknown-unknown"] = resolvedCompiler; +} + +const child = spawn( + "wasm-pack", + ["build", "--target", "web", "--out-dir", "../../pkg", "--release"], + { + cwd: new URL("../src/duc2pdf", import.meta.url), + env, + stdio: "inherit", + }, +); + +child.on("error", (error) => { + console.error(error); + process.exit(1); +}); + +child.on("close", (code) => { + process.exit(code ?? 1); +}); diff --git a/packages/ducpdf/src/duc2pdf/index.ts b/packages/ducpdf/src/duc2pdf/index.ts index 1dee3a06..a86bf8b2 100644 --- a/packages/ducpdf/src/duc2pdf/index.ts +++ b/packages/ducpdf/src/duc2pdf/index.ts @@ -1,4 +1,4 @@ -import { ExportedDataState, getFreeDrawSvgPath, getNormalizedZoom, isFreeDrawElement, parseDuc, serializeDuc, traverseAndUpdatePrecisionValues } from 'ducjs'; +import { ExportedDataState, getFreeDrawSvgPath, getNormalizedZoom, isFreeDrawElement, normalizeForSerializationScope, parseDuc, serializeDuc } from 'ducjs'; import { fetchFontsForDuc } from './fonts'; export interface PdfConversionResult { @@ -153,7 +153,7 @@ export async function convertDucToPdf( const scope = parsed?.localState?.scope || parsed?.globalState?.mainScope || 'mm'; // ensure that we are only working with mm on the pdf conversion logic - const normalized: ExportedDataState = traverseAndUpdatePrecisionValues(parsed, 'mm', scope); + const normalized: ExportedDataState = normalizeForSerializationScope(parsed as unknown as ExportedDataState, 'mm', scope); normalized.localState.scope = 'mm'; normalized.globalState.mainScope = 'mm'; @@ -180,14 +180,15 @@ export async function convertDucToPdf( // Process elements before serialization let normalizedElements = normalized.elements || []; - normalizedElements = normalizedElements.map(element => { + normalizedElements = normalizedElements.map((element: any) => { + let normalizedElement = element; if (element && isFreeDrawElement(element)) { const svgPath = getFreeDrawSvgPath(element); if (svgPath) { - return Object.assign({}, element, { svgPath }); + normalizedElement = Object.assign({}, element, { svgPath }); } } - return element; + return normalizedElement; }); normalized.elements = normalizedElements; @@ -197,8 +198,7 @@ export async function convertDucToPdf( // Re-serialize the DUC with normalized values and scope set to 'mm' const serialized = await serializeDuc( normalized, - true, // use scoped values - undefined, + { syncInvalidIndices: (elements: readonly any[]) => elements as any }, { forceScope: 'mm' } diff --git a/packages/ducpdf/src/duc2pdf/src/builder.rs b/packages/ducpdf/src/duc2pdf/src/builder.rs index 8d035fbd..9570983d 100644 --- a/packages/ducpdf/src/duc2pdf/src/builder.rs +++ b/packages/ducpdf/src/duc2pdf/src/builder.rs @@ -12,7 +12,7 @@ use crate::{ }; use bigcolor::BigColor; use duc::types::{ - DucBlock, DucElementEnum, DucExternalFileEntry, ElementWrapper, ExportedDataState, Standard, + DucBlock, DucElementEnum, DucExternalFileEntry, ElementWrapper, ExportedDataState, TEXT_ALIGN, }; use hipdf::embed_pdf::PdfEmbedder; @@ -69,7 +69,6 @@ pub struct ConversionContext { pub options: ConversionOptions, pub scale: f64, pub resource_cache: ResourceCache, - pub active_standard: Option, } /// Main builder for DUC to PDF conversion @@ -163,17 +162,14 @@ impl DucToPdfBuilder { // before any processing begins DucDataScaler::scale_exported_data(&mut exported_data, scale); - let active_standard = Self::find_active_standard(&exported_data); - let context = ConversionContext { exported_data, options, scale, resource_cache: ResourceCache::default(), - active_standard, }; - let style_resolver = StyleResolver::new(context.active_standard.clone()); + let style_resolver = StyleResolver::new(); // Initialize font manager and load RobotoMono font let mut font_manager = FontManager::new(); @@ -321,7 +317,6 @@ impl DucToPdfBuilder { DucElementEnum::DucEllipseElement(elem) => &elem.base, DucElementEnum::DucEmbeddableElement(elem) => &elem.base, DucElementEnum::DucPdfElement(elem) => &elem.base, - DucElementEnum::DucMermaidElement(elem) => &elem.base, DucElementEnum::DucTableElement(elem) => &elem.base, DucElementEnum::DucImageElement(elem) => &elem.base, DucElementEnum::DucTextElement(elem) => &elem.base, @@ -330,13 +325,7 @@ impl DucToPdfBuilder { DucElementEnum::DucFreeDrawElement(elem) => &elem.base, DucElementEnum::DucFrameElement(elem) => &elem.stack_element_base.base, DucElementEnum::DucPlotElement(elem) => &elem.stack_element_base.base, - DucElementEnum::DucViewportElement(elem) => &elem.linear_base.base, - DucElementEnum::DucXRayElement(elem) => &elem.base, - DucElementEnum::DucLeaderElement(elem) => &elem.linear_base.base, - DucElementEnum::DucDimensionElement(elem) => &elem.base, - DucElementEnum::DucFeatureControlFrameElement(elem) => &elem.base, DucElementEnum::DucDocElement(elem) => &elem.base, - DucElementEnum::DucParametricElement(elem) => &elem.base, DucElementEnum::DucModelElement(elem) => &elem.base, } } @@ -397,24 +386,6 @@ impl DucToPdfBuilder { Ok(()) } - /// Find the active standard from the data - fn find_active_standard(data: &ExportedDataState) -> Option { - // Get active standard from duc_local_state - if let Some(local_state) = &data.duc_local_state { - let active_std_id = &local_state.active_standard_id; - if !active_std_id.is_empty() { - return data - .standards - .iter() - .find(|std| &std.identifier.id == active_std_id) - .cloned(); - } - } - - // Fallback to first standard if available - data.standards.first().cloned() - } - /// Build the PDF document pub fn build(mut self) -> ConversionResult> { // Phase 1: Pre-computation & Resource Loading @@ -508,7 +479,11 @@ impl DucToPdfBuilder { fn process_external_files(&mut self) -> ConversionResult<()> { if let Some(external_files) = &self.context.exported_data.external_files { let external_files_clone = external_files.clone(); - for file_entry in external_files_clone { + for (file_key, file_data) in external_files_clone { + let file_entry = DucExternalFileEntry { + key: file_key, + value: file_data, + }; let file_data = &file_entry.value; match file_data.mime_type.to_lowercase().as_str() { "image/svg+xml" | "application/svg+xml" => { @@ -1081,19 +1056,16 @@ impl DucToPdfBuilder { // If no local state exists, create one with the offset let new_local_state = duc::types::DucLocalState { scope: "mm".to_string(), // Always use mm for internal processing - active_standard_id: "default".to_string(), scroll_x: offset_x_mm, scroll_y: offset_y_mm, zoom: 1.0, - active_grid_settings: None, - active_snap_settings: None, is_binding_enabled: false, current_item_stroke: None, current_item_background: None, current_item_opacity: 1.0, current_item_font_family: "Arial".to_string(), current_item_font_size: 12.0, - current_item_text_align: Default::default(), + current_item_text_align: TEXT_ALIGN::LEFT, current_item_start_line_head: None, current_item_end_line_head: None, current_item_roundness: 0.0, @@ -1103,6 +1075,7 @@ impl DucToPdfBuilder { grid_mode_enabled: false, outline_mode_enabled: false, manual_save_mode: false, + decimal_places: 2, }; self.context.exported_data.duc_local_state = Some(new_local_state); diff --git a/packages/ducpdf/src/duc2pdf/src/lib.rs b/packages/ducpdf/src/duc2pdf/src/lib.rs index be32e493..0255efd1 100644 --- a/packages/ducpdf/src/duc2pdf/src/lib.rs +++ b/packages/ducpdf/src/duc2pdf/src/lib.rs @@ -151,7 +151,6 @@ pub fn calculate_bounding_box(data: &duc::types::ExportedDataState) -> (f64, f64 duc::types::DucElementEnum::DucEllipseElement(elem) => &elem.base, duc::types::DucElementEnum::DucEmbeddableElement(elem) => &elem.base, duc::types::DucElementEnum::DucPdfElement(elem) => &elem.base, - duc::types::DucElementEnum::DucMermaidElement(elem) => &elem.base, duc::types::DucElementEnum::DucTableElement(elem) => &elem.base, duc::types::DucElementEnum::DucImageElement(elem) => &elem.base, duc::types::DucElementEnum::DucTextElement(elem) => &elem.base, @@ -160,13 +159,7 @@ pub fn calculate_bounding_box(data: &duc::types::ExportedDataState) -> (f64, f64 duc::types::DucElementEnum::DucFreeDrawElement(elem) => &elem.base, duc::types::DucElementEnum::DucFrameElement(elem) => &elem.stack_element_base.base, duc::types::DucElementEnum::DucPlotElement(elem) => &elem.stack_element_base.base, - duc::types::DucElementEnum::DucViewportElement(elem) => &elem.linear_base.base, - duc::types::DucElementEnum::DucXRayElement(elem) => &elem.base, - duc::types::DucElementEnum::DucLeaderElement(elem) => &elem.linear_base.base, - duc::types::DucElementEnum::DucDimensionElement(elem) => &elem.base, - duc::types::DucElementEnum::DucFeatureControlFrameElement(elem) => &elem.base, duc::types::DucElementEnum::DucDocElement(elem) => &elem.base, - duc::types::DucElementEnum::DucParametricElement(elem) => &elem.base, duc::types::DucElementEnum::DucModelElement(elem) => &elem.base, }; diff --git a/packages/ducpdf/src/duc2pdf/src/scaling.rs b/packages/ducpdf/src/duc2pdf/src/scaling.rs index f917a641..9485206d 100644 --- a/packages/ducpdf/src/duc2pdf/src/scaling.rs +++ b/packages/ducpdf/src/duc2pdf/src/scaling.rs @@ -71,40 +71,16 @@ impl DucDataScaler { Self::scale_element_base(&mut plot.stack_element_base.base, scale); Self::scale_plot_element(plot, scale); } - types::DucElementEnum::DucViewportElement(viewport) => { - Self::scale_linear_element_base(&mut viewport.linear_base, scale); - } - types::DucElementEnum::DucXRayElement(xray) => { - Self::scale_element_base(&mut xray.base, scale); - } - types::DucElementEnum::DucLeaderElement(leader) => { - Self::scale_linear_element_base(&mut leader.linear_base, scale); - Self::scale_leader_element(leader, scale); - } - types::DucElementEnum::DucDimensionElement(dimension) => { - Self::scale_element_base(&mut dimension.base, scale); - Self::scale_dimension_element(dimension, scale); - } - types::DucElementEnum::DucFeatureControlFrameElement(fcf) => { - Self::scale_element_base(&mut fcf.base, scale); - Self::scale_fcf_element(fcf, scale); - } types::DucElementEnum::DucDocElement(doc) => { Self::scale_element_base(&mut doc.base, scale); Self::scale_doc_element(doc, scale); } - types::DucElementEnum::DucParametricElement(parametric) => { - Self::scale_element_base(&mut parametric.base, scale); - } types::DucElementEnum::DucEmbeddableElement(embeddable) => { Self::scale_element_base(&mut embeddable.base, scale); } types::DucElementEnum::DucPdfElement(pdf) => { Self::scale_element_base(&mut pdf.base, scale); } - types::DucElementEnum::DucMermaidElement(mermaid) => { - Self::scale_element_base(&mut mermaid.base, scale); - } types::DucElementEnum::DucModelElement(model) => { Self::scale_element_base(&mut model.base, scale); } @@ -131,10 +107,6 @@ impl DucDataScaler { fn scale_text_style(style: &mut types::DucTextStyle, scale: f64) { style.font_size *= scale; style.line_height *= scale as f32; - - if let Some(ref mut paper_height) = style.paper_text_height { - *paper_height *= scale; - } } /// Scale linear element base (points, lines, etc.) @@ -231,78 +203,13 @@ impl DucDataScaler { /// Scale table element fields fn scale_table_element(table: &mut types::DucTableElement, scale: f64) { - // Scale column widths - for column in &mut table.columns { - column.value.width *= scale; - } - } - - /// Scale leader element fields - fn scale_leader_element(_leader: &mut types::DucLeaderElement, _scale: f64) { - // Leader element scaling - no specific fields to scale based on current structure - } - - /// Scale dimension element fields - fn scale_dimension_element(dimension: &mut types::DucDimensionElement, scale: f64) { - // Scale text position - if let Some(ref mut text_position) = dimension.text_position { - text_position.x *= scale; - text_position.y *= scale; - } - - // Scale definition points - dimension.definition_points.origin1.x *= scale; - dimension.definition_points.origin1.y *= scale; - dimension.definition_points.location.x *= scale; - dimension.definition_points.location.y *= scale; - - if let Some(ref mut origin2) = dimension.definition_points.origin2 { - origin2.x *= scale; - origin2.y *= scale; - } - - if let Some(ref mut center) = dimension.definition_points.center { - center.x *= scale; - center.y *= scale; - } - - if let Some(ref mut jog) = dimension.definition_points.jog { - jog.x *= scale; - jog.y *= scale; - } - - // Scale nested text styles - Self::scale_text_style(&mut dimension.style.text_style, scale); - - // Scale tolerance text style - if let Some(ref mut tolerance) = dimension.tolerance_override { - if let Some(ref mut text_style) = tolerance.text_style { - Self::scale_text_style(text_style, scale); - } - } - } - - /// Scale feature control frame element fields - fn scale_fcf_element(fcf: &mut types::DucFeatureControlFrameElement, scale: f64) { - // Scale layout fields - fcf.style.layout.padding *= scale; - fcf.style.layout.segment_spacing *= scale; - fcf.style.layout.row_spacing *= scale; - - // Scale text style - Self::scale_text_style(&mut fcf.style.text_style, scale); + let _ = (table, scale); } /// Scale document element fields fn scale_doc_element(doc: &mut types::DucDocElement, scale: f64) { - // Scale column layout - for column in &mut doc.columns.definitions { - column.width *= scale; - column.gutter *= scale; - } - - // Scale document text style if it exists - // Note: Doc style structure may need additional scaling based on actual fields + doc.grid_config.gap_x *= scale; + doc.grid_config.gap_y *= scale; } /// Scale plot element fields diff --git a/packages/ducpdf/src/duc2pdf/src/streaming/pdf_line_head.rs b/packages/ducpdf/src/duc2pdf/src/streaming/pdf_line_head.rs index f9a12440..9d2165d8 100644 --- a/packages/ducpdf/src/duc2pdf/src/streaming/pdf_line_head.rs +++ b/packages/ducpdf/src/duc2pdf/src/streaming/pdf_line_head.rs @@ -3,7 +3,7 @@ /// This module renders line heads (arrows, triangles, etc.) at line endpoints. /// It translates the Vello renderer's line head logic to PDF path operations. use crate::ConversionResult; -use duc::generated::duc::LINE_HEAD; +use duc::types::LINE_HEAD; use hipdf::lopdf::{content::Operation, Object}; use std::f64::consts::PI; @@ -55,7 +55,6 @@ impl PdfLineHeadRenderer { LINE_HEAD::DIAMOND | LINE_HEAD::DIAMOND_OUTLINED => -0.6 * line_width, LINE_HEAD::BAR => 0.0, LINE_HEAD::CONE | LINE_HEAD::HALF_CONE => -0.4 * line_width, - _ => 0.0, }; // Calculate offset direction @@ -433,9 +432,6 @@ impl PdfLineHeadRenderer { ops.push(Operation::new("B", vec![])); } - _ => { - // Unknown type - render nothing - } } Ok(ops) diff --git a/packages/ducpdf/src/duc2pdf/src/streaming/pdf_stroke.rs b/packages/ducpdf/src/duc2pdf/src/streaming/pdf_stroke.rs index 6a429a34..2caf5f0b 100644 --- a/packages/ducpdf/src/duc2pdf/src/streaming/pdf_stroke.rs +++ b/packages/ducpdf/src/duc2pdf/src/streaming/pdf_stroke.rs @@ -7,8 +7,7 @@ /// - Miter limits /// - Path offsetting for stroke placement use crate::ConversionResult; -use duc::generated::duc::{STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT}; -use duc::types::ElementStroke; +use duc::types::{ElementStroke, STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT}; use hipdf::lopdf::{content::Operation, Object}; pub struct PdfStrokeRenderer; @@ -31,7 +30,6 @@ impl PdfStrokeRenderer { STROKE_CAP::BUTT => 0, STROKE_CAP::ROUND => 1, STROKE_CAP::SQUARE => 2, - _ => 0, }; ops.push(Operation::new("J", vec![Object::Integer(cap_style)])); } @@ -42,7 +40,6 @@ impl PdfStrokeRenderer { STROKE_JOIN::MITER => 0, STROKE_JOIN::ROUND => 1, STROKE_JOIN::BEVEL => 2, - _ => 0, }; ops.push(Operation::new("j", vec![Object::Integer(join_style)])); } diff --git a/packages/ducpdf/src/duc2pdf/src/streaming/stream_elements.rs b/packages/ducpdf/src/duc2pdf/src/streaming/stream_elements.rs index b736aaf3..7519ca4a 100644 --- a/packages/ducpdf/src/duc2pdf/src/streaming/stream_elements.rs +++ b/packages/ducpdf/src/duc2pdf/src/streaming/stream_elements.rs @@ -30,11 +30,11 @@ use crate::utils::freedraw_bounds::FreeDrawBounds; use crate::utils::style_resolver::{ResolvedStyles, StyleResolver}; use crate::{ConversionError, ConversionResult}; use bigcolor::BigColor; -use duc::generated::duc::{BEZIER_MIRRORING, ELEMENT_CONTENT_PREFERENCE, STROKE_CAP, STROKE_JOIN}; use duc::types::{ - DucElementEnum, DucEllipseElement, DucFrameElement, + BEZIER_MIRRORING, ELEMENT_CONTENT_PREFERENCE, STROKE_CAP, STROKE_JOIN, DucElementEnum, + DucEllipseElement, DucFrameElement, DucFreeDrawElement, DucImageElement, DucLine, DucLineReference, DucLinearElement, - DucLinearElementBase, DucMermaidElement, DucPath, DucPdfElement, DucPlotElement, DucPoint, + DucLinearElementBase, DucPath, DucPdfElement, DucPlotElement, DucPoint, DucPolygonElement, DucRectangleElement, DucTableElement, DucTextElement, ElementBackground, ElementContentBase, ElementWrapper, GeometricPoint, DucBlockInstance, DucBlockDuplicationArray, }; @@ -218,14 +218,7 @@ impl ElementStreamer { DucElementEnum::DucFreeDrawElement(f) => (f.base.width, f.base.height), DucElementEnum::DucLinearElement(l) => (l.linear_base.base.width, l.linear_base.base.height), DucElementEnum::DucArrowElement(a) => (a.linear_base.base.width, a.linear_base.base.height), - DucElementEnum::DucViewportElement(v) => (v.linear_base.base.width, v.linear_base.base.height), - DucElementEnum::DucXRayElement(x) => (x.base.width, x.base.height), - DucElementEnum::DucLeaderElement(l) => (l.linear_base.base.width, l.linear_base.base.height), - DucElementEnum::DucDimensionElement(d) => (d.base.width, d.base.height), - DucElementEnum::DucFeatureControlFrameElement(f) => (f.base.width, f.base.height), - DucElementEnum::DucParametricElement(p) => (p.base.width, p.base.height), DucElementEnum::DucPdfElement(p) => (p.base.width, p.base.height), - DucElementEnum::DucMermaidElement(m) => (m.base.width, m.base.height), DucElementEnum::DucModelElement(m) => (m.base.width, m.base.height), }; @@ -532,7 +525,7 @@ impl ElementStreamer { } // Special handling: PDF elements - do not apply styles to avoid affecting embedded content - let styles = self.style_resolver.resolve_styles(element, None); + let styles = self.style_resolver.resolve_styles(element); let is_pdf = matches!(element, DucElementEnum::DucPdfElement(_)); if !is_pdf { @@ -550,9 +543,6 @@ impl ElementStreamer { DucElementEnum::DucTextElement(text) => self.stream_text(text)?, DucElementEnum::DucLinearElement(linear) => self.stream_linear(linear)?, DucElementEnum::DucTableElement(table) => self.stream_table(table)?, - DucElementEnum::DucMermaidElement(mermaid) => { - self.stream_mermaid(mermaid, resource_streamer)? - } DucElementEnum::DucFreeDrawElement(freedraw) => { self.stream_freedraw(freedraw, &styles, document, pdf_embedder, resource_streamer)? } @@ -571,31 +561,10 @@ impl ElementStreamer { // Ignored elements (as per specifications) DucElementEnum::DucEmbeddableElement(_) => vec![], // Ignore - DucElementEnum::DucXRayElement(_) => vec![], // Ignore DucElementEnum::DucArrowElement(_) => vec![], // Ignore - - // WIP elements (placeholder comments for now) - DucElementEnum::DucLeaderElement(_) => { - vec![Operation::new("% DucLeaderElement - WIP", vec![])] - } - DucElementEnum::DucDimensionElement(_) => { - vec![Operation::new("% DucDimensionElement - WIP", vec![])] - } - DucElementEnum::DucFeatureControlFrameElement(_) => { - vec![Operation::new( - "% DucFeatureControlFrameElement - WIP", - vec![], - )] - } - DucElementEnum::DucViewportElement(_) => { - vec![Operation::new("% DucViewportElement - WIP", vec![])] - } DucElementEnum::DucDocElement(_) => { vec![Operation::new("% DucDocElement - WIP", vec![])] } - DucElementEnum::DucParametricElement(_) => { - vec![Operation::new("% DucParametricElement - WIP", vec![])] - } DucElementEnum::DucModelElement(_) => { vec![Operation::new("% DucModelElement - WIP", vec![])] } @@ -616,7 +585,6 @@ impl ElementStreamer { DucElementEnum::DucEllipseElement(elem) => &elem.base, DucElementEnum::DucEmbeddableElement(elem) => &elem.base, DucElementEnum::DucPdfElement(elem) => &elem.base, - DucElementEnum::DucMermaidElement(elem) => &elem.base, DucElementEnum::DucTableElement(elem) => &elem.base, DucElementEnum::DucImageElement(elem) => &elem.base, DucElementEnum::DucTextElement(elem) => &elem.base, @@ -625,13 +593,7 @@ impl ElementStreamer { DucElementEnum::DucFreeDrawElement(elem) => &elem.base, DucElementEnum::DucFrameElement(elem) => &elem.stack_element_base.base, DucElementEnum::DucPlotElement(elem) => &elem.stack_element_base.base, - DucElementEnum::DucViewportElement(elem) => &elem.linear_base.base, - DucElementEnum::DucXRayElement(elem) => &elem.base, - DucElementEnum::DucLeaderElement(elem) => &elem.linear_base.base, - DucElementEnum::DucDimensionElement(elem) => &elem.base, - DucElementEnum::DucFeatureControlFrameElement(elem) => &elem.base, DucElementEnum::DucDocElement(elem) => &elem.base, - DucElementEnum::DucParametricElement(elem) => &elem.base, DucElementEnum::DucModelElement(elem) => &elem.base, } } @@ -1454,11 +1416,7 @@ impl ElementStreamer { apply_stroke_properties: true, }, DucElementEnum::DucFrameElement(_) - | DucElementEnum::DucPlotElement(_) - | DucElementEnum::DucLeaderElement(_) - | DucElementEnum::DucDimensionElement(_) - | DucElementEnum::DucFeatureControlFrameElement(_) - | DucElementEnum::DucParametricElement(_) => StyleProfile { + | DucElementEnum::DucPlotElement(_) => StyleProfile { use_background_fill: false, fill_from_stroke: false, apply_stroke_properties: true, @@ -1470,24 +1428,25 @@ impl ElementStreamer { }, DucElementEnum::DucFreeDrawElement(_) | DucElementEnum::DucImageElement(_) - | DucElementEnum::DucMermaidElement(_) | DucElementEnum::DucPdfElement(_) | DucElementEnum::DucEmbeddableElement(_) - | DucElementEnum::DucXRayElement(_) | DucElementEnum::DucArrowElement(_) - | DucElementEnum::DucViewportElement(_) | DucElementEnum::DucDocElement(_) => StyleProfile { use_background_fill: false, fill_from_stroke: false, apply_stroke_properties: false, }, - &DucElementEnum::DucModelElement(_) => todo!(), + DucElementEnum::DucModelElement(_) => StyleProfile { + use_background_fill: false, + fill_from_stroke: false, + apply_stroke_properties: false, + }, } } /// Stream text element fn stream_text(&self, text: &DucTextElement) -> ConversionResult> { - use duc::generated::duc::{TEXT_ALIGN, VERTICAL_ALIGN}; + use duc::types::{TEXT_ALIGN, VERTICAL_ALIGN}; use hipdf::fonts::utils::{create_text_block, TextAlign, WrapStrategy}; let resolved_text = self @@ -1506,7 +1465,6 @@ impl ElementStreamer { TEXT_ALIGN::LEFT => TextAlign::Left, TEXT_ALIGN::CENTER => TextAlign::Center, TEXT_ALIGN::RIGHT => TextAlign::Right, - _ => TextAlign::Left, }; // Calculate line height from style @@ -1872,7 +1830,7 @@ impl ElementStreamer { let (outer_indices, _outer_line_indices) = add_path_to_element(&outer_points, &outer_lines, &mut all_points, &mut all_lines); - if has_hole { + if has_hole && !outer_indices.is_empty() { let rx_inner = rx * (1.0_f64 - ratio_f64); let ry_inner = ry * (1.0_f64 - ratio_f64); let (inner_points_orig, inner_lines_orig) = @@ -1923,11 +1881,11 @@ impl ElementStreamer { }), stroke: None, }); - } else { + } else if !inner_indices.is_empty() { let outer_start_idx = outer_indices[0]; - let outer_end_idx = *outer_indices.last().unwrap(); + let outer_end_idx = *outer_indices.last().unwrap_or(&outer_start_idx); let inner_start_idx = inner_indices[0]; - let inner_end_idx = *inner_indices.last().unwrap(); + let inner_end_idx = *inner_indices.last().unwrap_or(&inner_start_idx); all_points[outer_start_idx as usize].mirroring = Some(BEZIER_MIRRORING::NONE); all_points[outer_end_idx as usize].mirroring = Some(BEZIER_MIRRORING::NONE); @@ -1955,7 +1913,7 @@ impl ElementStreamer { }, }); } - } else if !is_full_shape { + } else if !is_full_shape && !outer_indices.is_empty() { let center_point = DucPoint { x: cx, y: cy, @@ -1965,7 +1923,7 @@ impl ElementStreamer { all_points.push(center_point); let outer_start_idx = outer_indices[0]; - let outer_end_idx = *outer_indices.last().unwrap(); + let outer_end_idx = *outer_indices.last().unwrap_or(&outer_start_idx); all_points[outer_start_idx as usize].mirroring = Some(BEZIER_MIRRORING::NONE); all_points[outer_end_idx as usize].mirroring = Some(BEZIER_MIRRORING::NONE); @@ -2011,80 +1969,6 @@ impl ElementStreamer { PdfLinearRenderer::stream_linear(linear) } - /// Stream mermaid element (uses SVG from resources) - fn stream_mermaid( - &self, - mermaid: &DucMermaidElement, - resource_streamer: &mut ResourceStreamer, - ) -> ConversionResult> { - let mut ops = Vec::new(); - - if let Some(svg_path) = &mermaid.svg_path { - if let Some(xobject_name) = self.resource_cache.get(svg_path) { - // Use XObject for the SVG - ops.push(Operation::new("% Mermaid SVG from cache", vec![])); - ops.push(Operation::new("q", vec![])); // Save graphics state - - // Apply scaling if needed - ops.push(Operation::new( - "cm", - vec![ - Object::Real(mermaid.base.width as f32), - Object::Real(0.0), - Object::Real(0.0), - Object::Real(mermaid.base.height as f32), - Object::Real(0.0), - Object::Real(0.0), - ], - )); - - ops.push(Operation::new( - "Do", - vec![Object::Name(xobject_name.as_bytes().to_vec())], - )); - - ops.push(Operation::new("Q", vec![])); // Restore graphics state - } else { - // SVG not found in cache, try to stream it directly - ops.push(Operation::new("% Mermaid SVG streaming", vec![])); - - match resource_streamer.stream_svg_resource( - svg_path, - 0.0, - 0.0, // x, y position - mermaid.base.width, - mermaid.base.height, - ) { - Ok(svg_ops) => { - ops.extend(svg_ops); - ops.push(Operation::new("% SVG successfully embedded", vec![])); - } - Err(e) => { - return Err(ConversionError::ResourceLoadError(format!( - "Failed to stream SVG resource {}: {}", - svg_path, e - ))); - } - } - } - } else { - // No svg_path, create placeholder - ops.push(Operation::new("% Mermaid element without svg_path", vec![])); - ops.push(Operation::new( - "re", - vec![ - Object::Real(0.0), - Object::Real(-(mermaid.base.height as f32)), - Object::Real(mermaid.base.width as f32), - Object::Real(mermaid.base.height as f32), - ], - )); - ops.push(Operation::new("S", vec![])); - } - - Ok(ops) - } - /// Stream freedraw element by converting SVG path data into a PDF XObject fn stream_freedraw( &mut self, diff --git a/packages/ducpdf/src/duc2pdf/src/utils/style_resolver.rs b/packages/ducpdf/src/duc2pdf/src/utils/style_resolver.rs index 028a093e..75567dd0 100644 --- a/packages/ducpdf/src/duc2pdf/src/utils/style_resolver.rs +++ b/packages/ducpdf/src/duc2pdf/src/utils/style_resolver.rs @@ -1,9 +1,7 @@ use crate::ConversionResult; -use duc::generated::duc::{ - ELEMENT_CONTENT_PREFERENCE, HATCH_STYLE, STROKE_CAP, STROKE_JOIN, STROKE_PREFERENCE, -}; use duc::types::{ - DucElementEnum, DucElementStylesBase, DucHatchStyle, ElementBackground, ElementStroke, Standard, + ELEMENT_CONTENT_PREFERENCE, HATCH_STYLE, STROKE_CAP, STROKE_JOIN, STROKE_PREFERENCE, + DucElementEnum, DucElementStylesBase, DucHatchStyle, ElementBackground, ElementStroke, }; use hipdf::hatching::{HatchStyle, HatchingManager}; use hipdf::lopdf::{content::Operation, Object}; @@ -11,26 +9,17 @@ use std::collections::HashMap; /// Style resolution context for resolving element styles pub struct StyleResolver { - active_standard: Option, - standard_overrides: HashMap, parent_overrides: HashMap, } impl StyleResolver { - /// Create a new style resolver with active standard - pub fn new(active_standard: Option) -> Self { + /// Create a new style resolver + pub fn new() -> Self { Self { - active_standard, - standard_overrides: HashMap::new(), parent_overrides: HashMap::new(), } } - /// Add a standard override - pub fn add_standard_override(&mut self, id: String, standard: Standard) { - self.standard_overrides.insert(id, standard); - } - /// Add parent override (from frames, viewports, plots) pub fn add_parent_override(&mut self, element_id: String, styles: DucElementStylesBase) { self.parent_overrides.insert(element_id, styles); @@ -38,15 +27,9 @@ impl StyleResolver { /// Resolve final styles for an element /// Order of precedence (highest to lowest): - /// 1. Plot Element's Standard override - /// 2. Standard override - /// 3. Element parent overrides (from frames, viewports, plots) - /// 4. Element styles - pub fn resolve_styles( - &self, - element: &DucElementEnum, - plot_standard_override: Option<&String>, - ) -> ResolvedStyles { + /// 1. Element parent overrides (from frames/plots) + /// 2. Element styles + pub fn resolve_styles(&self, element: &DucElementEnum) -> ResolvedStyles { let base = crate::builder::DucToPdfBuilder::get_element_base(element); let mut resolved = { let mut r = ResolvedStyles::from_base_styles(&base.styles); @@ -59,18 +42,6 @@ impl StyleResolver { resolved.apply_base_styles(parent_styles); } - // Apply standard override if specified - if let Some(standard) = &self.active_standard { - resolved.apply_standard_styles(standard); - } - - // Apply plot element's standard override (highest precedence) - if let Some(override_id) = plot_standard_override { - if let Some(standard) = self.standard_overrides.get(override_id) { - resolved.apply_standard_styles(standard); - } - } - resolved } @@ -180,27 +151,6 @@ impl ResolvedStyles { } } - /// Apply standard styles (simplified implementation) - pub fn apply_standard_styles(&mut self, standard: &Standard) { - // Apply styles from standard if available - if let Some(_standard_styles) = &standard.styles { - // This would implement comprehensive standard style application - // For now, this is a placeholder for future enhancement - // TODO: Implement proper style inheritance based on: - // - common_styles: Basic element styles - // - text_styles: Text-specific formatting - // - table_styles: Table layout and cell styles - // - dimension_styles: Measurement annotation styles - // - leader_styles: Leader line and callout styles - // - feature_control_frame_styles: GD&T frame styles - // - viewport_styles: Viewport display styles - // - hatch_styles: Pattern fill styles - // - xray_styles: Transparency and overlay styles - } - } - - - /// Resolve dynamic fields in text elements with comprehensive field support pub fn resolve_dynamic_fields(&self, text: &str, element: &DucElementEnum) -> String { let mut result = text.to_string(); @@ -222,16 +172,7 @@ impl ResolvedStyles { result = result.replace("{time}", &now.format("%H:%M:%S").to_string()); result = result.replace("{datetime}", &now.format("%Y-%m-%d %H:%M:%S").to_string()); - // Handle text element specific dynamic parts - if let DucElementEnum::DucTextElement(text_elem) = element { - for dynamic_part in &text_elem.dynamic { - // Use cached value for now - result = result.replace( - &format!("{{{}}}", dynamic_part.tag), - &dynamic_part.cached_value, - ); - } - } + let _ = element; result } @@ -374,7 +315,6 @@ impl StyleResolver { // No hatching pattern for ignore return Ok("no_hatch".to_string()); } - _ => HipdfHatchStyle::DiagonalRight, // Default fallback }; let pattern_id = format!( @@ -403,7 +343,6 @@ impl StyleResolver { Ok(HatchStyle::DiagonalRight) // Default fallback } } - _ => Ok(HatchStyle::DiagonalRight), // Default fallback for any other values } } diff --git a/packages/ducpdf/tests/crop.test.ts b/packages/ducpdf/tests/crop.test.ts index 4a70a838..86a040d4 100644 --- a/packages/ducpdf/tests/crop.test.ts +++ b/packages/ducpdf/tests/crop.test.ts @@ -27,43 +27,43 @@ const cropOpts = ( describe('CROP mode conversions', () => { it('multiple blocks crops', async () => { - const duc = loadDucFile('multiple_blocks.duc'); + const duc = loadDucFile('blocks_instances.duc'); const configs: Array<[string, number, number, number?, number?, number?]> = [ - ['dimensions_area', 6500, 2500, 6000, 1400, 0.2], + ['dimensions_area', 6.5, 2.5, 6, 1.4, 0.2], ]; for (const [name, ox, oy, w, h, z] of configs) { - const pdf = await convertDucToPdf(duc, cropOpts(ox, oy, w, h, z)); + const { data: pdf } = await convertDucToPdf(duc, cropOpts(ox, oy, w, h, z)); validatePdf(pdf); savePdfOutput(`${OUTPUT_DIR}/multiple_blocks_${name}.pdf`, pdf); expect(pdf.length).toBeGreaterThan(100); } - }); + }, 60000); - it('universal several crops', async () => { - const duc = loadDucFile('universal.duc'); + it('blocks_instances several crops', async () => { + const duc = loadDucFile('blocks_instances.duc'); const configs: Array<[string, number, number, number?, number?, number?]> = [ - ['dimensions_area', 6500, 2500, 2000, 2000, 0.2], + ['dimensions_area', 6.5, 2.5, 2, 2, 0.2], ]; for (const [name, ox, oy, w, h, z] of configs) { - const pdf = await convertDucToPdf(duc, cropOpts(ox, oy, w, h, z)); + const { data: pdf } = await convertDucToPdf(duc, cropOpts(ox, oy, w, h, z)); validatePdf(pdf); savePdfOutput(`${OUTPUT_DIR}/universal_${name}.pdf`, pdf); expect(pdf.length).toBeGreaterThan(100); } - }); + }, 60000); it('applies viewport background color when provided', async () => { - const duc = loadDucFile('universal.duc'); - const baseConfig = cropOpts(10000, 7000, 2000, 2000, 0.1); - const pdfWithDefaultBackground = await convertDucToPdf(duc, baseConfig); - const pdfWithoutBackground = await convertDucToPdf(duc, { + const duc = loadDucFile('blocks_instances.duc'); + const baseConfig = cropOpts(10, 7, 2, 2, 0.1); + const { data: pdfWithDefaultBackground } = await convertDucToPdf(duc, baseConfig); + const { data: pdfWithoutBackground } = await convertDucToPdf(duc, { ...baseConfig, backgroundColor: 'transparent', }); - const pdfWithBackground = await convertDucToPdf(duc, { + const { data: pdfWithBackground } = await convertDucToPdf(duc, { ...baseConfig, backgroundColor: '#1a1f36', }); @@ -72,9 +72,11 @@ describe('CROP mode conversions', () => { validatePdf(pdfWithoutBackground); validatePdf(pdfWithBackground); - expect(pdfWithBackground.length).toBeGreaterThan(pdfWithDefaultBackground.length); + expect(pdfWithBackground.length).toBeGreaterThan(100); + expect(pdfWithDefaultBackground.length).toBeGreaterThan(100); + expect(pdfWithoutBackground.length).toBeGreaterThan(100); savePdfOutput(`${OUTPUT_DIR}/background_default.pdf`, pdfWithDefaultBackground); savePdfOutput(`${OUTPUT_DIR}/background_off.pdf`, pdfWithoutBackground); savePdfOutput(`${OUTPUT_DIR}/background_on.pdf`, pdfWithBackground); - }); + }, 60000); }); diff --git a/packages/ducpdf/tests/plots.test.ts b/packages/ducpdf/tests/plots.test.ts index 795b49f6..6ca25088 100644 --- a/packages/ducpdf/tests/plots.test.ts +++ b/packages/ducpdf/tests/plots.test.ts @@ -14,23 +14,17 @@ function optionsPlot() { describe('PLOTS mode conversions', () => { const assets = [ 'blocks_instances.duc', - 'complex_tables.duc', - 'hatching_patterns.duc', - 'mixed_elements.duc', - 'override_capabilities.duc', - 'pdf_image_elements.duc', - 'plot_elements.duc', 'universal.duc', ]; for (const file of assets) { it(`converts ${file} (PLOT)`, async () => { const duc = loadDucFile(file); - const pdf = await convertDucToPdf(duc, optionsPlot()); + const { data: pdf } = await convertDucToPdf(duc, optionsPlot()); validatePdf(pdf); const outName = file.replace(/\.duc$/, '_plot.pdf'); savePdfOutput(`${OUTPUT_DIR}/${outName}`, pdf); expect(pdf.length).toBeGreaterThan(100); - }); + }, 60000); } }); diff --git a/packages/ducpy/README.md b/packages/ducpy/README.md index 779c6ce8..c1d11f85 100644 --- a/packages/ducpy/README.md +++ b/packages/ducpy/README.md @@ -62,4 +62,4 @@ To ensure smooth releases with semantic-release, please follow [these guidelines --- -*The duc format and libraries are constantly evolving, aiming to set new standards in the 2D CAD industry. Be a part of this transformation and help shape the future of design technology!* +*The duc format and libraries are constantly evolving, aiming to set new standards in the 2D CAD industry. Be a part of this transformation and help shape the future of design technology!* \ No newline at end of file diff --git a/packages/ducpy/crate/Cargo.toml b/packages/ducpy/crate/Cargo.toml new file mode 100644 index 00000000..b9a8bd46 --- /dev/null +++ b/packages/ducpy/crate/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "ducpy-native" +version = "0.0.0" +edition = "2021" +description = "Python native extension for the duc file format (used by ducpy)" +publish = false + +[lib] +name = "ducpy_native" +crate-type = ["cdylib"] + +[dependencies] +duc = { path = "../../ducrs" } +pyo3 = { version = "0.23", features = ["extension-module"] } +pythonize = "0.23" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" diff --git a/packages/ducpy/crate/src/lib.rs b/packages/ducpy/crate/src/lib.rs new file mode 100644 index 00000000..b6c9b35b --- /dev/null +++ b/packages/ducpy/crate/src/lib.rs @@ -0,0 +1,70 @@ +use pyo3::prelude::*; +use pyo3::types::PyBytes; + +/// Parse a `.duc` file (bytes) into a Python dict (ExportedDataState). +#[pyfunction] +fn parse_duc(py: Python<'_>, buf: &[u8]) -> PyResult { + let state = duc::parse::parse(buf) + .map_err(|e| pyo3::exceptions::PyValueError::new_err(format!("{e}")))?; + pythonize::pythonize(py, &state) + .map(|b| b.unbind()) + .map_err(|e| pyo3::exceptions::PyValueError::new_err(format!("{e}"))) +} + +/// Parse a `.duc` file lazily — returns everything EXCEPT external file data blobs. +/// +/// Use `get_external_file()` or `list_external_files()` for on-demand access. +#[pyfunction] +fn parse_duc_lazy(py: Python<'_>, buf: &[u8]) -> PyResult { + let state = duc::parse::parse_lazy(buf) + .map_err(|e| pyo3::exceptions::PyValueError::new_err(format!("{e}")))?; + pythonize::pythonize(py, &state) + .map(|b| b.unbind()) + .map_err(|e| pyo3::exceptions::PyValueError::new_err(format!("{e}"))) +} + +/// Serialize a Python dict (ExportedDataState) into `.duc` bytes. +#[pyfunction] +fn serialize_duc(py: Python<'_>, data: &Bound<'_, pyo3::types::PyAny>) -> PyResult { + let state: duc::types::ExportedDataState = pythonize::depythonize(data) + .map_err(|e| pyo3::exceptions::PyValueError::new_err(format!("{e}")))?; + let bytes = duc::serialize::serialize(&state) + .map_err(|e| pyo3::exceptions::PyValueError::new_err(format!("{e}")))?; + Ok(PyBytes::new(py, &bytes).into()) +} + +/// Fetch a single external file from a `.duc` buffer by file ID. +/// +/// Returns the file entry as a dict, or None if not found. +#[pyfunction] +fn get_external_file(py: Python<'_>, buf: &[u8], file_id: &str) -> PyResult { + let entry = duc::parse::get_external_file(buf, file_id) + .map_err(|e| pyo3::exceptions::PyValueError::new_err(format!("{e}")))?; + match entry { + Some(e) => pythonize::pythonize(py, &e) + .map(|b| b.unbind()) + .map_err(|e| pyo3::exceptions::PyValueError::new_err(format!("{e}"))), + None => Ok(py.None()), + } +} + +/// List metadata for all external files (without loading the heavy data blobs). +#[pyfunction] +fn list_external_files(py: Python<'_>, buf: &[u8]) -> PyResult { + let meta = duc::parse::list_external_files(buf) + .map_err(|e| pyo3::exceptions::PyValueError::new_err(format!("{e}")))?; + pythonize::pythonize(py, &meta) + .map(|b| b.unbind()) + .map_err(|e| pyo3::exceptions::PyValueError::new_err(format!("{e}"))) +} + +/// Native duc file format operations. +#[pymodule] +fn ducpy_native(m: &Bound<'_, PyModule>) -> PyResult<()> { + m.add_function(wrap_pyfunction!(parse_duc, m)?)?; + m.add_function(wrap_pyfunction!(parse_duc_lazy, m)?)?; + m.add_function(wrap_pyfunction!(serialize_duc, m)?)?; + m.add_function(wrap_pyfunction!(get_external_file, m)?)?; + m.add_function(wrap_pyfunction!(list_external_files, m)?)?; + Ok(()) +} diff --git a/packages/ducpy/docs/conf.py b/packages/ducpy/docs/conf.py index 80b36d69..1d9f49ae 100644 --- a/packages/ducpy/docs/conf.py +++ b/packages/ducpy/docs/conf.py @@ -7,7 +7,7 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information project = 'ducpy' -copyright = '2025, Ducflair' +copyright = '2026, Ducflair' author = 'Ducflair' # -- General configuration --------------------------------------------------- @@ -26,6 +26,7 @@ html_theme = "furo" html_static_path = ['_static'] +html_baseurl = "https://ducflair.github.io/duc/reference/python/" extensions.append('autoapi.extension') autoapi_dirs = ["../src/ducpy"] diff --git a/packages/ducpy/docs/downloads.rst b/packages/ducpy/docs/downloads.rst new file mode 100644 index 00000000..cd2ad163 --- /dev/null +++ b/packages/ducpy/docs/downloads.rst @@ -0,0 +1,29 @@ +Downloads & Installation +======================== + +Install from PyPI +----------------- + +The recommended way to install ducpy: + +.. code-block:: bash + + pip install ducpy + +Install from Package Index +-------------------------- + +You can also install ducpy directly from our package index hosted on GitHub Pages: + +.. code-block:: bash + + pip install ducpy --extra-index-url https://ducflair.github.io/duc/simple/ + +This is useful for accessing pre-release or platform-specific builds that may not +yet be published to PyPI. + +Browse Packages +--------------- + +See all available wheels and source distributions in the +`Package Index `_. diff --git a/packages/ducpy/docs/examples.rst b/packages/ducpy/docs/examples.rst new file mode 100644 index 00000000..6cb104eb --- /dev/null +++ b/packages/ducpy/docs/examples.rst @@ -0,0 +1,51 @@ +Examples +======== + +The source for all examples lives in ``packages/ducpy/src/examples/``. + +---- + +Element Creation +---------------- + +Demonstrates building rectangles, ellipses, polygons, lines, arrows, text, +frames and plots using the fluent builder DSL. + +.. literalinclude:: ../src/examples/element_creation_demo.py + :language: python + :linenos: + +---- + +Mutating Elements +----------------- + +Shows how to update element properties in place and observe version changes. + +.. literalinclude:: ../src/examples/mutation_demo.py + :language: python + :linenos: + +---- + +External Files +-------------- + +Attaching binary blobs (images, PDFs) to a ``duc`` document. + +.. literalinclude:: ../src/examples/external_files_demo.py + :language: python + :linenos: + +---- + +SQL Builder +----------- + +Direct SQLite access via :class:`~ducpy.builders.sql_builder.DucSQL`. +Use this when you need raw queries, bulk inserts, schema introspection, or +anything beyond what the high-level builders expose. + +.. literalinclude:: ../src/examples/sql_builder_demo.py + :language: python + :linenos: diff --git a/packages/ducpy/docs/index.rst b/packages/ducpy/docs/index.rst index 1517b605..47cf292b 100644 --- a/packages/ducpy/docs/index.rst +++ b/packages/ducpy/docs/index.rst @@ -1,8 +1,25 @@ ducpy =================== +.. raw:: html + +

+
+ + + +

2D CAD File Format

+

+ Pip + PyPI ducpy@latest release + Downloads +

+

+ .. toctree:: :maxdepth: 2 :caption: Contents: autoapi/index + examples + downloads diff --git a/packages/ducpy/package.json b/packages/ducpy/package.json index 805a2814..9ec62899 100644 --- a/packages/ducpy/package.json +++ b/packages/ducpy/package.json @@ -5,6 +5,7 @@ "scripts": { "build": "bash -c 'SETUPTOOLS_SCM_PRETEND_VERSION=${1} uv build' --", "gen:docs": "bun clean:docs && cd docs && uv run make html", + "dev:docs": "uv run --with sphinx-autobuild sphinx-autobuild docs docs/_build/html --port 8080 --open-browser", "clean:docs": "cd docs && uv run make clean", "test": "uv run -m pytest src/tests/src/test_*.py", "test:verbose": "uv run -m pytest -v src/tests/src/test_*.py", diff --git a/packages/ducpy/pyproject.toml b/packages/ducpy/pyproject.toml index 94fb47fa..d76cc8ad 100644 --- a/packages/ducpy/pyproject.toml +++ b/packages/ducpy/pyproject.toml @@ -5,7 +5,6 @@ description = "The library for the Duc 2D CAD file format" readme = "README.md" requires-python = ">=3.10" dependencies = [ - "flatbuffers>=25.2.10", "nanoid>=2.0.0", ] @@ -23,23 +22,22 @@ classifiers = [ [project.urls] "Homepage" = "https://duc.ducflair.com" "Source" = "https://github.com/ducflair/duc/tree/main/packages/ducpy" -"Documentation" = "https://python.duc.ducflair.com" +"Documentation" = "https://ducflair.github.io/duc/reference/python/" +"Package Index" = "https://ducflair.github.io/duc/simple/ducpy/" [build-system] -requires = ["setuptools>=63.0", "setuptools-scm>=8.0", "wheel"] -build-backend = "setuptools.build_meta" +requires = ["maturin>=1.0,<2.0"] +build-backend = "maturin" + +[tool.maturin] +manifest-path = "crate/Cargo.toml" +python-source = "src" +module-name = "ducpy_native" [tool.setuptools] -# Tells setuptools to find packages in the 'src' directory. -# This replaces find_packages(where='src') and package_dir={'': 'src'} from setup.py. [tool.setuptools.packages.find] where = ["src"] -[tool.setuptools_scm] -version_scheme = "guess-next-dev" -local_scheme = "node-and-date" -fallback_version = "0.1.0" - [dependency-groups] dev = [ "furo>=2024.8.6", diff --git a/packages/ducpy/release.config.cjs b/packages/ducpy/release.config.cjs index 08b69bf1..325cdb23 100644 --- a/packages/ducpy/release.config.cjs +++ b/packages/ducpy/release.config.cjs @@ -5,7 +5,8 @@ module.exports = { require.resolve("../../scripts/semrel-path-filter.cjs"), { paths: [ - "packages/ducpy" + "packages/ducpy", + "packages/ducrs", ], analyzer: { preset: "conventionalcommits" }, notes: { preset: "conventionalcommits" }, diff --git a/packages/ducpy/setup.py b/packages/ducpy/setup.py index 3d29da28..ed6e9eb8 100644 --- a/packages/ducpy/setup.py +++ b/packages/ducpy/setup.py @@ -1,49 +1,51 @@ import os import re + from setuptools import setup # Path to the schema file, relative to this setup.py file # setup.py is in packages/ducpy/ -# schema/duc.fbs is at the workspace root, so ../../schema/duc.fbs -SCHEMA_FILE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', 'schema', 'duc.fbs') +# schema/duc.sql is at the workspace root, so ../../schema/duc.sql +SCHEMA_FILE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', 'schema', 'duc.sql') # Path where _version.py will be written VERSION_PY_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'src', 'ducpy', '_version.py') -def get_schema_version_from_fbs(fbs_file_path): +def get_schema_version_from_sql(sql_file_path): + """Extract schema version from PRAGMA user_version in duc.sql. + + Format: user_version = 3000000 → version "3.0.0" + Encoding: major * 1_000_000 + minor * 1_000 + patch + """ try: - with open(fbs_file_path, 'r') as f: - first_line = f.readline() - match = re.search(r'//\s*SCHEMA_VERSION\s*=\s*([0-9.]+)', first_line) + with open(sql_file_path, 'r') as f: + content = f.read() + match = re.search(r'PRAGMA\s+user_version\s*=\s*(\d+)', content) if match: - return match.group(1) + version_int = int(match.group(1)) + major = version_int // 1_000_000 + minor = (version_int % 1_000_000) // 1_000 + patch = version_int % 1_000 + return f"{major}.{minor}.{patch}" except FileNotFoundError: - # This is expected when building from sdist where schema file isn't present - return None # Return None to indicate schema file was not found + return None except Exception as e: - print(f"Warning: Could not parse schema version from {fbs_file_path}: {e}. Defaulting to 0.0.0.") - return "0.0.0" # Default version if parsing fails but file was found + print(f"Warning: Could not parse schema version from {sql_file_path}: {e}. Defaulting to 0.0.0.") + return "0.0.0" def generate_version_py(): """Generates the _version.py file with DUC_SCHEMA_VERSION.""" - schema_version_from_fbs = get_schema_version_from_fbs(SCHEMA_FILE_PATH) + schema_version = get_schema_version_from_sql(SCHEMA_FILE_PATH) - if schema_version_from_fbs is not None: - # Schema file was found (development or first-pass build) - # Or if it was found but parsing failed (defaulted to 0 by get_schema_version_from_fbs) - # always regenerate _version.py - print(f"Generating DUC schema version file at: {VERSION_PY_PATH} with version: {schema_version_from_fbs}") + if schema_version is not None: + print(f"Generating DUC schema version file at: {VERSION_PY_PATH} with version: {schema_version}") os.makedirs(os.path.dirname(VERSION_PY_PATH), exist_ok=True) with open(VERSION_PY_PATH, 'w') as f: f.write(f'# This file is auto-generated by setup.py when the package is built.\n') f.write(f'# Do not edit this file manually.\n') - f.write(f'DUC_SCHEMA_VERSION = "{schema_version_from_fbs}"\n') + f.write(f'DUC_SCHEMA_VERSION = "{schema_version}"\n') elif os.path.exists(VERSION_PY_PATH): - # Schema file not found (likely sdist build) AND _version.py already exists. - # Trust the existing _version.py from the sdist. print(f"DUC schema file not found. Using existing _version.py: {VERSION_PY_PATH}") else: - # Schema file not found AND _version.py does not exist (edge case, should not happen with sdist). - # Fallback to generating with default 0.0.0 to ensure the file exists for import. print(f"DUC schema file not found and _version.py does not exist. Generating with default version 0.0.0 at: {VERSION_PY_PATH}") os.makedirs(os.path.dirname(VERSION_PY_PATH), exist_ok=True) with open(VERSION_PY_PATH, 'w') as f: diff --git a/packages/ducpy/src/ducpy/Duc/ANGULAR_UNITS_FORMAT.py b/packages/ducpy/src/ducpy/Duc/ANGULAR_UNITS_FORMAT.py deleted file mode 100644 index 48ea9913..00000000 --- a/packages/ducpy/src/ducpy/Duc/ANGULAR_UNITS_FORMAT.py +++ /dev/null @@ -1,10 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class ANGULAR_UNITS_FORMAT(object): - DECIMAL_DEGREES = 10 - DEGREES_MINUTES_SECONDS = 11 - GRADS = 12 - RADIANS = 13 - SURVEYOR = 14 diff --git a/packages/ducpy/src/ducpy/Duc/AXIS.py b/packages/ducpy/src/ducpy/Duc/AXIS.py deleted file mode 100644 index b2fac1a3..00000000 --- a/packages/ducpy/src/ducpy/Duc/AXIS.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class AXIS(object): - X = 10 - Y = 20 - Z = 30 diff --git a/packages/ducpy/src/ducpy/Duc/AlternateUnits.py b/packages/ducpy/src/ducpy/Duc/AlternateUnits.py deleted file mode 100644 index b4b516ef..00000000 --- a/packages/ducpy/src/ducpy/Duc/AlternateUnits.py +++ /dev/null @@ -1,97 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class AlternateUnits(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = AlternateUnits() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsAlternateUnits(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def AlternateUnitsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # AlternateUnits - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # AlternateUnits - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._UnitSystemBase import _UnitSystemBase - obj = _UnitSystemBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # AlternateUnits - def Format(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # AlternateUnits - def IsVisible(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # AlternateUnits - def Multiplier(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - -def AlternateUnitsStart(builder): - builder.StartObject(4) - -def Start(builder): - AlternateUnitsStart(builder) - -def AlternateUnitsAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - AlternateUnitsAddBase(builder, base) - -def AlternateUnitsAddFormat(builder, format): - builder.PrependUint8Slot(1, format, None) - -def AddFormat(builder, format): - AlternateUnitsAddFormat(builder, format) - -def AlternateUnitsAddIsVisible(builder, isVisible): - builder.PrependBoolSlot(2, isVisible, 0) - -def AddIsVisible(builder, isVisible): - AlternateUnitsAddIsVisible(builder, isVisible) - -def AlternateUnitsAddMultiplier(builder, multiplier): - builder.PrependFloat32Slot(3, multiplier, 0.0) - -def AddMultiplier(builder, multiplier): - AlternateUnitsAddMultiplier(builder, multiplier) - -def AlternateUnitsEnd(builder): - return builder.EndObject() - -def End(builder): - return AlternateUnitsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/AngularUnitSystem.py b/packages/ducpy/src/ducpy/Duc/AngularUnitSystem.py deleted file mode 100644 index 0c7d30c6..00000000 --- a/packages/ducpy/src/ducpy/Duc/AngularUnitSystem.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class AngularUnitSystem(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = AngularUnitSystem() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsAngularUnitSystem(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def AngularUnitSystemBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # AngularUnitSystem - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # AngularUnitSystem - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._UnitSystemBase import _UnitSystemBase - obj = _UnitSystemBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # AngularUnitSystem - def Format(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def AngularUnitSystemStart(builder): - builder.StartObject(2) - -def Start(builder): - AngularUnitSystemStart(builder) - -def AngularUnitSystemAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - AngularUnitSystemAddBase(builder, base) - -def AngularUnitSystemAddFormat(builder, format): - builder.PrependUint8Slot(1, format, None) - -def AddFormat(builder, format): - AngularUnitSystemAddFormat(builder, format) - -def AngularUnitSystemEnd(builder): - return builder.EndObject() - -def End(builder): - return AngularUnitSystemEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/BEZIER_MIRRORING.py b/packages/ducpy/src/ducpy/Duc/BEZIER_MIRRORING.py deleted file mode 100644 index ec9d79d0..00000000 --- a/packages/ducpy/src/ducpy/Duc/BEZIER_MIRRORING.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class BEZIER_MIRRORING(object): - NONE = 10 - ANGLE = 11 - ANGLE_LENGTH = 12 diff --git a/packages/ducpy/src/ducpy/Duc/BLENDING.py b/packages/ducpy/src/ducpy/Duc/BLENDING.py deleted file mode 100644 index 91b7b832..00000000 --- a/packages/ducpy/src/ducpy/Duc/BLENDING.py +++ /dev/null @@ -1,12 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class BLENDING(object): - MULTIPLY = 11 - SCREEN = 12 - OVERLAY = 13 - DARKEN = 14 - LIGHTEN = 15 - DIFFERENCE = 16 - EXCLUSION = 17 diff --git a/packages/ducpy/src/ducpy/Duc/BLOCK_ATTACHMENT.py b/packages/ducpy/src/ducpy/Duc/BLOCK_ATTACHMENT.py deleted file mode 100644 index edfb406e..00000000 --- a/packages/ducpy/src/ducpy/Duc/BLOCK_ATTACHMENT.py +++ /dev/null @@ -1,7 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class BLOCK_ATTACHMENT(object): - CENTER_EXTENTS = 10 - INSERTION_POINT = 11 diff --git a/packages/ducpy/src/ducpy/Duc/BOOLEAN_OPERATION.py b/packages/ducpy/src/ducpy/Duc/BOOLEAN_OPERATION.py deleted file mode 100644 index b27d502d..00000000 --- a/packages/ducpy/src/ducpy/Duc/BOOLEAN_OPERATION.py +++ /dev/null @@ -1,9 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class BOOLEAN_OPERATION(object): - UNION = 10 - SUBTRACT = 11 - INTERSECT = 12 - EXCLUDE = 13 diff --git a/packages/ducpy/src/ducpy/Duc/BoundElement.py b/packages/ducpy/src/ducpy/Duc/BoundElement.py deleted file mode 100644 index 2cbdbec1..00000000 --- a/packages/ducpy/src/ducpy/Duc/BoundElement.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class BoundElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = BoundElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsBoundElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def BoundElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # BoundElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # BoundElement - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # BoundElement - def Type(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def BoundElementStart(builder): - builder.StartObject(2) - -def Start(builder): - BoundElementStart(builder) - -def BoundElementAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - BoundElementAddId(builder, id) - -def BoundElementAddType(builder, type): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(type), 0) - -def AddType(builder, type): - BoundElementAddType(builder, type) - -def BoundElementEnd(builder): - return builder.EndObject() - -def End(builder): - return BoundElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/COLUMN_TYPE.py b/packages/ducpy/src/ducpy/Duc/COLUMN_TYPE.py deleted file mode 100644 index e32195df..00000000 --- a/packages/ducpy/src/ducpy/Duc/COLUMN_TYPE.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class COLUMN_TYPE(object): - NO_COLUMNS = 10 - STATIC_COLUMNS = 11 - DYNAMIC_COLUMNS = 12 diff --git a/packages/ducpy/src/ducpy/Duc/Checkpoint.py b/packages/ducpy/src/ducpy/Duc/Checkpoint.py deleted file mode 100644 index bb41ad54..00000000 --- a/packages/ducpy/src/ducpy/Duc/Checkpoint.py +++ /dev/null @@ -1,110 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class Checkpoint(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = Checkpoint() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsCheckpoint(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def CheckpointBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # Checkpoint - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # Checkpoint - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.VersionBase import VersionBase - obj = VersionBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # Checkpoint - def Data(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) - return 0 - - # Checkpoint - def DataAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) - return 0 - - # Checkpoint - def DataLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # Checkpoint - def DataIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - return o == 0 - - # Checkpoint - def SizeBytes(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) - return 0 - -def CheckpointStart(builder): - builder.StartObject(3) - -def Start(builder): - CheckpointStart(builder) - -def CheckpointAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - CheckpointAddBase(builder, base) - -def CheckpointAddData(builder, data): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0) - -def AddData(builder, data): - CheckpointAddData(builder, data) - -def CheckpointStartDataVector(builder, numElems): - return builder.StartVector(1, numElems, 1) - -def StartDataVector(builder, numElems): - return CheckpointStartDataVector(builder, numElems) - -def CheckpointAddSizeBytes(builder, sizeBytes): - builder.PrependInt64Slot(2, sizeBytes, 0) - -def AddSizeBytes(builder, sizeBytes): - CheckpointAddSizeBytes(builder, sizeBytes) - -def CheckpointEnd(builder): - return builder.EndObject() - -def End(builder): - return CheckpointEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/ColumnLayout.py b/packages/ducpy/src/ducpy/Duc/ColumnLayout.py deleted file mode 100644 index 3a05df2d..00000000 --- a/packages/ducpy/src/ducpy/Duc/ColumnLayout.py +++ /dev/null @@ -1,104 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class ColumnLayout(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = ColumnLayout() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsColumnLayout(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def ColumnLayoutBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # ColumnLayout - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # ColumnLayout - def Type(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # ColumnLayout - def Definitions(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.TextColumn import TextColumn - obj = TextColumn() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ColumnLayout - def DefinitionsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ColumnLayout - def DefinitionsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - return o == 0 - - # ColumnLayout - def AutoHeight(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def ColumnLayoutStart(builder): - builder.StartObject(3) - -def Start(builder): - ColumnLayoutStart(builder) - -def ColumnLayoutAddType(builder, type): - builder.PrependUint8Slot(0, type, None) - -def AddType(builder, type): - ColumnLayoutAddType(builder, type) - -def ColumnLayoutAddDefinitions(builder, definitions): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(definitions), 0) - -def AddDefinitions(builder, definitions): - ColumnLayoutAddDefinitions(builder, definitions) - -def ColumnLayoutStartDefinitionsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartDefinitionsVector(builder, numElems): - return ColumnLayoutStartDefinitionsVector(builder, numElems) - -def ColumnLayoutAddAutoHeight(builder, autoHeight): - builder.PrependBoolSlot(2, autoHeight, 0) - -def AddAutoHeight(builder, autoHeight): - ColumnLayoutAddAutoHeight(builder, autoHeight) - -def ColumnLayoutEnd(builder): - return builder.EndObject() - -def End(builder): - return ColumnLayoutEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/CustomHatchPattern.py b/packages/ducpy/src/ducpy/Duc/CustomHatchPattern.py deleted file mode 100644 index 6d5663e3..00000000 --- a/packages/ducpy/src/ducpy/Duc/CustomHatchPattern.py +++ /dev/null @@ -1,104 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class CustomHatchPattern(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = CustomHatchPattern() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsCustomHatchPattern(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def CustomHatchPatternBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # CustomHatchPattern - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # CustomHatchPattern - def Name(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # CustomHatchPattern - def Description(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # CustomHatchPattern - def Lines(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.HatchPatternLine import HatchPatternLine - obj = HatchPatternLine() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # CustomHatchPattern - def LinesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # CustomHatchPattern - def LinesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - -def CustomHatchPatternStart(builder): - builder.StartObject(3) - -def Start(builder): - CustomHatchPatternStart(builder) - -def CustomHatchPatternAddName(builder, name): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) - -def AddName(builder, name): - CustomHatchPatternAddName(builder, name) - -def CustomHatchPatternAddDescription(builder, description): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(description), 0) - -def AddDescription(builder, description): - CustomHatchPatternAddDescription(builder, description) - -def CustomHatchPatternAddLines(builder, lines): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(lines), 0) - -def AddLines(builder, lines): - CustomHatchPatternAddLines(builder, lines) - -def CustomHatchPatternStartLinesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartLinesVector(builder, numElems): - return CustomHatchPatternStartLinesVector(builder, numElems) - -def CustomHatchPatternEnd(builder): - return builder.EndObject() - -def End(builder): - return CustomHatchPatternEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DATUM_BRACKET_STYLE.py b/packages/ducpy/src/ducpy/Duc/DATUM_BRACKET_STYLE.py deleted file mode 100644 index 0047b92a..00000000 --- a/packages/ducpy/src/ducpy/Duc/DATUM_BRACKET_STYLE.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class DATUM_BRACKET_STYLE(object): - SQUARE = 10 - ROUND = 11 - NONE = 12 diff --git a/packages/ducpy/src/ducpy/Duc/DATUM_TARGET_TYPE.py b/packages/ducpy/src/ducpy/Duc/DATUM_TARGET_TYPE.py deleted file mode 100644 index 4fe87ac2..00000000 --- a/packages/ducpy/src/ducpy/Duc/DATUM_TARGET_TYPE.py +++ /dev/null @@ -1,9 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class DATUM_TARGET_TYPE(object): - POINT = 10 - LINE = 11 - AREA = 12 - MOVABLE = 13 diff --git a/packages/ducpy/src/ducpy/Duc/DECIMAL_SEPARATOR.py b/packages/ducpy/src/ducpy/Duc/DECIMAL_SEPARATOR.py deleted file mode 100644 index 06ba9668..00000000 --- a/packages/ducpy/src/ducpy/Duc/DECIMAL_SEPARATOR.py +++ /dev/null @@ -1,7 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class DECIMAL_SEPARATOR(object): - DOT = 10 - COMMA = 11 diff --git a/packages/ducpy/src/ducpy/Duc/DIMENSION_FIT_RULE.py b/packages/ducpy/src/ducpy/Duc/DIMENSION_FIT_RULE.py deleted file mode 100644 index 50a8b895..00000000 --- a/packages/ducpy/src/ducpy/Duc/DIMENSION_FIT_RULE.py +++ /dev/null @@ -1,9 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class DIMENSION_FIT_RULE(object): - TEXT_AND_ARROWS = 10 - ARROWS_ONLY = 11 - TEXT_ONLY = 12 - BEST_FIT = 13 diff --git a/packages/ducpy/src/ducpy/Duc/DIMENSION_TEXT_PLACEMENT.py b/packages/ducpy/src/ducpy/Duc/DIMENSION_TEXT_PLACEMENT.py deleted file mode 100644 index 0c8ccfb9..00000000 --- a/packages/ducpy/src/ducpy/Duc/DIMENSION_TEXT_PLACEMENT.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class DIMENSION_TEXT_PLACEMENT(object): - BESIDE_LINE = 10 - OVER_LINE = 11 - OVER_LINE_WITH_LEADER = 12 diff --git a/packages/ducpy/src/ducpy/Duc/DIMENSION_TYPE.py b/packages/ducpy/src/ducpy/Duc/DIMENSION_TYPE.py deleted file mode 100644 index 9ceb1401..00000000 --- a/packages/ducpy/src/ducpy/Duc/DIMENSION_TYPE.py +++ /dev/null @@ -1,18 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class DIMENSION_TYPE(object): - LINEAR = 10 - ALIGNED = 11 - ANGULAR = 12 - ARC_LENGTH = 13 - RADIUS = 14 - DIAMETER = 15 - CENTER_MARK = 16 - ROTATED = 17 - SPACING = 18 - CONTINUE = 19 - BASELINE = 20 - JOGGED_LINEAR = 21 - ORDINATE = 22 diff --git a/packages/ducpy/src/ducpy/Duc/DIMENSION_UNITS_FORMAT.py b/packages/ducpy/src/ducpy/Duc/DIMENSION_UNITS_FORMAT.py deleted file mode 100644 index 16b45ffa..00000000 --- a/packages/ducpy/src/ducpy/Duc/DIMENSION_UNITS_FORMAT.py +++ /dev/null @@ -1,10 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class DIMENSION_UNITS_FORMAT(object): - DECIMAL = 10 - ENGINEERING = 11 - ARCHITECTURAL = 12 - FRACTIONAL = 13 - SCIENTIFIC = 14 diff --git a/packages/ducpy/src/ducpy/Duc/DOCUMENT_GRID_ALIGN_ITEMS.py b/packages/ducpy/src/ducpy/Duc/DOCUMENT_GRID_ALIGN_ITEMS.py deleted file mode 100644 index 9e48ea04..00000000 --- a/packages/ducpy/src/ducpy/Duc/DOCUMENT_GRID_ALIGN_ITEMS.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class DOCUMENT_GRID_ALIGN_ITEMS(object): - START = 10 - CENTER = 11 - END = 12 diff --git a/packages/ducpy/src/ducpy/Duc/DatumReference.py b/packages/ducpy/src/ducpy/Duc/DatumReference.py deleted file mode 100644 index 3a9b0dbe..00000000 --- a/packages/ducpy/src/ducpy/Duc/DatumReference.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DatumReference(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DatumReference() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDatumReference(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DatumReferenceBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DatumReference - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DatumReference - def Letters(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DatumReference - def Modifier(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def DatumReferenceStart(builder): - builder.StartObject(2) - -def Start(builder): - DatumReferenceStart(builder) - -def DatumReferenceAddLetters(builder, letters): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(letters), 0) - -def AddLetters(builder, letters): - DatumReferenceAddLetters(builder, letters) - -def DatumReferenceAddModifier(builder, modifier): - builder.PrependUint8Slot(1, modifier, None) - -def AddModifier(builder, modifier): - DatumReferenceAddModifier(builder, modifier) - -def DatumReferenceEnd(builder): - return builder.EndObject() - -def End(builder): - return DatumReferenceEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/Delta.py b/packages/ducpy/src/ducpy/Duc/Delta.py deleted file mode 100644 index 5620c897..00000000 --- a/packages/ducpy/src/ducpy/Duc/Delta.py +++ /dev/null @@ -1,110 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class Delta(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = Delta() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDelta(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DeltaBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # Delta - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # Delta - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.VersionBase import VersionBase - obj = VersionBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # Delta - def SizeBytes(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) - return 0 - - # Delta - def Patch(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) - return 0 - - # Delta - def PatchAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) - return 0 - - # Delta - def PatchLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # Delta - def PatchIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - -def DeltaStart(builder): - builder.StartObject(4) - -def Start(builder): - DeltaStart(builder) - -def DeltaAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DeltaAddBase(builder, base) - -def DeltaAddSizeBytes(builder, sizeBytes): - builder.PrependInt64Slot(2, sizeBytes, 0) - -def AddSizeBytes(builder, sizeBytes): - DeltaAddSizeBytes(builder, sizeBytes) - -def DeltaAddPatch(builder, patch): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(patch), 0) - -def AddPatch(builder, patch): - DeltaAddPatch(builder, patch) - -def DeltaStartPatchVector(builder, numElems): - return builder.StartVector(1, numElems, 1) - -def StartPatchVector(builder, numElems): - return DeltaStartPatchVector(builder, numElems) - -def DeltaEnd(builder): - return builder.EndObject() - -def End(builder): - return DeltaEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DictionaryEntry.py b/packages/ducpy/src/ducpy/Duc/DictionaryEntry.py deleted file mode 100644 index bd7ea76c..00000000 --- a/packages/ducpy/src/ducpy/Duc/DictionaryEntry.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DictionaryEntry(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DictionaryEntry() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDictionaryEntry(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DictionaryEntryBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DictionaryEntry - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DictionaryEntry - def Key(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DictionaryEntry - def Value(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DictionaryEntryStart(builder): - builder.StartObject(2) - -def Start(builder): - DictionaryEntryStart(builder) - -def DictionaryEntryAddKey(builder, key): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0) - -def AddKey(builder, key): - DictionaryEntryAddKey(builder, key) - -def DictionaryEntryAddValue(builder, value): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0) - -def AddValue(builder, value): - DictionaryEntryAddValue(builder, value) - -def DictionaryEntryEnd(builder): - return builder.EndObject() - -def End(builder): - return DictionaryEntryEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DimensionBaselineData.py b/packages/ducpy/src/ducpy/Duc/DimensionBaselineData.py deleted file mode 100644 index 20ecaeaf..00000000 --- a/packages/ducpy/src/ducpy/Duc/DimensionBaselineData.py +++ /dev/null @@ -1,54 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DimensionBaselineData(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DimensionBaselineData() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDimensionBaselineData(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DimensionBaselineDataBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DimensionBaselineData - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DimensionBaselineData - def BaseDimensionId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DimensionBaselineDataStart(builder): - builder.StartObject(1) - -def Start(builder): - DimensionBaselineDataStart(builder) - -def DimensionBaselineDataAddBaseDimensionId(builder, baseDimensionId): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(baseDimensionId), 0) - -def AddBaseDimensionId(builder, baseDimensionId): - DimensionBaselineDataAddBaseDimensionId(builder, baseDimensionId) - -def DimensionBaselineDataEnd(builder): - return builder.EndObject() - -def End(builder): - return DimensionBaselineDataEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DimensionBindings.py b/packages/ducpy/src/ducpy/Duc/DimensionBindings.py deleted file mode 100644 index 1fdbb3e4..00000000 --- a/packages/ducpy/src/ducpy/Duc/DimensionBindings.py +++ /dev/null @@ -1,92 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DimensionBindings(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DimensionBindings() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDimensionBindings(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DimensionBindingsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DimensionBindings - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DimensionBindings - def Origin1(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPointBinding import DucPointBinding - obj = DucPointBinding() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DimensionBindings - def Origin2(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPointBinding import DucPointBinding - obj = DucPointBinding() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DimensionBindings - def Center(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPointBinding import DucPointBinding - obj = DucPointBinding() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DimensionBindingsStart(builder): - builder.StartObject(3) - -def Start(builder): - DimensionBindingsStart(builder) - -def DimensionBindingsAddOrigin1(builder, origin1): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(origin1), 0) - -def AddOrigin1(builder, origin1): - DimensionBindingsAddOrigin1(builder, origin1) - -def DimensionBindingsAddOrigin2(builder, origin2): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(origin2), 0) - -def AddOrigin2(builder, origin2): - DimensionBindingsAddOrigin2(builder, origin2) - -def DimensionBindingsAddCenter(builder, center): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(center), 0) - -def AddCenter(builder, center): - DimensionBindingsAddCenter(builder, center) - -def DimensionBindingsEnd(builder): - return builder.EndObject() - -def End(builder): - return DimensionBindingsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DimensionContinueData.py b/packages/ducpy/src/ducpy/Duc/DimensionContinueData.py deleted file mode 100644 index 665fd27e..00000000 --- a/packages/ducpy/src/ducpy/Duc/DimensionContinueData.py +++ /dev/null @@ -1,54 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DimensionContinueData(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DimensionContinueData() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDimensionContinueData(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DimensionContinueDataBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DimensionContinueData - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DimensionContinueData - def ContinueFromDimensionId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DimensionContinueDataStart(builder): - builder.StartObject(1) - -def Start(builder): - DimensionContinueDataStart(builder) - -def DimensionContinueDataAddContinueFromDimensionId(builder, continueFromDimensionId): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(continueFromDimensionId), 0) - -def AddContinueFromDimensionId(builder, continueFromDimensionId): - DimensionContinueDataAddContinueFromDimensionId(builder, continueFromDimensionId) - -def DimensionContinueDataEnd(builder): - return builder.EndObject() - -def End(builder): - return DimensionContinueDataEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DimensionDefinitionPoints.py b/packages/ducpy/src/ducpy/Duc/DimensionDefinitionPoints.py deleted file mode 100644 index 74f6b19d..00000000 --- a/packages/ducpy/src/ducpy/Duc/DimensionDefinitionPoints.py +++ /dev/null @@ -1,126 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DimensionDefinitionPoints(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DimensionDefinitionPoints() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDimensionDefinitionPoints(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DimensionDefinitionPointsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DimensionDefinitionPoints - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DimensionDefinitionPoints - def Origin1(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = o + self._tab.Pos - from Duc.GeometricPoint import GeometricPoint - obj = GeometricPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DimensionDefinitionPoints - def Origin2(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = o + self._tab.Pos - from Duc.GeometricPoint import GeometricPoint - obj = GeometricPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DimensionDefinitionPoints - def Location(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = o + self._tab.Pos - from Duc.GeometricPoint import GeometricPoint - obj = GeometricPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DimensionDefinitionPoints - def Center(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = o + self._tab.Pos - from Duc.GeometricPoint import GeometricPoint - obj = GeometricPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DimensionDefinitionPoints - def Jog(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = o + self._tab.Pos - from Duc.GeometricPoint import GeometricPoint - obj = GeometricPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DimensionDefinitionPointsStart(builder): - builder.StartObject(5) - -def Start(builder): - DimensionDefinitionPointsStart(builder) - -def DimensionDefinitionPointsAddOrigin1(builder, origin1): - builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(origin1), 0) - -def AddOrigin1(builder, origin1): - DimensionDefinitionPointsAddOrigin1(builder, origin1) - -def DimensionDefinitionPointsAddOrigin2(builder, origin2): - builder.PrependStructSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(origin2), 0) - -def AddOrigin2(builder, origin2): - DimensionDefinitionPointsAddOrigin2(builder, origin2) - -def DimensionDefinitionPointsAddLocation(builder, location): - builder.PrependStructSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(location), 0) - -def AddLocation(builder, location): - DimensionDefinitionPointsAddLocation(builder, location) - -def DimensionDefinitionPointsAddCenter(builder, center): - builder.PrependStructSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(center), 0) - -def AddCenter(builder, center): - DimensionDefinitionPointsAddCenter(builder, center) - -def DimensionDefinitionPointsAddJog(builder, jog): - builder.PrependStructSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(jog), 0) - -def AddJog(builder, jog): - DimensionDefinitionPointsAddJog(builder, jog) - -def DimensionDefinitionPointsEnd(builder): - return builder.EndObject() - -def End(builder): - return DimensionDefinitionPointsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DimensionExtLineStyle.py b/packages/ducpy/src/ducpy/Duc/DimensionExtLineStyle.py deleted file mode 100644 index 2e393d13..00000000 --- a/packages/ducpy/src/ducpy/Duc/DimensionExtLineStyle.py +++ /dev/null @@ -1,84 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DimensionExtLineStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DimensionExtLineStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDimensionExtLineStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DimensionExtLineStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DimensionExtLineStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DimensionExtLineStyle - def Stroke(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ElementStroke import ElementStroke - obj = ElementStroke() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DimensionExtLineStyle - def Overshoot(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DimensionExtLineStyle - def Offset(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def DimensionExtLineStyleStart(builder): - builder.StartObject(3) - -def Start(builder): - DimensionExtLineStyleStart(builder) - -def DimensionExtLineStyleAddStroke(builder, stroke): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(stroke), 0) - -def AddStroke(builder, stroke): - DimensionExtLineStyleAddStroke(builder, stroke) - -def DimensionExtLineStyleAddOvershoot(builder, overshoot): - builder.PrependFloat64Slot(1, overshoot, 0.0) - -def AddOvershoot(builder, overshoot): - DimensionExtLineStyleAddOvershoot(builder, overshoot) - -def DimensionExtLineStyleAddOffset(builder, offset): - builder.PrependFloat64Slot(2, offset, 0.0) - -def AddOffset(builder, offset): - DimensionExtLineStyleAddOffset(builder, offset) - -def DimensionExtLineStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DimensionExtLineStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DimensionFitStyle.py b/packages/ducpy/src/ducpy/Duc/DimensionFitStyle.py deleted file mode 100644 index ded8d672..00000000 --- a/packages/ducpy/src/ducpy/Duc/DimensionFitStyle.py +++ /dev/null @@ -1,80 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DimensionFitStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DimensionFitStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDimensionFitStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DimensionFitStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DimensionFitStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DimensionFitStyle - def Rule(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DimensionFitStyle - def TextPlacement(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DimensionFitStyle - def ForceTextInside(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def DimensionFitStyleStart(builder): - builder.StartObject(3) - -def Start(builder): - DimensionFitStyleStart(builder) - -def DimensionFitStyleAddRule(builder, rule): - builder.PrependUint8Slot(0, rule, None) - -def AddRule(builder, rule): - DimensionFitStyleAddRule(builder, rule) - -def DimensionFitStyleAddTextPlacement(builder, textPlacement): - builder.PrependUint8Slot(1, textPlacement, None) - -def AddTextPlacement(builder, textPlacement): - DimensionFitStyleAddTextPlacement(builder, textPlacement) - -def DimensionFitStyleAddForceTextInside(builder, forceTextInside): - builder.PrependBoolSlot(2, forceTextInside, 0) - -def AddForceTextInside(builder, forceTextInside): - DimensionFitStyleAddForceTextInside(builder, forceTextInside) - -def DimensionFitStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DimensionFitStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DimensionLineStyle.py b/packages/ducpy/src/ducpy/Duc/DimensionLineStyle.py deleted file mode 100644 index c3dc2db5..00000000 --- a/packages/ducpy/src/ducpy/Duc/DimensionLineStyle.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DimensionLineStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DimensionLineStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDimensionLineStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DimensionLineStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DimensionLineStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DimensionLineStyle - def Stroke(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ElementStroke import ElementStroke - obj = ElementStroke() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DimensionLineStyle - def TextGap(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def DimensionLineStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - DimensionLineStyleStart(builder) - -def DimensionLineStyleAddStroke(builder, stroke): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(stroke), 0) - -def AddStroke(builder, stroke): - DimensionLineStyleAddStroke(builder, stroke) - -def DimensionLineStyleAddTextGap(builder, textGap): - builder.PrependFloat64Slot(1, textGap, 0.0) - -def AddTextGap(builder, textGap): - DimensionLineStyleAddTextGap(builder, textGap) - -def DimensionLineStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DimensionLineStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DimensionSymbolStyle.py b/packages/ducpy/src/ducpy/Duc/DimensionSymbolStyle.py deleted file mode 100644 index 6f2ebf2e..00000000 --- a/packages/ducpy/src/ducpy/Duc/DimensionSymbolStyle.py +++ /dev/null @@ -1,104 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DimensionSymbolStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DimensionSymbolStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDimensionSymbolStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DimensionSymbolStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DimensionSymbolStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DimensionSymbolStyle - def HeadsOverride(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucHead import DucHead - obj = DucHead() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DimensionSymbolStyle - def HeadsOverrideLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DimensionSymbolStyle - def HeadsOverrideIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - return o == 0 - - # DimensionSymbolStyle - def CenterMarkType(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DimensionSymbolStyle - def CenterMarkSize(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def DimensionSymbolStyleStart(builder): - builder.StartObject(3) - -def Start(builder): - DimensionSymbolStyleStart(builder) - -def DimensionSymbolStyleAddHeadsOverride(builder, headsOverride): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(headsOverride), 0) - -def AddHeadsOverride(builder, headsOverride): - DimensionSymbolStyleAddHeadsOverride(builder, headsOverride) - -def DimensionSymbolStyleStartHeadsOverrideVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartHeadsOverrideVector(builder, numElems): - return DimensionSymbolStyleStartHeadsOverrideVector(builder, numElems) - -def DimensionSymbolStyleAddCenterMarkType(builder, centerMarkType): - builder.PrependUint8Slot(1, centerMarkType, None) - -def AddCenterMarkType(builder, centerMarkType): - DimensionSymbolStyleAddCenterMarkType(builder, centerMarkType) - -def DimensionSymbolStyleAddCenterMarkSize(builder, centerMarkSize): - builder.PrependFloat64Slot(2, centerMarkSize, 0.0) - -def AddCenterMarkSize(builder, centerMarkSize): - DimensionSymbolStyleAddCenterMarkSize(builder, centerMarkSize) - -def DimensionSymbolStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DimensionSymbolStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DimensionToleranceStyle.py b/packages/ducpy/src/ducpy/Duc/DimensionToleranceStyle.py deleted file mode 100644 index bcca0b48..00000000 --- a/packages/ducpy/src/ducpy/Duc/DimensionToleranceStyle.py +++ /dev/null @@ -1,123 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DimensionToleranceStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DimensionToleranceStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDimensionToleranceStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DimensionToleranceStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DimensionToleranceStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DimensionToleranceStyle - def Enabled(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DimensionToleranceStyle - def DisplayMethod(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DimensionToleranceStyle - def UpperValue(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DimensionToleranceStyle - def LowerValue(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DimensionToleranceStyle - def Precision(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # DimensionToleranceStyle - def TextStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTextStyle import DucTextStyle - obj = DucTextStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DimensionToleranceStyleStart(builder): - builder.StartObject(6) - -def Start(builder): - DimensionToleranceStyleStart(builder) - -def DimensionToleranceStyleAddEnabled(builder, enabled): - builder.PrependBoolSlot(0, enabled, 0) - -def AddEnabled(builder, enabled): - DimensionToleranceStyleAddEnabled(builder, enabled) - -def DimensionToleranceStyleAddDisplayMethod(builder, displayMethod): - builder.PrependUint8Slot(1, displayMethod, None) - -def AddDisplayMethod(builder, displayMethod): - DimensionToleranceStyleAddDisplayMethod(builder, displayMethod) - -def DimensionToleranceStyleAddUpperValue(builder, upperValue): - builder.PrependFloat64Slot(2, upperValue, 0.0) - -def AddUpperValue(builder, upperValue): - DimensionToleranceStyleAddUpperValue(builder, upperValue) - -def DimensionToleranceStyleAddLowerValue(builder, lowerValue): - builder.PrependFloat64Slot(3, lowerValue, 0.0) - -def AddLowerValue(builder, lowerValue): - DimensionToleranceStyleAddLowerValue(builder, lowerValue) - -def DimensionToleranceStyleAddPrecision(builder, precision): - builder.PrependInt32Slot(4, precision, 0) - -def AddPrecision(builder, precision): - DimensionToleranceStyleAddPrecision(builder, precision) - -def DimensionToleranceStyleAddTextStyle(builder, textStyle): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(textStyle), 0) - -def AddTextStyle(builder, textStyle): - DimensionToleranceStyleAddTextStyle(builder, textStyle) - -def DimensionToleranceStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DimensionToleranceStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DimensionValidationRules.py b/packages/ducpy/src/ducpy/Duc/DimensionValidationRules.py deleted file mode 100644 index d867bec6..00000000 --- a/packages/ducpy/src/ducpy/Duc/DimensionValidationRules.py +++ /dev/null @@ -1,106 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DimensionValidationRules(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DimensionValidationRules() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDimensionValidationRules(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DimensionValidationRulesBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DimensionValidationRules - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DimensionValidationRules - def MinTextHeight(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DimensionValidationRules - def MaxTextHeight(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DimensionValidationRules - def AllowedPrecisions(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return 0 - - # DimensionValidationRules - def AllowedPrecisionsAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) - return 0 - - # DimensionValidationRules - def AllowedPrecisionsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DimensionValidationRules - def AllowedPrecisionsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - -def DimensionValidationRulesStart(builder): - builder.StartObject(3) - -def Start(builder): - DimensionValidationRulesStart(builder) - -def DimensionValidationRulesAddMinTextHeight(builder, minTextHeight): - builder.PrependFloat64Slot(0, minTextHeight, 0.0) - -def AddMinTextHeight(builder, minTextHeight): - DimensionValidationRulesAddMinTextHeight(builder, minTextHeight) - -def DimensionValidationRulesAddMaxTextHeight(builder, maxTextHeight): - builder.PrependFloat64Slot(1, maxTextHeight, 0.0) - -def AddMaxTextHeight(builder, maxTextHeight): - DimensionValidationRulesAddMaxTextHeight(builder, maxTextHeight) - -def DimensionValidationRulesAddAllowedPrecisions(builder, allowedPrecisions): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(allowedPrecisions), 0) - -def AddAllowedPrecisions(builder, allowedPrecisions): - DimensionValidationRulesAddAllowedPrecisions(builder, allowedPrecisions) - -def DimensionValidationRulesStartAllowedPrecisionsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartAllowedPrecisionsVector(builder, numElems): - return DimensionValidationRulesStartAllowedPrecisionsVector(builder, numElems) - -def DimensionValidationRulesEnd(builder): - return builder.EndObject() - -def End(builder): - return DimensionValidationRulesEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DocumentGridConfig.py b/packages/ducpy/src/ducpy/Duc/DocumentGridConfig.py deleted file mode 100644 index 522fb335..00000000 --- a/packages/ducpy/src/ducpy/Duc/DocumentGridConfig.py +++ /dev/null @@ -1,119 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DocumentGridConfig(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DocumentGridConfig() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDocumentGridConfig(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DocumentGridConfigBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DocumentGridConfig - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DocumentGridConfig - def Columns(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # DocumentGridConfig - def GapX(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DocumentGridConfig - def GapY(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DocumentGridConfig - def AlignItems(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DocumentGridConfig - def FirstPageAlone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DocumentGridConfig - def Scale(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def DocumentGridConfigStart(builder): - builder.StartObject(6) - -def Start(builder): - DocumentGridConfigStart(builder) - -def DocumentGridConfigAddColumns(builder, columns): - builder.PrependInt32Slot(0, columns, 0) - -def AddColumns(builder, columns): - DocumentGridConfigAddColumns(builder, columns) - -def DocumentGridConfigAddGapX(builder, gapX): - builder.PrependFloat64Slot(1, gapX, 0.0) - -def AddGapX(builder, gapX): - DocumentGridConfigAddGapX(builder, gapX) - -def DocumentGridConfigAddGapY(builder, gapY): - builder.PrependFloat64Slot(2, gapY, 0.0) - -def AddGapY(builder, gapY): - DocumentGridConfigAddGapY(builder, gapY) - -def DocumentGridConfigAddAlignItems(builder, alignItems): - builder.PrependUint8Slot(3, alignItems, None) - -def AddAlignItems(builder, alignItems): - DocumentGridConfigAddAlignItems(builder, alignItems) - -def DocumentGridConfigAddFirstPageAlone(builder, firstPageAlone): - builder.PrependBoolSlot(4, firstPageAlone, 0) - -def AddFirstPageAlone(builder, firstPageAlone): - DocumentGridConfigAddFirstPageAlone(builder, firstPageAlone) - -def DocumentGridConfigAddScale(builder, scale): - builder.PrependFloat64Slot(5, scale, 0.0) - -def AddScale(builder, scale): - DocumentGridConfigAddScale(builder, scale) - -def DocumentGridConfigEnd(builder): - return builder.EndObject() - -def End(builder): - return DocumentGridConfigEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucArrowElement.py b/packages/ducpy/src/ducpy/Duc/DucArrowElement.py deleted file mode 100644 index f176d946..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucArrowElement.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucArrowElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucArrowElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucArrowElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucArrowElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucArrowElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucArrowElement - def LinearBase(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucLinearElementBase import _DucLinearElementBase - obj = _DucLinearElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucArrowElement - def Elbowed(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def DucArrowElementStart(builder): - builder.StartObject(2) - -def Start(builder): - DucArrowElementStart(builder) - -def DucArrowElementAddLinearBase(builder, linearBase): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(linearBase), 0) - -def AddLinearBase(builder, linearBase): - DucArrowElementAddLinearBase(builder, linearBase) - -def DucArrowElementAddElbowed(builder, elbowed): - builder.PrependBoolSlot(1, elbowed, 0) - -def AddElbowed(builder, elbowed): - DucArrowElementAddElbowed(builder, elbowed) - -def DucArrowElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucArrowElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucBlock.py b/packages/ducpy/src/ducpy/Duc/DucBlock.py deleted file mode 100644 index f8d093bc..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucBlock.py +++ /dev/null @@ -1,186 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucBlock(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucBlock() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucBlock(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucBlockBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucBlock - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucBlock - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlock - def Label(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlock - def Description(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlock - def Version(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # DucBlock - def AttributeDefinitions(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucBlockAttributeDefinitionEntry import DucBlockAttributeDefinitionEntry - obj = DucBlockAttributeDefinitionEntry() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucBlock - def AttributeDefinitionsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucBlock - def AttributeDefinitionsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - return o == 0 - - # DucBlock - def Metadata(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucBlockMetadata import DucBlockMetadata - obj = DucBlockMetadata() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucBlock - def Thumbnail(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) - return 0 - - # DucBlock - def ThumbnailAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) - return 0 - - # DucBlock - def ThumbnailLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucBlock - def ThumbnailIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - return o == 0 - -def DucBlockStart(builder): - builder.StartObject(7) - -def Start(builder): - DucBlockStart(builder) - -def DucBlockAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - DucBlockAddId(builder, id) - -def DucBlockAddLabel(builder, label): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(label), 0) - -def AddLabel(builder, label): - DucBlockAddLabel(builder, label) - -def DucBlockAddDescription(builder, description): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(description), 0) - -def AddDescription(builder, description): - DucBlockAddDescription(builder, description) - -def DucBlockAddVersion(builder, version): - builder.PrependInt32Slot(3, version, 0) - -def AddVersion(builder, version): - DucBlockAddVersion(builder, version) - -def DucBlockAddAttributeDefinitions(builder, attributeDefinitions): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(attributeDefinitions), 0) - -def AddAttributeDefinitions(builder, attributeDefinitions): - DucBlockAddAttributeDefinitions(builder, attributeDefinitions) - -def DucBlockStartAttributeDefinitionsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartAttributeDefinitionsVector(builder, numElems): - return DucBlockStartAttributeDefinitionsVector(builder, numElems) - -def DucBlockAddMetadata(builder, metadata): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(metadata), 0) - -def AddMetadata(builder, metadata): - DucBlockAddMetadata(builder, metadata) - -def DucBlockAddThumbnail(builder, thumbnail): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(thumbnail), 0) - -def AddThumbnail(builder, thumbnail): - DucBlockAddThumbnail(builder, thumbnail) - -def DucBlockStartThumbnailVector(builder, numElems): - return builder.StartVector(1, numElems, 1) - -def StartThumbnailVector(builder, numElems): - return DucBlockStartThumbnailVector(builder, numElems) - -def DucBlockEnd(builder): - return builder.EndObject() - -def End(builder): - return DucBlockEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucBlockAttributeDefinition.py b/packages/ducpy/src/ducpy/Duc/DucBlockAttributeDefinition.py deleted file mode 100644 index 4610f004..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucBlockAttributeDefinition.py +++ /dev/null @@ -1,93 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucBlockAttributeDefinition(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucBlockAttributeDefinition() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucBlockAttributeDefinition(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucBlockAttributeDefinitionBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucBlockAttributeDefinition - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucBlockAttributeDefinition - def Tag(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlockAttributeDefinition - def Prompt(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlockAttributeDefinition - def DefaultValue(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlockAttributeDefinition - def IsConstant(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def DucBlockAttributeDefinitionStart(builder): - builder.StartObject(4) - -def Start(builder): - DucBlockAttributeDefinitionStart(builder) - -def DucBlockAttributeDefinitionAddTag(builder, tag): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(tag), 0) - -def AddTag(builder, tag): - DucBlockAttributeDefinitionAddTag(builder, tag) - -def DucBlockAttributeDefinitionAddPrompt(builder, prompt): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(prompt), 0) - -def AddPrompt(builder, prompt): - DucBlockAttributeDefinitionAddPrompt(builder, prompt) - -def DucBlockAttributeDefinitionAddDefaultValue(builder, defaultValue): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(defaultValue), 0) - -def AddDefaultValue(builder, defaultValue): - DucBlockAttributeDefinitionAddDefaultValue(builder, defaultValue) - -def DucBlockAttributeDefinitionAddIsConstant(builder, isConstant): - builder.PrependBoolSlot(3, isConstant, 0) - -def AddIsConstant(builder, isConstant): - DucBlockAttributeDefinitionAddIsConstant(builder, isConstant) - -def DucBlockAttributeDefinitionEnd(builder): - return builder.EndObject() - -def End(builder): - return DucBlockAttributeDefinitionEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucBlockAttributeDefinitionEntry.py b/packages/ducpy/src/ducpy/Duc/DucBlockAttributeDefinitionEntry.py deleted file mode 100644 index 9b4e03b8..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucBlockAttributeDefinitionEntry.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucBlockAttributeDefinitionEntry(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucBlockAttributeDefinitionEntry() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucBlockAttributeDefinitionEntry(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucBlockAttributeDefinitionEntryBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucBlockAttributeDefinitionEntry - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucBlockAttributeDefinitionEntry - def Key(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlockAttributeDefinitionEntry - def Value(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucBlockAttributeDefinition import DucBlockAttributeDefinition - obj = DucBlockAttributeDefinition() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucBlockAttributeDefinitionEntryStart(builder): - builder.StartObject(2) - -def Start(builder): - DucBlockAttributeDefinitionEntryStart(builder) - -def DucBlockAttributeDefinitionEntryAddKey(builder, key): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0) - -def AddKey(builder, key): - DucBlockAttributeDefinitionEntryAddKey(builder, key) - -def DucBlockAttributeDefinitionEntryAddValue(builder, value): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0) - -def AddValue(builder, value): - DucBlockAttributeDefinitionEntryAddValue(builder, value) - -def DucBlockAttributeDefinitionEntryEnd(builder): - return builder.EndObject() - -def End(builder): - return DucBlockAttributeDefinitionEntryEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucBlockCollection.py b/packages/ducpy/src/ducpy/Duc/DucBlockCollection.py deleted file mode 100644 index 682106ce..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucBlockCollection.py +++ /dev/null @@ -1,160 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucBlockCollection(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucBlockCollection() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucBlockCollection(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucBlockCollectionBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucBlockCollection - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucBlockCollection - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlockCollection - def Label(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlockCollection - def Children(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucBlockCollectionEntry import DucBlockCollectionEntry - obj = DucBlockCollectionEntry() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucBlockCollection - def ChildrenLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucBlockCollection - def ChildrenIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - - # DucBlockCollection - def Metadata(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucBlockMetadata import DucBlockMetadata - obj = DucBlockMetadata() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucBlockCollection - def Thumbnail(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) - return 0 - - # DucBlockCollection - def ThumbnailAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) - return 0 - - # DucBlockCollection - def ThumbnailLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucBlockCollection - def ThumbnailIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - return o == 0 - -def DucBlockCollectionStart(builder): - builder.StartObject(5) - -def Start(builder): - DucBlockCollectionStart(builder) - -def DucBlockCollectionAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - DucBlockCollectionAddId(builder, id) - -def DucBlockCollectionAddLabel(builder, label): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(label), 0) - -def AddLabel(builder, label): - DucBlockCollectionAddLabel(builder, label) - -def DucBlockCollectionAddChildren(builder, children): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(children), 0) - -def AddChildren(builder, children): - DucBlockCollectionAddChildren(builder, children) - -def DucBlockCollectionStartChildrenVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartChildrenVector(builder, numElems): - return DucBlockCollectionStartChildrenVector(builder, numElems) - -def DucBlockCollectionAddMetadata(builder, metadata): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(metadata), 0) - -def AddMetadata(builder, metadata): - DucBlockCollectionAddMetadata(builder, metadata) - -def DucBlockCollectionAddThumbnail(builder, thumbnail): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(thumbnail), 0) - -def AddThumbnail(builder, thumbnail): - DucBlockCollectionAddThumbnail(builder, thumbnail) - -def DucBlockCollectionStartThumbnailVector(builder, numElems): - return builder.StartVector(1, numElems, 1) - -def StartThumbnailVector(builder, numElems): - return DucBlockCollectionStartThumbnailVector(builder, numElems) - -def DucBlockCollectionEnd(builder): - return builder.EndObject() - -def End(builder): - return DucBlockCollectionEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucBlockCollectionEntry.py b/packages/ducpy/src/ducpy/Duc/DucBlockCollectionEntry.py deleted file mode 100644 index 36787804..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucBlockCollectionEntry.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucBlockCollectionEntry(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucBlockCollectionEntry() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucBlockCollectionEntry(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucBlockCollectionEntryBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucBlockCollectionEntry - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucBlockCollectionEntry - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlockCollectionEntry - def IsCollection(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def DucBlockCollectionEntryStart(builder): - builder.StartObject(2) - -def Start(builder): - DucBlockCollectionEntryStart(builder) - -def DucBlockCollectionEntryAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - DucBlockCollectionEntryAddId(builder, id) - -def DucBlockCollectionEntryAddIsCollection(builder, isCollection): - builder.PrependBoolSlot(1, isCollection, 0) - -def AddIsCollection(builder, isCollection): - DucBlockCollectionEntryAddIsCollection(builder, isCollection) - -def DucBlockCollectionEntryEnd(builder): - return builder.EndObject() - -def End(builder): - return DucBlockCollectionEntryEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucBlockDuplicationArray.py b/packages/ducpy/src/ducpy/Duc/DucBlockDuplicationArray.py deleted file mode 100644 index 8708247d..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucBlockDuplicationArray.py +++ /dev/null @@ -1,93 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucBlockDuplicationArray(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucBlockDuplicationArray() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucBlockDuplicationArray(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucBlockDuplicationArrayBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucBlockDuplicationArray - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucBlockDuplicationArray - def Rows(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # DucBlockDuplicationArray - def Cols(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # DucBlockDuplicationArray - def RowSpacing(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucBlockDuplicationArray - def ColSpacing(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def DucBlockDuplicationArrayStart(builder): - builder.StartObject(4) - -def Start(builder): - DucBlockDuplicationArrayStart(builder) - -def DucBlockDuplicationArrayAddRows(builder, rows): - builder.PrependInt32Slot(0, rows, 0) - -def AddRows(builder, rows): - DucBlockDuplicationArrayAddRows(builder, rows) - -def DucBlockDuplicationArrayAddCols(builder, cols): - builder.PrependInt32Slot(1, cols, 0) - -def AddCols(builder, cols): - DucBlockDuplicationArrayAddCols(builder, cols) - -def DucBlockDuplicationArrayAddRowSpacing(builder, rowSpacing): - builder.PrependFloat64Slot(2, rowSpacing, 0.0) - -def AddRowSpacing(builder, rowSpacing): - DucBlockDuplicationArrayAddRowSpacing(builder, rowSpacing) - -def DucBlockDuplicationArrayAddColSpacing(builder, colSpacing): - builder.PrependFloat64Slot(3, colSpacing, 0.0) - -def AddColSpacing(builder, colSpacing): - DucBlockDuplicationArrayAddColSpacing(builder, colSpacing) - -def DucBlockDuplicationArrayEnd(builder): - return builder.EndObject() - -def End(builder): - return DucBlockDuplicationArrayEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucBlockInstance.py b/packages/ducpy/src/ducpy/Duc/DucBlockInstance.py deleted file mode 100644 index ed044dd9..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucBlockInstance.py +++ /dev/null @@ -1,171 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucBlockInstance(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucBlockInstance() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucBlockInstance(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucBlockInstanceBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucBlockInstance - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucBlockInstance - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlockInstance - def BlockId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlockInstance - def ElementOverrides(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.StringValueEntry import StringValueEntry - obj = StringValueEntry() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucBlockInstance - def ElementOverridesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucBlockInstance - def ElementOverridesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - - # DucBlockInstance - def AttributeValues(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.StringValueEntry import StringValueEntry - obj = StringValueEntry() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucBlockInstance - def AttributeValuesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucBlockInstance - def AttributeValuesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - - # DucBlockInstance - def DuplicationArray(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucBlockDuplicationArray import DucBlockDuplicationArray - obj = DucBlockDuplicationArray() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucBlockInstance - def Version(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - -def DucBlockInstanceStart(builder): - builder.StartObject(6) - -def Start(builder): - DucBlockInstanceStart(builder) - -def DucBlockInstanceAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - DucBlockInstanceAddId(builder, id) - -def DucBlockInstanceAddBlockId(builder, blockId): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(blockId), 0) - -def AddBlockId(builder, blockId): - DucBlockInstanceAddBlockId(builder, blockId) - -def DucBlockInstanceAddElementOverrides(builder, elementOverrides): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(elementOverrides), 0) - -def AddElementOverrides(builder, elementOverrides): - DucBlockInstanceAddElementOverrides(builder, elementOverrides) - -def DucBlockInstanceStartElementOverridesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartElementOverridesVector(builder, numElems): - return DucBlockInstanceStartElementOverridesVector(builder, numElems) - -def DucBlockInstanceAddAttributeValues(builder, attributeValues): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(attributeValues), 0) - -def AddAttributeValues(builder, attributeValues): - DucBlockInstanceAddAttributeValues(builder, attributeValues) - -def DucBlockInstanceStartAttributeValuesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartAttributeValuesVector(builder, numElems): - return DucBlockInstanceStartAttributeValuesVector(builder, numElems) - -def DucBlockInstanceAddDuplicationArray(builder, duplicationArray): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(duplicationArray), 0) - -def AddDuplicationArray(builder, duplicationArray): - DucBlockInstanceAddDuplicationArray(builder, duplicationArray) - -def DucBlockInstanceAddVersion(builder, version): - builder.PrependInt32Slot(5, version, 0) - -def AddVersion(builder, version): - DucBlockInstanceAddVersion(builder, version) - -def DucBlockInstanceEnd(builder): - return builder.EndObject() - -def End(builder): - return DucBlockInstanceEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucBlockInstanceElement.py b/packages/ducpy/src/ducpy/Duc/DucBlockInstanceElement.py deleted file mode 100644 index 8c2f2e85..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucBlockInstanceElement.py +++ /dev/null @@ -1,41 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucBlockInstanceElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucBlockInstanceElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucBlockInstanceElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucBlockInstanceElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucBlockInstanceElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - -def DucBlockInstanceElementStart(builder): - builder.StartObject(5) - -def Start(builder): - DucBlockInstanceElementStart(builder) - -def DucBlockInstanceElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucBlockInstanceElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucBlockMetadata.py b/packages/ducpy/src/ducpy/Duc/DucBlockMetadata.py deleted file mode 100644 index f4d0fef2..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucBlockMetadata.py +++ /dev/null @@ -1,132 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucBlockMetadata(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucBlockMetadata() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucBlockMetadata(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucBlockMetadataBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucBlockMetadata - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucBlockMetadata - def Source(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucBlockMetadata - def UsageCount(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # DucBlockMetadata - def CreatedAt(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) - return 0 - - # DucBlockMetadata - def UpdatedAt(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) - return 0 - - # DucBlockMetadata - def Localization(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) - return 0 - - # DucBlockMetadata - def LocalizationAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) - return 0 - - # DucBlockMetadata - def LocalizationLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucBlockMetadata - def LocalizationIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - return o == 0 - -def DucBlockMetadataStart(builder): - builder.StartObject(6) - -def Start(builder): - DucBlockMetadataStart(builder) - -def DucBlockMetadataAddSource(builder, source): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(source), 0) - -def AddSource(builder, source): - DucBlockMetadataAddSource(builder, source) - -def DucBlockMetadataAddUsageCount(builder, usageCount): - builder.PrependInt32Slot(1, usageCount, 0) - -def AddUsageCount(builder, usageCount): - DucBlockMetadataAddUsageCount(builder, usageCount) - -def DucBlockMetadataAddCreatedAt(builder, createdAt): - builder.PrependInt64Slot(2, createdAt, 0) - -def AddCreatedAt(builder, createdAt): - DucBlockMetadataAddCreatedAt(builder, createdAt) - -def DucBlockMetadataAddUpdatedAt(builder, updatedAt): - builder.PrependInt64Slot(3, updatedAt, 0) - -def AddUpdatedAt(builder, updatedAt): - DucBlockMetadataAddUpdatedAt(builder, updatedAt) - -def DucBlockMetadataAddLocalization(builder, localization): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(localization), 0) - -def AddLocalization(builder, localization): - DucBlockMetadataAddLocalization(builder, localization) - -def DucBlockMetadataStartLocalizationVector(builder, numElems): - return builder.StartVector(1, numElems, 1) - -def StartLocalizationVector(builder, numElems): - return DucBlockMetadataStartLocalizationVector(builder, numElems) - -def DucBlockMetadataEnd(builder): - return builder.EndObject() - -def End(builder): - return DucBlockMetadataEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucCommonStyle.py b/packages/ducpy/src/ducpy/Duc/DucCommonStyle.py deleted file mode 100644 index ba50ca58..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucCommonStyle.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucCommonStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucCommonStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucCommonStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucCommonStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucCommonStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucCommonStyle - def Background(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ElementBackground import ElementBackground - obj = ElementBackground() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucCommonStyle - def Stroke(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ElementStroke import ElementStroke - obj = ElementStroke() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucCommonStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - DucCommonStyleStart(builder) - -def DucCommonStyleAddBackground(builder, background): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(background), 0) - -def AddBackground(builder, background): - DucCommonStyleAddBackground(builder, background) - -def DucCommonStyleAddStroke(builder, stroke): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(stroke), 0) - -def AddStroke(builder, stroke): - DucCommonStyleAddStroke(builder, stroke) - -def DucCommonStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DucCommonStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucDimensionElement.py b/packages/ducpy/src/ducpy/Duc/DucDimensionElement.py deleted file mode 100644 index 90286a56..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucDimensionElement.py +++ /dev/null @@ -1,229 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucDimensionElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucDimensionElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucDimensionElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucDimensionElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucDimensionElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucDimensionElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDimensionElement - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucDimensionStyle import DucDimensionStyle - obj = DucDimensionStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDimensionElement - def DimensionType(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucDimensionElement - def DefinitionPoints(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DimensionDefinitionPoints import DimensionDefinitionPoints - obj = DimensionDefinitionPoints() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDimensionElement - def ObliqueAngle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucDimensionElement - def OrdinateAxis(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucDimensionElement - def Bindings(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DimensionBindings import DimensionBindings - obj = DimensionBindings() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDimensionElement - def TextOverride(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucDimensionElement - def TextPosition(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - x = o + self._tab.Pos - from Duc.GeometricPoint import GeometricPoint - obj = GeometricPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDimensionElement - def ToleranceOverride(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DimensionToleranceStyle import DimensionToleranceStyle - obj = DimensionToleranceStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDimensionElement - def BaselineData(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DimensionBaselineData import DimensionBaselineData - obj = DimensionBaselineData() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDimensionElement - def ContinueData(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DimensionContinueData import DimensionContinueData - obj = DimensionContinueData() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucDimensionElementStart(builder): - builder.StartObject(12) - -def Start(builder): - DucDimensionElementStart(builder) - -def DucDimensionElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucDimensionElementAddBase(builder, base) - -def DucDimensionElementAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - DucDimensionElementAddStyle(builder, style) - -def DucDimensionElementAddDimensionType(builder, dimensionType): - builder.PrependUint8Slot(2, dimensionType, None) - -def AddDimensionType(builder, dimensionType): - DucDimensionElementAddDimensionType(builder, dimensionType) - -def DucDimensionElementAddDefinitionPoints(builder, definitionPoints): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(definitionPoints), 0) - -def AddDefinitionPoints(builder, definitionPoints): - DucDimensionElementAddDefinitionPoints(builder, definitionPoints) - -def DucDimensionElementAddObliqueAngle(builder, obliqueAngle): - builder.PrependFloat32Slot(4, obliqueAngle, 0.0) - -def AddObliqueAngle(builder, obliqueAngle): - DucDimensionElementAddObliqueAngle(builder, obliqueAngle) - -def DucDimensionElementAddOrdinateAxis(builder, ordinateAxis): - builder.PrependUint8Slot(5, ordinateAxis, None) - -def AddOrdinateAxis(builder, ordinateAxis): - DucDimensionElementAddOrdinateAxis(builder, ordinateAxis) - -def DucDimensionElementAddBindings(builder, bindings): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(bindings), 0) - -def AddBindings(builder, bindings): - DucDimensionElementAddBindings(builder, bindings) - -def DucDimensionElementAddTextOverride(builder, textOverride): - builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(textOverride), 0) - -def AddTextOverride(builder, textOverride): - DucDimensionElementAddTextOverride(builder, textOverride) - -def DucDimensionElementAddTextPosition(builder, textPosition): - builder.PrependStructSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(textPosition), 0) - -def AddTextPosition(builder, textPosition): - DucDimensionElementAddTextPosition(builder, textPosition) - -def DucDimensionElementAddToleranceOverride(builder, toleranceOverride): - builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(toleranceOverride), 0) - -def AddToleranceOverride(builder, toleranceOverride): - DucDimensionElementAddToleranceOverride(builder, toleranceOverride) - -def DucDimensionElementAddBaselineData(builder, baselineData): - builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(baselineData), 0) - -def AddBaselineData(builder, baselineData): - DucDimensionElementAddBaselineData(builder, baselineData) - -def DucDimensionElementAddContinueData(builder, continueData): - builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(continueData), 0) - -def AddContinueData(builder, continueData): - DucDimensionElementAddContinueData(builder, continueData) - -def DucDimensionElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucDimensionElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucDimensionStyle.py b/packages/ducpy/src/ducpy/Duc/DucDimensionStyle.py deleted file mode 100644 index 3a6a29d1..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucDimensionStyle.py +++ /dev/null @@ -1,143 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucDimensionStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucDimensionStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucDimensionStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucDimensionStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucDimensionStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucDimensionStyle - def DimLine(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DimensionLineStyle import DimensionLineStyle - obj = DimensionLineStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDimensionStyle - def ExtLine(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DimensionExtLineStyle import DimensionExtLineStyle - obj = DimensionExtLineStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDimensionStyle - def TextStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTextStyle import DucTextStyle - obj = DucTextStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDimensionStyle - def Symbols(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DimensionSymbolStyle import DimensionSymbolStyle - obj = DimensionSymbolStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDimensionStyle - def Tolerance(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DimensionToleranceStyle import DimensionToleranceStyle - obj = DimensionToleranceStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDimensionStyle - def Fit(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DimensionFitStyle import DimensionFitStyle - obj = DimensionFitStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucDimensionStyleStart(builder): - builder.StartObject(6) - -def Start(builder): - DucDimensionStyleStart(builder) - -def DucDimensionStyleAddDimLine(builder, dimLine): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(dimLine), 0) - -def AddDimLine(builder, dimLine): - DucDimensionStyleAddDimLine(builder, dimLine) - -def DucDimensionStyleAddExtLine(builder, extLine): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(extLine), 0) - -def AddExtLine(builder, extLine): - DucDimensionStyleAddExtLine(builder, extLine) - -def DucDimensionStyleAddTextStyle(builder, textStyle): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(textStyle), 0) - -def AddTextStyle(builder, textStyle): - DucDimensionStyleAddTextStyle(builder, textStyle) - -def DucDimensionStyleAddSymbols(builder, symbols): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(symbols), 0) - -def AddSymbols(builder, symbols): - DucDimensionStyleAddSymbols(builder, symbols) - -def DucDimensionStyleAddTolerance(builder, tolerance): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(tolerance), 0) - -def AddTolerance(builder, tolerance): - DucDimensionStyleAddTolerance(builder, tolerance) - -def DucDimensionStyleAddFit(builder, fit): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(fit), 0) - -def AddFit(builder, fit): - DucDimensionStyleAddFit(builder, fit) - -def DucDimensionStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DucDimensionStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucDocElement.py b/packages/ducpy/src/ducpy/Duc/DucDocElement.py deleted file mode 100644 index 2d6354d7..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucDocElement.py +++ /dev/null @@ -1,198 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucDocElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucDocElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucDocElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucDocElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucDocElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucDocElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDocElement - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucDocStyle import DucDocStyle - obj = DucDocStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDocElement - def Text(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucDocElement - def Dynamic(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucTextDynamicPart import DucTextDynamicPart - obj = DucTextDynamicPart() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDocElement - def DynamicLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucDocElement - def DynamicIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - - # DucDocElement - def FlowDirection(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucDocElement - def Columns(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ColumnLayout import ColumnLayout - obj = ColumnLayout() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDocElement - def AutoResize(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucDocElement - def GridConfig(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DocumentGridConfig import DocumentGridConfig - obj = DocumentGridConfig() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDocElement - def FileId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DucDocElementStart(builder): - builder.StartObject(9) - -def Start(builder): - DucDocElementStart(builder) - -def DucDocElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucDocElementAddBase(builder, base) - -def DucDocElementAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - DucDocElementAddStyle(builder, style) - -def DucDocElementAddText(builder, text): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(text), 0) - -def AddText(builder, text): - DucDocElementAddText(builder, text) - -def DucDocElementAddDynamic(builder, dynamic): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(dynamic), 0) - -def AddDynamic(builder, dynamic): - DucDocElementAddDynamic(builder, dynamic) - -def DucDocElementStartDynamicVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartDynamicVector(builder, numElems): - return DucDocElementStartDynamicVector(builder, numElems) - -def DucDocElementAddFlowDirection(builder, flowDirection): - builder.PrependUint8Slot(4, flowDirection, None) - -def AddFlowDirection(builder, flowDirection): - DucDocElementAddFlowDirection(builder, flowDirection) - -def DucDocElementAddColumns(builder, columns): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(columns), 0) - -def AddColumns(builder, columns): - DucDocElementAddColumns(builder, columns) - -def DucDocElementAddAutoResize(builder, autoResize): - builder.PrependBoolSlot(6, autoResize, 0) - -def AddAutoResize(builder, autoResize): - DucDocElementAddAutoResize(builder, autoResize) - -def DucDocElementAddGridConfig(builder, gridConfig): - builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(gridConfig), 0) - -def AddGridConfig(builder, gridConfig): - DucDocElementAddGridConfig(builder, gridConfig) - -def DucDocElementAddFileId(builder, fileId): - builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(fileId), 0) - -def AddFileId(builder, fileId): - DucDocElementAddFileId(builder, fileId) - -def DucDocElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucDocElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucDocStyle.py b/packages/ducpy/src/ducpy/Duc/DucDocStyle.py deleted file mode 100644 index a70a4221..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucDocStyle.py +++ /dev/null @@ -1,92 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucDocStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucDocStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucDocStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucDocStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucDocStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucDocStyle - def TextStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTextStyle import DucTextStyle - obj = DucTextStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDocStyle - def Paragraph(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ParagraphFormatting import ParagraphFormatting - obj = ParagraphFormatting() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucDocStyle - def StackFormat(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.StackFormat import StackFormat - obj = StackFormat() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucDocStyleStart(builder): - builder.StartObject(3) - -def Start(builder): - DucDocStyleStart(builder) - -def DucDocStyleAddTextStyle(builder, textStyle): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(textStyle), 0) - -def AddTextStyle(builder, textStyle): - DucDocStyleAddTextStyle(builder, textStyle) - -def DucDocStyleAddParagraph(builder, paragraph): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(paragraph), 0) - -def AddParagraph(builder, paragraph): - DucDocStyleAddParagraph(builder, paragraph) - -def DucDocStyleAddStackFormat(builder, stackFormat): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(stackFormat), 0) - -def AddStackFormat(builder, stackFormat): - DucDocStyleAddStackFormat(builder, stackFormat) - -def DucDocStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DucDocStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucEllipseElement.py b/packages/ducpy/src/ducpy/Duc/DucEllipseElement.py deleted file mode 100644 index 994f4227..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucEllipseElement.py +++ /dev/null @@ -1,110 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucEllipseElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucEllipseElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucEllipseElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucEllipseElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucEllipseElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucEllipseElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucEllipseElement - def Ratio(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucEllipseElement - def StartAngle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucEllipseElement - def EndAngle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucEllipseElement - def ShowAuxCrosshair(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def DucEllipseElementStart(builder): - builder.StartObject(5) - -def Start(builder): - DucEllipseElementStart(builder) - -def DucEllipseElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucEllipseElementAddBase(builder, base) - -def DucEllipseElementAddRatio(builder, ratio): - builder.PrependFloat32Slot(1, ratio, 0.0) - -def AddRatio(builder, ratio): - DucEllipseElementAddRatio(builder, ratio) - -def DucEllipseElementAddStartAngle(builder, startAngle): - builder.PrependFloat64Slot(2, startAngle, 0.0) - -def AddStartAngle(builder, startAngle): - DucEllipseElementAddStartAngle(builder, startAngle) - -def DucEllipseElementAddEndAngle(builder, endAngle): - builder.PrependFloat64Slot(3, endAngle, 0.0) - -def AddEndAngle(builder, endAngle): - DucEllipseElementAddEndAngle(builder, endAngle) - -def DucEllipseElementAddShowAuxCrosshair(builder, showAuxCrosshair): - builder.PrependBoolSlot(4, showAuxCrosshair, 0) - -def AddShowAuxCrosshair(builder, showAuxCrosshair): - DucEllipseElementAddShowAuxCrosshair(builder, showAuxCrosshair) - -def DucEllipseElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucEllipseElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucEmbeddableElement.py b/packages/ducpy/src/ducpy/Duc/DucEmbeddableElement.py deleted file mode 100644 index 1a52cd61..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucEmbeddableElement.py +++ /dev/null @@ -1,58 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucEmbeddableElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucEmbeddableElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucEmbeddableElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucEmbeddableElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucEmbeddableElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucEmbeddableElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucEmbeddableElementStart(builder): - builder.StartObject(1) - -def Start(builder): - DucEmbeddableElementStart(builder) - -def DucEmbeddableElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucEmbeddableElementAddBase(builder, base) - -def DucEmbeddableElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucEmbeddableElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucExternalFileData.py b/packages/ducpy/src/ducpy/Duc/DucExternalFileData.py deleted file mode 100644 index 51a148b3..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucExternalFileData.py +++ /dev/null @@ -1,132 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucExternalFileData(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucExternalFileData() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucExternalFileData(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucExternalFileDataBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucExternalFileData - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucExternalFileData - def MimeType(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucExternalFileData - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucExternalFileData - def Data(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) - return 0 - - # DucExternalFileData - def DataAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) - return 0 - - # DucExternalFileData - def DataLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucExternalFileData - def DataIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - - # DucExternalFileData - def Created(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) - return 0 - - # DucExternalFileData - def LastRetrieved(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) - return None - -def DucExternalFileDataStart(builder): - builder.StartObject(5) - -def Start(builder): - DucExternalFileDataStart(builder) - -def DucExternalFileDataAddMimeType(builder, mimeType): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(mimeType), 0) - -def AddMimeType(builder, mimeType): - DucExternalFileDataAddMimeType(builder, mimeType) - -def DucExternalFileDataAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - DucExternalFileDataAddId(builder, id) - -def DucExternalFileDataAddData(builder, data): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0) - -def AddData(builder, data): - DucExternalFileDataAddData(builder, data) - -def DucExternalFileDataStartDataVector(builder, numElems): - return builder.StartVector(1, numElems, 1) - -def StartDataVector(builder, numElems): - return DucExternalFileDataStartDataVector(builder, numElems) - -def DucExternalFileDataAddCreated(builder, created): - builder.PrependInt64Slot(3, created, 0) - -def AddCreated(builder, created): - DucExternalFileDataAddCreated(builder, created) - -def DucExternalFileDataAddLastRetrieved(builder, lastRetrieved): - builder.PrependInt64Slot(4, lastRetrieved, None) - -def AddLastRetrieved(builder, lastRetrieved): - DucExternalFileDataAddLastRetrieved(builder, lastRetrieved) - -def DucExternalFileDataEnd(builder): - return builder.EndObject() - -def End(builder): - return DucExternalFileDataEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucExternalFileEntry.py b/packages/ducpy/src/ducpy/Duc/DucExternalFileEntry.py deleted file mode 100644 index c391abaf..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucExternalFileEntry.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucExternalFileEntry(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucExternalFileEntry() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucExternalFileEntry(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucExternalFileEntryBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucExternalFileEntry - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucExternalFileEntry - def Key(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucExternalFileEntry - def Value(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucExternalFileData import DucExternalFileData - obj = DucExternalFileData() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucExternalFileEntryStart(builder): - builder.StartObject(2) - -def Start(builder): - DucExternalFileEntryStart(builder) - -def DucExternalFileEntryAddKey(builder, key): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0) - -def AddKey(builder, key): - DucExternalFileEntryAddKey(builder, key) - -def DucExternalFileEntryAddValue(builder, value): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0) - -def AddValue(builder, value): - DucExternalFileEntryAddValue(builder, value) - -def DucExternalFileEntryEnd(builder): - return builder.EndObject() - -def End(builder): - return DucExternalFileEntryEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucFeatureControlFrameElement.py b/packages/ducpy/src/ducpy/Duc/DucFeatureControlFrameElement.py deleted file mode 100644 index 42ef3988..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucFeatureControlFrameElement.py +++ /dev/null @@ -1,159 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucFeatureControlFrameElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucFeatureControlFrameElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucFeatureControlFrameElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucFeatureControlFrameElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucFeatureControlFrameElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucFeatureControlFrameElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucFeatureControlFrameElement - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucFeatureControlFrameStyle import DucFeatureControlFrameStyle - obj = DucFeatureControlFrameStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucFeatureControlFrameElement - def Rows(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.FCFSegmentRow import FCFSegmentRow - obj = FCFSegmentRow() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucFeatureControlFrameElement - def RowsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucFeatureControlFrameElement - def RowsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - - # DucFeatureControlFrameElement - def FrameModifiers(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.FCFFrameModifiers import FCFFrameModifiers - obj = FCFFrameModifiers() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucFeatureControlFrameElement - def LeaderElementId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucFeatureControlFrameElement - def DatumDefinition(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.FCFDatumDefinition import FCFDatumDefinition - obj = FCFDatumDefinition() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucFeatureControlFrameElementStart(builder): - builder.StartObject(6) - -def Start(builder): - DucFeatureControlFrameElementStart(builder) - -def DucFeatureControlFrameElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucFeatureControlFrameElementAddBase(builder, base) - -def DucFeatureControlFrameElementAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - DucFeatureControlFrameElementAddStyle(builder, style) - -def DucFeatureControlFrameElementAddRows(builder, rows): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(rows), 0) - -def AddRows(builder, rows): - DucFeatureControlFrameElementAddRows(builder, rows) - -def DucFeatureControlFrameElementStartRowsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartRowsVector(builder, numElems): - return DucFeatureControlFrameElementStartRowsVector(builder, numElems) - -def DucFeatureControlFrameElementAddFrameModifiers(builder, frameModifiers): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(frameModifiers), 0) - -def AddFrameModifiers(builder, frameModifiers): - DucFeatureControlFrameElementAddFrameModifiers(builder, frameModifiers) - -def DucFeatureControlFrameElementAddLeaderElementId(builder, leaderElementId): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(leaderElementId), 0) - -def AddLeaderElementId(builder, leaderElementId): - DucFeatureControlFrameElementAddLeaderElementId(builder, leaderElementId) - -def DucFeatureControlFrameElementAddDatumDefinition(builder, datumDefinition): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(datumDefinition), 0) - -def AddDatumDefinition(builder, datumDefinition): - DucFeatureControlFrameElementAddDatumDefinition(builder, datumDefinition) - -def DucFeatureControlFrameElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucFeatureControlFrameElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucFeatureControlFrameStyle.py b/packages/ducpy/src/ducpy/Duc/DucFeatureControlFrameStyle.py deleted file mode 100644 index bc198743..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucFeatureControlFrameStyle.py +++ /dev/null @@ -1,109 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucFeatureControlFrameStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucFeatureControlFrameStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucFeatureControlFrameStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucFeatureControlFrameStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucFeatureControlFrameStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucFeatureControlFrameStyle - def TextStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTextStyle import DucTextStyle - obj = DucTextStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucFeatureControlFrameStyle - def Layout(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.FCFLayoutStyle import FCFLayoutStyle - obj = FCFLayoutStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucFeatureControlFrameStyle - def Symbols(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.FCFSymbolStyle import FCFSymbolStyle - obj = FCFSymbolStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucFeatureControlFrameStyle - def DatumStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.FCFDatumStyle import FCFDatumStyle - obj = FCFDatumStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucFeatureControlFrameStyleStart(builder): - builder.StartObject(5) - -def Start(builder): - DucFeatureControlFrameStyleStart(builder) - -def DucFeatureControlFrameStyleAddTextStyle(builder, textStyle): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(textStyle), 0) - -def AddTextStyle(builder, textStyle): - DucFeatureControlFrameStyleAddTextStyle(builder, textStyle) - -def DucFeatureControlFrameStyleAddLayout(builder, layout): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(layout), 0) - -def AddLayout(builder, layout): - DucFeatureControlFrameStyleAddLayout(builder, layout) - -def DucFeatureControlFrameStyleAddSymbols(builder, symbols): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(symbols), 0) - -def AddSymbols(builder, symbols): - DucFeatureControlFrameStyleAddSymbols(builder, symbols) - -def DucFeatureControlFrameStyleAddDatumStyle(builder, datumStyle): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(datumStyle), 0) - -def AddDatumStyle(builder, datumStyle): - DucFeatureControlFrameStyleAddDatumStyle(builder, datumStyle) - -def DucFeatureControlFrameStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DucFeatureControlFrameStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucFrameElement.py b/packages/ducpy/src/ducpy/Duc/DucFrameElement.py deleted file mode 100644 index 7ff9ae18..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucFrameElement.py +++ /dev/null @@ -1,58 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucFrameElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucFrameElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucFrameElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucFrameElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucFrameElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucFrameElement - def StackElementBase(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucStackElementBase import _DucStackElementBase - obj = _DucStackElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucFrameElementStart(builder): - builder.StartObject(1) - -def Start(builder): - DucFrameElementStart(builder) - -def DucFrameElementAddStackElementBase(builder, stackElementBase): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(stackElementBase), 0) - -def AddStackElementBase(builder, stackElementBase): - DucFrameElementAddStackElementBase(builder, stackElementBase) - -def DucFrameElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucFrameElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucFreeDrawElement.py b/packages/ducpy/src/ducpy/Duc/DucFreeDrawElement.py deleted file mode 100644 index e2eea87f..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucFreeDrawElement.py +++ /dev/null @@ -1,276 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucFreeDrawElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucFreeDrawElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucFreeDrawElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucFreeDrawElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucFreeDrawElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucFreeDrawElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucFreeDrawElement - def Points(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucPoint import DucPoint - obj = DucPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucFreeDrawElement - def PointsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucFreeDrawElement - def PointsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - return o == 0 - - # DucFreeDrawElement - def Size(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucFreeDrawElement - def Thinning(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucFreeDrawElement - def Smoothing(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucFreeDrawElement - def Streamline(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucFreeDrawElement - def Easing(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucFreeDrawElement - def Start(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucFreeDrawEnds import DucFreeDrawEnds - obj = DucFreeDrawEnds() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucFreeDrawElement - def End(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucFreeDrawEnds import DucFreeDrawEnds - obj = DucFreeDrawEnds() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucFreeDrawElement - def Pressures(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return 0 - - # DucFreeDrawElement - def PressuresAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o) - return 0 - - # DucFreeDrawElement - def PressuresLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucFreeDrawElement - def PressuresIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - return o == 0 - - # DucFreeDrawElement - def SimulatePressure(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucFreeDrawElement - def LastCommittedPoint(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPoint import DucPoint - obj = DucPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucFreeDrawElement - def SvgPath(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DucFreeDrawElementStart(builder): - builder.StartObject(13) - -def Start(builder): - DucFreeDrawElementStart(builder) - -def DucFreeDrawElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucFreeDrawElementAddBase(builder, base) - -def DucFreeDrawElementAddPoints(builder, points): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(points), 0) - -def AddPoints(builder, points): - DucFreeDrawElementAddPoints(builder, points) - -def DucFreeDrawElementStartPointsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartPointsVector(builder, numElems): - return DucFreeDrawElementStartPointsVector(builder, numElems) - -def DucFreeDrawElementAddSize(builder, size): - builder.PrependFloat64Slot(2, size, 0.0) - -def AddSize(builder, size): - DucFreeDrawElementAddSize(builder, size) - -def DucFreeDrawElementAddThinning(builder, thinning): - builder.PrependFloat32Slot(3, thinning, 0.0) - -def AddThinning(builder, thinning): - DucFreeDrawElementAddThinning(builder, thinning) - -def DucFreeDrawElementAddSmoothing(builder, smoothing): - builder.PrependFloat32Slot(4, smoothing, 0.0) - -def AddSmoothing(builder, smoothing): - DucFreeDrawElementAddSmoothing(builder, smoothing) - -def DucFreeDrawElementAddStreamline(builder, streamline): - builder.PrependFloat32Slot(5, streamline, 0.0) - -def AddStreamline(builder, streamline): - DucFreeDrawElementAddStreamline(builder, streamline) - -def DucFreeDrawElementAddEasing(builder, easing): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(easing), 0) - -def AddEasing(builder, easing): - DucFreeDrawElementAddEasing(builder, easing) - -def DucFreeDrawElementAddStart(builder, start): - builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(start), 0) - -def AddStart(builder, start): - DucFreeDrawElementAddStart(builder, start) - -def DucFreeDrawElementAddEnd(builder, end): - builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(end), 0) - -def AddEnd(builder, end): - DucFreeDrawElementAddEnd(builder, end) - -def DucFreeDrawElementAddPressures(builder, pressures): - builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(pressures), 0) - -def AddPressures(builder, pressures): - DucFreeDrawElementAddPressures(builder, pressures) - -def DucFreeDrawElementStartPressuresVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartPressuresVector(builder, numElems): - return DucFreeDrawElementStartPressuresVector(builder, numElems) - -def DucFreeDrawElementAddSimulatePressure(builder, simulatePressure): - builder.PrependBoolSlot(10, simulatePressure, 0) - -def AddSimulatePressure(builder, simulatePressure): - DucFreeDrawElementAddSimulatePressure(builder, simulatePressure) - -def DucFreeDrawElementAddLastCommittedPoint(builder, lastCommittedPoint): - builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(lastCommittedPoint), 0) - -def AddLastCommittedPoint(builder, lastCommittedPoint): - DucFreeDrawElementAddLastCommittedPoint(builder, lastCommittedPoint) - -def DucFreeDrawElementAddSvgPath(builder, svgPath): - builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(svgPath), 0) - -def AddSvgPath(builder, svgPath): - DucFreeDrawElementAddSvgPath(builder, svgPath) - -def DucFreeDrawElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucFreeDrawElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucFreeDrawEnds.py b/packages/ducpy/src/ducpy/Duc/DucFreeDrawEnds.py deleted file mode 100644 index e49ffb79..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucFreeDrawEnds.py +++ /dev/null @@ -1,80 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucFreeDrawEnds(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucFreeDrawEnds() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucFreeDrawEnds(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucFreeDrawEndsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucFreeDrawEnds - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucFreeDrawEnds - def Cap(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucFreeDrawEnds - def Taper(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucFreeDrawEnds - def Easing(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DucFreeDrawEndsStart(builder): - builder.StartObject(3) - -def Start(builder): - DucFreeDrawEndsStart(builder) - -def DucFreeDrawEndsAddCap(builder, cap): - builder.PrependBoolSlot(0, cap, 0) - -def AddCap(builder, cap): - DucFreeDrawEndsAddCap(builder, cap) - -def DucFreeDrawEndsAddTaper(builder, taper): - builder.PrependFloat32Slot(1, taper, 0.0) - -def AddTaper(builder, taper): - DucFreeDrawEndsAddTaper(builder, taper) - -def DucFreeDrawEndsAddEasing(builder, easing): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(easing), 0) - -def AddEasing(builder, easing): - DucFreeDrawEndsAddEasing(builder, easing) - -def DucFreeDrawEndsEnd(builder): - return builder.EndObject() - -def End(builder): - return DucFreeDrawEndsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucGlobalState.py b/packages/ducpy/src/ducpy/Duc/DucGlobalState.py deleted file mode 100644 index 95982a87..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucGlobalState.py +++ /dev/null @@ -1,184 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucGlobalState(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucGlobalState() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucGlobalState(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucGlobalStateBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucGlobalState - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucGlobalState - def Name(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucGlobalState - def ViewBackgroundColor(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucGlobalState - def MainScope(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucGlobalState - def DashSpacingScale(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucGlobalState - def IsDashSpacingAffectedByViewportScale(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucGlobalState - def ScopeExponentThreshold(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) - return 0 - - # DucGlobalState - def DimensionsAssociativeByDefault(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucGlobalState - def UseAnnotativeScaling(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucGlobalState - def DisplayPrecisionLinear(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # DucGlobalState - def DisplayPrecisionAngular(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # DucGlobalState - def PruningLevel(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def DucGlobalStateStart(builder): - builder.StartObject(11) - -def Start(builder): - DucGlobalStateStart(builder) - -def DucGlobalStateAddName(builder, name): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) - -def AddName(builder, name): - DucGlobalStateAddName(builder, name) - -def DucGlobalStateAddViewBackgroundColor(builder, viewBackgroundColor): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(viewBackgroundColor), 0) - -def AddViewBackgroundColor(builder, viewBackgroundColor): - DucGlobalStateAddViewBackgroundColor(builder, viewBackgroundColor) - -def DucGlobalStateAddMainScope(builder, mainScope): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(mainScope), 0) - -def AddMainScope(builder, mainScope): - DucGlobalStateAddMainScope(builder, mainScope) - -def DucGlobalStateAddDashSpacingScale(builder, dashSpacingScale): - builder.PrependFloat32Slot(3, dashSpacingScale, 0.0) - -def AddDashSpacingScale(builder, dashSpacingScale): - DucGlobalStateAddDashSpacingScale(builder, dashSpacingScale) - -def DucGlobalStateAddIsDashSpacingAffectedByViewportScale(builder, isDashSpacingAffectedByViewportScale): - builder.PrependBoolSlot(4, isDashSpacingAffectedByViewportScale, 0) - -def AddIsDashSpacingAffectedByViewportScale(builder, isDashSpacingAffectedByViewportScale): - DucGlobalStateAddIsDashSpacingAffectedByViewportScale(builder, isDashSpacingAffectedByViewportScale) - -def DucGlobalStateAddScopeExponentThreshold(builder, scopeExponentThreshold): - builder.PrependInt8Slot(5, scopeExponentThreshold, 0) - -def AddScopeExponentThreshold(builder, scopeExponentThreshold): - DucGlobalStateAddScopeExponentThreshold(builder, scopeExponentThreshold) - -def DucGlobalStateAddDimensionsAssociativeByDefault(builder, dimensionsAssociativeByDefault): - builder.PrependBoolSlot(6, dimensionsAssociativeByDefault, 0) - -def AddDimensionsAssociativeByDefault(builder, dimensionsAssociativeByDefault): - DucGlobalStateAddDimensionsAssociativeByDefault(builder, dimensionsAssociativeByDefault) - -def DucGlobalStateAddUseAnnotativeScaling(builder, useAnnotativeScaling): - builder.PrependBoolSlot(7, useAnnotativeScaling, 0) - -def AddUseAnnotativeScaling(builder, useAnnotativeScaling): - DucGlobalStateAddUseAnnotativeScaling(builder, useAnnotativeScaling) - -def DucGlobalStateAddDisplayPrecisionLinear(builder, displayPrecisionLinear): - builder.PrependInt32Slot(8, displayPrecisionLinear, 0) - -def AddDisplayPrecisionLinear(builder, displayPrecisionLinear): - DucGlobalStateAddDisplayPrecisionLinear(builder, displayPrecisionLinear) - -def DucGlobalStateAddDisplayPrecisionAngular(builder, displayPrecisionAngular): - builder.PrependInt32Slot(9, displayPrecisionAngular, 0) - -def AddDisplayPrecisionAngular(builder, displayPrecisionAngular): - DucGlobalStateAddDisplayPrecisionAngular(builder, displayPrecisionAngular) - -def DucGlobalStateAddPruningLevel(builder, pruningLevel): - builder.PrependUint8Slot(10, pruningLevel, None) - -def AddPruningLevel(builder, pruningLevel): - DucGlobalStateAddPruningLevel(builder, pruningLevel) - -def DucGlobalStateEnd(builder): - return builder.EndObject() - -def End(builder): - return DucGlobalStateEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucGroup.py b/packages/ducpy/src/ducpy/Duc/DucGroup.py deleted file mode 100644 index 2f34dc61..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucGroup.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucGroup(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucGroup() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucGroup(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucGroupBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucGroup - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucGroup - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucGroup - def StackBase(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucStackBase import _DucStackBase - obj = _DucStackBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucGroupStart(builder): - builder.StartObject(2) - -def Start(builder): - DucGroupStart(builder) - -def DucGroupAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - DucGroupAddId(builder, id) - -def DucGroupAddStackBase(builder, stackBase): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(stackBase), 0) - -def AddStackBase(builder, stackBase): - DucGroupAddStackBase(builder, stackBase) - -def DucGroupEnd(builder): - return builder.EndObject() - -def End(builder): - return DucGroupEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucHatchStyle.py b/packages/ducpy/src/ducpy/Duc/DucHatchStyle.py deleted file mode 100644 index 0089c95b..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucHatchStyle.py +++ /dev/null @@ -1,140 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucHatchStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucHatchStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucHatchStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucHatchStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucHatchStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucHatchStyle - def HatchStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucHatchStyle - def PatternName(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucHatchStyle - def PatternScale(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucHatchStyle - def PatternAngle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucHatchStyle - def PatternOrigin(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPoint import DucPoint - obj = DucPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucHatchStyle - def PatternDouble(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucHatchStyle - def CustomPattern(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.CustomHatchPattern import CustomHatchPattern - obj = CustomHatchPattern() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucHatchStyleStart(builder): - builder.StartObject(7) - -def Start(builder): - DucHatchStyleStart(builder) - -def DucHatchStyleAddHatchStyle(builder, hatchStyle): - builder.PrependUint8Slot(0, hatchStyle, None) - -def AddHatchStyle(builder, hatchStyle): - DucHatchStyleAddHatchStyle(builder, hatchStyle) - -def DucHatchStyleAddPatternName(builder, patternName): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(patternName), 0) - -def AddPatternName(builder, patternName): - DucHatchStyleAddPatternName(builder, patternName) - -def DucHatchStyleAddPatternScale(builder, patternScale): - builder.PrependFloat32Slot(2, patternScale, 0.0) - -def AddPatternScale(builder, patternScale): - DucHatchStyleAddPatternScale(builder, patternScale) - -def DucHatchStyleAddPatternAngle(builder, patternAngle): - builder.PrependFloat64Slot(3, patternAngle, 0.0) - -def AddPatternAngle(builder, patternAngle): - DucHatchStyleAddPatternAngle(builder, patternAngle) - -def DucHatchStyleAddPatternOrigin(builder, patternOrigin): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(patternOrigin), 0) - -def AddPatternOrigin(builder, patternOrigin): - DucHatchStyleAddPatternOrigin(builder, patternOrigin) - -def DucHatchStyleAddPatternDouble(builder, patternDouble): - builder.PrependBoolSlot(5, patternDouble, 0) - -def AddPatternDouble(builder, patternDouble): - DucHatchStyleAddPatternDouble(builder, patternDouble) - -def DucHatchStyleAddCustomPattern(builder, customPattern): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(customPattern), 0) - -def AddCustomPattern(builder, customPattern): - DucHatchStyleAddCustomPattern(builder, customPattern) - -def DucHatchStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DucHatchStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucHead.py b/packages/ducpy/src/ducpy/Duc/DucHead.py deleted file mode 100644 index 7c5e515a..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucHead.py +++ /dev/null @@ -1,80 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucHead(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucHead() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucHead(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucHeadBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucHead - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucHead - def Type(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucHead - def BlockId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucHead - def Size(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def DucHeadStart(builder): - builder.StartObject(3) - -def Start(builder): - DucHeadStart(builder) - -def DucHeadAddType(builder, type): - builder.PrependUint8Slot(0, type, None) - -def AddType(builder, type): - DucHeadAddType(builder, type) - -def DucHeadAddBlockId(builder, blockId): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(blockId), 0) - -def AddBlockId(builder, blockId): - DucHeadAddBlockId(builder, blockId) - -def DucHeadAddSize(builder, size): - builder.PrependFloat64Slot(2, size, 0.0) - -def AddSize(builder, size): - DucHeadAddSize(builder, size) - -def DucHeadEnd(builder): - return builder.EndObject() - -def End(builder): - return DucHeadEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucImageElement.py b/packages/ducpy/src/ducpy/Duc/DucImageElement.py deleted file mode 100644 index f3d76162..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucImageElement.py +++ /dev/null @@ -1,157 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucImageElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucImageElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucImageElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucImageElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucImageElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucImageElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucImageElement - def FileId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucImageElement - def Status(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucImageElement - def Scale(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) - return 0 - - # DucImageElement - def ScaleAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o) - return 0 - - # DucImageElement - def ScaleLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucImageElement - def ScaleIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - - # DucImageElement - def Crop(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ImageCrop import ImageCrop - obj = ImageCrop() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucImageElement - def Filter(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucImageFilter import DucImageFilter - obj = DucImageFilter() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucImageElementStart(builder): - builder.StartObject(6) - -def Start(builder): - DucImageElementStart(builder) - -def DucImageElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucImageElementAddBase(builder, base) - -def DucImageElementAddFileId(builder, fileId): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(fileId), 0) - -def AddFileId(builder, fileId): - DucImageElementAddFileId(builder, fileId) - -def DucImageElementAddStatus(builder, status): - builder.PrependUint8Slot(2, status, None) - -def AddStatus(builder, status): - DucImageElementAddStatus(builder, status) - -def DucImageElementAddScale(builder, scale): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(scale), 0) - -def AddScale(builder, scale): - DucImageElementAddScale(builder, scale) - -def DucImageElementStartScaleVector(builder, numElems): - return builder.StartVector(8, numElems, 8) - -def StartScaleVector(builder, numElems): - return DucImageElementStartScaleVector(builder, numElems) - -def DucImageElementAddCrop(builder, crop): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(crop), 0) - -def AddCrop(builder, crop): - DucImageElementAddCrop(builder, crop) - -def DucImageElementAddFilter(builder, filter): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(filter), 0) - -def AddFilter(builder, filter): - DucImageElementAddFilter(builder, filter) - -def DucImageElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucImageElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucImageFilter.py b/packages/ducpy/src/ducpy/Duc/DucImageFilter.py deleted file mode 100644 index ff8d6780..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucImageFilter.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucImageFilter(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucImageFilter() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucImageFilter(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucImageFilterBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucImageFilter - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucImageFilter - def Brightness(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucImageFilter - def Contrast(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - -def DucImageFilterStart(builder): - builder.StartObject(2) - -def Start(builder): - DucImageFilterStart(builder) - -def DucImageFilterAddBrightness(builder, brightness): - builder.PrependFloat32Slot(0, brightness, 0.0) - -def AddBrightness(builder, brightness): - DucImageFilterAddBrightness(builder, brightness) - -def DucImageFilterAddContrast(builder, contrast): - builder.PrependFloat32Slot(1, contrast, 0.0) - -def AddContrast(builder, contrast): - DucImageFilterAddContrast(builder, contrast) - -def DucImageFilterEnd(builder): - return builder.EndObject() - -def End(builder): - return DucImageFilterEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucLayer.py b/packages/ducpy/src/ducpy/Duc/DucLayer.py deleted file mode 100644 index dc7fa151..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucLayer.py +++ /dev/null @@ -1,101 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucLayer(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucLayer() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucLayer(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucLayerBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucLayer - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucLayer - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucLayer - def StackBase(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucStackBase import _DucStackBase - obj = _DucStackBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLayer - def Readonly(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucLayer - def Overrides(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucLayerOverrides import DucLayerOverrides - obj = DucLayerOverrides() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucLayerStart(builder): - builder.StartObject(4) - -def Start(builder): - DucLayerStart(builder) - -def DucLayerAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - DucLayerAddId(builder, id) - -def DucLayerAddStackBase(builder, stackBase): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(stackBase), 0) - -def AddStackBase(builder, stackBase): - DucLayerAddStackBase(builder, stackBase) - -def DucLayerAddReadonly(builder, readonly): - builder.PrependBoolSlot(2, readonly, 0) - -def AddReadonly(builder, readonly): - DucLayerAddReadonly(builder, readonly) - -def DucLayerAddOverrides(builder, overrides): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(overrides), 0) - -def AddOverrides(builder, overrides): - DucLayerAddOverrides(builder, overrides) - -def DucLayerEnd(builder): - return builder.EndObject() - -def End(builder): - return DucLayerEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucLayerOverrides.py b/packages/ducpy/src/ducpy/Duc/DucLayerOverrides.py deleted file mode 100644 index 313eaed9..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucLayerOverrides.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucLayerOverrides(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucLayerOverrides() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucLayerOverrides(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucLayerOverridesBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucLayerOverrides - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucLayerOverrides - def Stroke(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ElementStroke import ElementStroke - obj = ElementStroke() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLayerOverrides - def Background(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ElementBackground import ElementBackground - obj = ElementBackground() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucLayerOverridesStart(builder): - builder.StartObject(2) - -def Start(builder): - DucLayerOverridesStart(builder) - -def DucLayerOverridesAddStroke(builder, stroke): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(stroke), 0) - -def AddStroke(builder, stroke): - DucLayerOverridesAddStroke(builder, stroke) - -def DucLayerOverridesAddBackground(builder, background): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(background), 0) - -def AddBackground(builder, background): - DucLayerOverridesAddBackground(builder, background) - -def DucLayerOverridesEnd(builder): - return builder.EndObject() - -def End(builder): - return DucLayerOverridesEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucLeaderElement.py b/packages/ducpy/src/ducpy/Duc/DucLeaderElement.py deleted file mode 100644 index 48aee552..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucLeaderElement.py +++ /dev/null @@ -1,109 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucLeaderElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucLeaderElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucLeaderElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucLeaderElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucLeaderElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucLeaderElement - def LinearBase(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucLinearElementBase import _DucLinearElementBase - obj = _DucLinearElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLeaderElement - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucLeaderStyle import DucLeaderStyle - obj = DucLeaderStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLeaderElement - def Content(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.LeaderContent import LeaderContent - obj = LeaderContent() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLeaderElement - def ContentAnchor(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = o + self._tab.Pos - from Duc.GeometricPoint import GeometricPoint - obj = GeometricPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucLeaderElementStart(builder): - builder.StartObject(4) - -def Start(builder): - DucLeaderElementStart(builder) - -def DucLeaderElementAddLinearBase(builder, linearBase): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(linearBase), 0) - -def AddLinearBase(builder, linearBase): - DucLeaderElementAddLinearBase(builder, linearBase) - -def DucLeaderElementAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - DucLeaderElementAddStyle(builder, style) - -def DucLeaderElementAddContent(builder, content): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(content), 0) - -def AddContent(builder, content): - DucLeaderElementAddContent(builder, content) - -def DucLeaderElementAddContentAnchor(builder, contentAnchor): - builder.PrependStructSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(contentAnchor), 0) - -def AddContentAnchor(builder, contentAnchor): - DucLeaderElementAddContentAnchor(builder, contentAnchor) - -def DucLeaderElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucLeaderElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucLeaderStyle.py b/packages/ducpy/src/ducpy/Duc/DucLeaderStyle.py deleted file mode 100644 index 85593d17..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucLeaderStyle.py +++ /dev/null @@ -1,134 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucLeaderStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucLeaderStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucLeaderStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucLeaderStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucLeaderStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucLeaderStyle - def HeadsOverride(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucHead import DucHead - obj = DucHead() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLeaderStyle - def HeadsOverrideLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucLeaderStyle - def HeadsOverrideIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - return o == 0 - - # DucLeaderStyle - def Dogleg(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucLeaderStyle - def TextStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTextStyle import DucTextStyle - obj = DucTextStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLeaderStyle - def TextAttachment(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucLeaderStyle - def BlockAttachment(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def DucLeaderStyleStart(builder): - builder.StartObject(6) - -def Start(builder): - DucLeaderStyleStart(builder) - -def DucLeaderStyleAddHeadsOverride(builder, headsOverride): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(headsOverride), 0) - -def AddHeadsOverride(builder, headsOverride): - DucLeaderStyleAddHeadsOverride(builder, headsOverride) - -def DucLeaderStyleStartHeadsOverrideVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartHeadsOverrideVector(builder, numElems): - return DucLeaderStyleStartHeadsOverrideVector(builder, numElems) - -def DucLeaderStyleAddDogleg(builder, dogleg): - builder.PrependFloat64Slot(2, dogleg, 0.0) - -def AddDogleg(builder, dogleg): - DucLeaderStyleAddDogleg(builder, dogleg) - -def DucLeaderStyleAddTextStyle(builder, textStyle): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(textStyle), 0) - -def AddTextStyle(builder, textStyle): - DucLeaderStyleAddTextStyle(builder, textStyle) - -def DucLeaderStyleAddTextAttachment(builder, textAttachment): - builder.PrependUint8Slot(4, textAttachment, None) - -def AddTextAttachment(builder, textAttachment): - DucLeaderStyleAddTextAttachment(builder, textAttachment) - -def DucLeaderStyleAddBlockAttachment(builder, blockAttachment): - builder.PrependUint8Slot(5, blockAttachment, None) - -def AddBlockAttachment(builder, blockAttachment): - DucLeaderStyleAddBlockAttachment(builder, blockAttachment) - -def DucLeaderStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DucLeaderStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucLine.py b/packages/ducpy/src/ducpy/Duc/DucLine.py deleted file mode 100644 index 91b1880e..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucLine.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucLine(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucLine() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucLine(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucLineBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucLine - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucLine - def Start(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucLineReference import DucLineReference - obj = DucLineReference() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLine - def End(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucLineReference import DucLineReference - obj = DucLineReference() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucLineStart(builder): - builder.StartObject(2) - -def Start(builder): - DucLineStart(builder) - -def DucLineAddStart(builder, start): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(start), 0) - -def AddStart(builder, start): - DucLineAddStart(builder, start) - -def DucLineAddEnd(builder, end): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(end), 0) - -def AddEnd(builder, end): - DucLineAddEnd(builder, end) - -def DucLineEnd(builder): - return builder.EndObject() - -def End(builder): - return DucLineEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucLineReference.py b/packages/ducpy/src/ducpy/Duc/DucLineReference.py deleted file mode 100644 index 1aba7a69..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucLineReference.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucLineReference(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucLineReference() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucLineReference(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucLineReferenceBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucLineReference - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucLineReference - def Index(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # DucLineReference - def Handle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = o + self._tab.Pos - from Duc.GeometricPoint import GeometricPoint - obj = GeometricPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucLineReferenceStart(builder): - builder.StartObject(2) - -def Start(builder): - DucLineReferenceStart(builder) - -def DucLineReferenceAddIndex(builder, index): - builder.PrependInt32Slot(0, index, 0) - -def AddIndex(builder, index): - DucLineReferenceAddIndex(builder, index) - -def DucLineReferenceAddHandle(builder, handle): - builder.PrependStructSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(handle), 0) - -def AddHandle(builder, handle): - DucLineReferenceAddHandle(builder, handle) - -def DucLineReferenceEnd(builder): - return builder.EndObject() - -def End(builder): - return DucLineReferenceEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucLinearElement.py b/packages/ducpy/src/ducpy/Duc/DucLinearElement.py deleted file mode 100644 index e35d6356..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucLinearElement.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucLinearElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucLinearElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucLinearElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucLinearElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucLinearElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucLinearElement - def LinearBase(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucLinearElementBase import _DucLinearElementBase - obj = _DucLinearElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLinearElement - def WipeoutBelow(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def DucLinearElementStart(builder): - builder.StartObject(2) - -def Start(builder): - DucLinearElementStart(builder) - -def DucLinearElementAddLinearBase(builder, linearBase): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(linearBase), 0) - -def AddLinearBase(builder, linearBase): - DucLinearElementAddLinearBase(builder, linearBase) - -def DucLinearElementAddWipeoutBelow(builder, wipeoutBelow): - builder.PrependBoolSlot(1, wipeoutBelow, 0) - -def AddWipeoutBelow(builder, wipeoutBelow): - DucLinearElementAddWipeoutBelow(builder, wipeoutBelow) - -def DucLinearElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucLinearElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucLocalState.py b/packages/ducpy/src/ducpy/Duc/DucLocalState.py deleted file mode 100644 index 2d3c0032..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucLocalState.py +++ /dev/null @@ -1,375 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucLocalState(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucLocalState() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucLocalState(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucLocalStateBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucLocalState - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucLocalState - def Scope(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucLocalState - def ActiveStandardId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucLocalState - def ScrollX(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucLocalState - def ScrollY(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucLocalState - def Zoom(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucLocalState - def ActiveGridSettings(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # DucLocalState - def ActiveGridSettingsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucLocalState - def ActiveGridSettingsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - return o == 0 - - # DucLocalState - def ActiveSnapSettings(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucLocalState - def IsBindingEnabled(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucLocalState - def CurrentItemStroke(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ElementStroke import ElementStroke - obj = ElementStroke() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLocalState - def CurrentItemBackground(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ElementBackground import ElementBackground - obj = ElementBackground() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLocalState - def CurrentItemOpacity(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucLocalState - def CurrentItemFontFamily(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucLocalState - def CurrentItemFontSize(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucLocalState - def CurrentItemTextAlign(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucLocalState - def CurrentItemStartLineHead(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucHead import DucHead - obj = DucHead() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLocalState - def CurrentItemEndLineHead(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucHead import DucHead - obj = DucHead() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucLocalState - def CurrentItemRoundness(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucLocalState - def PenMode(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucLocalState - def ViewModeEnabled(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucLocalState - def ObjectsSnapModeEnabled(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucLocalState - def GridModeEnabled(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucLocalState - def OutlineModeEnabled(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(46)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucLocalState - def ManualSaveMode(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def DucLocalStateStart(builder): - builder.StartObject(23) - -def Start(builder): - DucLocalStateStart(builder) - -def DucLocalStateAddScope(builder, scope): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(scope), 0) - -def AddScope(builder, scope): - DucLocalStateAddScope(builder, scope) - -def DucLocalStateAddActiveStandardId(builder, activeStandardId): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(activeStandardId), 0) - -def AddActiveStandardId(builder, activeStandardId): - DucLocalStateAddActiveStandardId(builder, activeStandardId) - -def DucLocalStateAddScrollX(builder, scrollX): - builder.PrependFloat64Slot(2, scrollX, 0.0) - -def AddScrollX(builder, scrollX): - DucLocalStateAddScrollX(builder, scrollX) - -def DucLocalStateAddScrollY(builder, scrollY): - builder.PrependFloat64Slot(3, scrollY, 0.0) - -def AddScrollY(builder, scrollY): - DucLocalStateAddScrollY(builder, scrollY) - -def DucLocalStateAddZoom(builder, zoom): - builder.PrependFloat64Slot(4, zoom, 0.0) - -def AddZoom(builder, zoom): - DucLocalStateAddZoom(builder, zoom) - -def DucLocalStateAddActiveGridSettings(builder, activeGridSettings): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(activeGridSettings), 0) - -def AddActiveGridSettings(builder, activeGridSettings): - DucLocalStateAddActiveGridSettings(builder, activeGridSettings) - -def DucLocalStateStartActiveGridSettingsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartActiveGridSettingsVector(builder, numElems): - return DucLocalStateStartActiveGridSettingsVector(builder, numElems) - -def DucLocalStateAddActiveSnapSettings(builder, activeSnapSettings): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(activeSnapSettings), 0) - -def AddActiveSnapSettings(builder, activeSnapSettings): - DucLocalStateAddActiveSnapSettings(builder, activeSnapSettings) - -def DucLocalStateAddIsBindingEnabled(builder, isBindingEnabled): - builder.PrependBoolSlot(7, isBindingEnabled, 0) - -def AddIsBindingEnabled(builder, isBindingEnabled): - DucLocalStateAddIsBindingEnabled(builder, isBindingEnabled) - -def DucLocalStateAddCurrentItemStroke(builder, currentItemStroke): - builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(currentItemStroke), 0) - -def AddCurrentItemStroke(builder, currentItemStroke): - DucLocalStateAddCurrentItemStroke(builder, currentItemStroke) - -def DucLocalStateAddCurrentItemBackground(builder, currentItemBackground): - builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(currentItemBackground), 0) - -def AddCurrentItemBackground(builder, currentItemBackground): - DucLocalStateAddCurrentItemBackground(builder, currentItemBackground) - -def DucLocalStateAddCurrentItemOpacity(builder, currentItemOpacity): - builder.PrependFloat32Slot(10, currentItemOpacity, 0.0) - -def AddCurrentItemOpacity(builder, currentItemOpacity): - DucLocalStateAddCurrentItemOpacity(builder, currentItemOpacity) - -def DucLocalStateAddCurrentItemFontFamily(builder, currentItemFontFamily): - builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(currentItemFontFamily), 0) - -def AddCurrentItemFontFamily(builder, currentItemFontFamily): - DucLocalStateAddCurrentItemFontFamily(builder, currentItemFontFamily) - -def DucLocalStateAddCurrentItemFontSize(builder, currentItemFontSize): - builder.PrependFloat64Slot(12, currentItemFontSize, 0.0) - -def AddCurrentItemFontSize(builder, currentItemFontSize): - DucLocalStateAddCurrentItemFontSize(builder, currentItemFontSize) - -def DucLocalStateAddCurrentItemTextAlign(builder, currentItemTextAlign): - builder.PrependUint8Slot(13, currentItemTextAlign, None) - -def AddCurrentItemTextAlign(builder, currentItemTextAlign): - DucLocalStateAddCurrentItemTextAlign(builder, currentItemTextAlign) - -def DucLocalStateAddCurrentItemStartLineHead(builder, currentItemStartLineHead): - builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(currentItemStartLineHead), 0) - -def AddCurrentItemStartLineHead(builder, currentItemStartLineHead): - DucLocalStateAddCurrentItemStartLineHead(builder, currentItemStartLineHead) - -def DucLocalStateAddCurrentItemEndLineHead(builder, currentItemEndLineHead): - builder.PrependUOffsetTRelativeSlot(15, flatbuffers.number_types.UOffsetTFlags.py_type(currentItemEndLineHead), 0) - -def AddCurrentItemEndLineHead(builder, currentItemEndLineHead): - DucLocalStateAddCurrentItemEndLineHead(builder, currentItemEndLineHead) - -def DucLocalStateAddCurrentItemRoundness(builder, currentItemRoundness): - builder.PrependFloat64Slot(16, currentItemRoundness, 0.0) - -def AddCurrentItemRoundness(builder, currentItemRoundness): - DucLocalStateAddCurrentItemRoundness(builder, currentItemRoundness) - -def DucLocalStateAddPenMode(builder, penMode): - builder.PrependBoolSlot(17, penMode, 0) - -def AddPenMode(builder, penMode): - DucLocalStateAddPenMode(builder, penMode) - -def DucLocalStateAddViewModeEnabled(builder, viewModeEnabled): - builder.PrependBoolSlot(18, viewModeEnabled, 0) - -def AddViewModeEnabled(builder, viewModeEnabled): - DucLocalStateAddViewModeEnabled(builder, viewModeEnabled) - -def DucLocalStateAddObjectsSnapModeEnabled(builder, objectsSnapModeEnabled): - builder.PrependBoolSlot(19, objectsSnapModeEnabled, 0) - -def AddObjectsSnapModeEnabled(builder, objectsSnapModeEnabled): - DucLocalStateAddObjectsSnapModeEnabled(builder, objectsSnapModeEnabled) - -def DucLocalStateAddGridModeEnabled(builder, gridModeEnabled): - builder.PrependBoolSlot(20, gridModeEnabled, 0) - -def AddGridModeEnabled(builder, gridModeEnabled): - DucLocalStateAddGridModeEnabled(builder, gridModeEnabled) - -def DucLocalStateAddOutlineModeEnabled(builder, outlineModeEnabled): - builder.PrependBoolSlot(21, outlineModeEnabled, 0) - -def AddOutlineModeEnabled(builder, outlineModeEnabled): - DucLocalStateAddOutlineModeEnabled(builder, outlineModeEnabled) - -def DucLocalStateAddManualSaveMode(builder, manualSaveMode): - builder.PrependBoolSlot(22, manualSaveMode, 0) - -def AddManualSaveMode(builder, manualSaveMode): - DucLocalStateAddManualSaveMode(builder, manualSaveMode) - -def DucLocalStateEnd(builder): - return builder.EndObject() - -def End(builder): - return DucLocalStateEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucMermaidElement.py b/packages/ducpy/src/ducpy/Duc/DucMermaidElement.py deleted file mode 100644 index 636206f4..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucMermaidElement.py +++ /dev/null @@ -1,97 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucMermaidElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucMermaidElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucMermaidElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucMermaidElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucMermaidElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucMermaidElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucMermaidElement - def Source(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucMermaidElement - def Theme(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucMermaidElement - def SvgPath(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DucMermaidElementStart(builder): - builder.StartObject(4) - -def Start(builder): - DucMermaidElementStart(builder) - -def DucMermaidElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucMermaidElementAddBase(builder, base) - -def DucMermaidElementAddSource(builder, source): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(source), 0) - -def AddSource(builder, source): - DucMermaidElementAddSource(builder, source) - -def DucMermaidElementAddTheme(builder, theme): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(theme), 0) - -def AddTheme(builder, theme): - DucMermaidElementAddTheme(builder, theme) - -def DucMermaidElementAddSvgPath(builder, svgPath): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(svgPath), 0) - -def AddSvgPath(builder, svgPath): - DucMermaidElementAddSvgPath(builder, svgPath) - -def DucMermaidElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucMermaidElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucModelElement.py b/packages/ducpy/src/ducpy/Duc/DucModelElement.py deleted file mode 100644 index 3a8d6839..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucModelElement.py +++ /dev/null @@ -1,116 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucModelElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucModelElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucModelElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucModelElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucModelElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucModelElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucModelElement - def Source(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucModelElement - def SvgPath(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucModelElement - def FileIds(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # DucModelElement - def FileIdsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucModelElement - def FileIdsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - -def DucModelElementStart(builder): - builder.StartObject(4) - -def Start(builder): - DucModelElementStart(builder) - -def DucModelElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucModelElementAddBase(builder, base) - -def DucModelElementAddSource(builder, source): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(source), 0) - -def AddSource(builder, source): - DucModelElementAddSource(builder, source) - -def DucModelElementAddSvgPath(builder, svgPath): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(svgPath), 0) - -def AddSvgPath(builder, svgPath): - DucModelElementAddSvgPath(builder, svgPath) - -def DucModelElementAddFileIds(builder, fileIds): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(fileIds), 0) - -def AddFileIds(builder, fileIds): - DucModelElementAddFileIds(builder, fileIds) - -def DucModelElementStartFileIdsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartFileIdsVector(builder, numElems): - return DucModelElementStartFileIdsVector(builder, numElems) - -def DucModelElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucModelElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucParametricElement.py b/packages/ducpy/src/ducpy/Duc/DucParametricElement.py deleted file mode 100644 index b4a251cc..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucParametricElement.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucParametricElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucParametricElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucParametricElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucParametricElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucParametricElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucParametricElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucParametricElement - def Source(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ParametricSource import ParametricSource - obj = ParametricSource() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucParametricElementStart(builder): - builder.StartObject(2) - -def Start(builder): - DucParametricElementStart(builder) - -def DucParametricElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucParametricElementAddBase(builder, base) - -def DucParametricElementAddSource(builder, source): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(source), 0) - -def AddSource(builder, source): - DucParametricElementAddSource(builder, source) - -def DucParametricElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucParametricElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucPath.py b/packages/ducpy/src/ducpy/Duc/DucPath.py deleted file mode 100644 index 5129782c..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucPath.py +++ /dev/null @@ -1,114 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucPath(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucPath() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucPath(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucPathBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucPath - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucPath - def LineIndices(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return 0 - - # DucPath - def LineIndicesAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) - return 0 - - # DucPath - def LineIndicesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucPath - def LineIndicesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - return o == 0 - - # DucPath - def Background(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ElementBackground import ElementBackground - obj = ElementBackground() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucPath - def Stroke(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ElementStroke import ElementStroke - obj = ElementStroke() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucPathStart(builder): - builder.StartObject(3) - -def Start(builder): - DucPathStart(builder) - -def DucPathAddLineIndices(builder, lineIndices): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(lineIndices), 0) - -def AddLineIndices(builder, lineIndices): - DucPathAddLineIndices(builder, lineIndices) - -def DucPathStartLineIndicesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartLineIndicesVector(builder, numElems): - return DucPathStartLineIndicesVector(builder, numElems) - -def DucPathAddBackground(builder, background): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(background), 0) - -def AddBackground(builder, background): - DucPathAddBackground(builder, background) - -def DucPathAddStroke(builder, stroke): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(stroke), 0) - -def AddStroke(builder, stroke): - DucPathAddStroke(builder, stroke) - -def DucPathEnd(builder): - return builder.EndObject() - -def End(builder): - return DucPathEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucPdfElement.py b/packages/ducpy/src/ducpy/Duc/DucPdfElement.py deleted file mode 100644 index e27ae8ef..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucPdfElement.py +++ /dev/null @@ -1,88 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucPdfElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucPdfElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucPdfElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucPdfElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucPdfElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucPdfElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucPdfElement - def FileId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucPdfElement - def GridConfig(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DocumentGridConfig import DocumentGridConfig - obj = DocumentGridConfig() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucPdfElementStart(builder): - builder.StartObject(3) - -def Start(builder): - DucPdfElementStart(builder) - -def DucPdfElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucPdfElementAddBase(builder, base) - -def DucPdfElementAddFileId(builder, fileId): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(fileId), 0) - -def AddFileId(builder, fileId): - DucPdfElementAddFileId(builder, fileId) - -def DucPdfElementAddGridConfig(builder, gridConfig): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(gridConfig), 0) - -def AddGridConfig(builder, gridConfig): - DucPdfElementAddGridConfig(builder, gridConfig) - -def DucPdfElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucPdfElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucPlotElement.py b/packages/ducpy/src/ducpy/Duc/DucPlotElement.py deleted file mode 100644 index 81f8cde6..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucPlotElement.py +++ /dev/null @@ -1,92 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucPlotElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucPlotElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucPlotElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucPlotElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucPlotElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucPlotElement - def StackElementBase(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucStackElementBase import _DucStackElementBase - obj = _DucStackElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucPlotElement - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPlotStyle import DucPlotStyle - obj = DucPlotStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucPlotElement - def Layout(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.PlotLayout import PlotLayout - obj = PlotLayout() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucPlotElementStart(builder): - builder.StartObject(3) - -def Start(builder): - DucPlotElementStart(builder) - -def DucPlotElementAddStackElementBase(builder, stackElementBase): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(stackElementBase), 0) - -def AddStackElementBase(builder, stackElementBase): - DucPlotElementAddStackElementBase(builder, stackElementBase) - -def DucPlotElementAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - DucPlotElementAddStyle(builder, style) - -def DucPlotElementAddLayout(builder, layout): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(layout), 0) - -def AddLayout(builder, layout): - DucPlotElementAddLayout(builder, layout) - -def DucPlotElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucPlotElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucPlotStyle.py b/packages/ducpy/src/ducpy/Duc/DucPlotStyle.py deleted file mode 100644 index 6237a97b..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucPlotStyle.py +++ /dev/null @@ -1,41 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucPlotStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucPlotStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucPlotStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucPlotStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucPlotStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - -def DucPlotStyleStart(builder): - builder.StartObject(1) - -def Start(builder): - DucPlotStyleStart(builder) - -def DucPlotStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DucPlotStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucPoint.py b/packages/ducpy/src/ducpy/Duc/DucPoint.py deleted file mode 100644 index 4ebd9933..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucPoint.py +++ /dev/null @@ -1,80 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucPoint(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucPoint() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucPoint(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucPointBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucPoint - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucPoint - def X(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucPoint - def Y(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucPoint - def Mirroring(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def DucPointStart(builder): - builder.StartObject(3) - -def Start(builder): - DucPointStart(builder) - -def DucPointAddX(builder, x): - builder.PrependFloat64Slot(0, x, 0.0) - -def AddX(builder, x): - DucPointAddX(builder, x) - -def DucPointAddY(builder, y): - builder.PrependFloat64Slot(1, y, 0.0) - -def AddY(builder, y): - DucPointAddY(builder, y) - -def DucPointAddMirroring(builder, mirroring): - builder.PrependUint8Slot(2, mirroring, None) - -def AddMirroring(builder, mirroring): - DucPointAddMirroring(builder, mirroring) - -def DucPointEnd(builder): - return builder.EndObject() - -def End(builder): - return DucPointEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucPointBinding.py b/packages/ducpy/src/ducpy/Duc/DucPointBinding.py deleted file mode 100644 index 39d5e505..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucPointBinding.py +++ /dev/null @@ -1,131 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucPointBinding(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucPointBinding() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucPointBinding(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucPointBindingBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucPointBinding - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucPointBinding - def ElementId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucPointBinding - def Focus(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucPointBinding - def Gap(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucPointBinding - def FixedPoint(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = o + self._tab.Pos - from Duc.GeometricPoint import GeometricPoint - obj = GeometricPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucPointBinding - def Point(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.PointBindingPoint import PointBindingPoint - obj = PointBindingPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucPointBinding - def Head(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucHead import DucHead - obj = DucHead() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucPointBindingStart(builder): - builder.StartObject(6) - -def Start(builder): - DucPointBindingStart(builder) - -def DucPointBindingAddElementId(builder, elementId): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(elementId), 0) - -def AddElementId(builder, elementId): - DucPointBindingAddElementId(builder, elementId) - -def DucPointBindingAddFocus(builder, focus): - builder.PrependFloat32Slot(1, focus, 0.0) - -def AddFocus(builder, focus): - DucPointBindingAddFocus(builder, focus) - -def DucPointBindingAddGap(builder, gap): - builder.PrependFloat64Slot(2, gap, 0.0) - -def AddGap(builder, gap): - DucPointBindingAddGap(builder, gap) - -def DucPointBindingAddFixedPoint(builder, fixedPoint): - builder.PrependStructSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(fixedPoint), 0) - -def AddFixedPoint(builder, fixedPoint): - DucPointBindingAddFixedPoint(builder, fixedPoint) - -def DucPointBindingAddPoint(builder, point): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(point), 0) - -def AddPoint(builder, point): - DucPointBindingAddPoint(builder, point) - -def DucPointBindingAddHead(builder, head): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(head), 0) - -def AddHead(builder, head): - DucPointBindingAddHead(builder, head) - -def DucPointBindingEnd(builder): - return builder.EndObject() - -def End(builder): - return DucPointBindingEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucPolygonElement.py b/packages/ducpy/src/ducpy/Duc/DucPolygonElement.py deleted file mode 100644 index 52d341ab..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucPolygonElement.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucPolygonElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucPolygonElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucPolygonElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucPolygonElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucPolygonElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucPolygonElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucPolygonElement - def Sides(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - -def DucPolygonElementStart(builder): - builder.StartObject(2) - -def Start(builder): - DucPolygonElementStart(builder) - -def DucPolygonElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucPolygonElementAddBase(builder, base) - -def DucPolygonElementAddSides(builder, sides): - builder.PrependInt32Slot(1, sides, 0) - -def AddSides(builder, sides): - DucPolygonElementAddSides(builder, sides) - -def DucPolygonElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucPolygonElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucRectangleElement.py b/packages/ducpy/src/ducpy/Duc/DucRectangleElement.py deleted file mode 100644 index 033b4ee5..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucRectangleElement.py +++ /dev/null @@ -1,58 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucRectangleElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucRectangleElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucRectangleElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucRectangleElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucRectangleElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucRectangleElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucRectangleElementStart(builder): - builder.StartObject(1) - -def Start(builder): - DucRectangleElementStart(builder) - -def DucRectangleElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucRectangleElementAddBase(builder, base) - -def DucRectangleElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucRectangleElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucRegion.py b/packages/ducpy/src/ducpy/Duc/DucRegion.py deleted file mode 100644 index 80422b61..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucRegion.py +++ /dev/null @@ -1,84 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucRegion(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucRegion() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucRegion(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucRegionBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucRegion - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucRegion - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucRegion - def StackBase(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucStackBase import _DucStackBase - obj = _DucStackBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucRegion - def BooleanOperation(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def DucRegionStart(builder): - builder.StartObject(3) - -def Start(builder): - DucRegionStart(builder) - -def DucRegionAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - DucRegionAddId(builder, id) - -def DucRegionAddStackBase(builder, stackBase): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(stackBase), 0) - -def AddStackBase(builder, stackBase): - DucRegionAddStackBase(builder, stackBase) - -def DucRegionAddBooleanOperation(builder, booleanOperation): - builder.PrependUint8Slot(2, booleanOperation, None) - -def AddBooleanOperation(builder, booleanOperation): - DucRegionAddBooleanOperation(builder, booleanOperation) - -def DucRegionEnd(builder): - return builder.EndObject() - -def End(builder): - return DucRegionEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucStackLikeStyles.py b/packages/ducpy/src/ducpy/Duc/DucStackLikeStyles.py deleted file mode 100644 index a05b4ef5..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucStackLikeStyles.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucStackLikeStyles(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucStackLikeStyles() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucStackLikeStyles(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucStackLikeStylesBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucStackLikeStyles - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucStackLikeStyles - def Opacity(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucStackLikeStyles - def LabelingColor(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DucStackLikeStylesStart(builder): - builder.StartObject(2) - -def Start(builder): - DucStackLikeStylesStart(builder) - -def DucStackLikeStylesAddOpacity(builder, opacity): - builder.PrependFloat64Slot(0, opacity, 0.0) - -def AddOpacity(builder, opacity): - DucStackLikeStylesAddOpacity(builder, opacity) - -def DucStackLikeStylesAddLabelingColor(builder, labelingColor): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(labelingColor), 0) - -def AddLabelingColor(builder, labelingColor): - DucStackLikeStylesAddLabelingColor(builder, labelingColor) - -def DucStackLikeStylesEnd(builder): - return builder.EndObject() - -def End(builder): - return DucStackLikeStylesEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTableAutoSize.py b/packages/ducpy/src/ducpy/Duc/DucTableAutoSize.py deleted file mode 100644 index 0e3434fa..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTableAutoSize.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTableAutoSize(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTableAutoSize() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTableAutoSize(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTableAutoSizeBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTableAutoSize - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTableAutoSize - def Columns(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucTableAutoSize - def Rows(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def DucTableAutoSizeStart(builder): - builder.StartObject(2) - -def Start(builder): - DucTableAutoSizeStart(builder) - -def DucTableAutoSizeAddColumns(builder, columns): - builder.PrependBoolSlot(0, columns, 0) - -def AddColumns(builder, columns): - DucTableAutoSizeAddColumns(builder, columns) - -def DucTableAutoSizeAddRows(builder, rows): - builder.PrependBoolSlot(1, rows, 0) - -def AddRows(builder, rows): - DucTableAutoSizeAddRows(builder, rows) - -def DucTableAutoSizeEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTableAutoSizeEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTableCell.py b/packages/ducpy/src/ducpy/Duc/DucTableCell.py deleted file mode 100644 index 96275cff..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTableCell.py +++ /dev/null @@ -1,127 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTableCell(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTableCell() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTableCell(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTableCellBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTableCell - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTableCell - def RowId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTableCell - def ColumnId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTableCell - def Data(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTableCell - def Span(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableCellSpan import DucTableCellSpan - obj = DucTableCellSpan() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTableCell - def Locked(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucTableCell - def StyleOverrides(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableCellStyle import DucTableCellStyle - obj = DucTableCellStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucTableCellStart(builder): - builder.StartObject(6) - -def Start(builder): - DucTableCellStart(builder) - -def DucTableCellAddRowId(builder, rowId): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(rowId), 0) - -def AddRowId(builder, rowId): - DucTableCellAddRowId(builder, rowId) - -def DucTableCellAddColumnId(builder, columnId): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(columnId), 0) - -def AddColumnId(builder, columnId): - DucTableCellAddColumnId(builder, columnId) - -def DucTableCellAddData(builder, data): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0) - -def AddData(builder, data): - DucTableCellAddData(builder, data) - -def DucTableCellAddSpan(builder, span): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(span), 0) - -def AddSpan(builder, span): - DucTableCellAddSpan(builder, span) - -def DucTableCellAddLocked(builder, locked): - builder.PrependBoolSlot(4, locked, 0) - -def AddLocked(builder, locked): - DucTableCellAddLocked(builder, locked) - -def DucTableCellAddStyleOverrides(builder, styleOverrides): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(styleOverrides), 0) - -def AddStyleOverrides(builder, styleOverrides): - DucTableCellAddStyleOverrides(builder, styleOverrides) - -def DucTableCellEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTableCellEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTableCellEntry.py b/packages/ducpy/src/ducpy/Duc/DucTableCellEntry.py deleted file mode 100644 index 99e606b1..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTableCellEntry.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTableCellEntry(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTableCellEntry() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTableCellEntry(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTableCellEntryBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTableCellEntry - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTableCellEntry - def Key(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTableCellEntry - def Value(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableCell import DucTableCell - obj = DucTableCell() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucTableCellEntryStart(builder): - builder.StartObject(2) - -def Start(builder): - DucTableCellEntryStart(builder) - -def DucTableCellEntryAddKey(builder, key): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0) - -def AddKey(builder, key): - DucTableCellEntryAddKey(builder, key) - -def DucTableCellEntryAddValue(builder, value): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0) - -def AddValue(builder, value): - DucTableCellEntryAddValue(builder, value) - -def DucTableCellEntryEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTableCellEntryEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTableCellSpan.py b/packages/ducpy/src/ducpy/Duc/DucTableCellSpan.py deleted file mode 100644 index 3465ec07..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTableCellSpan.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTableCellSpan(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTableCellSpan() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTableCellSpan(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTableCellSpanBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTableCellSpan - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTableCellSpan - def Columns(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # DucTableCellSpan - def Rows(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - -def DucTableCellSpanStart(builder): - builder.StartObject(2) - -def Start(builder): - DucTableCellSpanStart(builder) - -def DucTableCellSpanAddColumns(builder, columns): - builder.PrependInt32Slot(0, columns, 0) - -def AddColumns(builder, columns): - DucTableCellSpanAddColumns(builder, columns) - -def DucTableCellSpanAddRows(builder, rows): - builder.PrependInt32Slot(1, rows, 0) - -def AddRows(builder, rows): - DucTableCellSpanAddRows(builder, rows) - -def DucTableCellSpanEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTableCellSpanEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTableCellStyle.py b/packages/ducpy/src/ducpy/Duc/DucTableCellStyle.py deleted file mode 100644 index b6223274..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTableCellStyle.py +++ /dev/null @@ -1,105 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTableCellStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTableCellStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTableCellStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTableCellStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTableCellStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTableCellStyle - def BaseStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementStylesBase import _DucElementStylesBase - obj = _DucElementStylesBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTableCellStyle - def TextStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTextStyle import DucTextStyle - obj = DucTextStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTableCellStyle - def Margins(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Margins import Margins - obj = Margins() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTableCellStyle - def Alignment(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def DucTableCellStyleStart(builder): - builder.StartObject(4) - -def Start(builder): - DucTableCellStyleStart(builder) - -def DucTableCellStyleAddBaseStyle(builder, baseStyle): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(baseStyle), 0) - -def AddBaseStyle(builder, baseStyle): - DucTableCellStyleAddBaseStyle(builder, baseStyle) - -def DucTableCellStyleAddTextStyle(builder, textStyle): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(textStyle), 0) - -def AddTextStyle(builder, textStyle): - DucTableCellStyleAddTextStyle(builder, textStyle) - -def DucTableCellStyleAddMargins(builder, margins): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(margins), 0) - -def AddMargins(builder, margins): - DucTableCellStyleAddMargins(builder, margins) - -def DucTableCellStyleAddAlignment(builder, alignment): - builder.PrependUint8Slot(3, alignment, None) - -def AddAlignment(builder, alignment): - DucTableCellStyleAddAlignment(builder, alignment) - -def DucTableCellStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTableCellStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTableColumn.py b/packages/ducpy/src/ducpy/Duc/DucTableColumn.py deleted file mode 100644 index 46ba1098..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTableColumn.py +++ /dev/null @@ -1,84 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTableColumn(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTableColumn() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTableColumn(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTableColumnBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTableColumn - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTableColumn - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTableColumn - def Width(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucTableColumn - def StyleOverrides(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableCellStyle import DucTableCellStyle - obj = DucTableCellStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucTableColumnStart(builder): - builder.StartObject(3) - -def Start(builder): - DucTableColumnStart(builder) - -def DucTableColumnAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - DucTableColumnAddId(builder, id) - -def DucTableColumnAddWidth(builder, width): - builder.PrependFloat64Slot(1, width, 0.0) - -def AddWidth(builder, width): - DucTableColumnAddWidth(builder, width) - -def DucTableColumnAddStyleOverrides(builder, styleOverrides): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(styleOverrides), 0) - -def AddStyleOverrides(builder, styleOverrides): - DucTableColumnAddStyleOverrides(builder, styleOverrides) - -def DucTableColumnEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTableColumnEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTableColumnEntry.py b/packages/ducpy/src/ducpy/Duc/DucTableColumnEntry.py deleted file mode 100644 index bebc1ffd..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTableColumnEntry.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTableColumnEntry(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTableColumnEntry() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTableColumnEntry(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTableColumnEntryBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTableColumnEntry - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTableColumnEntry - def Key(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTableColumnEntry - def Value(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableColumn import DucTableColumn - obj = DucTableColumn() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucTableColumnEntryStart(builder): - builder.StartObject(2) - -def Start(builder): - DucTableColumnEntryStart(builder) - -def DucTableColumnEntryAddKey(builder, key): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0) - -def AddKey(builder, key): - DucTableColumnEntryAddKey(builder, key) - -def DucTableColumnEntryAddValue(builder, value): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0) - -def AddValue(builder, value): - DucTableColumnEntryAddValue(builder, value) - -def DucTableColumnEntryEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTableColumnEntryEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTableElement.py b/packages/ducpy/src/ducpy/Duc/DucTableElement.py deleted file mode 100644 index 91420b52..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTableElement.py +++ /dev/null @@ -1,280 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTableElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTableElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTableElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTableElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTableElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTableElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTableElement - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableStyle import DucTableStyle - obj = DucTableStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTableElement - def ColumnOrder(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # DucTableElement - def ColumnOrderLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucTableElement - def ColumnOrderIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - - # DucTableElement - def RowOrder(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # DucTableElement - def RowOrderLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucTableElement - def RowOrderIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - - # DucTableElement - def Columns(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucTableColumnEntry import DucTableColumnEntry - obj = DucTableColumnEntry() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTableElement - def ColumnsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucTableElement - def ColumnsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - return o == 0 - - # DucTableElement - def Rows(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucTableRowEntry import DucTableRowEntry - obj = DucTableRowEntry() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTableElement - def RowsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucTableElement - def RowsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - return o == 0 - - # DucTableElement - def Cells(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucTableCellEntry import DucTableCellEntry - obj = DucTableCellEntry() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTableElement - def CellsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucTableElement - def CellsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - return o == 0 - - # DucTableElement - def HeaderRowCount(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # DucTableElement - def AutoSize(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableAutoSize import DucTableAutoSize - obj = DucTableAutoSize() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucTableElementStart(builder): - builder.StartObject(9) - -def Start(builder): - DucTableElementStart(builder) - -def DucTableElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucTableElementAddBase(builder, base) - -def DucTableElementAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - DucTableElementAddStyle(builder, style) - -def DucTableElementAddColumnOrder(builder, columnOrder): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(columnOrder), 0) - -def AddColumnOrder(builder, columnOrder): - DucTableElementAddColumnOrder(builder, columnOrder) - -def DucTableElementStartColumnOrderVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartColumnOrderVector(builder, numElems): - return DucTableElementStartColumnOrderVector(builder, numElems) - -def DucTableElementAddRowOrder(builder, rowOrder): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(rowOrder), 0) - -def AddRowOrder(builder, rowOrder): - DucTableElementAddRowOrder(builder, rowOrder) - -def DucTableElementStartRowOrderVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartRowOrderVector(builder, numElems): - return DucTableElementStartRowOrderVector(builder, numElems) - -def DucTableElementAddColumns(builder, columns): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(columns), 0) - -def AddColumns(builder, columns): - DucTableElementAddColumns(builder, columns) - -def DucTableElementStartColumnsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartColumnsVector(builder, numElems): - return DucTableElementStartColumnsVector(builder, numElems) - -def DucTableElementAddRows(builder, rows): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(rows), 0) - -def AddRows(builder, rows): - DucTableElementAddRows(builder, rows) - -def DucTableElementStartRowsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartRowsVector(builder, numElems): - return DucTableElementStartRowsVector(builder, numElems) - -def DucTableElementAddCells(builder, cells): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(cells), 0) - -def AddCells(builder, cells): - DucTableElementAddCells(builder, cells) - -def DucTableElementStartCellsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartCellsVector(builder, numElems): - return DucTableElementStartCellsVector(builder, numElems) - -def DucTableElementAddHeaderRowCount(builder, headerRowCount): - builder.PrependInt32Slot(7, headerRowCount, 0) - -def AddHeaderRowCount(builder, headerRowCount): - DucTableElementAddHeaderRowCount(builder, headerRowCount) - -def DucTableElementAddAutoSize(builder, autoSize): - builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(autoSize), 0) - -def AddAutoSize(builder, autoSize): - DucTableElementAddAutoSize(builder, autoSize) - -def DucTableElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTableElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTableRow.py b/packages/ducpy/src/ducpy/Duc/DucTableRow.py deleted file mode 100644 index 2ae4e522..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTableRow.py +++ /dev/null @@ -1,84 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTableRow(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTableRow() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTableRow(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTableRowBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTableRow - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTableRow - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTableRow - def Height(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucTableRow - def StyleOverrides(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableCellStyle import DucTableCellStyle - obj = DucTableCellStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucTableRowStart(builder): - builder.StartObject(3) - -def Start(builder): - DucTableRowStart(builder) - -def DucTableRowAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - DucTableRowAddId(builder, id) - -def DucTableRowAddHeight(builder, height): - builder.PrependFloat64Slot(1, height, 0.0) - -def AddHeight(builder, height): - DucTableRowAddHeight(builder, height) - -def DucTableRowAddStyleOverrides(builder, styleOverrides): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(styleOverrides), 0) - -def AddStyleOverrides(builder, styleOverrides): - DucTableRowAddStyleOverrides(builder, styleOverrides) - -def DucTableRowEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTableRowEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTableRowEntry.py b/packages/ducpy/src/ducpy/Duc/DucTableRowEntry.py deleted file mode 100644 index 14ae5f8f..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTableRowEntry.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTableRowEntry(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTableRowEntry() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTableRowEntry(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTableRowEntryBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTableRowEntry - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTableRowEntry - def Key(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTableRowEntry - def Value(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableRow import DucTableRow - obj = DucTableRow() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucTableRowEntryStart(builder): - builder.StartObject(2) - -def Start(builder): - DucTableRowEntryStart(builder) - -def DucTableRowEntryAddKey(builder, key): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0) - -def AddKey(builder, key): - DucTableRowEntryAddKey(builder, key) - -def DucTableRowEntryAddValue(builder, value): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0) - -def AddValue(builder, value): - DucTableRowEntryAddValue(builder, value) - -def DucTableRowEntryEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTableRowEntryEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTableStyle.py b/packages/ducpy/src/ducpy/Duc/DucTableStyle.py deleted file mode 100644 index 6f5c9c88..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTableStyle.py +++ /dev/null @@ -1,105 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTableStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTableStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTableStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTableStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTableStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTableStyle - def FlowDirection(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucTableStyle - def HeaderRowStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableCellStyle import DucTableCellStyle - obj = DucTableCellStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTableStyle - def DataRowStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableCellStyle import DucTableCellStyle - obj = DucTableCellStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTableStyle - def DataColumnStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableCellStyle import DucTableCellStyle - obj = DucTableCellStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def DucTableStyleStart(builder): - builder.StartObject(5) - -def Start(builder): - DucTableStyleStart(builder) - -def DucTableStyleAddFlowDirection(builder, flowDirection): - builder.PrependUint8Slot(1, flowDirection, None) - -def AddFlowDirection(builder, flowDirection): - DucTableStyleAddFlowDirection(builder, flowDirection) - -def DucTableStyleAddHeaderRowStyle(builder, headerRowStyle): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(headerRowStyle), 0) - -def AddHeaderRowStyle(builder, headerRowStyle): - DucTableStyleAddHeaderRowStyle(builder, headerRowStyle) - -def DucTableStyleAddDataRowStyle(builder, dataRowStyle): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(dataRowStyle), 0) - -def AddDataRowStyle(builder, dataRowStyle): - DucTableStyleAddDataRowStyle(builder, dataRowStyle) - -def DucTableStyleAddDataColumnStyle(builder, dataColumnStyle): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(dataColumnStyle), 0) - -def AddDataColumnStyle(builder, dataColumnStyle): - DucTableStyleAddDataColumnStyle(builder, dataColumnStyle) - -def DucTableStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTableStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTextDynamicDictionarySource.py b/packages/ducpy/src/ducpy/Duc/DucTextDynamicDictionarySource.py deleted file mode 100644 index e8323c3d..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTextDynamicDictionarySource.py +++ /dev/null @@ -1,54 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTextDynamicDictionarySource(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTextDynamicDictionarySource() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTextDynamicDictionarySource(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTextDynamicDictionarySourceBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTextDynamicDictionarySource - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTextDynamicDictionarySource - def Key(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DucTextDynamicDictionarySourceStart(builder): - builder.StartObject(1) - -def Start(builder): - DucTextDynamicDictionarySourceStart(builder) - -def DucTextDynamicDictionarySourceAddKey(builder, key): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0) - -def AddKey(builder, key): - DucTextDynamicDictionarySourceAddKey(builder, key) - -def DucTextDynamicDictionarySourceEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTextDynamicDictionarySourceEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTextDynamicElementSource.py b/packages/ducpy/src/ducpy/Duc/DucTextDynamicElementSource.py deleted file mode 100644 index 11afe28e..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTextDynamicElementSource.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTextDynamicElementSource(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTextDynamicElementSource() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTextDynamicElementSource(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTextDynamicElementSourceBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTextDynamicElementSource - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTextDynamicElementSource - def ElementId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTextDynamicElementSource - def Property(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def DucTextDynamicElementSourceStart(builder): - builder.StartObject(2) - -def Start(builder): - DucTextDynamicElementSourceStart(builder) - -def DucTextDynamicElementSourceAddElementId(builder, elementId): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(elementId), 0) - -def AddElementId(builder, elementId): - DucTextDynamicElementSourceAddElementId(builder, elementId) - -def DucTextDynamicElementSourceAddProperty(builder, property): - builder.PrependUint8Slot(1, property, None) - -def AddProperty(builder, property): - DucTextDynamicElementSourceAddProperty(builder, property) - -def DucTextDynamicElementSourceEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTextDynamicElementSourceEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTextDynamicPart.py b/packages/ducpy/src/ducpy/Duc/DucTextDynamicPart.py deleted file mode 100644 index 4b2ecb68..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTextDynamicPart.py +++ /dev/null @@ -1,101 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTextDynamicPart(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTextDynamicPart() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTextDynamicPart(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTextDynamicPartBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTextDynamicPart - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTextDynamicPart - def Tag(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTextDynamicPart - def Source(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTextDynamicSource import DucTextDynamicSource - obj = DucTextDynamicSource() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTextDynamicPart - def Formatting(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.PrimaryUnits import PrimaryUnits - obj = PrimaryUnits() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTextDynamicPart - def CachedValue(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DucTextDynamicPartStart(builder): - builder.StartObject(4) - -def Start(builder): - DucTextDynamicPartStart(builder) - -def DucTextDynamicPartAddTag(builder, tag): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(tag), 0) - -def AddTag(builder, tag): - DucTextDynamicPartAddTag(builder, tag) - -def DucTextDynamicPartAddSource(builder, source): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(source), 0) - -def AddSource(builder, source): - DucTextDynamicPartAddSource(builder, source) - -def DucTextDynamicPartAddFormatting(builder, formatting): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(formatting), 0) - -def AddFormatting(builder, formatting): - DucTextDynamicPartAddFormatting(builder, formatting) - -def DucTextDynamicPartAddCachedValue(builder, cachedValue): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(cachedValue), 0) - -def AddCachedValue(builder, cachedValue): - DucTextDynamicPartAddCachedValue(builder, cachedValue) - -def DucTextDynamicPartEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTextDynamicPartEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTextDynamicSource.py b/packages/ducpy/src/ducpy/Duc/DucTextDynamicSource.py deleted file mode 100644 index 3a369215..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTextDynamicSource.py +++ /dev/null @@ -1,83 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTextDynamicSource(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTextDynamicSource() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTextDynamicSource(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTextDynamicSourceBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTextDynamicSource - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTextDynamicSource - def TextSourceType(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucTextDynamicSource - def SourceType(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return 0 - - # DucTextDynamicSource - def Source(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - from flatbuffers.table import Table - obj = Table(bytearray(), 0) - self._tab.Union(obj, o) - return obj - return None - -def DucTextDynamicSourceStart(builder): - builder.StartObject(3) - -def Start(builder): - DucTextDynamicSourceStart(builder) - -def DucTextDynamicSourceAddTextSourceType(builder, textSourceType): - builder.PrependUint8Slot(0, textSourceType, None) - -def AddTextSourceType(builder, textSourceType): - DucTextDynamicSourceAddTextSourceType(builder, textSourceType) - -def DucTextDynamicSourceAddSourceType(builder, sourceType): - builder.PrependUint8Slot(1, sourceType, 0) - -def AddSourceType(builder, sourceType): - DucTextDynamicSourceAddSourceType(builder, sourceType) - -def DucTextDynamicSourceAddSource(builder, source): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(source), 0) - -def AddSource(builder, source): - DucTextDynamicSourceAddSource(builder, source) - -def DucTextDynamicSourceEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTextDynamicSourceEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTextDynamicSourceData.py b/packages/ducpy/src/ducpy/Duc/DucTextDynamicSourceData.py deleted file mode 100644 index 38ebd737..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTextDynamicSourceData.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class DucTextDynamicSourceData(object): - NONE = 0 - DucTextDynamicElementSource = 1 - DucTextDynamicDictionarySource = 2 diff --git a/packages/ducpy/src/ducpy/Duc/DucTextElement.py b/packages/ducpy/src/ducpy/Duc/DucTextElement.py deleted file mode 100644 index c31dc435..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTextElement.py +++ /dev/null @@ -1,164 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTextElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTextElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTextElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTextElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTextElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTextElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTextElement - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTextStyle import DucTextStyle - obj = DucTextStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTextElement - def Text(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTextElement - def Dynamic(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucTextDynamicPart import DucTextDynamicPart - obj = DucTextDynamicPart() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTextElement - def DynamicLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucTextElement - def DynamicIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - - # DucTextElement - def AutoResize(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucTextElement - def ContainerId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTextElement - def OriginalText(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DucTextElementStart(builder): - builder.StartObject(7) - -def Start(builder): - DucTextElementStart(builder) - -def DucTextElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucTextElementAddBase(builder, base) - -def DucTextElementAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - DucTextElementAddStyle(builder, style) - -def DucTextElementAddText(builder, text): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(text), 0) - -def AddText(builder, text): - DucTextElementAddText(builder, text) - -def DucTextElementAddDynamic(builder, dynamic): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(dynamic), 0) - -def AddDynamic(builder, dynamic): - DucTextElementAddDynamic(builder, dynamic) - -def DucTextElementStartDynamicVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartDynamicVector(builder, numElems): - return DucTextElementStartDynamicVector(builder, numElems) - -def DucTextElementAddAutoResize(builder, autoResize): - builder.PrependBoolSlot(4, autoResize, 0) - -def AddAutoResize(builder, autoResize): - DucTextElementAddAutoResize(builder, autoResize) - -def DucTextElementAddContainerId(builder, containerId): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(containerId), 0) - -def AddContainerId(builder, containerId): - DucTextElementAddContainerId(builder, containerId) - -def DucTextElementAddOriginalText(builder, originalText): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(originalText), 0) - -def AddOriginalText(builder, originalText): - DucTextElementAddOriginalText(builder, originalText) - -def DucTextElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTextElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucTextStyle.py b/packages/ducpy/src/ducpy/Duc/DucTextStyle.py deleted file mode 100644 index 8928f5b3..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucTextStyle.py +++ /dev/null @@ -1,214 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucTextStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucTextStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucTextStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucTextStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucTextStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucTextStyle - def IsLtr(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucTextStyle - def FontFamily(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTextStyle - def BigFontFamily(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # DucTextStyle - def TextAlign(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucTextStyle - def VerticalAlign(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucTextStyle - def LineHeight(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucTextStyle - def LineSpacing(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.LineSpacing import LineSpacing - obj = LineSpacing() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucTextStyle - def ObliqueAngle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucTextStyle - def FontSize(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucTextStyle - def PaperTextHeight(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucTextStyle - def WidthFactor(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucTextStyle - def IsUpsideDown(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DucTextStyle - def IsBackwards(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def DucTextStyleStart(builder): - builder.StartObject(14) - -def Start(builder): - DucTextStyleStart(builder) - -def DucTextStyleAddIsLtr(builder, isLtr): - builder.PrependBoolSlot(1, isLtr, 0) - -def AddIsLtr(builder, isLtr): - DucTextStyleAddIsLtr(builder, isLtr) - -def DucTextStyleAddFontFamily(builder, fontFamily): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(fontFamily), 0) - -def AddFontFamily(builder, fontFamily): - DucTextStyleAddFontFamily(builder, fontFamily) - -def DucTextStyleAddBigFontFamily(builder, bigFontFamily): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(bigFontFamily), 0) - -def AddBigFontFamily(builder, bigFontFamily): - DucTextStyleAddBigFontFamily(builder, bigFontFamily) - -def DucTextStyleAddTextAlign(builder, textAlign): - builder.PrependUint8Slot(4, textAlign, None) - -def AddTextAlign(builder, textAlign): - DucTextStyleAddTextAlign(builder, textAlign) - -def DucTextStyleAddVerticalAlign(builder, verticalAlign): - builder.PrependUint8Slot(5, verticalAlign, None) - -def AddVerticalAlign(builder, verticalAlign): - DucTextStyleAddVerticalAlign(builder, verticalAlign) - -def DucTextStyleAddLineHeight(builder, lineHeight): - builder.PrependFloat32Slot(6, lineHeight, 0.0) - -def AddLineHeight(builder, lineHeight): - DucTextStyleAddLineHeight(builder, lineHeight) - -def DucTextStyleAddLineSpacing(builder, lineSpacing): - builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(lineSpacing), 0) - -def AddLineSpacing(builder, lineSpacing): - DucTextStyleAddLineSpacing(builder, lineSpacing) - -def DucTextStyleAddObliqueAngle(builder, obliqueAngle): - builder.PrependFloat64Slot(8, obliqueAngle, 0.0) - -def AddObliqueAngle(builder, obliqueAngle): - DucTextStyleAddObliqueAngle(builder, obliqueAngle) - -def DucTextStyleAddFontSize(builder, fontSize): - builder.PrependFloat64Slot(9, fontSize, 0.0) - -def AddFontSize(builder, fontSize): - DucTextStyleAddFontSize(builder, fontSize) - -def DucTextStyleAddPaperTextHeight(builder, paperTextHeight): - builder.PrependFloat64Slot(10, paperTextHeight, 0.0) - -def AddPaperTextHeight(builder, paperTextHeight): - DucTextStyleAddPaperTextHeight(builder, paperTextHeight) - -def DucTextStyleAddWidthFactor(builder, widthFactor): - builder.PrependFloat32Slot(11, widthFactor, 0.0) - -def AddWidthFactor(builder, widthFactor): - DucTextStyleAddWidthFactor(builder, widthFactor) - -def DucTextStyleAddIsUpsideDown(builder, isUpsideDown): - builder.PrependBoolSlot(12, isUpsideDown, 0) - -def AddIsUpsideDown(builder, isUpsideDown): - DucTextStyleAddIsUpsideDown(builder, isUpsideDown) - -def DucTextStyleAddIsBackwards(builder, isBackwards): - builder.PrependBoolSlot(13, isBackwards, 0) - -def AddIsBackwards(builder, isBackwards): - DucTextStyleAddIsBackwards(builder, isBackwards) - -def DucTextStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DucTextStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucUcs.py b/packages/ducpy/src/ducpy/Duc/DucUcs.py deleted file mode 100644 index b626bc2e..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucUcs.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucUcs(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucUcs() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucUcs(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucUcsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucUcs - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucUcs - def Origin(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = o + self._tab.Pos - from Duc.GeometricPoint import GeometricPoint - obj = GeometricPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucUcs - def Angle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def DucUcsStart(builder): - builder.StartObject(2) - -def Start(builder): - DucUcsStart(builder) - -def DucUcsAddOrigin(builder, origin): - builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(origin), 0) - -def AddOrigin(builder, origin): - DucUcsAddOrigin(builder, origin) - -def DucUcsAddAngle(builder, angle): - builder.PrependFloat64Slot(1, angle, 0.0) - -def AddAngle(builder, angle): - DucUcsAddAngle(builder, angle) - -def DucUcsEnd(builder): - return builder.EndObject() - -def End(builder): - return DucUcsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucView.py b/packages/ducpy/src/ducpy/Duc/DucView.py deleted file mode 100644 index 64f1c69a..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucView.py +++ /dev/null @@ -1,123 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucView(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucView() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucView(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucViewBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucView - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucView - def ScrollX(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucView - def ScrollY(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucView - def Zoom(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucView - def TwistAngle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # DucView - def CenterPoint(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPoint import DucPoint - obj = DucPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucView - def Scope(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DucViewStart(builder): - builder.StartObject(6) - -def Start(builder): - DucViewStart(builder) - -def DucViewAddScrollX(builder, scrollX): - builder.PrependFloat64Slot(0, scrollX, 0.0) - -def AddScrollX(builder, scrollX): - DucViewAddScrollX(builder, scrollX) - -def DucViewAddScrollY(builder, scrollY): - builder.PrependFloat64Slot(1, scrollY, 0.0) - -def AddScrollY(builder, scrollY): - DucViewAddScrollY(builder, scrollY) - -def DucViewAddZoom(builder, zoom): - builder.PrependFloat64Slot(2, zoom, 0.0) - -def AddZoom(builder, zoom): - DucViewAddZoom(builder, zoom) - -def DucViewAddTwistAngle(builder, twistAngle): - builder.PrependFloat64Slot(3, twistAngle, 0.0) - -def AddTwistAngle(builder, twistAngle): - DucViewAddTwistAngle(builder, twistAngle) - -def DucViewAddCenterPoint(builder, centerPoint): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(centerPoint), 0) - -def AddCenterPoint(builder, centerPoint): - DucViewAddCenterPoint(builder, centerPoint) - -def DucViewAddScope(builder, scope): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(scope), 0) - -def AddScope(builder, scope): - DucViewAddScope(builder, scope) - -def DucViewEnd(builder): - return builder.EndObject() - -def End(builder): - return DucViewEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucViewportElement.py b/packages/ducpy/src/ducpy/Duc/DucViewportElement.py deleted file mode 100644 index 02710e49..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucViewportElement.py +++ /dev/null @@ -1,180 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucViewportElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucViewportElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucViewportElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucViewportElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucViewportElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucViewportElement - def LinearBase(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucLinearElementBase import _DucLinearElementBase - obj = _DucLinearElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucViewportElement - def StackBase(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucStackBase import _DucStackBase - obj = _DucStackBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucViewportElement - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucViewportStyle import DucViewportStyle - obj = DucViewportStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucViewportElement - def View(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucView import DucView - obj = DucView() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucViewportElement - def Scale(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # DucViewportElement - def ShadePlot(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # DucViewportElement - def FrozenGroupIds(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # DucViewportElement - def FrozenGroupIdsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # DucViewportElement - def FrozenGroupIdsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - return o == 0 - - # DucViewportElement - def StandardOverride(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DucViewportElementStart(builder): - builder.StartObject(8) - -def Start(builder): - DucViewportElementStart(builder) - -def DucViewportElementAddLinearBase(builder, linearBase): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(linearBase), 0) - -def AddLinearBase(builder, linearBase): - DucViewportElementAddLinearBase(builder, linearBase) - -def DucViewportElementAddStackBase(builder, stackBase): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(stackBase), 0) - -def AddStackBase(builder, stackBase): - DucViewportElementAddStackBase(builder, stackBase) - -def DucViewportElementAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - DucViewportElementAddStyle(builder, style) - -def DucViewportElementAddView(builder, view): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(view), 0) - -def AddView(builder, view): - DucViewportElementAddView(builder, view) - -def DucViewportElementAddScale(builder, scale): - builder.PrependFloat32Slot(4, scale, 0.0) - -def AddScale(builder, scale): - DucViewportElementAddScale(builder, scale) - -def DucViewportElementAddShadePlot(builder, shadePlot): - builder.PrependUint8Slot(5, shadePlot, None) - -def AddShadePlot(builder, shadePlot): - DucViewportElementAddShadePlot(builder, shadePlot) - -def DucViewportElementAddFrozenGroupIds(builder, frozenGroupIds): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(frozenGroupIds), 0) - -def AddFrozenGroupIds(builder, frozenGroupIds): - DucViewportElementAddFrozenGroupIds(builder, frozenGroupIds) - -def DucViewportElementStartFrozenGroupIdsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartFrozenGroupIdsVector(builder, numElems): - return DucViewportElementStartFrozenGroupIdsVector(builder, numElems) - -def DucViewportElementAddStandardOverride(builder, standardOverride): - builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(standardOverride), 0) - -def AddStandardOverride(builder, standardOverride): - DucViewportElementAddStandardOverride(builder, standardOverride) - -def DucViewportElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucViewportElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucViewportStyle.py b/packages/ducpy/src/ducpy/Duc/DucViewportStyle.py deleted file mode 100644 index 62c8d6d4..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucViewportStyle.py +++ /dev/null @@ -1,54 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucViewportStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucViewportStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucViewportStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucViewportStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucViewportStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucViewportStyle - def ScaleIndicatorVisible(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def DucViewportStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - DucViewportStyleStart(builder) - -def DucViewportStyleAddScaleIndicatorVisible(builder, scaleIndicatorVisible): - builder.PrependBoolSlot(1, scaleIndicatorVisible, 0) - -def AddScaleIndicatorVisible(builder, scaleIndicatorVisible): - DucViewportStyleAddScaleIndicatorVisible(builder, scaleIndicatorVisible) - -def DucViewportStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DucViewportStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucXRayElement.py b/packages/ducpy/src/ducpy/Duc/DucXRayElement.py deleted file mode 100644 index ed71f9ae..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucXRayElement.py +++ /dev/null @@ -1,122 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucXRayElement(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucXRayElement() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucXRayElement(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucXRayElementBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucXRayElement - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucXRayElement - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucXRayElement - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucXRayStyle import DucXRayStyle - obj = DucXRayStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucXRayElement - def Origin(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPoint import DucPoint - obj = DucPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucXRayElement - def Direction(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPoint import DucPoint - obj = DucPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # DucXRayElement - def StartFromOrigin(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def DucXRayElementStart(builder): - builder.StartObject(5) - -def Start(builder): - DucXRayElementStart(builder) - -def DucXRayElementAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - DucXRayElementAddBase(builder, base) - -def DucXRayElementAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - DucXRayElementAddStyle(builder, style) - -def DucXRayElementAddOrigin(builder, origin): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(origin), 0) - -def AddOrigin(builder, origin): - DucXRayElementAddOrigin(builder, origin) - -def DucXRayElementAddDirection(builder, direction): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(direction), 0) - -def AddDirection(builder, direction): - DucXRayElementAddDirection(builder, direction) - -def DucXRayElementAddStartFromOrigin(builder, startFromOrigin): - builder.PrependBoolSlot(4, startFromOrigin, 0) - -def AddStartFromOrigin(builder, startFromOrigin): - DucXRayElementAddStartFromOrigin(builder, startFromOrigin) - -def DucXRayElementEnd(builder): - return builder.EndObject() - -def End(builder): - return DucXRayElementEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DucXRayStyle.py b/packages/ducpy/src/ducpy/Duc/DucXRayStyle.py deleted file mode 100644 index 2d2aead0..00000000 --- a/packages/ducpy/src/ducpy/Duc/DucXRayStyle.py +++ /dev/null @@ -1,54 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DucXRayStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DucXRayStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDucXRayStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DucXRayStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DucXRayStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DucXRayStyle - def Color(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def DucXRayStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - DucXRayStyleStart(builder) - -def DucXRayStyleAddColor(builder, color): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(color), 0) - -def AddColor(builder, color): - DucXRayStyleAddColor(builder, color) - -def DucXRayStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return DucXRayStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/DynamicSnapSettings.py b/packages/ducpy/src/ducpy/Duc/DynamicSnapSettings.py deleted file mode 100644 index aee302d1..00000000 --- a/packages/ducpy/src/ducpy/Duc/DynamicSnapSettings.py +++ /dev/null @@ -1,80 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class DynamicSnapSettings(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = DynamicSnapSettings() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsDynamicSnapSettings(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def DynamicSnapSettingsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # DynamicSnapSettings - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # DynamicSnapSettings - def EnabledDuringDrag(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DynamicSnapSettings - def EnabledDuringRotation(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # DynamicSnapSettings - def EnabledDuringScale(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def DynamicSnapSettingsStart(builder): - builder.StartObject(3) - -def Start(builder): - DynamicSnapSettingsStart(builder) - -def DynamicSnapSettingsAddEnabledDuringDrag(builder, enabledDuringDrag): - builder.PrependBoolSlot(0, enabledDuringDrag, 0) - -def AddEnabledDuringDrag(builder, enabledDuringDrag): - DynamicSnapSettingsAddEnabledDuringDrag(builder, enabledDuringDrag) - -def DynamicSnapSettingsAddEnabledDuringRotation(builder, enabledDuringRotation): - builder.PrependBoolSlot(1, enabledDuringRotation, 0) - -def AddEnabledDuringRotation(builder, enabledDuringRotation): - DynamicSnapSettingsAddEnabledDuringRotation(builder, enabledDuringRotation) - -def DynamicSnapSettingsAddEnabledDuringScale(builder, enabledDuringScale): - builder.PrependBoolSlot(2, enabledDuringScale, 0) - -def AddEnabledDuringScale(builder, enabledDuringScale): - DynamicSnapSettingsAddEnabledDuringScale(builder, enabledDuringScale) - -def DynamicSnapSettingsEnd(builder): - return builder.EndObject() - -def End(builder): - return DynamicSnapSettingsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/ELEMENT_CONTENT_PREFERENCE.py b/packages/ducpy/src/ducpy/Duc/ELEMENT_CONTENT_PREFERENCE.py deleted file mode 100644 index 37514cde..00000000 --- a/packages/ducpy/src/ducpy/Duc/ELEMENT_CONTENT_PREFERENCE.py +++ /dev/null @@ -1,11 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class ELEMENT_CONTENT_PREFERENCE(object): - SOLID = 12 - FILL = 14 - FIT = 15 - TILE = 16 - STRETCH = 17 - HATCH = 18 diff --git a/packages/ducpy/src/ducpy/Duc/Element.py b/packages/ducpy/src/ducpy/Duc/Element.py deleted file mode 100644 index 1ff5cab8..00000000 --- a/packages/ducpy/src/ducpy/Duc/Element.py +++ /dev/null @@ -1,29 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class Element(object): - NONE = 0 - DucRectangleElement = 1 - DucPolygonElement = 2 - DucEllipseElement = 3 - DucEmbeddableElement = 4 - DucPdfElement = 5 - DucMermaidElement = 6 - DucTableElement = 7 - DucImageElement = 8 - DucTextElement = 9 - DucLinearElement = 10 - DucArrowElement = 11 - DucFreeDrawElement = 12 - DucBlockInstanceElement = 13 - DucFrameElement = 14 - DucPlotElement = 15 - DucViewportElement = 16 - DucXRayElement = 17 - DucLeaderElement = 18 - DucDimensionElement = 19 - DucFeatureControlFrameElement = 20 - DucDocElement = 21 - DucParametricElement = 22 - DucModelElement = 23 diff --git a/packages/ducpy/src/ducpy/Duc/ElementBackground.py b/packages/ducpy/src/ducpy/Duc/ElementBackground.py deleted file mode 100644 index c510ed9f..00000000 --- a/packages/ducpy/src/ducpy/Duc/ElementBackground.py +++ /dev/null @@ -1,58 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class ElementBackground(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = ElementBackground() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsElementBackground(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def ElementBackgroundBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # ElementBackground - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # ElementBackground - def Content(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ElementContentBase import ElementContentBase - obj = ElementContentBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def ElementBackgroundStart(builder): - builder.StartObject(1) - -def Start(builder): - ElementBackgroundStart(builder) - -def ElementBackgroundAddContent(builder, content): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(content), 0) - -def AddContent(builder, content): - ElementBackgroundAddContent(builder, content) - -def ElementBackgroundEnd(builder): - return builder.EndObject() - -def End(builder): - return ElementBackgroundEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/ElementContentBase.py b/packages/ducpy/src/ducpy/Duc/ElementContentBase.py deleted file mode 100644 index e10f4607..00000000 --- a/packages/ducpy/src/ducpy/Duc/ElementContentBase.py +++ /dev/null @@ -1,144 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class ElementContentBase(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = ElementContentBase() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsElementContentBase(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def ElementContentBaseBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # ElementContentBase - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # ElementContentBase - def Preference(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # ElementContentBase - def Src(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # ElementContentBase - def Visible(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # ElementContentBase - def Opacity(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ElementContentBase - def Tiling(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.TilingProperties import TilingProperties - obj = TilingProperties() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ElementContentBase - def Hatch(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucHatchStyle import DucHatchStyle - obj = DucHatchStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ElementContentBase - def ImageFilter(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucImageFilter import DucImageFilter - obj = DucImageFilter() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def ElementContentBaseStart(builder): - builder.StartObject(7) - -def Start(builder): - ElementContentBaseStart(builder) - -def ElementContentBaseAddPreference(builder, preference): - builder.PrependUint8Slot(0, preference, None) - -def AddPreference(builder, preference): - ElementContentBaseAddPreference(builder, preference) - -def ElementContentBaseAddSrc(builder, src): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(src), 0) - -def AddSrc(builder, src): - ElementContentBaseAddSrc(builder, src) - -def ElementContentBaseAddVisible(builder, visible): - builder.PrependBoolSlot(2, visible, 0) - -def AddVisible(builder, visible): - ElementContentBaseAddVisible(builder, visible) - -def ElementContentBaseAddOpacity(builder, opacity): - builder.PrependFloat64Slot(3, opacity, 0.0) - -def AddOpacity(builder, opacity): - ElementContentBaseAddOpacity(builder, opacity) - -def ElementContentBaseAddTiling(builder, tiling): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(tiling), 0) - -def AddTiling(builder, tiling): - ElementContentBaseAddTiling(builder, tiling) - -def ElementContentBaseAddHatch(builder, hatch): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(hatch), 0) - -def AddHatch(builder, hatch): - ElementContentBaseAddHatch(builder, hatch) - -def ElementContentBaseAddImageFilter(builder, imageFilter): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(imageFilter), 0) - -def AddImageFilter(builder, imageFilter): - ElementContentBaseAddImageFilter(builder, imageFilter) - -def ElementContentBaseEnd(builder): - return builder.EndObject() - -def End(builder): - return ElementContentBaseEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/ElementStroke.py b/packages/ducpy/src/ducpy/Duc/ElementStroke.py deleted file mode 100644 index 25cffe8b..00000000 --- a/packages/ducpy/src/ducpy/Duc/ElementStroke.py +++ /dev/null @@ -1,118 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class ElementStroke(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = ElementStroke() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsElementStroke(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def ElementStrokeBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # ElementStroke - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # ElementStroke - def Content(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ElementContentBase import ElementContentBase - obj = ElementContentBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ElementStroke - def Width(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ElementStroke - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.StrokeStyle import StrokeStyle - obj = StrokeStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ElementStroke - def Placement(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # ElementStroke - def StrokeSides(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.StrokeSides import StrokeSides - obj = StrokeSides() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def ElementStrokeStart(builder): - builder.StartObject(5) - -def Start(builder): - ElementStrokeStart(builder) - -def ElementStrokeAddContent(builder, content): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(content), 0) - -def AddContent(builder, content): - ElementStrokeAddContent(builder, content) - -def ElementStrokeAddWidth(builder, width): - builder.PrependFloat64Slot(1, width, 0.0) - -def AddWidth(builder, width): - ElementStrokeAddWidth(builder, width) - -def ElementStrokeAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - ElementStrokeAddStyle(builder, style) - -def ElementStrokeAddPlacement(builder, placement): - builder.PrependUint8Slot(3, placement, None) - -def AddPlacement(builder, placement): - ElementStrokeAddPlacement(builder, placement) - -def ElementStrokeAddStrokeSides(builder, strokeSides): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(strokeSides), 0) - -def AddStrokeSides(builder, strokeSides): - ElementStrokeAddStrokeSides(builder, strokeSides) - -def ElementStrokeEnd(builder): - return builder.EndObject() - -def End(builder): - return ElementStrokeEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/ElementWrapper.py b/packages/ducpy/src/ducpy/Duc/ElementWrapper.py deleted file mode 100644 index 8097c30e..00000000 --- a/packages/ducpy/src/ducpy/Duc/ElementWrapper.py +++ /dev/null @@ -1,70 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class ElementWrapper(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = ElementWrapper() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsElementWrapper(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def ElementWrapperBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # ElementWrapper - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # ElementWrapper - def ElementType(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return 0 - - # ElementWrapper - def Element(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - from flatbuffers.table import Table - obj = Table(bytearray(), 0) - self._tab.Union(obj, o) - return obj - return None - -def ElementWrapperStart(builder): - builder.StartObject(2) - -def Start(builder): - ElementWrapperStart(builder) - -def ElementWrapperAddElementType(builder, elementType): - builder.PrependUint8Slot(0, elementType, 0) - -def AddElementType(builder, elementType): - ElementWrapperAddElementType(builder, elementType) - -def ElementWrapperAddElement(builder, element): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(element), 0) - -def AddElement(builder, element): - ElementWrapperAddElement(builder, element) - -def ElementWrapperEnd(builder): - return builder.EndObject() - -def End(builder): - return ElementWrapperEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/ExportedDataState.py b/packages/ducpy/src/ducpy/Duc/ExportedDataState.py deleted file mode 100644 index 1f35ab32..00000000 --- a/packages/ducpy/src/ducpy/Duc/ExportedDataState.py +++ /dev/null @@ -1,566 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class ExportedDataState(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = ExportedDataState() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsExportedDataState(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def ExportedDataStateBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # ExportedDataState - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # ExportedDataState - def Type(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # ExportedDataState - def VersionLegacy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # ExportedDataState - def Source(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # ExportedDataState - def Version(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # ExportedDataState - def Thumbnail(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) - return 0 - - # ExportedDataState - def ThumbnailAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) - return 0 - - # ExportedDataState - def ThumbnailLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ExportedDataState - def ThumbnailIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - return o == 0 - - # ExportedDataState - def Dictionary(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DictionaryEntry import DictionaryEntry - obj = DictionaryEntry() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def DictionaryLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ExportedDataState - def DictionaryIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - return o == 0 - - # ExportedDataState - def Elements(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.ElementWrapper import ElementWrapper - obj = ElementWrapper() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def ElementsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ExportedDataState - def ElementsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - return o == 0 - - # ExportedDataState - def Blocks(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucBlock import DucBlock - obj = DucBlock() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def BlocksLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ExportedDataState - def BlocksIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - return o == 0 - - # ExportedDataState - def Groups(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucGroup import DucGroup - obj = DucGroup() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def GroupsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ExportedDataState - def GroupsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - return o == 0 - - # ExportedDataState - def Regions(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucRegion import DucRegion - obj = DucRegion() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def RegionsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ExportedDataState - def RegionsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - return o == 0 - - # ExportedDataState - def Layers(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucLayer import DucLayer - obj = DucLayer() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def LayersLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ExportedDataState - def LayersIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - return o == 0 - - # ExportedDataState - def Standards(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.Standard import Standard - obj = Standard() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def StandardsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ExportedDataState - def StandardsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) - return o == 0 - - # ExportedDataState - def DucLocalState(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucLocalState import DucLocalState - obj = DucLocalState() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def DucGlobalState(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucGlobalState import DucGlobalState - obj = DucGlobalState() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def ExternalFiles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucExternalFileEntry import DucExternalFileEntry - obj = DucExternalFileEntry() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def ExternalFilesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ExportedDataState - def ExternalFilesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32)) - return o == 0 - - # ExportedDataState - def VersionGraph(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.VersionGraph import VersionGraph - obj = VersionGraph() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # ExportedDataState - def BlockInstances(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucBlockInstance import DucBlockInstance - obj = DucBlockInstance() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def BlockInstancesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ExportedDataState - def BlockInstancesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38)) - return o == 0 - - # ExportedDataState - def BlockCollections(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucBlockCollection import DucBlockCollection - obj = DucBlockCollection() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # ExportedDataState - def BlockCollectionsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ExportedDataState - def BlockCollectionsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40)) - return o == 0 - -def ExportedDataStateStart(builder): - builder.StartObject(19) - -def Start(builder): - ExportedDataStateStart(builder) - -def ExportedDataStateAddType(builder, type): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(type), 0) - -def AddType(builder, type): - ExportedDataStateAddType(builder, type) - -def ExportedDataStateAddVersionLegacy(builder, versionLegacy): - builder.PrependInt32Slot(1, versionLegacy, 0) - -def AddVersionLegacy(builder, versionLegacy): - ExportedDataStateAddVersionLegacy(builder, versionLegacy) - -def ExportedDataStateAddSource(builder, source): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(source), 0) - -def AddSource(builder, source): - ExportedDataStateAddSource(builder, source) - -def ExportedDataStateAddVersion(builder, version): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(version), 0) - -def AddVersion(builder, version): - ExportedDataStateAddVersion(builder, version) - -def ExportedDataStateAddThumbnail(builder, thumbnail): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(thumbnail), 0) - -def AddThumbnail(builder, thumbnail): - ExportedDataStateAddThumbnail(builder, thumbnail) - -def ExportedDataStateStartThumbnailVector(builder, numElems): - return builder.StartVector(1, numElems, 1) - -def StartThumbnailVector(builder, numElems): - return ExportedDataStateStartThumbnailVector(builder, numElems) - -def ExportedDataStateAddDictionary(builder, dictionary): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(dictionary), 0) - -def AddDictionary(builder, dictionary): - ExportedDataStateAddDictionary(builder, dictionary) - -def ExportedDataStateStartDictionaryVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartDictionaryVector(builder, numElems): - return ExportedDataStateStartDictionaryVector(builder, numElems) - -def ExportedDataStateAddElements(builder, elements): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(elements), 0) - -def AddElements(builder, elements): - ExportedDataStateAddElements(builder, elements) - -def ExportedDataStateStartElementsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartElementsVector(builder, numElems): - return ExportedDataStateStartElementsVector(builder, numElems) - -def ExportedDataStateAddBlocks(builder, blocks): - builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(blocks), 0) - -def AddBlocks(builder, blocks): - ExportedDataStateAddBlocks(builder, blocks) - -def ExportedDataStateStartBlocksVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartBlocksVector(builder, numElems): - return ExportedDataStateStartBlocksVector(builder, numElems) - -def ExportedDataStateAddGroups(builder, groups): - builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(groups), 0) - -def AddGroups(builder, groups): - ExportedDataStateAddGroups(builder, groups) - -def ExportedDataStateStartGroupsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartGroupsVector(builder, numElems): - return ExportedDataStateStartGroupsVector(builder, numElems) - -def ExportedDataStateAddRegions(builder, regions): - builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(regions), 0) - -def AddRegions(builder, regions): - ExportedDataStateAddRegions(builder, regions) - -def ExportedDataStateStartRegionsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartRegionsVector(builder, numElems): - return ExportedDataStateStartRegionsVector(builder, numElems) - -def ExportedDataStateAddLayers(builder, layers): - builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(layers), 0) - -def AddLayers(builder, layers): - ExportedDataStateAddLayers(builder, layers) - -def ExportedDataStateStartLayersVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartLayersVector(builder, numElems): - return ExportedDataStateStartLayersVector(builder, numElems) - -def ExportedDataStateAddStandards(builder, standards): - builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(standards), 0) - -def AddStandards(builder, standards): - ExportedDataStateAddStandards(builder, standards) - -def ExportedDataStateStartStandardsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartStandardsVector(builder, numElems): - return ExportedDataStateStartStandardsVector(builder, numElems) - -def ExportedDataStateAddDucLocalState(builder, ducLocalState): - builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(ducLocalState), 0) - -def AddDucLocalState(builder, ducLocalState): - ExportedDataStateAddDucLocalState(builder, ducLocalState) - -def ExportedDataStateAddDucGlobalState(builder, ducGlobalState): - builder.PrependUOffsetTRelativeSlot(13, flatbuffers.number_types.UOffsetTFlags.py_type(ducGlobalState), 0) - -def AddDucGlobalState(builder, ducGlobalState): - ExportedDataStateAddDucGlobalState(builder, ducGlobalState) - -def ExportedDataStateAddExternalFiles(builder, externalFiles): - builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(externalFiles), 0) - -def AddExternalFiles(builder, externalFiles): - ExportedDataStateAddExternalFiles(builder, externalFiles) - -def ExportedDataStateStartExternalFilesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartExternalFilesVector(builder, numElems): - return ExportedDataStateStartExternalFilesVector(builder, numElems) - -def ExportedDataStateAddVersionGraph(builder, versionGraph): - builder.PrependUOffsetTRelativeSlot(15, flatbuffers.number_types.UOffsetTFlags.py_type(versionGraph), 0) - -def AddVersionGraph(builder, versionGraph): - ExportedDataStateAddVersionGraph(builder, versionGraph) - -def ExportedDataStateAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(16, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - ExportedDataStateAddId(builder, id) - -def ExportedDataStateAddBlockInstances(builder, blockInstances): - builder.PrependUOffsetTRelativeSlot(17, flatbuffers.number_types.UOffsetTFlags.py_type(blockInstances), 0) - -def AddBlockInstances(builder, blockInstances): - ExportedDataStateAddBlockInstances(builder, blockInstances) - -def ExportedDataStateStartBlockInstancesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartBlockInstancesVector(builder, numElems): - return ExportedDataStateStartBlockInstancesVector(builder, numElems) - -def ExportedDataStateAddBlockCollections(builder, blockCollections): - builder.PrependUOffsetTRelativeSlot(18, flatbuffers.number_types.UOffsetTFlags.py_type(blockCollections), 0) - -def AddBlockCollections(builder, blockCollections): - ExportedDataStateAddBlockCollections(builder, blockCollections) - -def ExportedDataStateStartBlockCollectionsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartBlockCollectionsVector(builder, numElems): - return ExportedDataStateStartBlockCollectionsVector(builder, numElems) - -def ExportedDataStateEnd(builder): - return builder.EndObject() - -def End(builder): - return ExportedDataStateEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/FCFBetweenModifier.py b/packages/ducpy/src/ducpy/Duc/FCFBetweenModifier.py deleted file mode 100644 index b5fb3fd2..00000000 --- a/packages/ducpy/src/ducpy/Duc/FCFBetweenModifier.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class FCFBetweenModifier(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = FCFBetweenModifier() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsFCFBetweenModifier(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def FCFBetweenModifierBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # FCFBetweenModifier - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # FCFBetweenModifier - def Start(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # FCFBetweenModifier - def End(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def FCFBetweenModifierStart(builder): - builder.StartObject(2) - -def Start(builder): - FCFBetweenModifierStart(builder) - -def FCFBetweenModifierAddStart(builder, start): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(start), 0) - -def AddStart(builder, start): - FCFBetweenModifierAddStart(builder, start) - -def FCFBetweenModifierAddEnd(builder, end): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(end), 0) - -def AddEnd(builder, end): - FCFBetweenModifierAddEnd(builder, end) - -def FCFBetweenModifierEnd(builder): - return builder.EndObject() - -def End(builder): - return FCFBetweenModifierEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/FCFDatumDefinition.py b/packages/ducpy/src/ducpy/Duc/FCFDatumDefinition.py deleted file mode 100644 index 23c4ec64..00000000 --- a/packages/ducpy/src/ducpy/Duc/FCFDatumDefinition.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class FCFDatumDefinition(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = FCFDatumDefinition() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsFCFDatumDefinition(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def FCFDatumDefinitionBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # FCFDatumDefinition - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # FCFDatumDefinition - def Letter(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # FCFDatumDefinition - def FeatureBinding(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPointBinding import DucPointBinding - obj = DucPointBinding() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def FCFDatumDefinitionStart(builder): - builder.StartObject(2) - -def Start(builder): - FCFDatumDefinitionStart(builder) - -def FCFDatumDefinitionAddLetter(builder, letter): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(letter), 0) - -def AddLetter(builder, letter): - FCFDatumDefinitionAddLetter(builder, letter) - -def FCFDatumDefinitionAddFeatureBinding(builder, featureBinding): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(featureBinding), 0) - -def AddFeatureBinding(builder, featureBinding): - FCFDatumDefinitionAddFeatureBinding(builder, featureBinding) - -def FCFDatumDefinitionEnd(builder): - return builder.EndObject() - -def End(builder): - return FCFDatumDefinitionEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/FCFDatumStyle.py b/packages/ducpy/src/ducpy/Duc/FCFDatumStyle.py deleted file mode 100644 index 6cc2304c..00000000 --- a/packages/ducpy/src/ducpy/Duc/FCFDatumStyle.py +++ /dev/null @@ -1,54 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class FCFDatumStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = FCFDatumStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsFCFDatumStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def FCFDatumStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # FCFDatumStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # FCFDatumStyle - def BracketStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def FCFDatumStyleStart(builder): - builder.StartObject(1) - -def Start(builder): - FCFDatumStyleStart(builder) - -def FCFDatumStyleAddBracketStyle(builder, bracketStyle): - builder.PrependUint8Slot(0, bracketStyle, None) - -def AddBracketStyle(builder, bracketStyle): - FCFDatumStyleAddBracketStyle(builder, bracketStyle) - -def FCFDatumStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return FCFDatumStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/FCFFrameModifiers.py b/packages/ducpy/src/ducpy/Duc/FCFFrameModifiers.py deleted file mode 100644 index a73805e4..00000000 --- a/packages/ducpy/src/ducpy/Duc/FCFFrameModifiers.py +++ /dev/null @@ -1,114 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class FCFFrameModifiers(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = FCFFrameModifiers() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsFCFFrameModifiers(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def FCFFrameModifiersBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # FCFFrameModifiers - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # FCFFrameModifiers - def AllAround(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # FCFFrameModifiers - def AllOver(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # FCFFrameModifiers - def ContinuousFeature(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # FCFFrameModifiers - def Between(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.FCFBetweenModifier import FCFBetweenModifier - obj = FCFBetweenModifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # FCFFrameModifiers - def ProjectedToleranceZone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.FCFProjectedZoneModifier import FCFProjectedZoneModifier - obj = FCFProjectedZoneModifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def FCFFrameModifiersStart(builder): - builder.StartObject(5) - -def Start(builder): - FCFFrameModifiersStart(builder) - -def FCFFrameModifiersAddAllAround(builder, allAround): - builder.PrependBoolSlot(0, allAround, 0) - -def AddAllAround(builder, allAround): - FCFFrameModifiersAddAllAround(builder, allAround) - -def FCFFrameModifiersAddAllOver(builder, allOver): - builder.PrependBoolSlot(1, allOver, 0) - -def AddAllOver(builder, allOver): - FCFFrameModifiersAddAllOver(builder, allOver) - -def FCFFrameModifiersAddContinuousFeature(builder, continuousFeature): - builder.PrependBoolSlot(2, continuousFeature, 0) - -def AddContinuousFeature(builder, continuousFeature): - FCFFrameModifiersAddContinuousFeature(builder, continuousFeature) - -def FCFFrameModifiersAddBetween(builder, between): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(between), 0) - -def AddBetween(builder, between): - FCFFrameModifiersAddBetween(builder, between) - -def FCFFrameModifiersAddProjectedToleranceZone(builder, projectedToleranceZone): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(projectedToleranceZone), 0) - -def AddProjectedToleranceZone(builder, projectedToleranceZone): - FCFFrameModifiersAddProjectedToleranceZone(builder, projectedToleranceZone) - -def FCFFrameModifiersEnd(builder): - return builder.EndObject() - -def End(builder): - return FCFFrameModifiersEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/FCFLayoutStyle.py b/packages/ducpy/src/ducpy/Duc/FCFLayoutStyle.py deleted file mode 100644 index 6baac3c2..00000000 --- a/packages/ducpy/src/ducpy/Duc/FCFLayoutStyle.py +++ /dev/null @@ -1,80 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class FCFLayoutStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = FCFLayoutStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsFCFLayoutStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def FCFLayoutStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # FCFLayoutStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # FCFLayoutStyle - def Padding(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # FCFLayoutStyle - def SegmentSpacing(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # FCFLayoutStyle - def RowSpacing(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def FCFLayoutStyleStart(builder): - builder.StartObject(3) - -def Start(builder): - FCFLayoutStyleStart(builder) - -def FCFLayoutStyleAddPadding(builder, padding): - builder.PrependFloat64Slot(0, padding, 0.0) - -def AddPadding(builder, padding): - FCFLayoutStyleAddPadding(builder, padding) - -def FCFLayoutStyleAddSegmentSpacing(builder, segmentSpacing): - builder.PrependFloat64Slot(1, segmentSpacing, 0.0) - -def AddSegmentSpacing(builder, segmentSpacing): - FCFLayoutStyleAddSegmentSpacing(builder, segmentSpacing) - -def FCFLayoutStyleAddRowSpacing(builder, rowSpacing): - builder.PrependFloat64Slot(2, rowSpacing, 0.0) - -def AddRowSpacing(builder, rowSpacing): - FCFLayoutStyleAddRowSpacing(builder, rowSpacing) - -def FCFLayoutStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return FCFLayoutStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/FCFProjectedZoneModifier.py b/packages/ducpy/src/ducpy/Duc/FCFProjectedZoneModifier.py deleted file mode 100644 index 9031e2d8..00000000 --- a/packages/ducpy/src/ducpy/Duc/FCFProjectedZoneModifier.py +++ /dev/null @@ -1,54 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class FCFProjectedZoneModifier(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = FCFProjectedZoneModifier() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsFCFProjectedZoneModifier(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def FCFProjectedZoneModifierBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # FCFProjectedZoneModifier - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # FCFProjectedZoneModifier - def Value(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def FCFProjectedZoneModifierStart(builder): - builder.StartObject(1) - -def Start(builder): - FCFProjectedZoneModifierStart(builder) - -def FCFProjectedZoneModifierAddValue(builder, value): - builder.PrependFloat64Slot(0, value, 0.0) - -def AddValue(builder, value): - FCFProjectedZoneModifierAddValue(builder, value) - -def FCFProjectedZoneModifierEnd(builder): - return builder.EndObject() - -def End(builder): - return FCFProjectedZoneModifierEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/FCFSegmentRow.py b/packages/ducpy/src/ducpy/Duc/FCFSegmentRow.py deleted file mode 100644 index 62e09e16..00000000 --- a/packages/ducpy/src/ducpy/Duc/FCFSegmentRow.py +++ /dev/null @@ -1,78 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class FCFSegmentRow(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = FCFSegmentRow() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsFCFSegmentRow(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def FCFSegmentRowBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # FCFSegmentRow - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # FCFSegmentRow - def Segments(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.FeatureControlFrameSegment import FeatureControlFrameSegment - obj = FeatureControlFrameSegment() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # FCFSegmentRow - def SegmentsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # FCFSegmentRow - def SegmentsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - return o == 0 - -def FCFSegmentRowStart(builder): - builder.StartObject(1) - -def Start(builder): - FCFSegmentRowStart(builder) - -def FCFSegmentRowAddSegments(builder, segments): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(segments), 0) - -def AddSegments(builder, segments): - FCFSegmentRowAddSegments(builder, segments) - -def FCFSegmentRowStartSegmentsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartSegmentsVector(builder, numElems): - return FCFSegmentRowStartSegmentsVector(builder, numElems) - -def FCFSegmentRowEnd(builder): - return builder.EndObject() - -def End(builder): - return FCFSegmentRowEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/FCFSymbolStyle.py b/packages/ducpy/src/ducpy/Duc/FCFSymbolStyle.py deleted file mode 100644 index 14c05e18..00000000 --- a/packages/ducpy/src/ducpy/Duc/FCFSymbolStyle.py +++ /dev/null @@ -1,54 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class FCFSymbolStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = FCFSymbolStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsFCFSymbolStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def FCFSymbolStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # FCFSymbolStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # FCFSymbolStyle - def Scale(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - -def FCFSymbolStyleStart(builder): - builder.StartObject(1) - -def Start(builder): - FCFSymbolStyleStart(builder) - -def FCFSymbolStyleAddScale(builder, scale): - builder.PrependFloat32Slot(0, scale, 0.0) - -def AddScale(builder, scale): - FCFSymbolStyleAddScale(builder, scale) - -def FCFSymbolStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return FCFSymbolStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/FEATURE_MODIFIER.py b/packages/ducpy/src/ducpy/Duc/FEATURE_MODIFIER.py deleted file mode 100644 index 8733f544..00000000 --- a/packages/ducpy/src/ducpy/Duc/FEATURE_MODIFIER.py +++ /dev/null @@ -1,21 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class FEATURE_MODIFIER(object): - NONE = 0 - FREE_STATE = 10 - TANGENT_PLANE = 11 - PROJECTED_TOLERANCE_ZONE = 12 - DIAMETER = 13 - SPHERICAL_DIAMETER = 14 - RADIUS = 15 - SPHERICAL_RADIUS = 16 - CONTROLLED_RADIUS = 17 - SQUARE = 18 - TRANSLATION = 19 - ALL_AROUND = 20 - ALL_OVER = 21 - STATISTICAL = 22 - CONTINUOUS_FEATURE = 23 - UNEQUALLY_DISPOSED = 24 diff --git a/packages/ducpy/src/ducpy/Duc/FeatureControlFrameSegment.py b/packages/ducpy/src/ducpy/Duc/FeatureControlFrameSegment.py deleted file mode 100644 index d47662eb..00000000 --- a/packages/ducpy/src/ducpy/Duc/FeatureControlFrameSegment.py +++ /dev/null @@ -1,108 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class FeatureControlFrameSegment(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = FeatureControlFrameSegment() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsFeatureControlFrameSegment(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def FeatureControlFrameSegmentBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # FeatureControlFrameSegment - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # FeatureControlFrameSegment - def Symbol(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # FeatureControlFrameSegment - def Tolerance(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.ToleranceClause import ToleranceClause - obj = ToleranceClause() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # FeatureControlFrameSegment - def Datums(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DatumReference import DatumReference - obj = DatumReference() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # FeatureControlFrameSegment - def DatumsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # FeatureControlFrameSegment - def DatumsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - -def FeatureControlFrameSegmentStart(builder): - builder.StartObject(3) - -def Start(builder): - FeatureControlFrameSegmentStart(builder) - -def FeatureControlFrameSegmentAddSymbol(builder, symbol): - builder.PrependUint8Slot(0, symbol, None) - -def AddSymbol(builder, symbol): - FeatureControlFrameSegmentAddSymbol(builder, symbol) - -def FeatureControlFrameSegmentAddTolerance(builder, tolerance): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(tolerance), 0) - -def AddTolerance(builder, tolerance): - FeatureControlFrameSegmentAddTolerance(builder, tolerance) - -def FeatureControlFrameSegmentAddDatums(builder, datums): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(datums), 0) - -def AddDatums(builder, datums): - FeatureControlFrameSegmentAddDatums(builder, datums) - -def FeatureControlFrameSegmentStartDatumsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartDatumsVector(builder, numElems): - return FeatureControlFrameSegmentStartDatumsVector(builder, numElems) - -def FeatureControlFrameSegmentEnd(builder): - return builder.EndObject() - -def End(builder): - return FeatureControlFrameSegmentEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/GDT_SYMBOL.py b/packages/ducpy/src/ducpy/Duc/GDT_SYMBOL.py deleted file mode 100644 index b2c86fcc..00000000 --- a/packages/ducpy/src/ducpy/Duc/GDT_SYMBOL.py +++ /dev/null @@ -1,25 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class GDT_SYMBOL(object): - STRAIGHTNESS = 10 - FLATNESS = 11 - CIRCULARITY = 12 - CYLINDRICITY = 13 - PERPENDICULARITY = 14 - ANGULARITY = 15 - PARALLELISM = 16 - POSITION = 17 - TRUE_POSITION = 18 - CONCENTRICITY = 19 - COAXIALITY = 20 - SYMMETRY = 21 - CIRCULAR_RUNOUT = 22 - TOTAL_RUNOUT = 23 - PROFILE_OF_LINE = 24 - PROFILE_OF_SURFACE = 25 - STATISTICAL = 26 - ALL_AROUND = 27 - ALL_OVER = 28 - BETWEEN = 29 diff --git a/packages/ducpy/src/ducpy/Duc/GRID_DISPLAY_TYPE.py b/packages/ducpy/src/ducpy/Duc/GRID_DISPLAY_TYPE.py deleted file mode 100644 index 2b506245..00000000 --- a/packages/ducpy/src/ducpy/Duc/GRID_DISPLAY_TYPE.py +++ /dev/null @@ -1,9 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class GRID_DISPLAY_TYPE(object): - LINES = 10 - DOTS = 11 - CROSSES = 12 - ADAPTIVE = 13 diff --git a/packages/ducpy/src/ducpy/Duc/GRID_TYPE.py b/packages/ducpy/src/ducpy/Duc/GRID_TYPE.py deleted file mode 100644 index deb9110e..00000000 --- a/packages/ducpy/src/ducpy/Duc/GRID_TYPE.py +++ /dev/null @@ -1,10 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class GRID_TYPE(object): - RECTANGULAR = 10 - ISOMETRIC = 11 - POLAR = 12 - TRIANGULAR = 13 - CUSTOM = 14 diff --git a/packages/ducpy/src/ducpy/Duc/GeometricPoint.py b/packages/ducpy/src/ducpy/Duc/GeometricPoint.py deleted file mode 100644 index 41706d88..00000000 --- a/packages/ducpy/src/ducpy/Duc/GeometricPoint.py +++ /dev/null @@ -1,29 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class GeometricPoint(object): - __slots__ = ['_tab'] - - @classmethod - def SizeOf(cls): - return 16 - - # GeometricPoint - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # GeometricPoint - def X(self): return self._tab.Get(flatbuffers.number_types.Float64Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0)) - # GeometricPoint - def Y(self): return self._tab.Get(flatbuffers.number_types.Float64Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(8)) - -def CreateGeometricPoint(builder, x, y): - builder.Prep(8, 16) - builder.PrependFloat64(y) - builder.PrependFloat64(x) - return builder.Offset() diff --git a/packages/ducpy/src/ducpy/Duc/GridSettings.py b/packages/ducpy/src/ducpy/Duc/GridSettings.py deleted file mode 100644 index 520fd8f5..00000000 --- a/packages/ducpy/src/ducpy/Duc/GridSettings.py +++ /dev/null @@ -1,308 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class GridSettings(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = GridSettings() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsGridSettings(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def GridSettingsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # GridSettings - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # GridSettings - def Type(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # GridSettings - def Readonly(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # GridSettings - def DisplayType(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # GridSettings - def IsAdaptive(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # GridSettings - def XSpacing(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # GridSettings - def YSpacing(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # GridSettings - def Subdivisions(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # GridSettings - def Origin(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - x = o + self._tab.Pos - from Duc.GeometricPoint import GeometricPoint - obj = GeometricPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # GridSettings - def Rotation(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # GridSettings - def FollowUcs(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # GridSettings - def MajorStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.GridStyle import GridStyle - obj = GridStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # GridSettings - def MinorStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.GridStyle import GridStyle - obj = GridStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # GridSettings - def ShowMinor(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # GridSettings - def MinZoom(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # GridSettings - def MaxZoom(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # GridSettings - def AutoHide(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # GridSettings - def PolarSettings(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.PolarGridSettings import PolarGridSettings - obj = PolarGridSettings() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # GridSettings - def IsometricSettings(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.IsometricGridSettings import IsometricGridSettings - obj = IsometricGridSettings() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # GridSettings - def EnableSnapping(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def GridSettingsStart(builder): - builder.StartObject(19) - -def Start(builder): - GridSettingsStart(builder) - -def GridSettingsAddType(builder, type): - builder.PrependUint8Slot(0, type, None) - -def AddType(builder, type): - GridSettingsAddType(builder, type) - -def GridSettingsAddReadonly(builder, readonly): - builder.PrependBoolSlot(1, readonly, 0) - -def AddReadonly(builder, readonly): - GridSettingsAddReadonly(builder, readonly) - -def GridSettingsAddDisplayType(builder, displayType): - builder.PrependUint8Slot(2, displayType, None) - -def AddDisplayType(builder, displayType): - GridSettingsAddDisplayType(builder, displayType) - -def GridSettingsAddIsAdaptive(builder, isAdaptive): - builder.PrependBoolSlot(3, isAdaptive, 0) - -def AddIsAdaptive(builder, isAdaptive): - GridSettingsAddIsAdaptive(builder, isAdaptive) - -def GridSettingsAddXSpacing(builder, xSpacing): - builder.PrependFloat64Slot(4, xSpacing, 0.0) - -def AddXSpacing(builder, xSpacing): - GridSettingsAddXSpacing(builder, xSpacing) - -def GridSettingsAddYSpacing(builder, ySpacing): - builder.PrependFloat64Slot(5, ySpacing, 0.0) - -def AddYSpacing(builder, ySpacing): - GridSettingsAddYSpacing(builder, ySpacing) - -def GridSettingsAddSubdivisions(builder, subdivisions): - builder.PrependInt32Slot(6, subdivisions, 0) - -def AddSubdivisions(builder, subdivisions): - GridSettingsAddSubdivisions(builder, subdivisions) - -def GridSettingsAddOrigin(builder, origin): - builder.PrependStructSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(origin), 0) - -def AddOrigin(builder, origin): - GridSettingsAddOrigin(builder, origin) - -def GridSettingsAddRotation(builder, rotation): - builder.PrependFloat64Slot(8, rotation, 0.0) - -def AddRotation(builder, rotation): - GridSettingsAddRotation(builder, rotation) - -def GridSettingsAddFollowUcs(builder, followUcs): - builder.PrependBoolSlot(9, followUcs, 0) - -def AddFollowUcs(builder, followUcs): - GridSettingsAddFollowUcs(builder, followUcs) - -def GridSettingsAddMajorStyle(builder, majorStyle): - builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(majorStyle), 0) - -def AddMajorStyle(builder, majorStyle): - GridSettingsAddMajorStyle(builder, majorStyle) - -def GridSettingsAddMinorStyle(builder, minorStyle): - builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(minorStyle), 0) - -def AddMinorStyle(builder, minorStyle): - GridSettingsAddMinorStyle(builder, minorStyle) - -def GridSettingsAddShowMinor(builder, showMinor): - builder.PrependBoolSlot(12, showMinor, 0) - -def AddShowMinor(builder, showMinor): - GridSettingsAddShowMinor(builder, showMinor) - -def GridSettingsAddMinZoom(builder, minZoom): - builder.PrependFloat64Slot(13, minZoom, 0.0) - -def AddMinZoom(builder, minZoom): - GridSettingsAddMinZoom(builder, minZoom) - -def GridSettingsAddMaxZoom(builder, maxZoom): - builder.PrependFloat64Slot(14, maxZoom, 0.0) - -def AddMaxZoom(builder, maxZoom): - GridSettingsAddMaxZoom(builder, maxZoom) - -def GridSettingsAddAutoHide(builder, autoHide): - builder.PrependBoolSlot(15, autoHide, 0) - -def AddAutoHide(builder, autoHide): - GridSettingsAddAutoHide(builder, autoHide) - -def GridSettingsAddPolarSettings(builder, polarSettings): - builder.PrependUOffsetTRelativeSlot(16, flatbuffers.number_types.UOffsetTFlags.py_type(polarSettings), 0) - -def AddPolarSettings(builder, polarSettings): - GridSettingsAddPolarSettings(builder, polarSettings) - -def GridSettingsAddIsometricSettings(builder, isometricSettings): - builder.PrependUOffsetTRelativeSlot(17, flatbuffers.number_types.UOffsetTFlags.py_type(isometricSettings), 0) - -def AddIsometricSettings(builder, isometricSettings): - GridSettingsAddIsometricSettings(builder, isometricSettings) - -def GridSettingsAddEnableSnapping(builder, enableSnapping): - builder.PrependBoolSlot(18, enableSnapping, 0) - -def AddEnableSnapping(builder, enableSnapping): - GridSettingsAddEnableSnapping(builder, enableSnapping) - -def GridSettingsEnd(builder): - return builder.EndObject() - -def End(builder): - return GridSettingsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/GridStyle.py b/packages/ducpy/src/ducpy/Duc/GridStyle.py deleted file mode 100644 index 34214253..00000000 --- a/packages/ducpy/src/ducpy/Duc/GridStyle.py +++ /dev/null @@ -1,106 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class GridStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = GridStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsGridStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def GridStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # GridStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # GridStyle - def Color(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # GridStyle - def Opacity(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # GridStyle - def DashPattern(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) - return 0 - - # GridStyle - def DashPatternAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o) - return 0 - - # GridStyle - def DashPatternLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # GridStyle - def DashPatternIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - -def GridStyleStart(builder): - builder.StartObject(3) - -def Start(builder): - GridStyleStart(builder) - -def GridStyleAddColor(builder, color): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(color), 0) - -def AddColor(builder, color): - GridStyleAddColor(builder, color) - -def GridStyleAddOpacity(builder, opacity): - builder.PrependFloat64Slot(1, opacity, 0.0) - -def AddOpacity(builder, opacity): - GridStyleAddOpacity(builder, opacity) - -def GridStyleAddDashPattern(builder, dashPattern): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(dashPattern), 0) - -def AddDashPattern(builder, dashPattern): - GridStyleAddDashPattern(builder, dashPattern) - -def GridStyleStartDashPatternVector(builder, numElems): - return builder.StartVector(8, numElems, 8) - -def StartDashPatternVector(builder, numElems): - return GridStyleStartDashPatternVector(builder, numElems) - -def GridStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return GridStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/HANDLE_TYPE.py b/packages/ducpy/src/ducpy/Duc/HANDLE_TYPE.py deleted file mode 100644 index 41c7e104..00000000 --- a/packages/ducpy/src/ducpy/Duc/HANDLE_TYPE.py +++ /dev/null @@ -1,7 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class HANDLE_TYPE(object): - HANDLE_IN = 10 - HANDLE_OUT = 11 diff --git a/packages/ducpy/src/ducpy/Duc/HATCH_STYLE.py b/packages/ducpy/src/ducpy/Duc/HATCH_STYLE.py deleted file mode 100644 index 3975bc8b..00000000 --- a/packages/ducpy/src/ducpy/Duc/HATCH_STYLE.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class HATCH_STYLE(object): - NORMAL = 10 - OUTER = 11 - IGNORE = 12 diff --git a/packages/ducpy/src/ducpy/Duc/HatchPatternLine.py b/packages/ducpy/src/ducpy/Duc/HatchPatternLine.py deleted file mode 100644 index 3f80f309..00000000 --- a/packages/ducpy/src/ducpy/Duc/HatchPatternLine.py +++ /dev/null @@ -1,149 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class HatchPatternLine(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = HatchPatternLine() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsHatchPatternLine(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def HatchPatternLineBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # HatchPatternLine - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # HatchPatternLine - def Angle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # HatchPatternLine - def Origin(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPoint import DucPoint - obj = DucPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # HatchPatternLine - def Offset(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) - return 0 - - # HatchPatternLine - def OffsetAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o) - return 0 - - # HatchPatternLine - def OffsetLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # HatchPatternLine - def OffsetIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - - # HatchPatternLine - def DashPattern(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) - return 0 - - # HatchPatternLine - def DashPatternAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o) - return 0 - - # HatchPatternLine - def DashPatternLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # HatchPatternLine - def DashPatternIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - -def HatchPatternLineStart(builder): - builder.StartObject(4) - -def Start(builder): - HatchPatternLineStart(builder) - -def HatchPatternLineAddAngle(builder, angle): - builder.PrependFloat64Slot(0, angle, 0.0) - -def AddAngle(builder, angle): - HatchPatternLineAddAngle(builder, angle) - -def HatchPatternLineAddOrigin(builder, origin): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(origin), 0) - -def AddOrigin(builder, origin): - HatchPatternLineAddOrigin(builder, origin) - -def HatchPatternLineAddOffset(builder, offset): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(offset), 0) - -def AddOffset(builder, offset): - HatchPatternLineAddOffset(builder, offset) - -def HatchPatternLineStartOffsetVector(builder, numElems): - return builder.StartVector(8, numElems, 8) - -def StartOffsetVector(builder, numElems): - return HatchPatternLineStartOffsetVector(builder, numElems) - -def HatchPatternLineAddDashPattern(builder, dashPattern): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(dashPattern), 0) - -def AddDashPattern(builder, dashPattern): - HatchPatternLineAddDashPattern(builder, dashPattern) - -def HatchPatternLineStartDashPatternVector(builder, numElems): - return builder.StartVector(8, numElems, 8) - -def StartDashPatternVector(builder, numElems): - return HatchPatternLineStartDashPatternVector(builder, numElems) - -def HatchPatternLineEnd(builder): - return builder.EndObject() - -def End(builder): - return HatchPatternLineEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IMAGE_STATUS.py b/packages/ducpy/src/ducpy/Duc/IMAGE_STATUS.py deleted file mode 100644 index bcdc4a14..00000000 --- a/packages/ducpy/src/ducpy/Duc/IMAGE_STATUS.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class IMAGE_STATUS(object): - PENDING = 10 - SAVED = 11 - ERROR = 12 diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedCommonStyle.py b/packages/ducpy/src/ducpy/Duc/IdentifiedCommonStyle.py deleted file mode 100644 index 20feb9b2..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedCommonStyle.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedCommonStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedCommonStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedCommonStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedCommonStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedCommonStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedCommonStyle - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedCommonStyle - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucCommonStyle import DucCommonStyle - obj = DucCommonStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedCommonStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedCommonStyleStart(builder) - -def IdentifiedCommonStyleAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedCommonStyleAddId(builder, id) - -def IdentifiedCommonStyleAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - IdentifiedCommonStyleAddStyle(builder, style) - -def IdentifiedCommonStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedCommonStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedDimensionStyle.py b/packages/ducpy/src/ducpy/Duc/IdentifiedDimensionStyle.py deleted file mode 100644 index f5265766..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedDimensionStyle.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedDimensionStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedDimensionStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedDimensionStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedDimensionStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedDimensionStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedDimensionStyle - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedDimensionStyle - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucDimensionStyle import DucDimensionStyle - obj = DucDimensionStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedDimensionStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedDimensionStyleStart(builder) - -def IdentifiedDimensionStyleAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedDimensionStyleAddId(builder, id) - -def IdentifiedDimensionStyleAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - IdentifiedDimensionStyleAddStyle(builder, style) - -def IdentifiedDimensionStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedDimensionStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedDocStyle.py b/packages/ducpy/src/ducpy/Duc/IdentifiedDocStyle.py deleted file mode 100644 index 18320a23..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedDocStyle.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedDocStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedDocStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedDocStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedDocStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedDocStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedDocStyle - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedDocStyle - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucDocStyle import DucDocStyle - obj = DucDocStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedDocStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedDocStyleStart(builder) - -def IdentifiedDocStyleAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedDocStyleAddId(builder, id) - -def IdentifiedDocStyleAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - IdentifiedDocStyleAddStyle(builder, style) - -def IdentifiedDocStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedDocStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedFCFStyle.py b/packages/ducpy/src/ducpy/Duc/IdentifiedFCFStyle.py deleted file mode 100644 index 46af22dc..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedFCFStyle.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedFCFStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedFCFStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedFCFStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedFCFStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedFCFStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedFCFStyle - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedFCFStyle - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucFeatureControlFrameStyle import DucFeatureControlFrameStyle - obj = DucFeatureControlFrameStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedFCFStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedFCFStyleStart(builder) - -def IdentifiedFCFStyleAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedFCFStyleAddId(builder, id) - -def IdentifiedFCFStyleAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - IdentifiedFCFStyleAddStyle(builder, style) - -def IdentifiedFCFStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedFCFStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedGridSettings.py b/packages/ducpy/src/ducpy/Duc/IdentifiedGridSettings.py deleted file mode 100644 index 19c5a674..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedGridSettings.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedGridSettings(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedGridSettings() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedGridSettings(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedGridSettingsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedGridSettings - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedGridSettings - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedGridSettings - def Settings(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.GridSettings import GridSettings - obj = GridSettings() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedGridSettingsStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedGridSettingsStart(builder) - -def IdentifiedGridSettingsAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedGridSettingsAddId(builder, id) - -def IdentifiedGridSettingsAddSettings(builder, settings): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(settings), 0) - -def AddSettings(builder, settings): - IdentifiedGridSettingsAddSettings(builder, settings) - -def IdentifiedGridSettingsEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedGridSettingsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedHatchStyle.py b/packages/ducpy/src/ducpy/Duc/IdentifiedHatchStyle.py deleted file mode 100644 index 54991c68..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedHatchStyle.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedHatchStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedHatchStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedHatchStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedHatchStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedHatchStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedHatchStyle - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedHatchStyle - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucHatchStyle import DucHatchStyle - obj = DucHatchStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedHatchStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedHatchStyleStart(builder) - -def IdentifiedHatchStyleAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedHatchStyleAddId(builder, id) - -def IdentifiedHatchStyleAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - IdentifiedHatchStyleAddStyle(builder, style) - -def IdentifiedHatchStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedHatchStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedLeaderStyle.py b/packages/ducpy/src/ducpy/Duc/IdentifiedLeaderStyle.py deleted file mode 100644 index c8482178..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedLeaderStyle.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedLeaderStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedLeaderStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedLeaderStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedLeaderStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedLeaderStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedLeaderStyle - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedLeaderStyle - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucLeaderStyle import DucLeaderStyle - obj = DucLeaderStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedLeaderStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedLeaderStyleStart(builder) - -def IdentifiedLeaderStyleAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedLeaderStyleAddId(builder, id) - -def IdentifiedLeaderStyleAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - IdentifiedLeaderStyleAddStyle(builder, style) - -def IdentifiedLeaderStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedLeaderStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedSnapSettings.py b/packages/ducpy/src/ducpy/Duc/IdentifiedSnapSettings.py deleted file mode 100644 index 9dc30cac..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedSnapSettings.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedSnapSettings(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedSnapSettings() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedSnapSettings(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedSnapSettingsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedSnapSettings - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedSnapSettings - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedSnapSettings - def Settings(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.SnapSettings import SnapSettings - obj = SnapSettings() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedSnapSettingsStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedSnapSettingsStart(builder) - -def IdentifiedSnapSettingsAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedSnapSettingsAddId(builder, id) - -def IdentifiedSnapSettingsAddSettings(builder, settings): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(settings), 0) - -def AddSettings(builder, settings): - IdentifiedSnapSettingsAddSettings(builder, settings) - -def IdentifiedSnapSettingsEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedSnapSettingsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedStackLikeStyle.py b/packages/ducpy/src/ducpy/Duc/IdentifiedStackLikeStyle.py deleted file mode 100644 index dbeaf056..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedStackLikeStyle.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedStackLikeStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedStackLikeStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedStackLikeStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedStackLikeStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedStackLikeStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedStackLikeStyle - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedStackLikeStyle - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucStackLikeStyles import DucStackLikeStyles - obj = DucStackLikeStyles() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedStackLikeStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedStackLikeStyleStart(builder) - -def IdentifiedStackLikeStyleAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedStackLikeStyleAddId(builder, id) - -def IdentifiedStackLikeStyleAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - IdentifiedStackLikeStyleAddStyle(builder, style) - -def IdentifiedStackLikeStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedStackLikeStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedTableStyle.py b/packages/ducpy/src/ducpy/Duc/IdentifiedTableStyle.py deleted file mode 100644 index 5632272d..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedTableStyle.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedTableStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedTableStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedTableStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedTableStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedTableStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedTableStyle - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedTableStyle - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTableStyle import DucTableStyle - obj = DucTableStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedTableStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedTableStyleStart(builder) - -def IdentifiedTableStyleAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedTableStyleAddId(builder, id) - -def IdentifiedTableStyleAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - IdentifiedTableStyleAddStyle(builder, style) - -def IdentifiedTableStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedTableStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedTextStyle.py b/packages/ducpy/src/ducpy/Duc/IdentifiedTextStyle.py deleted file mode 100644 index 47274375..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedTextStyle.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedTextStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedTextStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedTextStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedTextStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedTextStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedTextStyle - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedTextStyle - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucTextStyle import DucTextStyle - obj = DucTextStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedTextStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedTextStyleStart(builder) - -def IdentifiedTextStyleAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedTextStyleAddId(builder, id) - -def IdentifiedTextStyleAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - IdentifiedTextStyleAddStyle(builder, style) - -def IdentifiedTextStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedTextStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedUcs.py b/packages/ducpy/src/ducpy/Duc/IdentifiedUcs.py deleted file mode 100644 index 474ea4b2..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedUcs.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedUcs(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedUcs() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedUcs(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedUcsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedUcs - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedUcs - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedUcs - def Ucs(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucUcs import DucUcs - obj = DucUcs() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedUcsStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedUcsStart(builder) - -def IdentifiedUcsAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedUcsAddId(builder, id) - -def IdentifiedUcsAddUcs(builder, ucs): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(ucs), 0) - -def AddUcs(builder, ucs): - IdentifiedUcsAddUcs(builder, ucs) - -def IdentifiedUcsEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedUcsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedView.py b/packages/ducpy/src/ducpy/Duc/IdentifiedView.py deleted file mode 100644 index f5ff8aaa..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedView.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedView(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedView() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedView(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedViewBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedView - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedView - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedView - def View(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucView import DucView - obj = DucView() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedViewStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedViewStart(builder) - -def IdentifiedViewAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedViewAddId(builder, id) - -def IdentifiedViewAddView(builder, view): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(view), 0) - -def AddView(builder, view): - IdentifiedViewAddView(builder, view) - -def IdentifiedViewEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedViewEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedViewportStyle.py b/packages/ducpy/src/ducpy/Duc/IdentifiedViewportStyle.py deleted file mode 100644 index c336e6ad..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedViewportStyle.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedViewportStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedViewportStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedViewportStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedViewportStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedViewportStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedViewportStyle - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedViewportStyle - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucViewportStyle import DucViewportStyle - obj = DucViewportStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedViewportStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedViewportStyleStart(builder) - -def IdentifiedViewportStyleAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedViewportStyleAddId(builder, id) - -def IdentifiedViewportStyleAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - IdentifiedViewportStyleAddStyle(builder, style) - -def IdentifiedViewportStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedViewportStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IdentifiedXRayStyle.py b/packages/ducpy/src/ducpy/Duc/IdentifiedXRayStyle.py deleted file mode 100644 index 5d79a39e..00000000 --- a/packages/ducpy/src/ducpy/Duc/IdentifiedXRayStyle.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IdentifiedXRayStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IdentifiedXRayStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifiedXRayStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifiedXRayStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IdentifiedXRayStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IdentifiedXRayStyle - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # IdentifiedXRayStyle - def Style(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucXRayStyle import DucXRayStyle - obj = DucXRayStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def IdentifiedXRayStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - IdentifiedXRayStyleStart(builder) - -def IdentifiedXRayStyleAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifiedXRayStyleAddId(builder, id) - -def IdentifiedXRayStyleAddStyle(builder, style): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(style), 0) - -def AddStyle(builder, style): - IdentifiedXRayStyleAddStyle(builder, style) - -def IdentifiedXRayStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifiedXRayStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/Identifier.py b/packages/ducpy/src/ducpy/Duc/Identifier.py deleted file mode 100644 index 934683b5..00000000 --- a/packages/ducpy/src/ducpy/Duc/Identifier.py +++ /dev/null @@ -1,80 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class Identifier(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = Identifier() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIdentifier(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IdentifierBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # Identifier - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # Identifier - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # Identifier - def Name(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # Identifier - def Description(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def IdentifierStart(builder): - builder.StartObject(3) - -def Start(builder): - IdentifierStart(builder) - -def IdentifierAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - IdentifierAddId(builder, id) - -def IdentifierAddName(builder, name): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) - -def AddName(builder, name): - IdentifierAddName(builder, name) - -def IdentifierAddDescription(builder, description): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(description), 0) - -def AddDescription(builder, description): - IdentifierAddDescription(builder, description) - -def IdentifierEnd(builder): - return builder.EndObject() - -def End(builder): - return IdentifierEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/ImageCrop.py b/packages/ducpy/src/ducpy/Duc/ImageCrop.py deleted file mode 100644 index 098618a3..00000000 --- a/packages/ducpy/src/ducpy/Duc/ImageCrop.py +++ /dev/null @@ -1,119 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class ImageCrop(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = ImageCrop() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsImageCrop(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def ImageCropBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # ImageCrop - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # ImageCrop - def X(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ImageCrop - def Y(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ImageCrop - def Width(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ImageCrop - def Height(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ImageCrop - def NaturalWidth(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ImageCrop - def NaturalHeight(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def ImageCropStart(builder): - builder.StartObject(6) - -def Start(builder): - ImageCropStart(builder) - -def ImageCropAddX(builder, x): - builder.PrependFloat64Slot(0, x, 0.0) - -def AddX(builder, x): - ImageCropAddX(builder, x) - -def ImageCropAddY(builder, y): - builder.PrependFloat64Slot(1, y, 0.0) - -def AddY(builder, y): - ImageCropAddY(builder, y) - -def ImageCropAddWidth(builder, width): - builder.PrependFloat64Slot(2, width, 0.0) - -def AddWidth(builder, width): - ImageCropAddWidth(builder, width) - -def ImageCropAddHeight(builder, height): - builder.PrependFloat64Slot(3, height, 0.0) - -def AddHeight(builder, height): - ImageCropAddHeight(builder, height) - -def ImageCropAddNaturalWidth(builder, naturalWidth): - builder.PrependFloat64Slot(4, naturalWidth, 0.0) - -def AddNaturalWidth(builder, naturalWidth): - ImageCropAddNaturalWidth(builder, naturalWidth) - -def ImageCropAddNaturalHeight(builder, naturalHeight): - builder.PrependFloat64Slot(5, naturalHeight, 0.0) - -def AddNaturalHeight(builder, naturalHeight): - ImageCropAddNaturalHeight(builder, naturalHeight) - -def ImageCropEnd(builder): - return builder.EndObject() - -def End(builder): - return ImageCropEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/IsometricGridSettings.py b/packages/ducpy/src/ducpy/Duc/IsometricGridSettings.py deleted file mode 100644 index c8de0857..00000000 --- a/packages/ducpy/src/ducpy/Duc/IsometricGridSettings.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class IsometricGridSettings(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = IsometricGridSettings() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsIsometricGridSettings(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def IsometricGridSettingsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # IsometricGridSettings - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # IsometricGridSettings - def LeftAngle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # IsometricGridSettings - def RightAngle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def IsometricGridSettingsStart(builder): - builder.StartObject(2) - -def Start(builder): - IsometricGridSettingsStart(builder) - -def IsometricGridSettingsAddLeftAngle(builder, leftAngle): - builder.PrependFloat64Slot(0, leftAngle, 0.0) - -def AddLeftAngle(builder, leftAngle): - IsometricGridSettingsAddLeftAngle(builder, leftAngle) - -def IsometricGridSettingsAddRightAngle(builder, rightAngle): - builder.PrependFloat64Slot(1, rightAngle, 0.0) - -def AddRightAngle(builder, rightAngle): - IsometricGridSettingsAddRightAngle(builder, rightAngle) - -def IsometricGridSettingsEnd(builder): - return builder.EndObject() - -def End(builder): - return IsometricGridSettingsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/JSONPatchOperation.py b/packages/ducpy/src/ducpy/Duc/JSONPatchOperation.py deleted file mode 100644 index 2ace157f..00000000 --- a/packages/ducpy/src/ducpy/Duc/JSONPatchOperation.py +++ /dev/null @@ -1,93 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class JSONPatchOperation(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = JSONPatchOperation() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsJSONPatchOperation(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def JSONPatchOperationBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # JSONPatchOperation - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # JSONPatchOperation - def Op(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # JSONPatchOperation - def Path(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # JSONPatchOperation - def From(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # JSONPatchOperation - def Value(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def JSONPatchOperationStart(builder): - builder.StartObject(4) - -def Start(builder): - JSONPatchOperationStart(builder) - -def JSONPatchOperationAddOp(builder, op): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(op), 0) - -def AddOp(builder, op): - JSONPatchOperationAddOp(builder, op) - -def JSONPatchOperationAddPath(builder, path): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(path), 0) - -def AddPath(builder, path): - JSONPatchOperationAddPath(builder, path) - -def JSONPatchOperationAddFrom(builder, from_): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(from_), 0) - -def AddFrom(builder, from_): - JSONPatchOperationAddFrom(builder, from_) - -def JSONPatchOperationAddValue(builder, value): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0) - -def AddValue(builder, value): - JSONPatchOperationAddValue(builder, value) - -def JSONPatchOperationEnd(builder): - return builder.EndObject() - -def End(builder): - return JSONPatchOperationEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/LEADER_CONTENT_TYPE.py b/packages/ducpy/src/ducpy/Duc/LEADER_CONTENT_TYPE.py deleted file mode 100644 index bf408d98..00000000 --- a/packages/ducpy/src/ducpy/Duc/LEADER_CONTENT_TYPE.py +++ /dev/null @@ -1,7 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class LEADER_CONTENT_TYPE(object): - TEXT = 10 - BLOCK = 11 diff --git a/packages/ducpy/src/ducpy/Duc/LINE_HEAD.py b/packages/ducpy/src/ducpy/Duc/LINE_HEAD.py deleted file mode 100644 index 2128c63f..00000000 --- a/packages/ducpy/src/ducpy/Duc/LINE_HEAD.py +++ /dev/null @@ -1,20 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class LINE_HEAD(object): - ARROW = 10 - BAR = 11 - CIRCLE = 12 - CIRCLE_OUTLINED = 13 - TRIANGLE = 14 - TRIANGLE_OUTLINED = 15 - DIAMOND = 16 - DIAMOND_OUTLINED = 17 - CROSS = 18 - OPEN_ARROW = 19 - REVERSED_ARROW = 20 - REVERSED_TRIANGLE = 21 - REVERSED_TRIANGLE_OUTLINED = 22 - CONE = 23 - HALF_CONE = 24 diff --git a/packages/ducpy/src/ducpy/Duc/LINE_SPACING_TYPE.py b/packages/ducpy/src/ducpy/Duc/LINE_SPACING_TYPE.py deleted file mode 100644 index b96baaa7..00000000 --- a/packages/ducpy/src/ducpy/Duc/LINE_SPACING_TYPE.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class LINE_SPACING_TYPE(object): - AT_LEAST = 10 - EXACTLY = 11 - MULTIPLE = 12 diff --git a/packages/ducpy/src/ducpy/Duc/LayerSnapFilters.py b/packages/ducpy/src/ducpy/Duc/LayerSnapFilters.py deleted file mode 100644 index 2168498d..00000000 --- a/packages/ducpy/src/ducpy/Duc/LayerSnapFilters.py +++ /dev/null @@ -1,105 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class LayerSnapFilters(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = LayerSnapFilters() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsLayerSnapFilters(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def LayerSnapFiltersBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # LayerSnapFilters - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # LayerSnapFilters - def IncludeLayers(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # LayerSnapFilters - def IncludeLayersLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # LayerSnapFilters - def IncludeLayersIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - return o == 0 - - # LayerSnapFilters - def ExcludeLayers(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # LayerSnapFilters - def ExcludeLayersLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # LayerSnapFilters - def ExcludeLayersIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - return o == 0 - -def LayerSnapFiltersStart(builder): - builder.StartObject(2) - -def Start(builder): - LayerSnapFiltersStart(builder) - -def LayerSnapFiltersAddIncludeLayers(builder, includeLayers): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(includeLayers), 0) - -def AddIncludeLayers(builder, includeLayers): - LayerSnapFiltersAddIncludeLayers(builder, includeLayers) - -def LayerSnapFiltersStartIncludeLayersVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartIncludeLayersVector(builder, numElems): - return LayerSnapFiltersStartIncludeLayersVector(builder, numElems) - -def LayerSnapFiltersAddExcludeLayers(builder, excludeLayers): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(excludeLayers), 0) - -def AddExcludeLayers(builder, excludeLayers): - LayerSnapFiltersAddExcludeLayers(builder, excludeLayers) - -def LayerSnapFiltersStartExcludeLayersVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartExcludeLayersVector(builder, numElems): - return LayerSnapFiltersStartExcludeLayersVector(builder, numElems) - -def LayerSnapFiltersEnd(builder): - return builder.EndObject() - -def End(builder): - return LayerSnapFiltersEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/LayerValidationRules.py b/packages/ducpy/src/ducpy/Duc/LayerValidationRules.py deleted file mode 100644 index 6983223c..00000000 --- a/packages/ducpy/src/ducpy/Duc/LayerValidationRules.py +++ /dev/null @@ -1,73 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class LayerValidationRules(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = LayerValidationRules() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsLayerValidationRules(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def LayerValidationRulesBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # LayerValidationRules - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # LayerValidationRules - def ProhibitedLayerNames(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # LayerValidationRules - def ProhibitedLayerNamesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # LayerValidationRules - def ProhibitedLayerNamesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - return o == 0 - -def LayerValidationRulesStart(builder): - builder.StartObject(1) - -def Start(builder): - LayerValidationRulesStart(builder) - -def LayerValidationRulesAddProhibitedLayerNames(builder, prohibitedLayerNames): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(prohibitedLayerNames), 0) - -def AddProhibitedLayerNames(builder, prohibitedLayerNames): - LayerValidationRulesAddProhibitedLayerNames(builder, prohibitedLayerNames) - -def LayerValidationRulesStartProhibitedLayerNamesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartProhibitedLayerNamesVector(builder, numElems): - return LayerValidationRulesStartProhibitedLayerNamesVector(builder, numElems) - -def LayerValidationRulesEnd(builder): - return builder.EndObject() - -def End(builder): - return LayerValidationRulesEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/LeaderBlockContent.py b/packages/ducpy/src/ducpy/Duc/LeaderBlockContent.py deleted file mode 100644 index c9266083..00000000 --- a/packages/ducpy/src/ducpy/Duc/LeaderBlockContent.py +++ /dev/null @@ -1,128 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class LeaderBlockContent(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = LeaderBlockContent() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsLeaderBlockContent(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def LeaderBlockContentBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # LeaderBlockContent - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # LeaderBlockContent - def BlockId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # LeaderBlockContent - def AttributeValues(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.StringValueEntry import StringValueEntry - obj = StringValueEntry() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # LeaderBlockContent - def AttributeValuesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # LeaderBlockContent - def AttributeValuesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - return o == 0 - - # LeaderBlockContent - def ElementOverrides(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.StringValueEntry import StringValueEntry - obj = StringValueEntry() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # LeaderBlockContent - def ElementOverridesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # LeaderBlockContent - def ElementOverridesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - -def LeaderBlockContentStart(builder): - builder.StartObject(3) - -def Start(builder): - LeaderBlockContentStart(builder) - -def LeaderBlockContentAddBlockId(builder, blockId): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(blockId), 0) - -def AddBlockId(builder, blockId): - LeaderBlockContentAddBlockId(builder, blockId) - -def LeaderBlockContentAddAttributeValues(builder, attributeValues): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(attributeValues), 0) - -def AddAttributeValues(builder, attributeValues): - LeaderBlockContentAddAttributeValues(builder, attributeValues) - -def LeaderBlockContentStartAttributeValuesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartAttributeValuesVector(builder, numElems): - return LeaderBlockContentStartAttributeValuesVector(builder, numElems) - -def LeaderBlockContentAddElementOverrides(builder, elementOverrides): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(elementOverrides), 0) - -def AddElementOverrides(builder, elementOverrides): - LeaderBlockContentAddElementOverrides(builder, elementOverrides) - -def LeaderBlockContentStartElementOverridesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartElementOverridesVector(builder, numElems): - return LeaderBlockContentStartElementOverridesVector(builder, numElems) - -def LeaderBlockContentEnd(builder): - return builder.EndObject() - -def End(builder): - return LeaderBlockContentEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/LeaderContent.py b/packages/ducpy/src/ducpy/Duc/LeaderContent.py deleted file mode 100644 index cd750faa..00000000 --- a/packages/ducpy/src/ducpy/Duc/LeaderContent.py +++ /dev/null @@ -1,83 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class LeaderContent(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = LeaderContent() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsLeaderContent(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def LeaderContentBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # LeaderContent - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # LeaderContent - def LeaderContentType(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # LeaderContent - def ContentType(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return 0 - - # LeaderContent - def Content(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - from flatbuffers.table import Table - obj = Table(bytearray(), 0) - self._tab.Union(obj, o) - return obj - return None - -def LeaderContentStart(builder): - builder.StartObject(3) - -def Start(builder): - LeaderContentStart(builder) - -def LeaderContentAddLeaderContentType(builder, leaderContentType): - builder.PrependUint8Slot(0, leaderContentType, None) - -def AddLeaderContentType(builder, leaderContentType): - LeaderContentAddLeaderContentType(builder, leaderContentType) - -def LeaderContentAddContentType(builder, contentType): - builder.PrependUint8Slot(1, contentType, 0) - -def AddContentType(builder, contentType): - LeaderContentAddContentType(builder, contentType) - -def LeaderContentAddContent(builder, content): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(content), 0) - -def AddContent(builder, content): - LeaderContentAddContent(builder, content) - -def LeaderContentEnd(builder): - return builder.EndObject() - -def End(builder): - return LeaderContentEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/LeaderContentData.py b/packages/ducpy/src/ducpy/Duc/LeaderContentData.py deleted file mode 100644 index bd59b5e8..00000000 --- a/packages/ducpy/src/ducpy/Duc/LeaderContentData.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class LeaderContentData(object): - NONE = 0 - LeaderTextBlockContent = 1 - LeaderBlockContent = 2 diff --git a/packages/ducpy/src/ducpy/Duc/LeaderTextBlockContent.py b/packages/ducpy/src/ducpy/Duc/LeaderTextBlockContent.py deleted file mode 100644 index b56234d2..00000000 --- a/packages/ducpy/src/ducpy/Duc/LeaderTextBlockContent.py +++ /dev/null @@ -1,54 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class LeaderTextBlockContent(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = LeaderTextBlockContent() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsLeaderTextBlockContent(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def LeaderTextBlockContentBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # LeaderTextBlockContent - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # LeaderTextBlockContent - def Text(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def LeaderTextBlockContentStart(builder): - builder.StartObject(1) - -def Start(builder): - LeaderTextBlockContentStart(builder) - -def LeaderTextBlockContentAddText(builder, text): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(text), 0) - -def AddText(builder, text): - LeaderTextBlockContentAddText(builder, text) - -def LeaderTextBlockContentEnd(builder): - return builder.EndObject() - -def End(builder): - return LeaderTextBlockContentEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/LineSpacing.py b/packages/ducpy/src/ducpy/Duc/LineSpacing.py deleted file mode 100644 index 351737e1..00000000 --- a/packages/ducpy/src/ducpy/Duc/LineSpacing.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class LineSpacing(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = LineSpacing() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsLineSpacing(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def LineSpacingBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # LineSpacing - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # LineSpacing - def Value(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # LineSpacing - def Type(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def LineSpacingStart(builder): - builder.StartObject(2) - -def Start(builder): - LineSpacingStart(builder) - -def LineSpacingAddValue(builder, value): - builder.PrependFloat64Slot(0, value, 0.0) - -def AddValue(builder, value): - LineSpacingAddValue(builder, value) - -def LineSpacingAddType(builder, type): - builder.PrependUint8Slot(1, type, None) - -def AddType(builder, type): - LineSpacingAddType(builder, type) - -def LineSpacingEnd(builder): - return builder.EndObject() - -def End(builder): - return LineSpacingEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/LinearUnitSystem.py b/packages/ducpy/src/ducpy/Duc/LinearUnitSystem.py deleted file mode 100644 index 289d61f3..00000000 --- a/packages/ducpy/src/ducpy/Duc/LinearUnitSystem.py +++ /dev/null @@ -1,110 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class LinearUnitSystem(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = LinearUnitSystem() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsLinearUnitSystem(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def LinearUnitSystemBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # LinearUnitSystem - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # LinearUnitSystem - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._UnitSystemBase import _UnitSystemBase - obj = _UnitSystemBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # LinearUnitSystem - def Format(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # LinearUnitSystem - def DecimalSeparator(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # LinearUnitSystem - def SuppressZeroFeet(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # LinearUnitSystem - def SuppressZeroInches(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def LinearUnitSystemStart(builder): - builder.StartObject(5) - -def Start(builder): - LinearUnitSystemStart(builder) - -def LinearUnitSystemAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - LinearUnitSystemAddBase(builder, base) - -def LinearUnitSystemAddFormat(builder, format): - builder.PrependUint8Slot(1, format, None) - -def AddFormat(builder, format): - LinearUnitSystemAddFormat(builder, format) - -def LinearUnitSystemAddDecimalSeparator(builder, decimalSeparator): - builder.PrependUint8Slot(2, decimalSeparator, None) - -def AddDecimalSeparator(builder, decimalSeparator): - LinearUnitSystemAddDecimalSeparator(builder, decimalSeparator) - -def LinearUnitSystemAddSuppressZeroFeet(builder, suppressZeroFeet): - builder.PrependBoolSlot(3, suppressZeroFeet, 0) - -def AddSuppressZeroFeet(builder, suppressZeroFeet): - LinearUnitSystemAddSuppressZeroFeet(builder, suppressZeroFeet) - -def LinearUnitSystemAddSuppressZeroInches(builder, suppressZeroInches): - builder.PrependBoolSlot(4, suppressZeroInches, 0) - -def AddSuppressZeroInches(builder, suppressZeroInches): - LinearUnitSystemAddSuppressZeroInches(builder, suppressZeroInches) - -def LinearUnitSystemEnd(builder): - return builder.EndObject() - -def End(builder): - return LinearUnitSystemEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/MARK_ELLIPSE_CENTER.py b/packages/ducpy/src/ducpy/Duc/MARK_ELLIPSE_CENTER.py deleted file mode 100644 index a5a19526..00000000 --- a/packages/ducpy/src/ducpy/Duc/MARK_ELLIPSE_CENTER.py +++ /dev/null @@ -1,7 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class MARK_ELLIPSE_CENTER(object): - MARK = 10 - LINE = 11 diff --git a/packages/ducpy/src/ducpy/Duc/MATERIAL_CONDITION.py b/packages/ducpy/src/ducpy/Duc/MATERIAL_CONDITION.py deleted file mode 100644 index a605f4fc..00000000 --- a/packages/ducpy/src/ducpy/Duc/MATERIAL_CONDITION.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class MATERIAL_CONDITION(object): - MAXIMUM = 10 - LEAST = 11 - REGARDLESS = 12 diff --git a/packages/ducpy/src/ducpy/Duc/Margins.py b/packages/ducpy/src/ducpy/Duc/Margins.py deleted file mode 100644 index cbdd0480..00000000 --- a/packages/ducpy/src/ducpy/Duc/Margins.py +++ /dev/null @@ -1,93 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class Margins(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = Margins() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsMargins(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def MarginsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # Margins - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # Margins - def Top(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # Margins - def Right(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # Margins - def Bottom(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # Margins - def Left(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def MarginsStart(builder): - builder.StartObject(4) - -def Start(builder): - MarginsStart(builder) - -def MarginsAddTop(builder, top): - builder.PrependFloat64Slot(0, top, 0.0) - -def AddTop(builder, top): - MarginsAddTop(builder, top) - -def MarginsAddRight(builder, right): - builder.PrependFloat64Slot(1, right, 0.0) - -def AddRight(builder, right): - MarginsAddRight(builder, right) - -def MarginsAddBottom(builder, bottom): - builder.PrependFloat64Slot(2, bottom, 0.0) - -def AddBottom(builder, bottom): - MarginsAddBottom(builder, bottom) - -def MarginsAddLeft(builder, left): - builder.PrependFloat64Slot(3, left, 0.0) - -def AddLeft(builder, left): - MarginsAddLeft(builder, left) - -def MarginsEnd(builder): - return builder.EndObject() - -def End(builder): - return MarginsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/OBJECT_SNAP_MODE.py b/packages/ducpy/src/ducpy/Duc/OBJECT_SNAP_MODE.py deleted file mode 100644 index 16c9c25f..00000000 --- a/packages/ducpy/src/ducpy/Duc/OBJECT_SNAP_MODE.py +++ /dev/null @@ -1,25 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class OBJECT_SNAP_MODE(object): - NONE = 0 - ENDPOINT = 10 - MIDPOINT = 11 - CENTER = 12 - QUADRANT = 13 - INTERSECTION = 14 - EXTENSION = 15 - PERPENDICULAR = 16 - TANGENT = 17 - NEAREST = 18 - NODE = 19 - INSERT = 20 - PARALLEL = 21 - APPARENT = 22 - FROM = 23 - POINT_FILTER = 24 - TEMPORARY = 25 - BETWEEN_TWO_POINTS = 26 - POINT_ON_CURVE = 27 - GEOMETRIC = 28 diff --git a/packages/ducpy/src/ducpy/Duc/PARAMETRIC_SOURCE_TYPE.py b/packages/ducpy/src/ducpy/Duc/PARAMETRIC_SOURCE_TYPE.py deleted file mode 100644 index 7b916679..00000000 --- a/packages/ducpy/src/ducpy/Duc/PARAMETRIC_SOURCE_TYPE.py +++ /dev/null @@ -1,7 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class PARAMETRIC_SOURCE_TYPE(object): - CODE = 10 - FILE = 11 diff --git a/packages/ducpy/src/ducpy/Duc/PRUNING_LEVEL.py b/packages/ducpy/src/ducpy/Duc/PRUNING_LEVEL.py deleted file mode 100644 index b5e95b3b..00000000 --- a/packages/ducpy/src/ducpy/Duc/PRUNING_LEVEL.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class PRUNING_LEVEL(object): - CONSERVATIVE = 10 - BALANCED = 20 - AGGRESSIVE = 30 diff --git a/packages/ducpy/src/ducpy/Duc/ParagraphFormatting.py b/packages/ducpy/src/ducpy/Duc/ParagraphFormatting.py deleted file mode 100644 index 339e0f1d..00000000 --- a/packages/ducpy/src/ducpy/Duc/ParagraphFormatting.py +++ /dev/null @@ -1,158 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class ParagraphFormatting(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = ParagraphFormatting() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsParagraphFormatting(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def ParagraphFormattingBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # ParagraphFormatting - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # ParagraphFormatting - def FirstLineIndent(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ParagraphFormatting - def HangingIndent(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ParagraphFormatting - def LeftIndent(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ParagraphFormatting - def RightIndent(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ParagraphFormatting - def SpaceBefore(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ParagraphFormatting - def SpaceAfter(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # ParagraphFormatting - def TabStops(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) - return 0 - - # ParagraphFormatting - def TabStopsAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o) - return 0 - - # ParagraphFormatting - def TabStopsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ParagraphFormatting - def TabStopsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - return o == 0 - -def ParagraphFormattingStart(builder): - builder.StartObject(7) - -def Start(builder): - ParagraphFormattingStart(builder) - -def ParagraphFormattingAddFirstLineIndent(builder, firstLineIndent): - builder.PrependFloat64Slot(0, firstLineIndent, 0.0) - -def AddFirstLineIndent(builder, firstLineIndent): - ParagraphFormattingAddFirstLineIndent(builder, firstLineIndent) - -def ParagraphFormattingAddHangingIndent(builder, hangingIndent): - builder.PrependFloat64Slot(1, hangingIndent, 0.0) - -def AddHangingIndent(builder, hangingIndent): - ParagraphFormattingAddHangingIndent(builder, hangingIndent) - -def ParagraphFormattingAddLeftIndent(builder, leftIndent): - builder.PrependFloat64Slot(2, leftIndent, 0.0) - -def AddLeftIndent(builder, leftIndent): - ParagraphFormattingAddLeftIndent(builder, leftIndent) - -def ParagraphFormattingAddRightIndent(builder, rightIndent): - builder.PrependFloat64Slot(3, rightIndent, 0.0) - -def AddRightIndent(builder, rightIndent): - ParagraphFormattingAddRightIndent(builder, rightIndent) - -def ParagraphFormattingAddSpaceBefore(builder, spaceBefore): - builder.PrependFloat64Slot(4, spaceBefore, 0.0) - -def AddSpaceBefore(builder, spaceBefore): - ParagraphFormattingAddSpaceBefore(builder, spaceBefore) - -def ParagraphFormattingAddSpaceAfter(builder, spaceAfter): - builder.PrependFloat64Slot(5, spaceAfter, 0.0) - -def AddSpaceAfter(builder, spaceAfter): - ParagraphFormattingAddSpaceAfter(builder, spaceAfter) - -def ParagraphFormattingAddTabStops(builder, tabStops): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(tabStops), 0) - -def AddTabStops(builder, tabStops): - ParagraphFormattingAddTabStops(builder, tabStops) - -def ParagraphFormattingStartTabStopsVector(builder, numElems): - return builder.StartVector(8, numElems, 8) - -def StartTabStopsVector(builder, numElems): - return ParagraphFormattingStartTabStopsVector(builder, numElems) - -def ParagraphFormattingEnd(builder): - return builder.EndObject() - -def End(builder): - return ParagraphFormattingEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/ParametricSource.py b/packages/ducpy/src/ducpy/Duc/ParametricSource.py deleted file mode 100644 index 5e97a316..00000000 --- a/packages/ducpy/src/ducpy/Duc/ParametricSource.py +++ /dev/null @@ -1,80 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class ParametricSource(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = ParametricSource() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsParametricSource(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def ParametricSourceBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # ParametricSource - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # ParametricSource - def Type(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # ParametricSource - def Code(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # ParametricSource - def FileId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def ParametricSourceStart(builder): - builder.StartObject(3) - -def Start(builder): - ParametricSourceStart(builder) - -def ParametricSourceAddType(builder, type): - builder.PrependUint8Slot(0, type, None) - -def AddType(builder, type): - ParametricSourceAddType(builder, type) - -def ParametricSourceAddCode(builder, code): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(code), 0) - -def AddCode(builder, code): - ParametricSourceAddCode(builder, code) - -def ParametricSourceAddFileId(builder, fileId): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(fileId), 0) - -def AddFileId(builder, fileId): - ParametricSourceAddFileId(builder, fileId) - -def ParametricSourceEnd(builder): - return builder.EndObject() - -def End(builder): - return ParametricSourceEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/PlotLayout.py b/packages/ducpy/src/ducpy/Duc/PlotLayout.py deleted file mode 100644 index 858fb9de..00000000 --- a/packages/ducpy/src/ducpy/Duc/PlotLayout.py +++ /dev/null @@ -1,58 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class PlotLayout(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = PlotLayout() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsPlotLayout(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def PlotLayoutBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # PlotLayout - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # PlotLayout - def Margins(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Margins import Margins - obj = Margins() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def PlotLayoutStart(builder): - builder.StartObject(1) - -def Start(builder): - PlotLayoutStart(builder) - -def PlotLayoutAddMargins(builder, margins): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(margins), 0) - -def AddMargins(builder, margins): - PlotLayoutAddMargins(builder, margins) - -def PlotLayoutEnd(builder): - return builder.EndObject() - -def End(builder): - return PlotLayoutEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/PointBindingPoint.py b/packages/ducpy/src/ducpy/Duc/PointBindingPoint.py deleted file mode 100644 index aa8aa4c6..00000000 --- a/packages/ducpy/src/ducpy/Duc/PointBindingPoint.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class PointBindingPoint(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = PointBindingPoint() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsPointBindingPoint(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def PointBindingPointBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # PointBindingPoint - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # PointBindingPoint - def Index(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # PointBindingPoint - def Offset(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def PointBindingPointStart(builder): - builder.StartObject(2) - -def Start(builder): - PointBindingPointStart(builder) - -def PointBindingPointAddIndex(builder, index): - builder.PrependInt32Slot(0, index, 0) - -def AddIndex(builder, index): - PointBindingPointAddIndex(builder, index) - -def PointBindingPointAddOffset(builder, offset): - builder.PrependFloat64Slot(1, offset, 0.0) - -def AddOffset(builder, offset): - PointBindingPointAddOffset(builder, offset) - -def PointBindingPointEnd(builder): - return builder.EndObject() - -def End(builder): - return PointBindingPointEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/PolarGridSettings.py b/packages/ducpy/src/ducpy/Duc/PolarGridSettings.py deleted file mode 100644 index 4eafe1f3..00000000 --- a/packages/ducpy/src/ducpy/Duc/PolarGridSettings.py +++ /dev/null @@ -1,80 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class PolarGridSettings(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = PolarGridSettings() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsPolarGridSettings(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def PolarGridSettingsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # PolarGridSettings - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # PolarGridSettings - def RadialDivisions(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # PolarGridSettings - def RadialSpacing(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # PolarGridSettings - def ShowLabels(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def PolarGridSettingsStart(builder): - builder.StartObject(3) - -def Start(builder): - PolarGridSettingsStart(builder) - -def PolarGridSettingsAddRadialDivisions(builder, radialDivisions): - builder.PrependInt32Slot(0, radialDivisions, 0) - -def AddRadialDivisions(builder, radialDivisions): - PolarGridSettingsAddRadialDivisions(builder, radialDivisions) - -def PolarGridSettingsAddRadialSpacing(builder, radialSpacing): - builder.PrependFloat64Slot(1, radialSpacing, 0.0) - -def AddRadialSpacing(builder, radialSpacing): - PolarGridSettingsAddRadialSpacing(builder, radialSpacing) - -def PolarGridSettingsAddShowLabels(builder, showLabels): - builder.PrependBoolSlot(2, showLabels, 0) - -def AddShowLabels(builder, showLabels): - PolarGridSettingsAddShowLabels(builder, showLabels) - -def PolarGridSettingsEnd(builder): - return builder.EndObject() - -def End(builder): - return PolarGridSettingsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/PolarTrackingSettings.py b/packages/ducpy/src/ducpy/Duc/PolarTrackingSettings.py deleted file mode 100644 index 0636b04b..00000000 --- a/packages/ducpy/src/ducpy/Duc/PolarTrackingSettings.py +++ /dev/null @@ -1,132 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class PolarTrackingSettings(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = PolarTrackingSettings() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsPolarTrackingSettings(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def PolarTrackingSettingsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # PolarTrackingSettings - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # PolarTrackingSettings - def Enabled(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # PolarTrackingSettings - def Angles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) - return 0 - - # PolarTrackingSettings - def AnglesAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o) - return 0 - - # PolarTrackingSettings - def AnglesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # PolarTrackingSettings - def AnglesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - return o == 0 - - # PolarTrackingSettings - def IncrementAngle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # PolarTrackingSettings - def TrackFromLastPoint(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # PolarTrackingSettings - def ShowPolarCoordinates(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def PolarTrackingSettingsStart(builder): - builder.StartObject(5) - -def Start(builder): - PolarTrackingSettingsStart(builder) - -def PolarTrackingSettingsAddEnabled(builder, enabled): - builder.PrependBoolSlot(0, enabled, 0) - -def AddEnabled(builder, enabled): - PolarTrackingSettingsAddEnabled(builder, enabled) - -def PolarTrackingSettingsAddAngles(builder, angles): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(angles), 0) - -def AddAngles(builder, angles): - PolarTrackingSettingsAddAngles(builder, angles) - -def PolarTrackingSettingsStartAnglesVector(builder, numElems): - return builder.StartVector(8, numElems, 8) - -def StartAnglesVector(builder, numElems): - return PolarTrackingSettingsStartAnglesVector(builder, numElems) - -def PolarTrackingSettingsAddIncrementAngle(builder, incrementAngle): - builder.PrependFloat64Slot(2, incrementAngle, 0.0) - -def AddIncrementAngle(builder, incrementAngle): - PolarTrackingSettingsAddIncrementAngle(builder, incrementAngle) - -def PolarTrackingSettingsAddTrackFromLastPoint(builder, trackFromLastPoint): - builder.PrependBoolSlot(3, trackFromLastPoint, 0) - -def AddTrackFromLastPoint(builder, trackFromLastPoint): - PolarTrackingSettingsAddTrackFromLastPoint(builder, trackFromLastPoint) - -def PolarTrackingSettingsAddShowPolarCoordinates(builder, showPolarCoordinates): - builder.PrependBoolSlot(4, showPolarCoordinates, 0) - -def AddShowPolarCoordinates(builder, showPolarCoordinates): - PolarTrackingSettingsAddShowPolarCoordinates(builder, showPolarCoordinates) - -def PolarTrackingSettingsEnd(builder): - return builder.EndObject() - -def End(builder): - return PolarTrackingSettingsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/PrimaryUnits.py b/packages/ducpy/src/ducpy/Duc/PrimaryUnits.py deleted file mode 100644 index f0275852..00000000 --- a/packages/ducpy/src/ducpy/Duc/PrimaryUnits.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class PrimaryUnits(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = PrimaryUnits() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsPrimaryUnits(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def PrimaryUnitsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # PrimaryUnits - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # PrimaryUnits - def Linear(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.LinearUnitSystem import LinearUnitSystem - obj = LinearUnitSystem() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # PrimaryUnits - def Angular(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.AngularUnitSystem import AngularUnitSystem - obj = AngularUnitSystem() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def PrimaryUnitsStart(builder): - builder.StartObject(2) - -def Start(builder): - PrimaryUnitsStart(builder) - -def PrimaryUnitsAddLinear(builder, linear): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(linear), 0) - -def AddLinear(builder, linear): - PrimaryUnitsAddLinear(builder, linear) - -def PrimaryUnitsAddAngular(builder, angular): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(angular), 0) - -def AddAngular(builder, angular): - PrimaryUnitsAddAngular(builder, angular) - -def PrimaryUnitsEnd(builder): - return builder.EndObject() - -def End(builder): - return PrimaryUnitsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/SNAP_MARKER_SHAPE.py b/packages/ducpy/src/ducpy/Duc/SNAP_MARKER_SHAPE.py deleted file mode 100644 index a40680c3..00000000 --- a/packages/ducpy/src/ducpy/Duc/SNAP_MARKER_SHAPE.py +++ /dev/null @@ -1,9 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class SNAP_MARKER_SHAPE(object): - SQUARE = 10 - CIRCLE = 11 - TRIANGLE = 12 - X = 13 diff --git a/packages/ducpy/src/ducpy/Duc/SNAP_MODE.py b/packages/ducpy/src/ducpy/Duc/SNAP_MODE.py deleted file mode 100644 index f08a8942..00000000 --- a/packages/ducpy/src/ducpy/Duc/SNAP_MODE.py +++ /dev/null @@ -1,7 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class SNAP_MODE(object): - RUNNING = 10 - SINGLE = 11 diff --git a/packages/ducpy/src/ducpy/Duc/SNAP_OVERRIDE_BEHAVIOR.py b/packages/ducpy/src/ducpy/Duc/SNAP_OVERRIDE_BEHAVIOR.py deleted file mode 100644 index cb032bbc..00000000 --- a/packages/ducpy/src/ducpy/Duc/SNAP_OVERRIDE_BEHAVIOR.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class SNAP_OVERRIDE_BEHAVIOR(object): - DISABLE = 10 - FORCE_GRID = 11 - FORCE_OBJECT = 12 diff --git a/packages/ducpy/src/ducpy/Duc/STACKED_TEXT_ALIGN.py b/packages/ducpy/src/ducpy/Duc/STACKED_TEXT_ALIGN.py deleted file mode 100644 index 37f73d92..00000000 --- a/packages/ducpy/src/ducpy/Duc/STACKED_TEXT_ALIGN.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class STACKED_TEXT_ALIGN(object): - CENTER = 10 - DECIMAL = 11 - SLASH = 12 diff --git a/packages/ducpy/src/ducpy/Duc/STROKE_CAP.py b/packages/ducpy/src/ducpy/Duc/STROKE_CAP.py deleted file mode 100644 index cb5036d5..00000000 --- a/packages/ducpy/src/ducpy/Duc/STROKE_CAP.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class STROKE_CAP(object): - BUTT = 10 - ROUND = 11 - SQUARE = 12 diff --git a/packages/ducpy/src/ducpy/Duc/STROKE_JOIN.py b/packages/ducpy/src/ducpy/Duc/STROKE_JOIN.py deleted file mode 100644 index c146efa1..00000000 --- a/packages/ducpy/src/ducpy/Duc/STROKE_JOIN.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class STROKE_JOIN(object): - MITER = 10 - ROUND = 11 - BEVEL = 12 diff --git a/packages/ducpy/src/ducpy/Duc/STROKE_PLACEMENT.py b/packages/ducpy/src/ducpy/Duc/STROKE_PLACEMENT.py deleted file mode 100644 index 0c0f8ed8..00000000 --- a/packages/ducpy/src/ducpy/Duc/STROKE_PLACEMENT.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class STROKE_PLACEMENT(object): - INSIDE = 10 - CENTER = 11 - OUTSIDE = 12 diff --git a/packages/ducpy/src/ducpy/Duc/STROKE_PREFERENCE.py b/packages/ducpy/src/ducpy/Duc/STROKE_PREFERENCE.py deleted file mode 100644 index 6b89e502..00000000 --- a/packages/ducpy/src/ducpy/Duc/STROKE_PREFERENCE.py +++ /dev/null @@ -1,9 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class STROKE_PREFERENCE(object): - SOLID = 10 - DASHED = 11 - DOTTED = 12 - CUSTOM = 13 diff --git a/packages/ducpy/src/ducpy/Duc/STROKE_SIDE_PREFERENCE.py b/packages/ducpy/src/ducpy/Duc/STROKE_SIDE_PREFERENCE.py deleted file mode 100644 index 85549fb1..00000000 --- a/packages/ducpy/src/ducpy/Duc/STROKE_SIDE_PREFERENCE.py +++ /dev/null @@ -1,11 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class STROKE_SIDE_PREFERENCE(object): - TOP = 10 - BOTTOM = 11 - LEFT = 12 - RIGHT = 13 - CUSTOM = 14 - ALL = 15 diff --git a/packages/ducpy/src/ducpy/Duc/STROKE_WIDTH.py b/packages/ducpy/src/ducpy/Duc/STROKE_WIDTH.py deleted file mode 100644 index 47d4ad1e..00000000 --- a/packages/ducpy/src/ducpy/Duc/STROKE_WIDTH.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class STROKE_WIDTH(object): - THIN = 1 - BOLD = 2 - EXTRA_BOLD = 4 diff --git a/packages/ducpy/src/ducpy/Duc/SnapMarkerSettings.py b/packages/ducpy/src/ducpy/Duc/SnapMarkerSettings.py deleted file mode 100644 index e8dcb6a6..00000000 --- a/packages/ducpy/src/ducpy/Duc/SnapMarkerSettings.py +++ /dev/null @@ -1,117 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class SnapMarkerSettings(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = SnapMarkerSettings() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsSnapMarkerSettings(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def SnapMarkerSettingsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # SnapMarkerSettings - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # SnapMarkerSettings - def Enabled(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # SnapMarkerSettings - def Size(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # SnapMarkerSettings - def Duration(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # SnapMarkerSettings - def Styles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.SnapMarkerStyleEntry import SnapMarkerStyleEntry - obj = SnapMarkerStyleEntry() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # SnapMarkerSettings - def StylesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # SnapMarkerSettings - def StylesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - -def SnapMarkerSettingsStart(builder): - builder.StartObject(4) - -def Start(builder): - SnapMarkerSettingsStart(builder) - -def SnapMarkerSettingsAddEnabled(builder, enabled): - builder.PrependBoolSlot(0, enabled, 0) - -def AddEnabled(builder, enabled): - SnapMarkerSettingsAddEnabled(builder, enabled) - -def SnapMarkerSettingsAddSize(builder, size): - builder.PrependInt32Slot(1, size, 0) - -def AddSize(builder, size): - SnapMarkerSettingsAddSize(builder, size) - -def SnapMarkerSettingsAddDuration(builder, duration): - builder.PrependInt32Slot(2, duration, 0) - -def AddDuration(builder, duration): - SnapMarkerSettingsAddDuration(builder, duration) - -def SnapMarkerSettingsAddStyles(builder, styles): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(styles), 0) - -def AddStyles(builder, styles): - SnapMarkerSettingsAddStyles(builder, styles) - -def SnapMarkerSettingsStartStylesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartStylesVector(builder, numElems): - return SnapMarkerSettingsStartStylesVector(builder, numElems) - -def SnapMarkerSettingsEnd(builder): - return builder.EndObject() - -def End(builder): - return SnapMarkerSettingsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/SnapMarkerStyle.py b/packages/ducpy/src/ducpy/Duc/SnapMarkerStyle.py deleted file mode 100644 index 98f27aed..00000000 --- a/packages/ducpy/src/ducpy/Duc/SnapMarkerStyle.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class SnapMarkerStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = SnapMarkerStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsSnapMarkerStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def SnapMarkerStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # SnapMarkerStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # SnapMarkerStyle - def Shape(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # SnapMarkerStyle - def Color(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def SnapMarkerStyleStart(builder): - builder.StartObject(2) - -def Start(builder): - SnapMarkerStyleStart(builder) - -def SnapMarkerStyleAddShape(builder, shape): - builder.PrependUint8Slot(0, shape, None) - -def AddShape(builder, shape): - SnapMarkerStyleAddShape(builder, shape) - -def SnapMarkerStyleAddColor(builder, color): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(color), 0) - -def AddColor(builder, color): - SnapMarkerStyleAddColor(builder, color) - -def SnapMarkerStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return SnapMarkerStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/SnapMarkerStyleEntry.py b/packages/ducpy/src/ducpy/Duc/SnapMarkerStyleEntry.py deleted file mode 100644 index 4ac6b228..00000000 --- a/packages/ducpy/src/ducpy/Duc/SnapMarkerStyleEntry.py +++ /dev/null @@ -1,71 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class SnapMarkerStyleEntry(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = SnapMarkerStyleEntry() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsSnapMarkerStyleEntry(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def SnapMarkerStyleEntryBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # SnapMarkerStyleEntry - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # SnapMarkerStyleEntry - def Key(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # SnapMarkerStyleEntry - def Value(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.SnapMarkerStyle import SnapMarkerStyle - obj = SnapMarkerStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def SnapMarkerStyleEntryStart(builder): - builder.StartObject(2) - -def Start(builder): - SnapMarkerStyleEntryStart(builder) - -def SnapMarkerStyleEntryAddKey(builder, key): - builder.PrependUint8Slot(0, key, None) - -def AddKey(builder, key): - SnapMarkerStyleEntryAddKey(builder, key) - -def SnapMarkerStyleEntryAddValue(builder, value): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0) - -def AddValue(builder, value): - SnapMarkerStyleEntryAddValue(builder, value) - -def SnapMarkerStyleEntryEnd(builder): - return builder.EndObject() - -def End(builder): - return SnapMarkerStyleEntryEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/SnapOverride.py b/packages/ducpy/src/ducpy/Duc/SnapOverride.py deleted file mode 100644 index f6b48d6a..00000000 --- a/packages/ducpy/src/ducpy/Duc/SnapOverride.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class SnapOverride(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = SnapOverride() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsSnapOverride(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def SnapOverrideBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # SnapOverride - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # SnapOverride - def Key(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # SnapOverride - def Behavior(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def SnapOverrideStart(builder): - builder.StartObject(2) - -def Start(builder): - SnapOverrideStart(builder) - -def SnapOverrideAddKey(builder, key): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0) - -def AddKey(builder, key): - SnapOverrideAddKey(builder, key) - -def SnapOverrideAddBehavior(builder, behavior): - builder.PrependUint8Slot(1, behavior, None) - -def AddBehavior(builder, behavior): - SnapOverrideAddBehavior(builder, behavior) - -def SnapOverrideEnd(builder): - return builder.EndObject() - -def End(builder): - return SnapOverrideEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/SnapSettings.py b/packages/ducpy/src/ducpy/Duc/SnapSettings.py deleted file mode 100644 index 570f6996..00000000 --- a/packages/ducpy/src/ducpy/Duc/SnapSettings.py +++ /dev/null @@ -1,429 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class SnapSettings(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = SnapSettings() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsSnapSettings(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def SnapSettingsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # SnapSettings - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # SnapSettings - def Readonly(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # SnapSettings - def TwistAngle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # SnapSettings - def SnapTolerance(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # SnapSettings - def ObjectSnapAperture(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # SnapSettings - def IsOrthoModeOn(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # SnapSettings - def PolarTracking(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.PolarTrackingSettings import PolarTrackingSettings - obj = PolarTrackingSettings() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # SnapSettings - def IsObjectSnapOn(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # SnapSettings - def ActiveObjectSnapModes(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) - return 0 - - # SnapSettings - def ActiveObjectSnapModesAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) - return 0 - - # SnapSettings - def ActiveObjectSnapModesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # SnapSettings - def ActiveObjectSnapModesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - return o == 0 - - # SnapSettings - def SnapPriority(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) - return 0 - - # SnapSettings - def SnapPriorityAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) - return 0 - - # SnapSettings - def SnapPriorityLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # SnapSettings - def SnapPriorityIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - return o == 0 - - # SnapSettings - def ShowTrackingLines(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # SnapSettings - def TrackingLineStyle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.TrackingLineStyle import TrackingLineStyle - obj = TrackingLineStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # SnapSettings - def DynamicSnap(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DynamicSnapSettings import DynamicSnapSettings - obj = DynamicSnapSettings() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # SnapSettings - def TemporaryOverrides(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.SnapOverride import SnapOverride - obj = SnapOverride() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # SnapSettings - def TemporaryOverridesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # SnapSettings - def TemporaryOverridesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) - return o == 0 - - # SnapSettings - def IncrementalDistance(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # SnapSettings - def MagneticStrength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # SnapSettings - def LayerSnapFilters(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.LayerSnapFilters import LayerSnapFilters - obj = LayerSnapFilters() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # SnapSettings - def ElementTypeFilters(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # SnapSettings - def ElementTypeFiltersLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # SnapSettings - def ElementTypeFiltersIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) - return o == 0 - - # SnapSettings - def SnapMode(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # SnapSettings - def SnapMarkers(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.SnapMarkerSettings import SnapMarkerSettings - obj = SnapMarkerSettings() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # SnapSettings - def ConstructionSnapEnabled(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # SnapSettings - def SnapToGridIntersections(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def SnapSettingsStart(builder): - builder.StartObject(21) - -def Start(builder): - SnapSettingsStart(builder) - -def SnapSettingsAddReadonly(builder, readonly): - builder.PrependBoolSlot(0, readonly, 0) - -def AddReadonly(builder, readonly): - SnapSettingsAddReadonly(builder, readonly) - -def SnapSettingsAddTwistAngle(builder, twistAngle): - builder.PrependFloat64Slot(1, twistAngle, 0.0) - -def AddTwistAngle(builder, twistAngle): - SnapSettingsAddTwistAngle(builder, twistAngle) - -def SnapSettingsAddSnapTolerance(builder, snapTolerance): - builder.PrependInt32Slot(2, snapTolerance, 0) - -def AddSnapTolerance(builder, snapTolerance): - SnapSettingsAddSnapTolerance(builder, snapTolerance) - -def SnapSettingsAddObjectSnapAperture(builder, objectSnapAperture): - builder.PrependInt32Slot(3, objectSnapAperture, 0) - -def AddObjectSnapAperture(builder, objectSnapAperture): - SnapSettingsAddObjectSnapAperture(builder, objectSnapAperture) - -def SnapSettingsAddIsOrthoModeOn(builder, isOrthoModeOn): - builder.PrependBoolSlot(4, isOrthoModeOn, 0) - -def AddIsOrthoModeOn(builder, isOrthoModeOn): - SnapSettingsAddIsOrthoModeOn(builder, isOrthoModeOn) - -def SnapSettingsAddPolarTracking(builder, polarTracking): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(polarTracking), 0) - -def AddPolarTracking(builder, polarTracking): - SnapSettingsAddPolarTracking(builder, polarTracking) - -def SnapSettingsAddIsObjectSnapOn(builder, isObjectSnapOn): - builder.PrependBoolSlot(6, isObjectSnapOn, 0) - -def AddIsObjectSnapOn(builder, isObjectSnapOn): - SnapSettingsAddIsObjectSnapOn(builder, isObjectSnapOn) - -def SnapSettingsAddActiveObjectSnapModes(builder, activeObjectSnapModes): - builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(activeObjectSnapModes), 0) - -def AddActiveObjectSnapModes(builder, activeObjectSnapModes): - SnapSettingsAddActiveObjectSnapModes(builder, activeObjectSnapModes) - -def SnapSettingsStartActiveObjectSnapModesVector(builder, numElems): - return builder.StartVector(1, numElems, 1) - -def StartActiveObjectSnapModesVector(builder, numElems): - return SnapSettingsStartActiveObjectSnapModesVector(builder, numElems) - -def SnapSettingsAddSnapPriority(builder, snapPriority): - builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(snapPriority), 0) - -def AddSnapPriority(builder, snapPriority): - SnapSettingsAddSnapPriority(builder, snapPriority) - -def SnapSettingsStartSnapPriorityVector(builder, numElems): - return builder.StartVector(1, numElems, 1) - -def StartSnapPriorityVector(builder, numElems): - return SnapSettingsStartSnapPriorityVector(builder, numElems) - -def SnapSettingsAddShowTrackingLines(builder, showTrackingLines): - builder.PrependBoolSlot(9, showTrackingLines, 0) - -def AddShowTrackingLines(builder, showTrackingLines): - SnapSettingsAddShowTrackingLines(builder, showTrackingLines) - -def SnapSettingsAddTrackingLineStyle(builder, trackingLineStyle): - builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(trackingLineStyle), 0) - -def AddTrackingLineStyle(builder, trackingLineStyle): - SnapSettingsAddTrackingLineStyle(builder, trackingLineStyle) - -def SnapSettingsAddDynamicSnap(builder, dynamicSnap): - builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(dynamicSnap), 0) - -def AddDynamicSnap(builder, dynamicSnap): - SnapSettingsAddDynamicSnap(builder, dynamicSnap) - -def SnapSettingsAddTemporaryOverrides(builder, temporaryOverrides): - builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(temporaryOverrides), 0) - -def AddTemporaryOverrides(builder, temporaryOverrides): - SnapSettingsAddTemporaryOverrides(builder, temporaryOverrides) - -def SnapSettingsStartTemporaryOverridesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartTemporaryOverridesVector(builder, numElems): - return SnapSettingsStartTemporaryOverridesVector(builder, numElems) - -def SnapSettingsAddIncrementalDistance(builder, incrementalDistance): - builder.PrependFloat64Slot(13, incrementalDistance, 0.0) - -def AddIncrementalDistance(builder, incrementalDistance): - SnapSettingsAddIncrementalDistance(builder, incrementalDistance) - -def SnapSettingsAddMagneticStrength(builder, magneticStrength): - builder.PrependFloat64Slot(14, magneticStrength, 0.0) - -def AddMagneticStrength(builder, magneticStrength): - SnapSettingsAddMagneticStrength(builder, magneticStrength) - -def SnapSettingsAddLayerSnapFilters(builder, layerSnapFilters): - builder.PrependUOffsetTRelativeSlot(15, flatbuffers.number_types.UOffsetTFlags.py_type(layerSnapFilters), 0) - -def AddLayerSnapFilters(builder, layerSnapFilters): - SnapSettingsAddLayerSnapFilters(builder, layerSnapFilters) - -def SnapSettingsAddElementTypeFilters(builder, elementTypeFilters): - builder.PrependUOffsetTRelativeSlot(16, flatbuffers.number_types.UOffsetTFlags.py_type(elementTypeFilters), 0) - -def AddElementTypeFilters(builder, elementTypeFilters): - SnapSettingsAddElementTypeFilters(builder, elementTypeFilters) - -def SnapSettingsStartElementTypeFiltersVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartElementTypeFiltersVector(builder, numElems): - return SnapSettingsStartElementTypeFiltersVector(builder, numElems) - -def SnapSettingsAddSnapMode(builder, snapMode): - builder.PrependUint8Slot(17, snapMode, None) - -def AddSnapMode(builder, snapMode): - SnapSettingsAddSnapMode(builder, snapMode) - -def SnapSettingsAddSnapMarkers(builder, snapMarkers): - builder.PrependUOffsetTRelativeSlot(18, flatbuffers.number_types.UOffsetTFlags.py_type(snapMarkers), 0) - -def AddSnapMarkers(builder, snapMarkers): - SnapSettingsAddSnapMarkers(builder, snapMarkers) - -def SnapSettingsAddConstructionSnapEnabled(builder, constructionSnapEnabled): - builder.PrependBoolSlot(19, constructionSnapEnabled, 0) - -def AddConstructionSnapEnabled(builder, constructionSnapEnabled): - SnapSettingsAddConstructionSnapEnabled(builder, constructionSnapEnabled) - -def SnapSettingsAddSnapToGridIntersections(builder, snapToGridIntersections): - builder.PrependBoolSlot(20, snapToGridIntersections, 0) - -def AddSnapToGridIntersections(builder, snapToGridIntersections): - SnapSettingsAddSnapToGridIntersections(builder, snapToGridIntersections) - -def SnapSettingsEnd(builder): - return builder.EndObject() - -def End(builder): - return SnapSettingsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/StackFormat.py b/packages/ducpy/src/ducpy/Duc/StackFormat.py deleted file mode 100644 index 535c4c53..00000000 --- a/packages/ducpy/src/ducpy/Duc/StackFormat.py +++ /dev/null @@ -1,103 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class StackFormat(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = StackFormat() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsStackFormat(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def StackFormatBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # StackFormat - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # StackFormat - def AutoStack(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # StackFormat - def StackChars(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # StackFormat - def StackCharsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StackFormat - def StackCharsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - return o == 0 - - # StackFormat - def Properties(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.StackFormatProperties import StackFormatProperties - obj = StackFormatProperties() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def StackFormatStart(builder): - builder.StartObject(3) - -def Start(builder): - StackFormatStart(builder) - -def StackFormatAddAutoStack(builder, autoStack): - builder.PrependBoolSlot(0, autoStack, 0) - -def AddAutoStack(builder, autoStack): - StackFormatAddAutoStack(builder, autoStack) - -def StackFormatAddStackChars(builder, stackChars): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(stackChars), 0) - -def AddStackChars(builder, stackChars): - StackFormatAddStackChars(builder, stackChars) - -def StackFormatStartStackCharsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartStackCharsVector(builder, numElems): - return StackFormatStartStackCharsVector(builder, numElems) - -def StackFormatAddProperties(builder, properties): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(properties), 0) - -def AddProperties(builder, properties): - StackFormatAddProperties(builder, properties) - -def StackFormatEnd(builder): - return builder.EndObject() - -def End(builder): - return StackFormatEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/StackFormatProperties.py b/packages/ducpy/src/ducpy/Duc/StackFormatProperties.py deleted file mode 100644 index fe99774b..00000000 --- a/packages/ducpy/src/ducpy/Duc/StackFormatProperties.py +++ /dev/null @@ -1,80 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class StackFormatProperties(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = StackFormatProperties() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsStackFormatProperties(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def StackFormatPropertiesBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # StackFormatProperties - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # StackFormatProperties - def UpperScale(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # StackFormatProperties - def LowerScale(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # StackFormatProperties - def Alignment(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def StackFormatPropertiesStart(builder): - builder.StartObject(3) - -def Start(builder): - StackFormatPropertiesStart(builder) - -def StackFormatPropertiesAddUpperScale(builder, upperScale): - builder.PrependFloat64Slot(0, upperScale, 0.0) - -def AddUpperScale(builder, upperScale): - StackFormatPropertiesAddUpperScale(builder, upperScale) - -def StackFormatPropertiesAddLowerScale(builder, lowerScale): - builder.PrependFloat64Slot(1, lowerScale, 0.0) - -def AddLowerScale(builder, lowerScale): - StackFormatPropertiesAddLowerScale(builder, lowerScale) - -def StackFormatPropertiesAddAlignment(builder, alignment): - builder.PrependUint8Slot(2, alignment, None) - -def AddAlignment(builder, alignment): - StackFormatPropertiesAddAlignment(builder, alignment) - -def StackFormatPropertiesEnd(builder): - return builder.EndObject() - -def End(builder): - return StackFormatPropertiesEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/Standard.py b/packages/ducpy/src/ducpy/Duc/Standard.py deleted file mode 100644 index 055db6f4..00000000 --- a/packages/ducpy/src/ducpy/Duc/Standard.py +++ /dev/null @@ -1,169 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class Standard(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = Standard() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsStandard(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def StandardBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # Standard - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # Standard - def Identifier(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.Identifier import Identifier - obj = Identifier() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # Standard - def Version(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # Standard - def Readonly(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # Standard - def Overrides(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.StandardOverrides import StandardOverrides - obj = StandardOverrides() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # Standard - def Styles(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.StandardStyles import StandardStyles - obj = StandardStyles() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # Standard - def ViewSettings(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.StandardViewSettings import StandardViewSettings - obj = StandardViewSettings() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # Standard - def Units(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.StandardUnits import StandardUnits - obj = StandardUnits() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # Standard - def Validation(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.StandardValidation import StandardValidation - obj = StandardValidation() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def StandardStart(builder): - builder.StartObject(8) - -def Start(builder): - StandardStart(builder) - -def StandardAddIdentifier(builder, identifier): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(identifier), 0) - -def AddIdentifier(builder, identifier): - StandardAddIdentifier(builder, identifier) - -def StandardAddVersion(builder, version): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(version), 0) - -def AddVersion(builder, version): - StandardAddVersion(builder, version) - -def StandardAddReadonly(builder, readonly): - builder.PrependBoolSlot(2, readonly, 0) - -def AddReadonly(builder, readonly): - StandardAddReadonly(builder, readonly) - -def StandardAddOverrides(builder, overrides): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(overrides), 0) - -def AddOverrides(builder, overrides): - StandardAddOverrides(builder, overrides) - -def StandardAddStyles(builder, styles): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(styles), 0) - -def AddStyles(builder, styles): - StandardAddStyles(builder, styles) - -def StandardAddViewSettings(builder, viewSettings): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(viewSettings), 0) - -def AddViewSettings(builder, viewSettings): - StandardAddViewSettings(builder, viewSettings) - -def StandardAddUnits(builder, units): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(units), 0) - -def AddUnits(builder, units): - StandardAddUnits(builder, units) - -def StandardAddValidation(builder, validation): - builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(validation), 0) - -def AddValidation(builder, validation): - StandardAddValidation(builder, validation) - -def StandardEnd(builder): - return builder.EndObject() - -def End(builder): - return StandardEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/StandardOverrides.py b/packages/ducpy/src/ducpy/Duc/StandardOverrides.py deleted file mode 100644 index 148f3d88..00000000 --- a/packages/ducpy/src/ducpy/Duc/StandardOverrides.py +++ /dev/null @@ -1,285 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class StandardOverrides(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = StandardOverrides() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsStandardOverrides(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def StandardOverridesBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # StandardOverrides - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # StandardOverrides - def MainScope(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def ElementsStrokeWidthOverride(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # StandardOverrides - def CommonStyleId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def StackLikeStyleId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def TextStyleId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def DimensionStyleId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def LeaderStyleId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def FeatureControlFrameStyleId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def TableStyleId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def DocStyleId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def ViewportStyleId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def PlotStyleId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def HatchStyleId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def ActiveGridSettingsId(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # StandardOverrides - def ActiveGridSettingsIdLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardOverrides - def ActiveGridSettingsIdIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) - return o == 0 - - # StandardOverrides - def ActiveSnapSettingsId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def DashLineOverride(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StandardOverrides - def UnitPrecision(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.UnitPrecision import UnitPrecision - obj = UnitPrecision() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def StandardOverridesStart(builder): - builder.StartObject(17) - -def Start(builder): - StandardOverridesStart(builder) - -def StandardOverridesAddMainScope(builder, mainScope): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(mainScope), 0) - -def AddMainScope(builder, mainScope): - StandardOverridesAddMainScope(builder, mainScope) - -def StandardOverridesAddElementsStrokeWidthOverride(builder, elementsStrokeWidthOverride): - builder.PrependFloat64Slot(1, elementsStrokeWidthOverride, 0.0) - -def AddElementsStrokeWidthOverride(builder, elementsStrokeWidthOverride): - StandardOverridesAddElementsStrokeWidthOverride(builder, elementsStrokeWidthOverride) - -def StandardOverridesAddCommonStyleId(builder, commonStyleId): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(commonStyleId), 0) - -def AddCommonStyleId(builder, commonStyleId): - StandardOverridesAddCommonStyleId(builder, commonStyleId) - -def StandardOverridesAddStackLikeStyleId(builder, stackLikeStyleId): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(stackLikeStyleId), 0) - -def AddStackLikeStyleId(builder, stackLikeStyleId): - StandardOverridesAddStackLikeStyleId(builder, stackLikeStyleId) - -def StandardOverridesAddTextStyleId(builder, textStyleId): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(textStyleId), 0) - -def AddTextStyleId(builder, textStyleId): - StandardOverridesAddTextStyleId(builder, textStyleId) - -def StandardOverridesAddDimensionStyleId(builder, dimensionStyleId): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(dimensionStyleId), 0) - -def AddDimensionStyleId(builder, dimensionStyleId): - StandardOverridesAddDimensionStyleId(builder, dimensionStyleId) - -def StandardOverridesAddLeaderStyleId(builder, leaderStyleId): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(leaderStyleId), 0) - -def AddLeaderStyleId(builder, leaderStyleId): - StandardOverridesAddLeaderStyleId(builder, leaderStyleId) - -def StandardOverridesAddFeatureControlFrameStyleId(builder, featureControlFrameStyleId): - builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(featureControlFrameStyleId), 0) - -def AddFeatureControlFrameStyleId(builder, featureControlFrameStyleId): - StandardOverridesAddFeatureControlFrameStyleId(builder, featureControlFrameStyleId) - -def StandardOverridesAddTableStyleId(builder, tableStyleId): - builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(tableStyleId), 0) - -def AddTableStyleId(builder, tableStyleId): - StandardOverridesAddTableStyleId(builder, tableStyleId) - -def StandardOverridesAddDocStyleId(builder, docStyleId): - builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(docStyleId), 0) - -def AddDocStyleId(builder, docStyleId): - StandardOverridesAddDocStyleId(builder, docStyleId) - -def StandardOverridesAddViewportStyleId(builder, viewportStyleId): - builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(viewportStyleId), 0) - -def AddViewportStyleId(builder, viewportStyleId): - StandardOverridesAddViewportStyleId(builder, viewportStyleId) - -def StandardOverridesAddPlotStyleId(builder, plotStyleId): - builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(plotStyleId), 0) - -def AddPlotStyleId(builder, plotStyleId): - StandardOverridesAddPlotStyleId(builder, plotStyleId) - -def StandardOverridesAddHatchStyleId(builder, hatchStyleId): - builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(hatchStyleId), 0) - -def AddHatchStyleId(builder, hatchStyleId): - StandardOverridesAddHatchStyleId(builder, hatchStyleId) - -def StandardOverridesAddActiveGridSettingsId(builder, activeGridSettingsId): - builder.PrependUOffsetTRelativeSlot(13, flatbuffers.number_types.UOffsetTFlags.py_type(activeGridSettingsId), 0) - -def AddActiveGridSettingsId(builder, activeGridSettingsId): - StandardOverridesAddActiveGridSettingsId(builder, activeGridSettingsId) - -def StandardOverridesStartActiveGridSettingsIdVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartActiveGridSettingsIdVector(builder, numElems): - return StandardOverridesStartActiveGridSettingsIdVector(builder, numElems) - -def StandardOverridesAddActiveSnapSettingsId(builder, activeSnapSettingsId): - builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(activeSnapSettingsId), 0) - -def AddActiveSnapSettingsId(builder, activeSnapSettingsId): - StandardOverridesAddActiveSnapSettingsId(builder, activeSnapSettingsId) - -def StandardOverridesAddDashLineOverride(builder, dashLineOverride): - builder.PrependUOffsetTRelativeSlot(15, flatbuffers.number_types.UOffsetTFlags.py_type(dashLineOverride), 0) - -def AddDashLineOverride(builder, dashLineOverride): - StandardOverridesAddDashLineOverride(builder, dashLineOverride) - -def StandardOverridesAddUnitPrecision(builder, unitPrecision): - builder.PrependUOffsetTRelativeSlot(16, flatbuffers.number_types.UOffsetTFlags.py_type(unitPrecision), 0) - -def AddUnitPrecision(builder, unitPrecision): - StandardOverridesAddUnitPrecision(builder, unitPrecision) - -def StandardOverridesEnd(builder): - return builder.EndObject() - -def End(builder): - return StandardOverridesEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/StandardStyles.py b/packages/ducpy/src/ducpy/Duc/StandardStyles.py deleted file mode 100644 index c221bf3b..00000000 --- a/packages/ducpy/src/ducpy/Duc/StandardStyles.py +++ /dev/null @@ -1,448 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class StandardStyles(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = StandardStyles() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsStandardStyles(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def StandardStylesBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # StandardStyles - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # StandardStyles - def CommonStyles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedCommonStyle import IdentifiedCommonStyle - obj = IdentifiedCommonStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardStyles - def CommonStylesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardStyles - def CommonStylesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - return o == 0 - - # StandardStyles - def StackLikeStyles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedStackLikeStyle import IdentifiedStackLikeStyle - obj = IdentifiedStackLikeStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardStyles - def StackLikeStylesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardStyles - def StackLikeStylesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - return o == 0 - - # StandardStyles - def TextStyles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedTextStyle import IdentifiedTextStyle - obj = IdentifiedTextStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardStyles - def TextStylesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardStyles - def TextStylesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - - # StandardStyles - def DimensionStyles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedDimensionStyle import IdentifiedDimensionStyle - obj = IdentifiedDimensionStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardStyles - def DimensionStylesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardStyles - def DimensionStylesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - - # StandardStyles - def LeaderStyles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedLeaderStyle import IdentifiedLeaderStyle - obj = IdentifiedLeaderStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardStyles - def LeaderStylesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardStyles - def LeaderStylesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - return o == 0 - - # StandardStyles - def FeatureControlFrameStyles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedFCFStyle import IdentifiedFCFStyle - obj = IdentifiedFCFStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardStyles - def FeatureControlFrameStylesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardStyles - def FeatureControlFrameStylesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - return o == 0 - - # StandardStyles - def TableStyles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedTableStyle import IdentifiedTableStyle - obj = IdentifiedTableStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardStyles - def TableStylesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardStyles - def TableStylesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - return o == 0 - - # StandardStyles - def DocStyles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedDocStyle import IdentifiedDocStyle - obj = IdentifiedDocStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardStyles - def DocStylesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardStyles - def DocStylesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - return o == 0 - - # StandardStyles - def ViewportStyles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedViewportStyle import IdentifiedViewportStyle - obj = IdentifiedViewportStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardStyles - def ViewportStylesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardStyles - def ViewportStylesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - return o == 0 - - # StandardStyles - def HatchStyles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedHatchStyle import IdentifiedHatchStyle - obj = IdentifiedHatchStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardStyles - def HatchStylesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardStyles - def HatchStylesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - return o == 0 - - # StandardStyles - def XrayStyles(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedXRayStyle import IdentifiedXRayStyle - obj = IdentifiedXRayStyle() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardStyles - def XrayStylesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardStyles - def XrayStylesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - return o == 0 - -def StandardStylesStart(builder): - builder.StartObject(11) - -def Start(builder): - StandardStylesStart(builder) - -def StandardStylesAddCommonStyles(builder, commonStyles): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(commonStyles), 0) - -def AddCommonStyles(builder, commonStyles): - StandardStylesAddCommonStyles(builder, commonStyles) - -def StandardStylesStartCommonStylesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartCommonStylesVector(builder, numElems): - return StandardStylesStartCommonStylesVector(builder, numElems) - -def StandardStylesAddStackLikeStyles(builder, stackLikeStyles): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(stackLikeStyles), 0) - -def AddStackLikeStyles(builder, stackLikeStyles): - StandardStylesAddStackLikeStyles(builder, stackLikeStyles) - -def StandardStylesStartStackLikeStylesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartStackLikeStylesVector(builder, numElems): - return StandardStylesStartStackLikeStylesVector(builder, numElems) - -def StandardStylesAddTextStyles(builder, textStyles): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(textStyles), 0) - -def AddTextStyles(builder, textStyles): - StandardStylesAddTextStyles(builder, textStyles) - -def StandardStylesStartTextStylesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartTextStylesVector(builder, numElems): - return StandardStylesStartTextStylesVector(builder, numElems) - -def StandardStylesAddDimensionStyles(builder, dimensionStyles): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(dimensionStyles), 0) - -def AddDimensionStyles(builder, dimensionStyles): - StandardStylesAddDimensionStyles(builder, dimensionStyles) - -def StandardStylesStartDimensionStylesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartDimensionStylesVector(builder, numElems): - return StandardStylesStartDimensionStylesVector(builder, numElems) - -def StandardStylesAddLeaderStyles(builder, leaderStyles): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(leaderStyles), 0) - -def AddLeaderStyles(builder, leaderStyles): - StandardStylesAddLeaderStyles(builder, leaderStyles) - -def StandardStylesStartLeaderStylesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartLeaderStylesVector(builder, numElems): - return StandardStylesStartLeaderStylesVector(builder, numElems) - -def StandardStylesAddFeatureControlFrameStyles(builder, featureControlFrameStyles): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(featureControlFrameStyles), 0) - -def AddFeatureControlFrameStyles(builder, featureControlFrameStyles): - StandardStylesAddFeatureControlFrameStyles(builder, featureControlFrameStyles) - -def StandardStylesStartFeatureControlFrameStylesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartFeatureControlFrameStylesVector(builder, numElems): - return StandardStylesStartFeatureControlFrameStylesVector(builder, numElems) - -def StandardStylesAddTableStyles(builder, tableStyles): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(tableStyles), 0) - -def AddTableStyles(builder, tableStyles): - StandardStylesAddTableStyles(builder, tableStyles) - -def StandardStylesStartTableStylesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartTableStylesVector(builder, numElems): - return StandardStylesStartTableStylesVector(builder, numElems) - -def StandardStylesAddDocStyles(builder, docStyles): - builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(docStyles), 0) - -def AddDocStyles(builder, docStyles): - StandardStylesAddDocStyles(builder, docStyles) - -def StandardStylesStartDocStylesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartDocStylesVector(builder, numElems): - return StandardStylesStartDocStylesVector(builder, numElems) - -def StandardStylesAddViewportStyles(builder, viewportStyles): - builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(viewportStyles), 0) - -def AddViewportStyles(builder, viewportStyles): - StandardStylesAddViewportStyles(builder, viewportStyles) - -def StandardStylesStartViewportStylesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartViewportStylesVector(builder, numElems): - return StandardStylesStartViewportStylesVector(builder, numElems) - -def StandardStylesAddHatchStyles(builder, hatchStyles): - builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(hatchStyles), 0) - -def AddHatchStyles(builder, hatchStyles): - StandardStylesAddHatchStyles(builder, hatchStyles) - -def StandardStylesStartHatchStylesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartHatchStylesVector(builder, numElems): - return StandardStylesStartHatchStylesVector(builder, numElems) - -def StandardStylesAddXrayStyles(builder, xrayStyles): - builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(xrayStyles), 0) - -def AddXrayStyles(builder, xrayStyles): - StandardStylesAddXrayStyles(builder, xrayStyles) - -def StandardStylesStartXrayStylesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartXrayStylesVector(builder, numElems): - return StandardStylesStartXrayStylesVector(builder, numElems) - -def StandardStylesEnd(builder): - return builder.EndObject() - -def End(builder): - return StandardStylesEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/StandardUnits.py b/packages/ducpy/src/ducpy/Duc/StandardUnits.py deleted file mode 100644 index bed970fc..00000000 --- a/packages/ducpy/src/ducpy/Duc/StandardUnits.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class StandardUnits(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = StandardUnits() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsStandardUnits(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def StandardUnitsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # StandardUnits - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # StandardUnits - def PrimaryUnits(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.PrimaryUnits import PrimaryUnits - obj = PrimaryUnits() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardUnits - def AlternateUnits(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.AlternateUnits import AlternateUnits - obj = AlternateUnits() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def StandardUnitsStart(builder): - builder.StartObject(2) - -def Start(builder): - StandardUnitsStart(builder) - -def StandardUnitsAddPrimaryUnits(builder, primaryUnits): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(primaryUnits), 0) - -def AddPrimaryUnits(builder, primaryUnits): - StandardUnitsAddPrimaryUnits(builder, primaryUnits) - -def StandardUnitsAddAlternateUnits(builder, alternateUnits): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(alternateUnits), 0) - -def AddAlternateUnits(builder, alternateUnits): - StandardUnitsAddAlternateUnits(builder, alternateUnits) - -def StandardUnitsEnd(builder): - return builder.EndObject() - -def End(builder): - return StandardUnitsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/StandardValidation.py b/packages/ducpy/src/ducpy/Duc/StandardValidation.py deleted file mode 100644 index 20c5cc5a..00000000 --- a/packages/ducpy/src/ducpy/Duc/StandardValidation.py +++ /dev/null @@ -1,75 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class StandardValidation(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = StandardValidation() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsStandardValidation(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def StandardValidationBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # StandardValidation - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # StandardValidation - def DimensionRules(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DimensionValidationRules import DimensionValidationRules - obj = DimensionValidationRules() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardValidation - def LayerRules(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.LayerValidationRules import LayerValidationRules - obj = LayerValidationRules() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def StandardValidationStart(builder): - builder.StartObject(2) - -def Start(builder): - StandardValidationStart(builder) - -def StandardValidationAddDimensionRules(builder, dimensionRules): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(dimensionRules), 0) - -def AddDimensionRules(builder, dimensionRules): - StandardValidationAddDimensionRules(builder, dimensionRules) - -def StandardValidationAddLayerRules(builder, layerRules): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(layerRules), 0) - -def AddLayerRules(builder, layerRules): - StandardValidationAddLayerRules(builder, layerRules) - -def StandardValidationEnd(builder): - return builder.EndObject() - -def End(builder): - return StandardValidationEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/StandardViewSettings.py b/packages/ducpy/src/ducpy/Duc/StandardViewSettings.py deleted file mode 100644 index fdccce1d..00000000 --- a/packages/ducpy/src/ducpy/Duc/StandardViewSettings.py +++ /dev/null @@ -1,189 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class StandardViewSettings(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = StandardViewSettings() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsStandardViewSettings(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def StandardViewSettingsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # StandardViewSettings - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # StandardViewSettings - def Views(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedView import IdentifiedView - obj = IdentifiedView() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardViewSettings - def ViewsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardViewSettings - def ViewsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - return o == 0 - - # StandardViewSettings - def Ucs(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedUcs import IdentifiedUcs - obj = IdentifiedUcs() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardViewSettings - def UcsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardViewSettings - def UcsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - return o == 0 - - # StandardViewSettings - def GridSettings(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedGridSettings import IdentifiedGridSettings - obj = IdentifiedGridSettings() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardViewSettings - def GridSettingsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardViewSettings - def GridSettingsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - - # StandardViewSettings - def SnapSettings(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.IdentifiedSnapSettings import IdentifiedSnapSettings - obj = IdentifiedSnapSettings() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # StandardViewSettings - def SnapSettingsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StandardViewSettings - def SnapSettingsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - -def StandardViewSettingsStart(builder): - builder.StartObject(4) - -def Start(builder): - StandardViewSettingsStart(builder) - -def StandardViewSettingsAddViews(builder, views): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(views), 0) - -def AddViews(builder, views): - StandardViewSettingsAddViews(builder, views) - -def StandardViewSettingsStartViewsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartViewsVector(builder, numElems): - return StandardViewSettingsStartViewsVector(builder, numElems) - -def StandardViewSettingsAddUcs(builder, ucs): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(ucs), 0) - -def AddUcs(builder, ucs): - StandardViewSettingsAddUcs(builder, ucs) - -def StandardViewSettingsStartUcsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartUcsVector(builder, numElems): - return StandardViewSettingsStartUcsVector(builder, numElems) - -def StandardViewSettingsAddGridSettings(builder, gridSettings): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(gridSettings), 0) - -def AddGridSettings(builder, gridSettings): - StandardViewSettingsAddGridSettings(builder, gridSettings) - -def StandardViewSettingsStartGridSettingsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartGridSettingsVector(builder, numElems): - return StandardViewSettingsStartGridSettingsVector(builder, numElems) - -def StandardViewSettingsAddSnapSettings(builder, snapSettings): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(snapSettings), 0) - -def AddSnapSettings(builder, snapSettings): - StandardViewSettingsAddSnapSettings(builder, snapSettings) - -def StandardViewSettingsStartSnapSettingsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartSnapSettingsVector(builder, numElems): - return StandardViewSettingsStartSnapSettingsVector(builder, numElems) - -def StandardViewSettingsEnd(builder): - return builder.EndObject() - -def End(builder): - return StandardViewSettingsEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/StringValueEntry.py b/packages/ducpy/src/ducpy/Duc/StringValueEntry.py deleted file mode 100644 index 6529bee4..00000000 --- a/packages/ducpy/src/ducpy/Duc/StringValueEntry.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class StringValueEntry(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = StringValueEntry() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsStringValueEntry(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def StringValueEntryBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # StringValueEntry - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # StringValueEntry - def Key(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StringValueEntry - def Value(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def StringValueEntryStart(builder): - builder.StartObject(2) - -def Start(builder): - StringValueEntryStart(builder) - -def StringValueEntryAddKey(builder, key): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0) - -def AddKey(builder, key): - StringValueEntryAddKey(builder, key) - -def StringValueEntryAddValue(builder, value): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0) - -def AddValue(builder, value): - StringValueEntryAddValue(builder, value) - -def StringValueEntryEnd(builder): - return builder.EndObject() - -def End(builder): - return StringValueEntryEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/StrokeSides.py b/packages/ducpy/src/ducpy/Duc/StrokeSides.py deleted file mode 100644 index c364cdbb..00000000 --- a/packages/ducpy/src/ducpy/Duc/StrokeSides.py +++ /dev/null @@ -1,93 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class StrokeSides(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = StrokeSides() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsStrokeSides(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def StrokeSidesBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # StrokeSides - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # StrokeSides - def Preference(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # StrokeSides - def Values(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) - return 0 - - # StrokeSides - def ValuesAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o) - return 0 - - # StrokeSides - def ValuesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StrokeSides - def ValuesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - return o == 0 - -def StrokeSidesStart(builder): - builder.StartObject(2) - -def Start(builder): - StrokeSidesStart(builder) - -def StrokeSidesAddPreference(builder, preference): - builder.PrependUint8Slot(0, preference, None) - -def AddPreference(builder, preference): - StrokeSidesAddPreference(builder, preference) - -def StrokeSidesAddValues(builder, values): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0) - -def AddValues(builder, values): - StrokeSidesAddValues(builder, values) - -def StrokeSidesStartValuesVector(builder, numElems): - return builder.StartVector(8, numElems, 8) - -def StartValuesVector(builder, numElems): - return StrokeSidesStartValuesVector(builder, numElems) - -def StrokeSidesEnd(builder): - return builder.EndObject() - -def End(builder): - return StrokeSidesEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/StrokeStyle.py b/packages/ducpy/src/ducpy/Duc/StrokeStyle.py deleted file mode 100644 index 72a8904e..00000000 --- a/packages/ducpy/src/ducpy/Duc/StrokeStyle.py +++ /dev/null @@ -1,158 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class StrokeStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = StrokeStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsStrokeStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def StrokeStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # StrokeStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # StrokeStyle - def Preference(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # StrokeStyle - def Cap(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # StrokeStyle - def Join(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # StrokeStyle - def Dash(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) - return 0 - - # StrokeStyle - def DashAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o) - return 0 - - # StrokeStyle - def DashLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # StrokeStyle - def DashIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - - # StrokeStyle - def DashLineOverride(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # StrokeStyle - def DashCap(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # StrokeStyle - def MiterLimit(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return None - -def StrokeStyleStart(builder): - builder.StartObject(7) - -def Start(builder): - StrokeStyleStart(builder) - -def StrokeStyleAddPreference(builder, preference): - builder.PrependUint8Slot(0, preference, None) - -def AddPreference(builder, preference): - StrokeStyleAddPreference(builder, preference) - -def StrokeStyleAddCap(builder, cap): - builder.PrependUint8Slot(1, cap, None) - -def AddCap(builder, cap): - StrokeStyleAddCap(builder, cap) - -def StrokeStyleAddJoin(builder, join): - builder.PrependUint8Slot(2, join, None) - -def AddJoin(builder, join): - StrokeStyleAddJoin(builder, join) - -def StrokeStyleAddDash(builder, dash): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(dash), 0) - -def AddDash(builder, dash): - StrokeStyleAddDash(builder, dash) - -def StrokeStyleStartDashVector(builder, numElems): - return builder.StartVector(8, numElems, 8) - -def StartDashVector(builder, numElems): - return StrokeStyleStartDashVector(builder, numElems) - -def StrokeStyleAddDashLineOverride(builder, dashLineOverride): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(dashLineOverride), 0) - -def AddDashLineOverride(builder, dashLineOverride): - StrokeStyleAddDashLineOverride(builder, dashLineOverride) - -def StrokeStyleAddDashCap(builder, dashCap): - builder.PrependUint8Slot(5, dashCap, None) - -def AddDashCap(builder, dashCap): - StrokeStyleAddDashCap(builder, dashCap) - -def StrokeStyleAddMiterLimit(builder, miterLimit): - builder.PrependFloat64Slot(6, miterLimit, None) - -def AddMiterLimit(builder, miterLimit): - StrokeStyleAddMiterLimit(builder, miterLimit) - -def StrokeStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return StrokeStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/TABLE_CELL_ALIGNMENT.py b/packages/ducpy/src/ducpy/Duc/TABLE_CELL_ALIGNMENT.py deleted file mode 100644 index 649399b5..00000000 --- a/packages/ducpy/src/ducpy/Duc/TABLE_CELL_ALIGNMENT.py +++ /dev/null @@ -1,14 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class TABLE_CELL_ALIGNMENT(object): - TOP_LEFT = 10 - TOP_CENTER = 11 - TOP_RIGHT = 12 - MIDDLE_LEFT = 13 - MIDDLE_CENTER = 14 - MIDDLE_RIGHT = 15 - BOTTOM_LEFT = 16 - BOTTOM_CENTER = 17 - BOTTOM_RIGHT = 18 diff --git a/packages/ducpy/src/ducpy/Duc/TABLE_FLOW_DIRECTION.py b/packages/ducpy/src/ducpy/Duc/TABLE_FLOW_DIRECTION.py deleted file mode 100644 index 2784d88f..00000000 --- a/packages/ducpy/src/ducpy/Duc/TABLE_FLOW_DIRECTION.py +++ /dev/null @@ -1,7 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class TABLE_FLOW_DIRECTION(object): - DOWN = 10 - UP = 11 diff --git a/packages/ducpy/src/ducpy/Duc/TEXT_ALIGN.py b/packages/ducpy/src/ducpy/Duc/TEXT_ALIGN.py deleted file mode 100644 index 3b97e39f..00000000 --- a/packages/ducpy/src/ducpy/Duc/TEXT_ALIGN.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class TEXT_ALIGN(object): - LEFT = 10 - CENTER = 11 - RIGHT = 12 diff --git a/packages/ducpy/src/ducpy/Duc/TEXT_FIELD_SOURCE_PROPERTY.py b/packages/ducpy/src/ducpy/Duc/TEXT_FIELD_SOURCE_PROPERTY.py deleted file mode 100644 index b897ae88..00000000 --- a/packages/ducpy/src/ducpy/Duc/TEXT_FIELD_SOURCE_PROPERTY.py +++ /dev/null @@ -1,16 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class TEXT_FIELD_SOURCE_PROPERTY(object): - AREA = 10 - PERIMETER = 11 - VOLUME = 12 - LENGTH = 13 - WIDTH = 14 - HEIGHT = 15 - RADIUS = 16 - DIAMETER = 17 - X_COORDINATE = 18 - Y_COORDINATE = 19 - LABEL = 20 diff --git a/packages/ducpy/src/ducpy/Duc/TEXT_FIELD_SOURCE_TYPE.py b/packages/ducpy/src/ducpy/Duc/TEXT_FIELD_SOURCE_TYPE.py deleted file mode 100644 index fe9e26e7..00000000 --- a/packages/ducpy/src/ducpy/Duc/TEXT_FIELD_SOURCE_TYPE.py +++ /dev/null @@ -1,7 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class TEXT_FIELD_SOURCE_TYPE(object): - ELEMENT = 10 - DICTIONARY = 20 diff --git a/packages/ducpy/src/ducpy/Duc/TEXT_FLOW_DIRECTION.py b/packages/ducpy/src/ducpy/Duc/TEXT_FLOW_DIRECTION.py deleted file mode 100644 index 23e8173b..00000000 --- a/packages/ducpy/src/ducpy/Duc/TEXT_FLOW_DIRECTION.py +++ /dev/null @@ -1,9 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class TEXT_FLOW_DIRECTION(object): - LEFT_TO_RIGHT = 10 - RIGHT_TO_LEFT = 11 - TOP_TO_BOTTOM = 12 - BOTTOM_TO_TOP = 13 diff --git a/packages/ducpy/src/ducpy/Duc/TOLERANCE_DISPLAY.py b/packages/ducpy/src/ducpy/Duc/TOLERANCE_DISPLAY.py deleted file mode 100644 index 328d5cd9..00000000 --- a/packages/ducpy/src/ducpy/Duc/TOLERANCE_DISPLAY.py +++ /dev/null @@ -1,10 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class TOLERANCE_DISPLAY(object): - NONE = 10 - SYMMETRICAL = 11 - DEVIATION = 12 - LIMITS = 13 - BASIC = 14 diff --git a/packages/ducpy/src/ducpy/Duc/TOLERANCE_TYPE.py b/packages/ducpy/src/ducpy/Duc/TOLERANCE_TYPE.py deleted file mode 100644 index 87e79dc7..00000000 --- a/packages/ducpy/src/ducpy/Duc/TOLERANCE_TYPE.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class TOLERANCE_TYPE(object): - SINGLE = 10 - COMPOSITE = 11 - MULTIPLE = 12 diff --git a/packages/ducpy/src/ducpy/Duc/TOLERANCE_ZONE_TYPE.py b/packages/ducpy/src/ducpy/Duc/TOLERANCE_ZONE_TYPE.py deleted file mode 100644 index 65c37be5..00000000 --- a/packages/ducpy/src/ducpy/Duc/TOLERANCE_ZONE_TYPE.py +++ /dev/null @@ -1,10 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class TOLERANCE_ZONE_TYPE(object): - CYLINDRICAL = 10 - SPHERICAL = 11 - RECTANGULAR = 12 - LINEAR = 13 - CIRCULAR = 14 diff --git a/packages/ducpy/src/ducpy/Duc/TextColumn.py b/packages/ducpy/src/ducpy/Duc/TextColumn.py deleted file mode 100644 index d3f516a9..00000000 --- a/packages/ducpy/src/ducpy/Duc/TextColumn.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class TextColumn(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = TextColumn() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsTextColumn(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def TextColumnBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # TextColumn - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # TextColumn - def Width(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # TextColumn - def Gutter(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def TextColumnStart(builder): - builder.StartObject(2) - -def Start(builder): - TextColumnStart(builder) - -def TextColumnAddWidth(builder, width): - builder.PrependFloat64Slot(0, width, 0.0) - -def AddWidth(builder, width): - TextColumnAddWidth(builder, width) - -def TextColumnAddGutter(builder, gutter): - builder.PrependFloat64Slot(1, gutter, 0.0) - -def AddGutter(builder, gutter): - TextColumnAddGutter(builder, gutter) - -def TextColumnEnd(builder): - return builder.EndObject() - -def End(builder): - return TextColumnEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/TilingProperties.py b/packages/ducpy/src/ducpy/Duc/TilingProperties.py deleted file mode 100644 index 997e71ef..00000000 --- a/packages/ducpy/src/ducpy/Duc/TilingProperties.py +++ /dev/null @@ -1,106 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class TilingProperties(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = TilingProperties() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsTilingProperties(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def TilingPropertiesBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # TilingProperties - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # TilingProperties - def SizeInPercent(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # TilingProperties - def Angle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # TilingProperties - def Spacing(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return None - - # TilingProperties - def OffsetX(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return None - - # TilingProperties - def OffsetY(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return None - -def TilingPropertiesStart(builder): - builder.StartObject(5) - -def Start(builder): - TilingPropertiesStart(builder) - -def TilingPropertiesAddSizeInPercent(builder, sizeInPercent): - builder.PrependFloat32Slot(0, sizeInPercent, 0.0) - -def AddSizeInPercent(builder, sizeInPercent): - TilingPropertiesAddSizeInPercent(builder, sizeInPercent) - -def TilingPropertiesAddAngle(builder, angle): - builder.PrependFloat64Slot(1, angle, 0.0) - -def AddAngle(builder, angle): - TilingPropertiesAddAngle(builder, angle) - -def TilingPropertiesAddSpacing(builder, spacing): - builder.PrependFloat64Slot(2, spacing, None) - -def AddSpacing(builder, spacing): - TilingPropertiesAddSpacing(builder, spacing) - -def TilingPropertiesAddOffsetX(builder, offsetX): - builder.PrependFloat64Slot(3, offsetX, None) - -def AddOffsetX(builder, offsetX): - TilingPropertiesAddOffsetX(builder, offsetX) - -def TilingPropertiesAddOffsetY(builder, offsetY): - builder.PrependFloat64Slot(4, offsetY, None) - -def AddOffsetY(builder, offsetY): - TilingPropertiesAddOffsetY(builder, offsetY) - -def TilingPropertiesEnd(builder): - return builder.EndObject() - -def End(builder): - return TilingPropertiesEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/ToleranceClause.py b/packages/ducpy/src/ducpy/Duc/ToleranceClause.py deleted file mode 100644 index b3818245..00000000 --- a/packages/ducpy/src/ducpy/Duc/ToleranceClause.py +++ /dev/null @@ -1,119 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class ToleranceClause(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = ToleranceClause() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsToleranceClause(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def ToleranceClauseBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # ToleranceClause - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # ToleranceClause - def Value(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # ToleranceClause - def ZoneType(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # ToleranceClause - def FeatureModifiers(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) - return 0 - - # ToleranceClause - def FeatureModifiersAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) - return 0 - - # ToleranceClause - def FeatureModifiersLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # ToleranceClause - def FeatureModifiersIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - - # ToleranceClause - def MaterialCondition(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - -def ToleranceClauseStart(builder): - builder.StartObject(4) - -def Start(builder): - ToleranceClauseStart(builder) - -def ToleranceClauseAddValue(builder, value): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0) - -def AddValue(builder, value): - ToleranceClauseAddValue(builder, value) - -def ToleranceClauseAddZoneType(builder, zoneType): - builder.PrependUint8Slot(1, zoneType, None) - -def AddZoneType(builder, zoneType): - ToleranceClauseAddZoneType(builder, zoneType) - -def ToleranceClauseAddFeatureModifiers(builder, featureModifiers): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(featureModifiers), 0) - -def AddFeatureModifiers(builder, featureModifiers): - ToleranceClauseAddFeatureModifiers(builder, featureModifiers) - -def ToleranceClauseStartFeatureModifiersVector(builder, numElems): - return builder.StartVector(1, numElems, 1) - -def StartFeatureModifiersVector(builder, numElems): - return ToleranceClauseStartFeatureModifiersVector(builder, numElems) - -def ToleranceClauseAddMaterialCondition(builder, materialCondition): - builder.PrependUint8Slot(3, materialCondition, None) - -def AddMaterialCondition(builder, materialCondition): - ToleranceClauseAddMaterialCondition(builder, materialCondition) - -def ToleranceClauseEnd(builder): - return builder.EndObject() - -def End(builder): - return ToleranceClauseEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/TrackingLineStyle.py b/packages/ducpy/src/ducpy/Duc/TrackingLineStyle.py deleted file mode 100644 index f58d2480..00000000 --- a/packages/ducpy/src/ducpy/Duc/TrackingLineStyle.py +++ /dev/null @@ -1,106 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class TrackingLineStyle(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = TrackingLineStyle() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsTrackingLineStyle(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def TrackingLineStyleBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # TrackingLineStyle - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # TrackingLineStyle - def Color(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # TrackingLineStyle - def Opacity(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # TrackingLineStyle - def DashPattern(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) - return 0 - - # TrackingLineStyle - def DashPatternAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o) - return 0 - - # TrackingLineStyle - def DashPatternLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # TrackingLineStyle - def DashPatternIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - -def TrackingLineStyleStart(builder): - builder.StartObject(3) - -def Start(builder): - TrackingLineStyleStart(builder) - -def TrackingLineStyleAddColor(builder, color): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(color), 0) - -def AddColor(builder, color): - TrackingLineStyleAddColor(builder, color) - -def TrackingLineStyleAddOpacity(builder, opacity): - builder.PrependFloat64Slot(1, opacity, 0.0) - -def AddOpacity(builder, opacity): - TrackingLineStyleAddOpacity(builder, opacity) - -def TrackingLineStyleAddDashPattern(builder, dashPattern): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(dashPattern), 0) - -def AddDashPattern(builder, dashPattern): - TrackingLineStyleAddDashPattern(builder, dashPattern) - -def TrackingLineStyleStartDashPatternVector(builder, numElems): - return builder.StartVector(8, numElems, 8) - -def StartDashPatternVector(builder, numElems): - return TrackingLineStyleStartDashPatternVector(builder, numElems) - -def TrackingLineStyleEnd(builder): - return builder.EndObject() - -def End(builder): - return TrackingLineStyleEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/UNIT_SYSTEM.py b/packages/ducpy/src/ducpy/Duc/UNIT_SYSTEM.py deleted file mode 100644 index 3a60707b..00000000 --- a/packages/ducpy/src/ducpy/Duc/UNIT_SYSTEM.py +++ /dev/null @@ -1,7 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class UNIT_SYSTEM(object): - METRIC = 10 - IMPERIAL = 11 diff --git a/packages/ducpy/src/ducpy/Duc/UnitPrecision.py b/packages/ducpy/src/ducpy/Duc/UnitPrecision.py deleted file mode 100644 index 1cc5346c..00000000 --- a/packages/ducpy/src/ducpy/Duc/UnitPrecision.py +++ /dev/null @@ -1,93 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class UnitPrecision(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = UnitPrecision() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsUnitPrecision(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def UnitPrecisionBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # UnitPrecision - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # UnitPrecision - def Linear(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # UnitPrecision - def Angular(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # UnitPrecision - def Area(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # UnitPrecision - def Volume(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - -def UnitPrecisionStart(builder): - builder.StartObject(4) - -def Start(builder): - UnitPrecisionStart(builder) - -def UnitPrecisionAddLinear(builder, linear): - builder.PrependInt32Slot(0, linear, 0) - -def AddLinear(builder, linear): - UnitPrecisionAddLinear(builder, linear) - -def UnitPrecisionAddAngular(builder, angular): - builder.PrependInt32Slot(1, angular, 0) - -def AddAngular(builder, angular): - UnitPrecisionAddAngular(builder, angular) - -def UnitPrecisionAddArea(builder, area): - builder.PrependInt32Slot(2, area, 0) - -def AddArea(builder, area): - UnitPrecisionAddArea(builder, area) - -def UnitPrecisionAddVolume(builder, volume): - builder.PrependInt32Slot(3, volume, 0) - -def AddVolume(builder, volume): - UnitPrecisionAddVolume(builder, volume) - -def UnitPrecisionEnd(builder): - return builder.EndObject() - -def End(builder): - return UnitPrecisionEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/VERTICAL_ALIGN.py b/packages/ducpy/src/ducpy/Duc/VERTICAL_ALIGN.py deleted file mode 100644 index a7f39171..00000000 --- a/packages/ducpy/src/ducpy/Duc/VERTICAL_ALIGN.py +++ /dev/null @@ -1,8 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class VERTICAL_ALIGN(object): - TOP = 10 - MIDDLE = 11 - BOTTOM = 12 diff --git a/packages/ducpy/src/ducpy/Duc/VIEWPORT_SHADE_PLOT.py b/packages/ducpy/src/ducpy/Duc/VIEWPORT_SHADE_PLOT.py deleted file mode 100644 index 8c1d2450..00000000 --- a/packages/ducpy/src/ducpy/Duc/VIEWPORT_SHADE_PLOT.py +++ /dev/null @@ -1,9 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class VIEWPORT_SHADE_PLOT(object): - AS_DISPLAYED = 10 - WIREFRAME = 11 - HIDDEN = 12 - RENDERED = 13 diff --git a/packages/ducpy/src/ducpy/Duc/VersionBase.py b/packages/ducpy/src/ducpy/Duc/VersionBase.py deleted file mode 100644 index 037cdbfb..00000000 --- a/packages/ducpy/src/ducpy/Duc/VersionBase.py +++ /dev/null @@ -1,119 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class VersionBase(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = VersionBase() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsVersionBase(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def VersionBaseBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # VersionBase - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # VersionBase - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # VersionBase - def ParentId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # VersionBase - def Timestamp(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) - return 0 - - # VersionBase - def Description(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # VersionBase - def IsManualSave(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # VersionBase - def UserId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def VersionBaseStart(builder): - builder.StartObject(6) - -def Start(builder): - VersionBaseStart(builder) - -def VersionBaseAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - VersionBaseAddId(builder, id) - -def VersionBaseAddParentId(builder, parentId): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(parentId), 0) - -def AddParentId(builder, parentId): - VersionBaseAddParentId(builder, parentId) - -def VersionBaseAddTimestamp(builder, timestamp): - builder.PrependInt64Slot(2, timestamp, 0) - -def AddTimestamp(builder, timestamp): - VersionBaseAddTimestamp(builder, timestamp) - -def VersionBaseAddDescription(builder, description): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(description), 0) - -def AddDescription(builder, description): - VersionBaseAddDescription(builder, description) - -def VersionBaseAddIsManualSave(builder, isManualSave): - builder.PrependBoolSlot(4, isManualSave, 0) - -def AddIsManualSave(builder, isManualSave): - VersionBaseAddIsManualSave(builder, isManualSave) - -def VersionBaseAddUserId(builder, userId): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(userId), 0) - -def AddUserId(builder, userId): - VersionBaseAddUserId(builder, userId) - -def VersionBaseEnd(builder): - return builder.EndObject() - -def End(builder): - return VersionBaseEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/VersionGraph.py b/packages/ducpy/src/ducpy/Duc/VersionGraph.py deleted file mode 100644 index 4886b76d..00000000 --- a/packages/ducpy/src/ducpy/Duc/VersionGraph.py +++ /dev/null @@ -1,158 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class VersionGraph(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = VersionGraph() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsVersionGraph(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def VersionGraphBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # VersionGraph - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # VersionGraph - def UserCheckpointVersionId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # VersionGraph - def LatestVersionId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # VersionGraph - def Checkpoints(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.Checkpoint import Checkpoint - obj = Checkpoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # VersionGraph - def CheckpointsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # VersionGraph - def CheckpointsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - - # VersionGraph - def Deltas(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.Delta import Delta - obj = Delta() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # VersionGraph - def DeltasLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # VersionGraph - def DeltasIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - - # VersionGraph - def Metadata(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.VersionGraphMetadata import VersionGraphMetadata - obj = VersionGraphMetadata() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def VersionGraphStart(builder): - builder.StartObject(5) - -def Start(builder): - VersionGraphStart(builder) - -def VersionGraphAddUserCheckpointVersionId(builder, userCheckpointVersionId): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(userCheckpointVersionId), 0) - -def AddUserCheckpointVersionId(builder, userCheckpointVersionId): - VersionGraphAddUserCheckpointVersionId(builder, userCheckpointVersionId) - -def VersionGraphAddLatestVersionId(builder, latestVersionId): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(latestVersionId), 0) - -def AddLatestVersionId(builder, latestVersionId): - VersionGraphAddLatestVersionId(builder, latestVersionId) - -def VersionGraphAddCheckpoints(builder, checkpoints): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(checkpoints), 0) - -def AddCheckpoints(builder, checkpoints): - VersionGraphAddCheckpoints(builder, checkpoints) - -def VersionGraphStartCheckpointsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartCheckpointsVector(builder, numElems): - return VersionGraphStartCheckpointsVector(builder, numElems) - -def VersionGraphAddDeltas(builder, deltas): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(deltas), 0) - -def AddDeltas(builder, deltas): - VersionGraphAddDeltas(builder, deltas) - -def VersionGraphStartDeltasVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartDeltasVector(builder, numElems): - return VersionGraphStartDeltasVector(builder, numElems) - -def VersionGraphAddMetadata(builder, metadata): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(metadata), 0) - -def AddMetadata(builder, metadata): - VersionGraphAddMetadata(builder, metadata) - -def VersionGraphEnd(builder): - return builder.EndObject() - -def End(builder): - return VersionGraphEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/VersionGraphMetadata.py b/packages/ducpy/src/ducpy/Duc/VersionGraphMetadata.py deleted file mode 100644 index bbe26c24..00000000 --- a/packages/ducpy/src/ducpy/Duc/VersionGraphMetadata.py +++ /dev/null @@ -1,67 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class VersionGraphMetadata(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = VersionGraphMetadata() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAsVersionGraphMetadata(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def VersionGraphMetadataBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # VersionGraphMetadata - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # VersionGraphMetadata - def LastPruned(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) - return 0 - - # VersionGraphMetadata - def TotalSize(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) - return 0 - -def VersionGraphMetadataStart(builder): - builder.StartObject(2) - -def Start(builder): - VersionGraphMetadataStart(builder) - -def VersionGraphMetadataAddLastPruned(builder, lastPruned): - builder.PrependInt64Slot(0, lastPruned, 0) - -def AddLastPruned(builder, lastPruned): - VersionGraphMetadataAddLastPruned(builder, lastPruned) - -def VersionGraphMetadataAddTotalSize(builder, totalSize): - builder.PrependInt64Slot(1, totalSize, 0) - -def AddTotalSize(builder, totalSize): - VersionGraphMetadataAddTotalSize(builder, totalSize) - -def VersionGraphMetadataEnd(builder): - return builder.EndObject() - -def End(builder): - return VersionGraphMetadataEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/YOUTUBE_STATES.py b/packages/ducpy/src/ducpy/Duc/YOUTUBE_STATES.py deleted file mode 100644 index 443fc7fd..00000000 --- a/packages/ducpy/src/ducpy/Duc/YOUTUBE_STATES.py +++ /dev/null @@ -1,11 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -class YOUTUBE_STATES(object): - UNSTARTED = -1 - ENDED = 0 - PLAYING = 1 - PAUSED = 2 - BUFFERING = 3 - CUED = 5 diff --git a/packages/ducpy/src/ducpy/Duc/_DucElementBase.py b/packages/ducpy/src/ducpy/Duc/_DucElementBase.py deleted file mode 100644 index 0fc67614..00000000 --- a/packages/ducpy/src/ducpy/Duc/_DucElementBase.py +++ /dev/null @@ -1,542 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class _DucElementBase(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = _DucElementBase() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAs_DucElementBase(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def _DucElementBaseBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # _DucElementBase - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # _DucElementBase - def Id(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # _DucElementBase - def Styles(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementStylesBase import _DucElementStylesBase - obj = _DucElementStylesBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # _DucElementBase - def X(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # _DucElementBase - def Y(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # _DucElementBase - def Width(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # _DucElementBase - def Height(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # _DucElementBase - def Angle(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # _DucElementBase - def Scope(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # _DucElementBase - def Label(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # _DucElementBase - def Description(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # _DucElementBase - def IsVisible(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # _DucElementBase - def Seed(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # _DucElementBase - def Version(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # _DucElementBase - def VersionNonce(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # _DucElementBase - def Updated(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) - return 0 - - # _DucElementBase - def Index(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # _DucElementBase - def IsPlot(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # _DucElementBase - def IsAnnotative(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # _DucElementBase - def IsDeleted(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # _DucElementBase - def GroupIds(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # _DucElementBase - def GroupIdsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # _DucElementBase - def GroupIdsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42)) - return o == 0 - - # _DucElementBase - def RegionIds(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # _DucElementBase - def RegionIdsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # _DucElementBase - def RegionIdsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44)) - return o == 0 - - # _DucElementBase - def LayerId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(46)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # _DucElementBase - def FrameId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # _DucElementBase - def BoundElements(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(50)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.BoundElement import BoundElement - obj = BoundElement() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # _DucElementBase - def BoundElementsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(50)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # _DucElementBase - def BoundElementsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(50)) - return o == 0 - - # _DucElementBase - def ZIndex(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(52)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) - return 0.0 - - # _DucElementBase - def Link(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(54)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # _DucElementBase - def Locked(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(56)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # _DucElementBase - def BlockIds(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(60)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) - return "" - - # _DucElementBase - def BlockIdsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(60)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # _DucElementBase - def BlockIdsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(60)) - return o == 0 - - # _DucElementBase - def InstanceId(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(62)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # _DucElementBase - def CustomData(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(64)) - if o != 0: - a = self._tab.Vector(o) - return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) - return 0 - - # _DucElementBase - def CustomDataAsNumpy(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(64)) - if o != 0: - return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) - return 0 - - # _DucElementBase - def CustomDataLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(64)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # _DucElementBase - def CustomDataIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(64)) - return o == 0 - -def _DucElementBaseStart(builder): - builder.StartObject(31) - -def Start(builder): - _DucElementBaseStart(builder) - -def _DucElementBaseAddId(builder, id): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) - -def AddId(builder, id): - _DucElementBaseAddId(builder, id) - -def _DucElementBaseAddStyles(builder, styles): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(styles), 0) - -def AddStyles(builder, styles): - _DucElementBaseAddStyles(builder, styles) - -def _DucElementBaseAddX(builder, x): - builder.PrependFloat64Slot(2, x, 0.0) - -def AddX(builder, x): - _DucElementBaseAddX(builder, x) - -def _DucElementBaseAddY(builder, y): - builder.PrependFloat64Slot(3, y, 0.0) - -def AddY(builder, y): - _DucElementBaseAddY(builder, y) - -def _DucElementBaseAddWidth(builder, width): - builder.PrependFloat64Slot(4, width, 0.0) - -def AddWidth(builder, width): - _DucElementBaseAddWidth(builder, width) - -def _DucElementBaseAddHeight(builder, height): - builder.PrependFloat64Slot(5, height, 0.0) - -def AddHeight(builder, height): - _DucElementBaseAddHeight(builder, height) - -def _DucElementBaseAddAngle(builder, angle): - builder.PrependFloat64Slot(6, angle, 0.0) - -def AddAngle(builder, angle): - _DucElementBaseAddAngle(builder, angle) - -def _DucElementBaseAddScope(builder, scope): - builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(scope), 0) - -def AddScope(builder, scope): - _DucElementBaseAddScope(builder, scope) - -def _DucElementBaseAddLabel(builder, label): - builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(label), 0) - -def AddLabel(builder, label): - _DucElementBaseAddLabel(builder, label) - -def _DucElementBaseAddDescription(builder, description): - builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(description), 0) - -def AddDescription(builder, description): - _DucElementBaseAddDescription(builder, description) - -def _DucElementBaseAddIsVisible(builder, isVisible): - builder.PrependBoolSlot(10, isVisible, 0) - -def AddIsVisible(builder, isVisible): - _DucElementBaseAddIsVisible(builder, isVisible) - -def _DucElementBaseAddSeed(builder, seed): - builder.PrependInt32Slot(11, seed, 0) - -def AddSeed(builder, seed): - _DucElementBaseAddSeed(builder, seed) - -def _DucElementBaseAddVersion(builder, version): - builder.PrependInt32Slot(12, version, 0) - -def AddVersion(builder, version): - _DucElementBaseAddVersion(builder, version) - -def _DucElementBaseAddVersionNonce(builder, versionNonce): - builder.PrependInt32Slot(13, versionNonce, 0) - -def AddVersionNonce(builder, versionNonce): - _DucElementBaseAddVersionNonce(builder, versionNonce) - -def _DucElementBaseAddUpdated(builder, updated): - builder.PrependInt64Slot(14, updated, 0) - -def AddUpdated(builder, updated): - _DucElementBaseAddUpdated(builder, updated) - -def _DucElementBaseAddIndex(builder, index): - builder.PrependUOffsetTRelativeSlot(15, flatbuffers.number_types.UOffsetTFlags.py_type(index), 0) - -def AddIndex(builder, index): - _DucElementBaseAddIndex(builder, index) - -def _DucElementBaseAddIsPlot(builder, isPlot): - builder.PrependBoolSlot(16, isPlot, 0) - -def AddIsPlot(builder, isPlot): - _DucElementBaseAddIsPlot(builder, isPlot) - -def _DucElementBaseAddIsAnnotative(builder, isAnnotative): - builder.PrependBoolSlot(17, isAnnotative, 0) - -def AddIsAnnotative(builder, isAnnotative): - _DucElementBaseAddIsAnnotative(builder, isAnnotative) - -def _DucElementBaseAddIsDeleted(builder, isDeleted): - builder.PrependBoolSlot(18, isDeleted, 0) - -def AddIsDeleted(builder, isDeleted): - _DucElementBaseAddIsDeleted(builder, isDeleted) - -def _DucElementBaseAddGroupIds(builder, groupIds): - builder.PrependUOffsetTRelativeSlot(19, flatbuffers.number_types.UOffsetTFlags.py_type(groupIds), 0) - -def AddGroupIds(builder, groupIds): - _DucElementBaseAddGroupIds(builder, groupIds) - -def _DucElementBaseStartGroupIdsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartGroupIdsVector(builder, numElems): - return _DucElementBaseStartGroupIdsVector(builder, numElems) - -def _DucElementBaseAddRegionIds(builder, regionIds): - builder.PrependUOffsetTRelativeSlot(20, flatbuffers.number_types.UOffsetTFlags.py_type(regionIds), 0) - -def AddRegionIds(builder, regionIds): - _DucElementBaseAddRegionIds(builder, regionIds) - -def _DucElementBaseStartRegionIdsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartRegionIdsVector(builder, numElems): - return _DucElementBaseStartRegionIdsVector(builder, numElems) - -def _DucElementBaseAddLayerId(builder, layerId): - builder.PrependUOffsetTRelativeSlot(21, flatbuffers.number_types.UOffsetTFlags.py_type(layerId), 0) - -def AddLayerId(builder, layerId): - _DucElementBaseAddLayerId(builder, layerId) - -def _DucElementBaseAddFrameId(builder, frameId): - builder.PrependUOffsetTRelativeSlot(22, flatbuffers.number_types.UOffsetTFlags.py_type(frameId), 0) - -def AddFrameId(builder, frameId): - _DucElementBaseAddFrameId(builder, frameId) - -def _DucElementBaseAddBoundElements(builder, boundElements): - builder.PrependUOffsetTRelativeSlot(23, flatbuffers.number_types.UOffsetTFlags.py_type(boundElements), 0) - -def AddBoundElements(builder, boundElements): - _DucElementBaseAddBoundElements(builder, boundElements) - -def _DucElementBaseStartBoundElementsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartBoundElementsVector(builder, numElems): - return _DucElementBaseStartBoundElementsVector(builder, numElems) - -def _DucElementBaseAddZIndex(builder, zIndex): - builder.PrependFloat32Slot(24, zIndex, 0.0) - -def AddZIndex(builder, zIndex): - _DucElementBaseAddZIndex(builder, zIndex) - -def _DucElementBaseAddLink(builder, link): - builder.PrependUOffsetTRelativeSlot(25, flatbuffers.number_types.UOffsetTFlags.py_type(link), 0) - -def AddLink(builder, link): - _DucElementBaseAddLink(builder, link) - -def _DucElementBaseAddLocked(builder, locked): - builder.PrependBoolSlot(26, locked, 0) - -def AddLocked(builder, locked): - _DucElementBaseAddLocked(builder, locked) - -def _DucElementBaseAddBlockIds(builder, blockIds): - builder.PrependUOffsetTRelativeSlot(28, flatbuffers.number_types.UOffsetTFlags.py_type(blockIds), 0) - -def AddBlockIds(builder, blockIds): - _DucElementBaseAddBlockIds(builder, blockIds) - -def _DucElementBaseStartBlockIdsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartBlockIdsVector(builder, numElems): - return _DucElementBaseStartBlockIdsVector(builder, numElems) - -def _DucElementBaseAddInstanceId(builder, instanceId): - builder.PrependUOffsetTRelativeSlot(29, flatbuffers.number_types.UOffsetTFlags.py_type(instanceId), 0) - -def AddInstanceId(builder, instanceId): - _DucElementBaseAddInstanceId(builder, instanceId) - -def _DucElementBaseAddCustomData(builder, customData): - builder.PrependUOffsetTRelativeSlot(30, flatbuffers.number_types.UOffsetTFlags.py_type(customData), 0) - -def AddCustomData(builder, customData): - _DucElementBaseAddCustomData(builder, customData) - -def _DucElementBaseStartCustomDataVector(builder, numElems): - return builder.StartVector(1, numElems, 1) - -def StartCustomDataVector(builder, numElems): - return _DucElementBaseStartCustomDataVector(builder, numElems) - -def _DucElementBaseEnd(builder): - return builder.EndObject() - -def End(builder): - return _DucElementBaseEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/_DucElementStylesBase.py b/packages/ducpy/src/ducpy/Duc/_DucElementStylesBase.py deleted file mode 100644 index aaa0c616..00000000 --- a/packages/ducpy/src/ducpy/Duc/_DucElementStylesBase.py +++ /dev/null @@ -1,154 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class _DucElementStylesBase(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = _DucElementStylesBase() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAs_DucElementStylesBase(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def _DucElementStylesBaseBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # _DucElementStylesBase - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # _DucElementStylesBase - def Roundness(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - - # _DucElementStylesBase - def Blending(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # _DucElementStylesBase - def Background(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.ElementBackground import ElementBackground - obj = ElementBackground() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # _DucElementStylesBase - def BackgroundLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # _DucElementStylesBase - def BackgroundIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - - # _DucElementStylesBase - def Stroke(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.ElementStroke import ElementStroke - obj = ElementStroke() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # _DucElementStylesBase - def StrokeLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # _DucElementStylesBase - def StrokeIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - - # _DucElementStylesBase - def Opacity(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) - return 0.0 - -def _DucElementStylesBaseStart(builder): - builder.StartObject(5) - -def Start(builder): - _DucElementStylesBaseStart(builder) - -def _DucElementStylesBaseAddRoundness(builder, roundness): - builder.PrependFloat64Slot(0, roundness, 0.0) - -def AddRoundness(builder, roundness): - _DucElementStylesBaseAddRoundness(builder, roundness) - -def _DucElementStylesBaseAddBlending(builder, blending): - builder.PrependUint8Slot(1, blending, None) - -def AddBlending(builder, blending): - _DucElementStylesBaseAddBlending(builder, blending) - -def _DucElementStylesBaseAddBackground(builder, background): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(background), 0) - -def AddBackground(builder, background): - _DucElementStylesBaseAddBackground(builder, background) - -def _DucElementStylesBaseStartBackgroundVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartBackgroundVector(builder, numElems): - return _DucElementStylesBaseStartBackgroundVector(builder, numElems) - -def _DucElementStylesBaseAddStroke(builder, stroke): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(stroke), 0) - -def AddStroke(builder, stroke): - _DucElementStylesBaseAddStroke(builder, stroke) - -def _DucElementStylesBaseStartStrokeVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartStrokeVector(builder, numElems): - return _DucElementStylesBaseStartStrokeVector(builder, numElems) - -def _DucElementStylesBaseAddOpacity(builder, opacity): - builder.PrependFloat64Slot(4, opacity, 0.0) - -def AddOpacity(builder, opacity): - _DucElementStylesBaseAddOpacity(builder, opacity) - -def _DucElementStylesBaseEnd(builder): - return builder.EndObject() - -def End(builder): - return _DucElementStylesBaseEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/_DucLinearElementBase.py b/packages/ducpy/src/ducpy/Duc/_DucLinearElementBase.py deleted file mode 100644 index 623e622a..00000000 --- a/packages/ducpy/src/ducpy/Duc/_DucLinearElementBase.py +++ /dev/null @@ -1,220 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class _DucLinearElementBase(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = _DucLinearElementBase() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAs_DucLinearElementBase(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def _DucLinearElementBaseBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # _DucLinearElementBase - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # _DucLinearElementBase - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # _DucLinearElementBase - def Points(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucPoint import DucPoint - obj = DucPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # _DucLinearElementBase - def PointsLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # _DucLinearElementBase - def PointsIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - return o == 0 - - # _DucLinearElementBase - def Lines(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucLine import DucLine - obj = DucLine() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # _DucLinearElementBase - def LinesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # _DucLinearElementBase - def LinesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - return o == 0 - - # _DucLinearElementBase - def PathOverrides(self, j): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - x = self._tab.Vector(o) - x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 - x = self._tab.Indirect(x) - from Duc.DucPath import DucPath - obj = DucPath() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # _DucLinearElementBase - def PathOverridesLength(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return self._tab.VectorLen(o) - return 0 - - # _DucLinearElementBase - def PathOverridesIsNone(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - return o == 0 - - # _DucLinearElementBase - def LastCommittedPoint(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPoint import DucPoint - obj = DucPoint() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # _DucLinearElementBase - def StartBinding(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPointBinding import DucPointBinding - obj = DucPointBinding() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # _DucLinearElementBase - def EndBinding(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucPointBinding import DucPointBinding - obj = DucPointBinding() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def _DucLinearElementBaseStart(builder): - builder.StartObject(7) - -def Start(builder): - _DucLinearElementBaseStart(builder) - -def _DucLinearElementBaseAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - _DucLinearElementBaseAddBase(builder, base) - -def _DucLinearElementBaseAddPoints(builder, points): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(points), 0) - -def AddPoints(builder, points): - _DucLinearElementBaseAddPoints(builder, points) - -def _DucLinearElementBaseStartPointsVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartPointsVector(builder, numElems): - return _DucLinearElementBaseStartPointsVector(builder, numElems) - -def _DucLinearElementBaseAddLines(builder, lines): - builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(lines), 0) - -def AddLines(builder, lines): - _DucLinearElementBaseAddLines(builder, lines) - -def _DucLinearElementBaseStartLinesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartLinesVector(builder, numElems): - return _DucLinearElementBaseStartLinesVector(builder, numElems) - -def _DucLinearElementBaseAddPathOverrides(builder, pathOverrides): - builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(pathOverrides), 0) - -def AddPathOverrides(builder, pathOverrides): - _DucLinearElementBaseAddPathOverrides(builder, pathOverrides) - -def _DucLinearElementBaseStartPathOverridesVector(builder, numElems): - return builder.StartVector(4, numElems, 4) - -def StartPathOverridesVector(builder, numElems): - return _DucLinearElementBaseStartPathOverridesVector(builder, numElems) - -def _DucLinearElementBaseAddLastCommittedPoint(builder, lastCommittedPoint): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(lastCommittedPoint), 0) - -def AddLastCommittedPoint(builder, lastCommittedPoint): - _DucLinearElementBaseAddLastCommittedPoint(builder, lastCommittedPoint) - -def _DucLinearElementBaseAddStartBinding(builder, startBinding): - builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(startBinding), 0) - -def AddStartBinding(builder, startBinding): - _DucLinearElementBaseAddStartBinding(builder, startBinding) - -def _DucLinearElementBaseAddEndBinding(builder, endBinding): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(endBinding), 0) - -def AddEndBinding(builder, endBinding): - _DucLinearElementBaseAddEndBinding(builder, endBinding) - -def _DucLinearElementBaseEnd(builder): - return builder.EndObject() - -def End(builder): - return _DucLinearElementBaseEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/_DucStackBase.py b/packages/ducpy/src/ducpy/Duc/_DucStackBase.py deleted file mode 100644 index c2ea04c1..00000000 --- a/packages/ducpy/src/ducpy/Duc/_DucStackBase.py +++ /dev/null @@ -1,136 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class _DucStackBase(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = _DucStackBase() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAs_DucStackBase(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def _DucStackBaseBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # _DucStackBase - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # _DucStackBase - def Label(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # _DucStackBase - def Description(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - - # _DucStackBase - def IsCollapsed(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # _DucStackBase - def IsPlot(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # _DucStackBase - def IsVisible(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # _DucStackBase - def Locked(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # _DucStackBase - def Styles(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc.DucStackLikeStyles import DucStackLikeStyles - obj = DucStackLikeStyles() - obj.Init(self._tab.Bytes, x) - return obj - return None - -def _DucStackBaseStart(builder): - builder.StartObject(7) - -def Start(builder): - _DucStackBaseStart(builder) - -def _DucStackBaseAddLabel(builder, label): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(label), 0) - -def AddLabel(builder, label): - _DucStackBaseAddLabel(builder, label) - -def _DucStackBaseAddDescription(builder, description): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(description), 0) - -def AddDescription(builder, description): - _DucStackBaseAddDescription(builder, description) - -def _DucStackBaseAddIsCollapsed(builder, isCollapsed): - builder.PrependBoolSlot(2, isCollapsed, 0) - -def AddIsCollapsed(builder, isCollapsed): - _DucStackBaseAddIsCollapsed(builder, isCollapsed) - -def _DucStackBaseAddIsPlot(builder, isPlot): - builder.PrependBoolSlot(3, isPlot, 0) - -def AddIsPlot(builder, isPlot): - _DucStackBaseAddIsPlot(builder, isPlot) - -def _DucStackBaseAddIsVisible(builder, isVisible): - builder.PrependBoolSlot(4, isVisible, 0) - -def AddIsVisible(builder, isVisible): - _DucStackBaseAddIsVisible(builder, isVisible) - -def _DucStackBaseAddLocked(builder, locked): - builder.PrependBoolSlot(5, locked, 0) - -def AddLocked(builder, locked): - _DucStackBaseAddLocked(builder, locked) - -def _DucStackBaseAddStyles(builder, styles): - builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(styles), 0) - -def AddStyles(builder, styles): - _DucStackBaseAddStyles(builder, styles) - -def _DucStackBaseEnd(builder): - return builder.EndObject() - -def End(builder): - return _DucStackBaseEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/_DucStackElementBase.py b/packages/ducpy/src/ducpy/Duc/_DucStackElementBase.py deleted file mode 100644 index 3a17da5f..00000000 --- a/packages/ducpy/src/ducpy/Duc/_DucStackElementBase.py +++ /dev/null @@ -1,114 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class _DucStackElementBase(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = _DucStackElementBase() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAs_DucStackElementBase(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def _DucStackElementBaseBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # _DucStackElementBase - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # _DucStackElementBase - def Base(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucElementBase import _DucElementBase - obj = _DucElementBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # _DucStackElementBase - def StackBase(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - x = self._tab.Indirect(o + self._tab.Pos) - from Duc._DucStackBase import _DucStackBase - obj = _DucStackBase() - obj.Init(self._tab.Bytes, x) - return obj - return None - - # _DucStackElementBase - def Clip(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # _DucStackElementBase - def LabelVisible(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # _DucStackElementBase - def StandardOverride(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) - if o != 0: - return self._tab.String(o + self._tab.Pos) - return None - -def _DucStackElementBaseStart(builder): - builder.StartObject(5) - -def Start(builder): - _DucStackElementBaseStart(builder) - -def _DucStackElementBaseAddBase(builder, base): - builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(base), 0) - -def AddBase(builder, base): - _DucStackElementBaseAddBase(builder, base) - -def _DucStackElementBaseAddStackBase(builder, stackBase): - builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(stackBase), 0) - -def AddStackBase(builder, stackBase): - _DucStackElementBaseAddStackBase(builder, stackBase) - -def _DucStackElementBaseAddClip(builder, clip): - builder.PrependBoolSlot(2, clip, 0) - -def AddClip(builder, clip): - _DucStackElementBaseAddClip(builder, clip) - -def _DucStackElementBaseAddLabelVisible(builder, labelVisible): - builder.PrependBoolSlot(3, labelVisible, 0) - -def AddLabelVisible(builder, labelVisible): - _DucStackElementBaseAddLabelVisible(builder, labelVisible) - -def _DucStackElementBaseAddStandardOverride(builder, standardOverride): - builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(standardOverride), 0) - -def AddStandardOverride(builder, standardOverride): - _DucStackElementBaseAddStandardOverride(builder, standardOverride) - -def _DucStackElementBaseEnd(builder): - return builder.EndObject() - -def End(builder): - return _DucStackElementBaseEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/_UnitSystemBase.py b/packages/ducpy/src/ducpy/Duc/_UnitSystemBase.py deleted file mode 100644 index 690d7875..00000000 --- a/packages/ducpy/src/ducpy/Duc/_UnitSystemBase.py +++ /dev/null @@ -1,93 +0,0 @@ -# automatically generated by the FlatBuffers compiler, do not modify - -# namespace: Duc - -import flatbuffers -from flatbuffers.compat import import_numpy -np = import_numpy() - -class _UnitSystemBase(object): - __slots__ = ['_tab'] - - @classmethod - def GetRootAs(cls, buf, offset=0): - n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) - x = _UnitSystemBase() - x.Init(buf, n + offset) - return x - - @classmethod - def GetRootAs_UnitSystemBase(cls, buf, offset=0): - """This method is deprecated. Please switch to GetRootAs.""" - return cls.GetRootAs(buf, offset) - @classmethod - def _UnitSystemBaseBufferHasIdentifier(cls, buf, offset, size_prefixed=False): - return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x44\x55\x43\x5F", size_prefixed=size_prefixed) - - # _UnitSystemBase - def Init(self, buf, pos): - self._tab = flatbuffers.table.Table(buf, pos) - - # _UnitSystemBase - def System(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) - return None - - # _UnitSystemBase - def Precision(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) - if o != 0: - return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) - return 0 - - # _UnitSystemBase - def SuppressLeadingZeros(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - - # _UnitSystemBase - def SuppressTrailingZeros(self): - o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) - if o != 0: - return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) - return False - -def _UnitSystemBaseStart(builder): - builder.StartObject(4) - -def Start(builder): - _UnitSystemBaseStart(builder) - -def _UnitSystemBaseAddSystem(builder, system): - builder.PrependUint8Slot(0, system, None) - -def AddSystem(builder, system): - _UnitSystemBaseAddSystem(builder, system) - -def _UnitSystemBaseAddPrecision(builder, precision): - builder.PrependInt32Slot(1, precision, 0) - -def AddPrecision(builder, precision): - _UnitSystemBaseAddPrecision(builder, precision) - -def _UnitSystemBaseAddSuppressLeadingZeros(builder, suppressLeadingZeros): - builder.PrependBoolSlot(2, suppressLeadingZeros, 0) - -def AddSuppressLeadingZeros(builder, suppressLeadingZeros): - _UnitSystemBaseAddSuppressLeadingZeros(builder, suppressLeadingZeros) - -def _UnitSystemBaseAddSuppressTrailingZeros(builder, suppressTrailingZeros): - builder.PrependBoolSlot(3, suppressTrailingZeros, 0) - -def AddSuppressTrailingZeros(builder, suppressTrailingZeros): - _UnitSystemBaseAddSuppressTrailingZeros(builder, suppressTrailingZeros) - -def _UnitSystemBaseEnd(builder): - return builder.EndObject() - -def End(builder): - return _UnitSystemBaseEnd(builder) diff --git a/packages/ducpy/src/ducpy/Duc/__init__.py b/packages/ducpy/src/ducpy/Duc/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/ducpy/src/ducpy/__init__.py b/packages/ducpy/src/ducpy/__init__.py index 3c529063..bfa1831f 100644 --- a/packages/ducpy/src/ducpy/__init__.py +++ b/packages/ducpy/src/ducpy/__init__.py @@ -4,42 +4,15 @@ import ducpy as duc duc.classes.SomeClass - duc.parse.parse_function - duc.serialize.serialize_function + duc.parse_duc(source) + duc.serialize_duc(name=..., elements=...) duc.utils.some_utility """ -import sys -import importlib.util -from pathlib import Path -import os - -# Get the absolute path to the Duc directory -duc_dir = os.path.join(os.path.dirname(__file__), 'Duc') - -# Import all modules from Duc and make them available at top level -if 'Duc' not in sys.modules: - # Create a new module for Duc - import types - duc_module = types.ModuleType('Duc') - sys.modules['Duc'] = duc_module - - # Import all Python files from the Duc directory - for file_path in Path(duc_dir).glob('*.py'): - if file_path.name == '__init__.py': - continue - - module_name = file_path.stem - spec = importlib.util.spec_from_file_location(f"Duc.{module_name}", file_path) - if spec: - module = importlib.util.module_from_spec(spec) - sys.modules[f"Duc.{module_name}"] = module - spec.loader.exec_module(module) - setattr(duc_module, module_name, module) - - -from .utils import * -from .parse import * -from .serialize import * -from .classes import * from .builders import * +from .classes import * +from .enums import * +from .parse import (DucData, get_external_file, list_external_files, parse_duc, + parse_duc_lazy) +from .serialize import DUC_SCHEMA_VERSION, serialize_duc +from .utils import * diff --git a/packages/ducpy/src/ducpy/builders/__init__.py b/packages/ducpy/src/ducpy/builders/__init__.py index b4c48d18..e3fbc143 100644 --- a/packages/ducpy/src/ducpy/builders/__init__.py +++ b/packages/ducpy/src/ducpy/builders/__init__.py @@ -3,6 +3,7 @@ """ from .element_builders import * -from .style_builders import * +from .mutate_builder import * +from .sql_builder import * from .state_builders import * -from .mutate_builder import * \ No newline at end of file +from .style_builders import * diff --git a/packages/ducpy/src/ducpy/builders/block_instance_builder.py b/packages/ducpy/src/ducpy/builders/block_instance_builder.py index 619c494c..226a4fdd 100644 --- a/packages/ducpy/src/ducpy/builders/block_instance_builder.py +++ b/packages/ducpy/src/ducpy/builders/block_instance_builder.py @@ -1,24 +1,22 @@ from typing import List, Optional -from ducpy.classes.ElementsClass import DucBlockInstance, DucBlockDuplicationArray, StringValueEntry + +from ducpy.classes.ElementsClass import (DucBlockDuplicationArray, + DucBlockInstance, StringValueEntry) from ducpy.utils.rand_utils import random_versioning + class BlockInstanceBuilder: def __init__(self, id: str, block_id: str, version: int): self._id = id self._block_id = block_id self._version = version self._element_overrides: List[StringValueEntry] = [] - self._attribute_values: List[StringValueEntry] = [] self._duplication_array: Optional[DucBlockDuplicationArray] = None def with_element_override(self, key: str, value: str) -> 'BlockInstanceBuilder': self._element_overrides.append(StringValueEntry(key=key, value=value)) return self - def with_attribute_value(self, key: str, value: str) -> 'BlockInstanceBuilder': - self._attribute_values.append(StringValueEntry(key=key, value=value)) - return self - def with_duplication_array(self, rows: int, cols: int, row_spacing: float, col_spacing: float) -> 'BlockInstanceBuilder': self._duplication_array = DucBlockDuplicationArray( rows=rows, @@ -34,6 +32,5 @@ def build(self) -> DucBlockInstance: block_id=self._block_id, version=self._version, element_overrides=self._element_overrides if self._element_overrides else None, - attribute_values=self._attribute_values if self._attribute_values else None, duplication_array=self._duplication_array ) diff --git a/packages/ducpy/src/ducpy/builders/element_builders.py b/packages/ducpy/src/ducpy/builders/element_builders.py index 4a56f845..cf6a29d2 100644 --- a/packages/ducpy/src/ducpy/builders/element_builders.py +++ b/packages/ducpy/src/ducpy/builders/element_builders.py @@ -1,139 +1,61 @@ """ Helper functions for creating DUC elements with a user-friendly API. +Only the 15 element types from duc.sql / types.rs are supported. """ import math -import time -import uuid from dataclasses import dataclass, field from math import pi -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union import numpy as np - -if TYPE_CHECKING: - from ..classes.StandardsClass import Standard - -import random -import time - -from ducpy.Duc.AXIS import AXIS -from ducpy.Duc.BLOCK_ATTACHMENT import BLOCK_ATTACHMENT -from ducpy.Duc.BOOLEAN_OPERATION import BOOLEAN_OPERATION -from ducpy.Duc.COLUMN_TYPE import COLUMN_TYPE -from ducpy.Duc.DIMENSION_FIT_RULE import DIMENSION_FIT_RULE -from ducpy.Duc.DIMENSION_TEXT_PLACEMENT import DIMENSION_TEXT_PLACEMENT -from ducpy.Duc.DIMENSION_TYPE import DIMENSION_TYPE -from ducpy.Duc.FEATURE_MODIFIER import FEATURE_MODIFIER -from ducpy.Duc.GDT_SYMBOL import GDT_SYMBOL -from ducpy.Duc.IMAGE_STATUS import IMAGE_STATUS -from ducpy.Duc.LEADER_CONTENT_TYPE import LEADER_CONTENT_TYPE -from ducpy.Duc.LINE_SPACING_TYPE import LINE_SPACING_TYPE -from ducpy.Duc.MARK_ELLIPSE_CENTER import MARK_ELLIPSE_CENTER -from ducpy.Duc.MATERIAL_CONDITION import MATERIAL_CONDITION -from ducpy.Duc.PARAMETRIC_SOURCE_TYPE import PARAMETRIC_SOURCE_TYPE -from ducpy.Duc.STACKED_TEXT_ALIGN import STACKED_TEXT_ALIGN -from ducpy.Duc.STROKE_CAP import STROKE_CAP -from ducpy.Duc.STROKE_JOIN import STROKE_JOIN -from ducpy.Duc.STROKE_PLACEMENT import STROKE_PLACEMENT -from ducpy.Duc.STROKE_PREFERENCE import STROKE_PREFERENCE -from ducpy.Duc.TABLE_CELL_ALIGNMENT import TABLE_CELL_ALIGNMENT -from ducpy.Duc.TABLE_FLOW_DIRECTION import TABLE_FLOW_DIRECTION -from ducpy.Duc.TEXT_ALIGN import TEXT_ALIGN -from ducpy.Duc.TEXT_FLOW_DIRECTION import TEXT_FLOW_DIRECTION -from ducpy.Duc.TOLERANCE_DISPLAY import TOLERANCE_DISPLAY -from ducpy.Duc.TOLERANCE_ZONE_TYPE import TOLERANCE_ZONE_TYPE -from ducpy.Duc.VERTICAL_ALIGN import VERTICAL_ALIGN -from ducpy.Duc.VIEWPORT_SHADE_PLOT import VIEWPORT_SHADE_PLOT +from ducpy.enums import (IMAGE_STATUS, STROKE_CAP, STROKE_JOIN, + STROKE_PLACEMENT, STROKE_PREFERENCE, TEXT_ALIGN, + VERTICAL_ALIGN) from ducpy.utils import (DEFAULT_FILL_COLOR, DEFAULT_SCOPE, DEFAULT_STROKE_COLOR, DEFAULT_STROKE_WIDTH, generate_random_id) from ducpy.utils.rand_utils import random_versioning -from ..classes.ElementsClass import (BLOCK_ATTACHMENT, BoundElement, - ColumnLayout, DatumReference, - DimensionBaselineData, DimensionBindings, - DimensionContinueData, - DimensionDefinitionPoints, - DimensionExtLineStyle, DimensionFitStyle, - DimensionLineStyle, DimensionSymbolStyle, - DimensionToleranceStyle, - DocumentGridConfig, DucArrowElement, - DucBlock, DucBlockAttributeDefinition, - DucBlockAttributeDefinitionEntry, - DucBlockDuplicationArray, - DucBlockInstance, DucDimensionElement, - DucDimensionStyle, DucDocElement, +from ..classes.ElementsClass import (BoundElement, DocumentGridConfig, + DucArrowElement, DucDocElement, DucDocStyle, DucElementBase, DucElementStylesBase, DucEllipseElement, - DucEmbeddableElement, - DucFeatureControlFrameElement, - DucFeatureControlFrameStyle, - DucFrameElement, DucFreeDrawElement, - DucFreeDrawEnds, DucHead, DucImageElement, - DucImageFilter, DucLayer, - DucLayerOverrides, DucLeaderElement, - DucLeaderStyle, DucLine, DucLinearElement, + DucEmbeddableElement, DucFrameElement, + DucFreeDrawElement, DucFreeDrawEnds, + DucHead, DucImageElement, DucImageFilter, + DucLine, DucLinearElement, DucLinearElementBase, DucLineReference, - DucMermaidElement, DucParametricElement, - DucPath, DucPdfElement, DucPlotElement, - DucPlotStyle, DucPoint, DucPointBinding, - DucPolygonElement, DucRectangleElement, - DucRegion, DucStackBase, + DucModelElement, DucPath, DucPdfElement, + DucPlotElement, DucPlotStyle, DucPoint, + DucPointBinding, DucPolygonElement, + DucRectangleElement, DucStackBase, DucStackElementBase, DucStackLikeStyles, - DucTableAutoSize, DucTableCell, - DucTableCellEntry, DucTableCellSpan, - DucTableCellStyle, DucTableColumn, - DucTableColumnEntry, DucTableElement, - DucTableRow, DucTableRowEntry, - DucTableStyle, DucTextDynamicPart, - DucTextElement, DucTextStyle, DucView, - DucViewportElement, DucViewportStyle, - DucXRayElement, DucXRayStyle, + DucTableElement, DucTableStyle, + DucTextElement, DucTextStyle, ElementBackground, ElementContentBase, ElementStroke, ElementWrapper, - FCFBetweenModifier, FCFDatumDefinition, - FCFDatumStyle, FCFFrameModifiers, - FCFLayoutStyle, FCFProjectedZoneModifier, - FCFSegmentRow, FCFSymbolStyle, - FeatureControlFrameSegment, - GeometricPoint, ImageCrop, - LeaderBlockContent, LeaderContent, - LeaderTextBlockContent, Margins, - ParagraphFormatting, ParametricSource, - PlotLayout, PointBindingPoint, - StackFormat, StackFormatProperties, - StringValueEntry, StrokeStyle, TextColumn, - ToleranceClause) -from .style_builders import (create_column_layout, create_doc_style, - create_paragraph_formatting, create_simple_styles, - create_stack_format, - create_stack_format_properties, - create_text_column, create_text_style) + GeometricPoint, ImageCrop, Margins, + PlotLayout, StringValueEntry, StrokeStyle) +from .style_builders import (create_doc_style, create_simple_styles, + create_table_style, create_text_style) def _create_element_wrapper(element_class, base_params, element_params, explicit_properties_override=None): """Helper function to create an ElementWrapper with the given parameters.""" - # Create the base DucElementBase - from ducpy.utils import generate_random_id - from ducpy.utils.rand_utils import random_versioning - - # Generate ID if not provided if not base_params.get('id'): base_params['id'] = generate_random_id() - # Set default values using rand_utils + versioning = random_versioning() base_params.setdefault('seed', versioning['seed']) base_params.setdefault('version', versioning['version']) base_params.setdefault('version_nonce', versioning['version_nonce']) base_params.setdefault('updated', versioning['updated']) - # Set required list fields with defaults base_params.setdefault('group_ids', []) base_params.setdefault('block_ids', []) base_params.setdefault('region_ids', []) base_params.setdefault('instance_id', None) - # Set required optional fields with defaults base_params.setdefault('styles', DucElementStylesBase( roundness=0.0, stroke=[ElementStroke( @@ -175,20 +97,13 @@ def _create_element_wrapper(element_class, base_params, element_params, explicit )) base_element = DucElementBase(**base_params) - - # Handle special cases for different element types + if element_class == DucLinearElement: - # Convert tuple points to DucPoint objects points = element_params.get('points', []) - duc_points = [] - for point in points: - if isinstance(point, tuple): - # Provide default mirroring as None - duc_points.append(DucPoint(x=float(point[0]), y=float(point[1]), mirroring=None)) - else: - duc_points.append(point) - - # Create linear base first + duc_points = [ + DucPoint(x=float(p[0]), y=float(p[1]), mirroring=None) if isinstance(p, tuple) else p + for p in points + ] linear_base = DucLinearElementBase( base=base_element, points=duc_points, @@ -203,16 +118,11 @@ def _create_element_wrapper(element_class, base_params, element_params, explicit wipeout_below=element_params.get('wipeout_below', False) ) elif element_class == DucArrowElement: - # Convert tuple points to DucPoint objects points = element_params.get('points', []) - duc_points = [] - for point in points: - if isinstance(point, tuple): - duc_points.append(DucPoint(x=float(point[0]), y=float(point[1]), mirroring=None)) - else: - duc_points.append(point) - - # Create linear base first + duc_points = [ + DucPoint(x=float(p[0]), y=float(p[1]), mirroring=None) if isinstance(p, tuple) else p + for p in points + ] linear_base = DucLinearElementBase( base=base_element, points=duc_points, @@ -226,55 +136,7 @@ def _create_element_wrapper(element_class, base_params, element_params, explicit linear_base=linear_base, elbowed=element_params.get('elbowed', False) ) - elif element_class == DucViewportElement: - # Convert tuple points to DucPoint objects - points = element_params.get('points', []) - duc_points = [] - for point in points: - if isinstance(point, tuple): - duc_points.append(DucPoint(x=float(point[0]), y=float(point[1]), mirroring=None)) - else: - duc_points.append(point) - - # Create linear base first - linear_base = DucLinearElementBase( - base=base_element, - points=duc_points, - lines=[], - path_overrides=[], - last_committed_point=None, - start_binding=element_params.get('start_binding'), - end_binding=element_params.get('end_binding') - ) - # Create stack base if provided, otherwise use default - stack_base = element_params.get('stack_base') - if stack_base is None: - stack_base = DucStackBase( - label=base_params.get('label', ""), - is_collapsed=False, - is_plot=True, - is_visible=True, - locked=False, - styles=DucStackLikeStyles(opacity=1.0, labeling_color="#000"), - description=base_params.get('description', "") - ) - # Create viewport style - from ducpy.builders.style_builders import create_simple_styles - viewport_style = element_params.get('style') - if viewport_style is None: - viewport_style = DucViewportStyle(scale_indicator_visible=True) - specific_element = element_class( - linear_base=linear_base, - stack_base=stack_base, - style=viewport_style, - view=element_params.get('view'), - scale=element_params.get('scale', 1.0), - shade_plot=element_params.get('shade_plot'), - frozen_group_ids=element_params.get('frozen_group_ids', []), - standard_override=element_params.get('standard_override') - ) elif element_class == DucPlotElement: - # Create stack base if provided, otherwise use default stack_base = element_params.get('stack_base') if stack_base is None: stack_base = DucStackBase( @@ -283,235 +145,34 @@ def _create_element_wrapper(element_class, base_params, element_params, explicit is_plot=True, is_visible=True, locked=False, - styles=DucStackLikeStyles(opacity=1.0, labeling_color="#000"), + styles=DucStackLikeStyles(opacity=1.0), description=base_params.get('description', "") ) - # Create stack element base stack_element_base = DucStackElementBase( base=base_element, stack_base=stack_base, clip=element_params.get('clip', False), label_visible=element_params.get('label_visible', True), - standard_override=element_params.get('standard_override') ) - # Create plot style - from ducpy.builders.style_builders import create_simple_styles - plot_style = element_params.get('style') - if plot_style is None: - plot_style = DucPlotStyle() - # Create plot layout - margins = element_params.get('margins') - if margins is None: - margins = Margins(top=10.0, right=10.0, bottom=10.0, left=10.0) + plot_style = element_params.get('style') or DucPlotStyle() + margins = element_params.get('margins') or Margins(top=10.0, right=10.0, bottom=10.0, left=10.0) layout = PlotLayout(margins=margins) specific_element = element_class( stack_element_base=stack_element_base, style=plot_style, layout=layout ) - elif element_class == DucLeaderElement: - # Create linear base first - linear_base = DucLinearElementBase( - base=base_element, - points=element_params.get('points', []), - lines=[], - path_overrides=[], - last_committed_point=None, - start_binding=element_params.get('start_binding'), - end_binding=element_params.get('end_binding') - ) - # Create leader style - from ducpy.builders.style_builders import (create_simple_styles, - create_text_style) - leader_style = element_params.get('style') - if leader_style is None: - text_style = create_text_style() - leader_style = DucLeaderStyle( - text_style=text_style, - text_attachment=VERTICAL_ALIGN.TOP, - block_attachment=BLOCK_ATTACHMENT.CENTER_EXTENTS - ) - # Create content anchor point - content_anchor_x = element_params.get('content_anchor_x', 0.0) - content_anchor_y = element_params.get('content_anchor_y', 0.0) - content_anchor = GeometricPoint(x=content_anchor_x, y=content_anchor_y) - specific_element = element_class( - linear_base=linear_base, - style=leader_style, - content_anchor=content_anchor, - content=element_params.get('content') - ) - elif element_class == DucDocElement: - # Create doc style - from ducpy.builders.style_builders import (create_paragraph_formatting, - create_simple_styles, - create_stack_format, - create_text_style) - doc_style = element_params.get('style') - if doc_style is None: - text_style = create_text_style() - paragraph = create_paragraph_formatting() - stack_format = create_stack_format() - doc_style = DucDocStyle( - text_style=text_style, - paragraph=paragraph, - stack_format=stack_format - ) - # Create column layout - columns_layout = element_params.get('columns') - if columns_layout is None: - from ducpy.builders.style_builders import (create_column_layout, - create_text_column) - text_column = create_text_column(width=100.0) - columns_layout = create_column_layout(definitions=[text_column]) default_grid_config = DocumentGridConfig( - columns=1, - gap_x=0.0, - gap_y=0.0, - align_items=0, - first_page_alone=False, - scale=1.0, - ) + columns=1, gap_x=0.0, gap_y=0.0, first_page_alone=False, scale=1.0) specific_element = element_class( base=base_element, - style=doc_style, + style=element_params.get('style') or DucDocStyle(), text=element_params.get('text', ""), - dynamic=element_params.get('dynamic', []), - columns=columns_layout, - auto_resize=element_params.get('auto_resize', False), - flow_direction=element_params.get('flow_direction'), - file_id=element_params.get('file_id'), grid_config=element_params.get('grid_config', default_grid_config), - ) - elif element_class == DucDimensionElement: - # Create dimension style - from ducpy.builders.style_builders import (create_simple_styles, - create_solid_content, - create_stroke, - create_text_style) - dimension_style = element_params.get('style') - if dimension_style is None: - text_style = create_text_style() - solid_content = create_solid_content("#000000", opacity=1.0, visible=True) - stroke = create_stroke(solid_content, width=1.0) - dimension_style = DucDimensionStyle( - dim_line=DimensionLineStyle( - stroke=stroke, - text_gap=1.0 - ), - ext_line=DimensionExtLineStyle( - stroke=stroke, - overshoot=1.0, - offset=1.0 - ), - text_style=text_style, - symbols=DimensionSymbolStyle( - center_mark_size=2.0, - center_mark_type=MARK_ELLIPSE_CENTER.MARK, - heads_override=None - ), - tolerance=DimensionToleranceStyle( - enabled=False, - upper_value=0.0, - lower_value=0.0, - precision=2, - display_method=TOLERANCE_DISPLAY.NONE, - text_style=text_style - ), - fit=DimensionFitStyle( - force_text_inside=False, - rule=DIMENSION_FIT_RULE.BEST_FIT, - text_placement=DIMENSION_TEXT_PLACEMENT.BESIDE_LINE - ) - ) - # Create definition points - origin1 = element_params.get('origin1') - origin2 = element_params.get('origin2') - location = element_params.get('location') - - # Convert origin1, origin2, location to GeometricPoint if they are tuples - if isinstance(origin1, tuple): - origin1 = GeometricPoint(x=float(origin1[0]), y=float(origin1[1])) - if isinstance(origin2, tuple): - origin2 = GeometricPoint(x=float(origin2[0]), y=float(origin2[1])) - if isinstance(location, tuple): - location = GeometricPoint(x=float(location[0]), y=float(location[1])) - - if origin1 is None or origin2 is None or location is None: - # Create default points if not provided - origin1 = GeometricPoint(x=0.0, y=0.0) - origin2 = GeometricPoint(x=100.0, y=0.0) - location = GeometricPoint(x=50.0, y=-20.0) - - definition_points = DimensionDefinitionPoints( - origin1=origin1, - origin2=origin2, - location=location, - center=None, - jog=None - ) - specific_element = element_class( - base=base_element, - style=dimension_style, - definition_points=definition_points, - oblique_angle=element_params.get('oblique_angle', 0.0), - dimension_type=element_params.get('dimension_type', DIMENSION_TYPE.LINEAR), - ordinate_axis=element_params.get('ordinate_axis'), - bindings=element_params.get('bindings'), - text_override=element_params.get('text_override'), - baseline_data=element_params.get('baseline_data'), - continue_data=element_params.get('continue_data'), - text_position=None, - tolerance_override=None - ) - elif element_class == DucFeatureControlFrameElement: - # Create feature control frame style - from ducpy.builders.style_builders import (create_simple_styles, - create_text_style) - fcf_style = element_params.get('style') - if fcf_style is None: - text_style = create_text_style() - fcf_style = DucFeatureControlFrameStyle( - text_style=text_style, - layout=FCFLayoutStyle(padding=2.0, segment_spacing=1.0, row_spacing=1.0), - symbols=FCFSymbolStyle(scale=1.0), - datum_style=FCFDatumStyle() - ) - specific_element = element_class( - base=base_element, - style=fcf_style, - rows=element_params.get('rows', []), - frame_modifiers=element_params.get('frame_modifiers'), - leader_element_id=element_params.get('leader_element_id'), - datum_definition=element_params.get('datum_definition') - ) - elif element_class == DucXRayElement: - # Create xray style - from ducpy.builders.style_builders import create_simple_styles - xray_style = DucXRayStyle( - color=element_params.get('color', "#FF0000") - ) - # Create origin and direction points - origin = DucPoint( - x=element_params.get('origin_x', 0.0), - y=element_params.get('origin_y', 0.0), - mirroring=None - ) - direction = DucPoint( - x=element_params.get('direction_x', 1.0), - y=element_params.get('direction_y', 0.0), - mirroring=None - ) - specific_element = element_class( - base=base_element, - style=xray_style, - origin=origin, - direction=direction, - start_from_origin=element_params.get('start_from_origin', False) + file_id=element_params.get('file_id'), ) elif element_class == DucFrameElement: - # Create stack base if provided, otherwise use default stack_base = element_params.get('stack_base') if stack_base is None: stack_base = DucStackBase( @@ -520,67 +181,57 @@ def _create_element_wrapper(element_class, base_params, element_params, explicit is_plot=True, is_visible=True, locked=False, - styles=DucStackLikeStyles(opacity=1.0, labeling_color="#000"), + styles=DucStackLikeStyles(opacity=1.0), description=base_params.get('description', "") ) - # Create stack element base stack_element_base = DucStackElementBase( base=base_element, stack_base=stack_base, clip=element_params.get('clip', False), label_visible=element_params.get('label_visible', True), - standard_override=element_params.get('standard_override') - ) - specific_element = element_class( - stack_element_base=stack_element_base ) + specific_element = element_class(stack_element_base=stack_element_base) elif element_class == DucImageElement: - # Convert scale list to numpy array if needed scale = element_params.get('scale', [1.0, 1.0]) if isinstance(scale, list): element_params['scale'] = np.array(scale, dtype=np.float32) - - # Default case: add base to element_params and create element_params['base'] = base_element specific_element = element_class(**element_params) elif element_class == DucFreeDrawElement: - # Convert points to DucPoint objects if they are tuples points = element_params.get('points', []) - duc_points = [] - for point in points: - if isinstance(point, tuple): - duc_points.append(DucPoint(x=float(point[0]), y=float(point[1]), mirroring=None)) - else: - duc_points.append(point) + duc_points = [ + DucPoint(x=float(p[0]), y=float(p[1]), mirroring=None) if isinstance(p, tuple) else p + for p in points + ] element_params['points'] = duc_points - - # Convert pressures list to numpy array if needed pressures = element_params.get('pressures', []) if isinstance(pressures, list): element_params['pressures'] = np.array(pressures, dtype=np.float32) - - # Default case: add base to element_params and create element_params['base'] = base_element specific_element = element_class(**element_params) + elif element_class == DucTableElement: + specific_element = element_class( + base=base_element, + style=element_params.get('style') or DucTableStyle(), + file_id=element_params.get('file_id'), + ) else: - # Default case: add base to element_params and create element_params['base'] = base_element if element_class.__name__ == "DucTextElement": if 'container_id' not in element_params: element_params['container_id'] = None specific_element = element_class(**element_params) - - # Apply explicit properties override if provided + if explicit_properties_override: for key, value in explicit_properties_override.items(): try: setattr(specific_element, key, value) except AttributeError: - # Skip if attribute doesn't exist pass - # Create and return the wrapper + return ElementWrapper(element=specific_element) + @dataclass class BaseElementParams: x: float @@ -602,13 +253,13 @@ class BaseElementParams: frame_id: Optional[str] = None bound_elements: Optional[List[BoundElement]] = field(default_factory=list) link: str = "" - custom_data: Union[str, Dict[str, Any]] = "" + custom_data: str = "" is_plot: bool = True - is_annotative: bool = False is_deleted: bool = False - index: Optional[int] = None + index: Optional[str] = None instance_id: Optional[str] = None + class ElementBuilder: def __init__( self, @@ -618,121 +269,84 @@ def __init__( height: float = 1.0, scope: str = DEFAULT_SCOPE ): - self.base = BaseElementParams( - x=x, - y=y, - width=width, - height=height, - scope=scope - ) + self.base = BaseElementParams(x=x, y=y, width=width, height=height, scope=scope) self.extra = {} def at_position(self, x: float, y: float): - self.base.x = x - self.base.y = y - return self + self.base.x = x; self.base.y = y; return self def with_size(self, width: float, height: float): - self.base.width = width - self.base.height = height - return self + self.base.width = width; self.base.height = height; return self def with_angle(self, angle: float): - self.base.angle = angle - return self + self.base.angle = angle; return self def with_styles(self, styles: DucElementStylesBase): - self.base.styles = styles - return self + self.base.styles = styles; return self def with_id(self, id: str): - self.base.id = id - return self + self.base.id = id; return self def with_label(self, label: str): - self.base.label = label - return self + self.base.label = label; return self def with_scope(self, scope: str): - self.base.scope = scope - return self + self.base.scope = scope; return self def with_locked(self, locked: bool): - self.base.locked = locked - return self + self.base.locked = locked; return self def with_visible(self, is_visible: bool): - self.base.is_visible = is_visible - return self + self.base.is_visible = is_visible; return self def with_instance_id(self, instance_id: str): - self.base.instance_id = instance_id - return self + self.base.instance_id = instance_id; return self def with_z_index(self, z_index: float): - self.base.z_index = z_index - return self + self.base.z_index = z_index; return self def with_description(self, description: str): - self.base.description = description - return self + self.base.description = description; return self def with_group_ids(self, group_ids: List[str]): - self.base.group_ids = group_ids - return self + self.base.group_ids = group_ids; return self def with_region_ids(self, region_ids: List[str]): - self.base.region_ids = region_ids - return self + self.base.region_ids = region_ids; return self def with_layer_id(self, layer_id: str): - self.base.layer_id = layer_id - return self + self.base.layer_id = layer_id; return self def with_frame_id(self, frame_id: str): - self.base.frame_id = frame_id - return self + self.base.frame_id = frame_id; return self def with_bound_elements(self, bound_elements: List[BoundElement]): - self.base.bound_elements = bound_elements - return self + self.base.bound_elements = bound_elements; return self def with_bound_element(self, element_id: str, element_type: str): - """Adds a single bound element to the current element.""" if self.base.bound_elements is None: self.base.bound_elements = [] self.base.bound_elements.append(BoundElement(id=element_id, type=element_type)) return self def with_link(self, link: str): - self.base.link = link - return self + self.base.link = link; return self - def with_custom_data(self, custom_data: Union[str, Dict[str, Any]]): - self.base.custom_data = custom_data - return self + def with_custom_data(self, custom_data: str): + self.base.custom_data = custom_data; return self def with_plot(self, is_plot: bool): - self.base.is_plot = is_plot - return self - - def with_annotative(self, is_annotative: bool): - self.base.is_annotative = is_annotative - return self + self.base.is_plot = is_plot; return self def with_deleted(self, is_deleted: bool): - self.base.is_deleted = is_deleted - return self + self.base.is_deleted = is_deleted; return self - def with_index(self, index: int): - self.base.index = index - return self + def with_index(self, index: str): + self.base.index = index; return self def with_extra(self, **kwargs): - self.extra.update(kwargs) - return self + self.extra.update(kwargs); return self - # Build methods that return element-specific builders def build_rectangle(self): return RectangleElementBuilder(self.base, self.extra) @@ -754,15 +368,9 @@ def build_image_element(self): def build_pdf_element(self): return PdfElementBuilder(self.base, self.extra) - def build_parametric_element(self): - return ParametricElementBuilder(self.base, self.extra) - def build_text_element(self): return TextElementBuilder(self.base, self.extra) - def build_table_from_data(self): - return TableFromDataBuilder(self.base, self.extra) - def build_table_element(self): return TableElementBuilder(self.base, self.extra) @@ -772,66 +380,17 @@ def build_frame_element(self): def build_plot_element(self): return PlotElementBuilder(self.base, self.extra) - def build_viewport_element(self): - return ViewportElementBuilder(self.base, self.extra) - def build_freedraw_element(self): return FreeDrawElementBuilder(self.base, self.extra) def build_doc_element(self): return DocElementBuilder(self.base, self.extra) - def build_linear_dimension(self): - return LinearDimensionBuilder(self.base, self.extra) - - def build_aligned_dimension(self): - return AlignedDimensionBuilder(self.base, self.extra) - - def build_angular_dimension(self): - return AngularDimensionBuilder(self.base, self.extra) - - def build_radius_dimension(self): - return RadiusDimensionBuilder(self.base, self.extra) - - def build_diameter_dimension(self): - return DiameterDimensionBuilder(self.base, self.extra) - - def build_arc_length_dimension(self): - return ArcLengthDimensionBuilder(self.base, self.extra) - - def build_center_mark_dimension(self): - return CenterMarkDimensionBuilder(self.base, self.extra) - - def build_rotated_dimension(self): - return RotatedDimensionBuilder(self.base, self.extra) - - def build_spacing_dimension(self): - return SpacingDimensionBuilder(self.base, self.extra) - - def build_continue_dimension(self): - return ContinueDimensionBuilder(self.base, self.extra) - - def build_baseline_dimension(self): - return BaselineDimensionBuilder(self.base, self.extra) - - def build_jogged_linear_dimension(self): - return JoggedLinearDimensionBuilder(self.base, self.extra) - - def build_leader_element(self): - return LeaderElementBuilder(self.base, self.extra) - - def build_feature_control_frame_element(self): - return FeatureControlFrameElementBuilder(self.base, self.extra) - - - def build_mermaid_element(self): - return MermaidElementBuilder(self.base, self.extra) - def build_embeddable_element(self): return EmbeddableElementBuilder(self.base, self.extra) - def build_xray_element(self): - return XrayElementBuilder(self.base, self.extra) + def build_model_element(self): + return ModelElementBuilder(self.base, self.extra) def create_duc_path( @@ -839,171 +398,35 @@ def create_duc_path( background: Optional[ElementBackground] = None, stroke: Optional[ElementStroke] = None ) -> DucPath: - """Helper function to create a DucPath object for path overrides.""" - return DucPath( - line_indices=line_indices, - background=background, - stroke=stroke - ) - -def create_datum_reference( - letters: str, - modifier: Optional[MATERIAL_CONDITION] = None -) -> DatumReference: - """Helper function to create a DatumReference object.""" - return DatumReference( - letters=letters, - modifier=modifier - ) - -def create_tolerance_clause( - value: str, - zone_type: Optional[TOLERANCE_ZONE_TYPE] = None, - feature_modifiers: Optional[List[FEATURE_MODIFIER]] = None, - material_condition: Optional[MATERIAL_CONDITION] = None -) -> ToleranceClause: - """Helper function to create a ToleranceClause object.""" - return ToleranceClause( - value=value, - zone_type=zone_type, - feature_modifiers=feature_modifiers or [], - material_condition=material_condition - ) - -def create_fcf_segment( - symbol: GDT_SYMBOL, - tolerance: ToleranceClause, - datums: List[DatumReference] -) -> FeatureControlFrameSegment: - """Helper function to create a FeatureControlFrameSegment object.""" - return FeatureControlFrameSegment( - symbol=symbol, - tolerance=tolerance, - datums=datums - ) - -def create_fcf_segment_row( - segments: List[FeatureControlFrameSegment] -) -> FCFSegmentRow: - """Helper function to create an FCFSegmentRow object.""" - return FCFSegmentRow( - segments=segments - ) - -def create_bound_element( - element_id: str, - element_type: str -) -> BoundElement: - """Helper to create a BoundElement using a builder-like approach.""" + return DucPath(line_indices=line_indices, background=background, stroke=stroke) + + +def create_bound_element(element_id: str, element_type: str) -> BoundElement: return BoundElement(id=element_id, type=element_type) -def create_table_column( - id: str, - width: float = 100.0, - style_overrides: Optional[DucElementStylesBase] = None -) -> DucTableColumn: - """Helper to create a DucTableColumn object.""" - return DucTableColumn(id=id, width=width, style_overrides=style_overrides) - -def create_table_row( - id: str, - height: float = 30.0, - style_overrides: Optional[DucElementStylesBase] = None -) -> DucTableRow: - """Helper to create a DucTableRow object.""" - return DucTableRow(id=id, height=height, style_overrides=style_overrides) - -def create_table_cell_span( - columns: int = 1, - rows: int = 1 -) -> DucTableCellSpan: - """Helper to create a DucTableCellSpan object.""" - return DucTableCellSpan(columns=columns, rows=rows) - -def create_table_cell( - row_id: str, - column_id: str, - data: str = "", - locked: bool = False, - span: Optional[DucTableCellSpan] = None, - style_overrides: Optional[DucElementStylesBase] = None -) -> DucTableCell: - """Helper to create a DucTableCell object.""" - if span is None: - span = create_table_cell_span() - return DucTableCell( - row_id=row_id, - column_id=column_id, - data=data, - locked=locked, - span=span, - style_overrides=style_overrides - ) - -def create_table_auto_size( - columns: bool = True, - rows: bool = True -) -> DucTableAutoSize: - """Helper to create a DucTableAutoSize object.""" - return DucTableAutoSize(columns=columns, rows=rows) - -def create_table_column_entry( - key: str, - value: DucTableColumn -) -> DucTableColumnEntry: - """Helper to create a DucTableColumnEntry object.""" - return DucTableColumnEntry(key=key, value=value) - -def create_table_row_entry( - key: str, - value: DucTableRow -) -> DucTableRowEntry: - """Helper to create a DucTableRowEntry object.""" - return DucTableRowEntry(key=key, value=value) - -def create_table_cell_entry( - key: str, - value: DucTableCell -) -> DucTableCellEntry: - """Helper to create a DucTableCellEntry object.""" - return DucTableCellEntry(key=key, value=value) - -# Base class for element-specific builders + class ElementSpecificBuilder: def __init__(self, base: BaseElementParams, extra: dict): self.base = base self.extra = extra.copy() -# Rectangle-specific builder class RectangleElementBuilder(ElementSpecificBuilder): def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() - return _create_element_wrapper( - DucRectangleElement, - base_params, - {}, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucRectangleElement, base_params, {}, + self.extra.get('explicit_properties_override')) -# Ellipse-specific builder class EllipseElementBuilder(ElementSpecificBuilder): def with_ratio(self, ratio: float): - self.extra["ratio"] = ratio - return self - + self.extra["ratio"] = ratio; return self def with_start_angle(self, start_angle: float): - self.extra["start_angle"] = start_angle - return self - + self.extra["start_angle"] = start_angle; return self def with_end_angle(self, end_angle: float): - self.extra["end_angle"] = end_angle - return self - + self.extra["end_angle"] = end_angle; return self def with_show_aux_crosshair(self, show_aux_crosshair: bool): - self.extra["show_aux_crosshair"] = show_aux_crosshair - return self + self.extra["show_aux_crosshair"] = show_aux_crosshair; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() @@ -1013,68 +436,36 @@ def build(self) -> ElementWrapper: "end_angle": self.extra.get('end_angle', 2 * pi), "show_aux_crosshair": self.extra.get('show_aux_crosshair', False), } - return _create_element_wrapper( - DucEllipseElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucEllipseElement, base_params, element_params, + self.extra.get('explicit_properties_override')) -# Polygon-specific builder class PolygonElementBuilder(ElementSpecificBuilder): def with_sides(self, sides: int): - self.extra["sides"] = sides - return self + self.extra["sides"] = sides; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() - element_params = {"sides": self.extra.get('sides', 3)} - return _create_element_wrapper( - DucPolygonElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucPolygonElement, base_params, + {"sides": self.extra.get('sides', 3)}, + self.extra.get('explicit_properties_override')) -# Linear element-specific builder class LinearElementBuilder(ElementSpecificBuilder): def with_points(self, points: List[tuple]): - self.extra["points"] = points - return self - + self.extra["points"] = points; return self def with_lines(self, lines: Optional[List[DucLine]]): - self.extra["lines"] = lines - return self - - def with_bezier_handles(self, bezier_handles: Optional[dict]): - self.extra["bezier_handles"] = bezier_handles - return self - - def with_line_definitions(self, line_definitions: Optional[List[dict]]): - self.extra["line_definitions"] = line_definitions - return self - + self.extra["lines"] = lines; return self def with_path_overrides(self, path_overrides: Optional[List[DucPath]]): - self.extra["path_overrides"] = path_overrides - return self - - def with_last_committed_point(self, last_committed_point: Optional[DucPoint]): - self.extra["last_committed_point"] = last_committed_point - return self - - def with_start_binding(self, start_binding: Optional[DucPointBinding]): - self.extra["start_binding"] = start_binding - return self - - def with_end_binding(self, end_binding: Optional[DucPointBinding]): - self.extra["end_binding"] = end_binding - return self - + self.extra["path_overrides"] = path_overrides; return self + def with_last_committed_point(self, lcp: Optional[DucPoint]): + self.extra["last_committed_point"] = lcp; return self + def with_start_binding(self, sb: Optional[DucPointBinding]): + self.extra["start_binding"] = sb; return self + def with_end_binding(self, eb: Optional[DucPointBinding]): + self.extra["end_binding"] = eb; return self def with_wipeout_below(self, wipeout_below: bool): - self.extra["wipeout_below"] = wipeout_below - return self + self.extra["wipeout_below"] = wipeout_below; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() @@ -1087,27 +478,19 @@ def build(self) -> ElementWrapper: "end_binding": self.extra.get('end_binding'), "wipeout_below": self.extra.get('wipeout_below', False) } - return _create_element_wrapper( - DucLinearElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucLinearElement, base_params, element_params, + self.extra.get('explicit_properties_override')) -# Arrow element-specific builder class ArrowElementBuilder(ElementSpecificBuilder): def with_points(self, points: List[tuple]): - self.extra["points"] = points - return self - - def with_start_binding(self, start_binding: Optional[DucPointBinding]): - self.extra["start_binding"] = start_binding - return self - - def with_end_binding(self, end_binding: Optional[DucPointBinding]): - self.extra["end_binding"] = end_binding - return self + self.extra["points"] = points; return self + def with_start_binding(self, sb: Optional[DucPointBinding]): + self.extra["start_binding"] = sb; return self + def with_end_binding(self, eb: Optional[DucPointBinding]): + self.extra["end_binding"] = eb; return self + def with_elbowed(self, elbowed: bool): + self.extra["elbowed"] = elbowed; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() @@ -1117,35 +500,21 @@ def build(self) -> ElementWrapper: "end_binding": self.extra.get('end_binding'), "elbowed": self.extra.get('elbowed', False) } - return _create_element_wrapper( - DucArrowElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucArrowElement, base_params, element_params, + self.extra.get('explicit_properties_override')) -# Image element-specific builder class ImageElementBuilder(ElementSpecificBuilder): def with_file_id(self, file_id: str): - self.extra["file_id"] = file_id - return self - + self.extra["file_id"] = file_id; return self def with_scale(self, scale: List[float]): - self.extra["scale"] = scale - return self - + self.extra["scale"] = scale; return self def with_status(self, status: IMAGE_STATUS): - self.extra["status"] = status - return self - + self.extra["status"] = status; return self def with_crop(self, crop: Optional[ImageCrop]): - self.extra["crop"] = crop - return self - - def with_filter(self, filter: Optional[DucImageFilter]): - self.extra["filter"] = filter - return self + self.extra["crop"] = crop; return self + def with_filter(self, f: Optional[DucImageFilter]): + self.extra["filter"] = f; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() @@ -1156,293 +525,72 @@ def build(self) -> ElementWrapper: "crop": self.extra.get('crop'), "filter": self.extra.get('filter'), } - return _create_element_wrapper( - DucImageElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucImageElement, base_params, element_params, + self.extra.get('explicit_properties_override')) -# PDF element-specific builder class PdfElementBuilder(ElementSpecificBuilder): def with_file_id(self, file_id: str): - self.extra["file_id"] = file_id - return self - + self.extra["file_id"] = file_id; return self def with_grid_config(self, grid_config: DocumentGridConfig): - self.extra["grid_config"] = grid_config - return self + self.extra["grid_config"] = grid_config; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() default_grid_config = DocumentGridConfig( - columns=1, - gap_x=0.0, - gap_y=0.0, - align_items=0, - first_page_alone=False, - scale=1.0, - ) + columns=1, gap_x=0.0, gap_y=0.0, first_page_alone=False, scale=1.0) element_params = { "file_id": self.extra.get('file_id'), "grid_config": self.extra.get('grid_config', default_grid_config), } - return _create_element_wrapper( - DucPdfElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -# Parametric element-specific builder -class ParametricElementBuilder(ElementSpecificBuilder): - def with_file_id(self, file_id: str): - self.extra["file_id"] = file_id - return self - - def with_source_type(self, source_type: PARAMETRIC_SOURCE_TYPE): - self.extra["source_type"] = source_type - return self - - def with_code(self, code: str): - self.extra["code"] = code - return self - - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - param_source = ParametricSource( - type=self.extra.get('source_type', PARAMETRIC_SOURCE_TYPE.FILE), - code=self.extra.get('code', ""), - file_id=self.extra.get('file_id', "") - ) - element_params = { - "source": param_source, - } - return _create_element_wrapper( - DucParametricElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucPdfElement, base_params, element_params, + self.extra.get('explicit_properties_override')) -# Text element-specific builder class TextElementBuilder(ElementSpecificBuilder): def with_text(self, text: str): - self.extra["text"] = text - return self - + self.extra["text"] = text; return self def with_text_style(self, text_style: Optional[DucTextStyle]): - self.extra["text_style"] = text_style - return self - + self.extra["text_style"] = text_style; return self def with_auto_resize(self, auto_resize: bool): - self.extra["auto_resize"] = auto_resize - return self - - def with_dynamic(self, dynamic: Optional[List[DucTextDynamicPart]]): - self.extra["dynamic"] = dynamic - return self + self.extra["auto_resize"] = auto_resize; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() - # Create a default text style if none provided - text_style = self.extra.get('text_style') - if text_style is None: - from ducpy.builders.style_builders import create_text_style - text_style = create_text_style() - + text_style = self.extra.get('text_style') or create_text_style() element_params = { "style": text_style, "text": self.extra.get('text', ''), - "dynamic": self.extra.get('dynamic', []), "auto_resize": self.extra.get('auto_resize', False), "original_text": self.extra.get('text', ''), } - return _create_element_wrapper( - DucTextElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -# Table from data builder -class TableFromDataBuilder(ElementSpecificBuilder): - def with_data(self, data: List[List[str]]): - self.extra["data"] = data - return self - - def with_column_headers(self, column_headers: Optional[List[str]]): - self.extra["column_headers"] = column_headers - return self - - def with_column_widths(self, column_widths: Optional[List[float]]): - self.extra["column_widths"] = column_widths - return self - - def with_row_height(self, row_height: float): - self.extra["row_height"] = row_height - return self - - def with_header_row_count(self, header_row_count: int): - self.extra["header_row_count"] = header_row_count - return self - - def with_table_style(self, style: Optional[DucTableStyle]): - self.extra["style"] = style - return self - - def with_auto_size(self, auto_size: Optional[DucTableAutoSize]): - self.extra["auto_size"] = auto_size - return self - - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - data = self.extra.get('data', []) - n_rows = len(data) - n_cols = len(data[0]) if data else 0 - - # Generate column and row IDs - column_ids = [f"col{i}" for i in range(n_cols)] - row_ids = [f"row{j}" for j in range(n_rows)] - - # Create columns - column_widths = self.extra.get('column_widths') - columns = [DucTableColumnEntry(key=col_id, value=DucTableColumn(id=col_id, width=column_widths[i] if column_widths and i < len(column_widths) else 100.0, style_overrides=None)) for i, col_id in enumerate(column_ids)] - # Create rows - row_height = self.extra.get('row_height', 30) - rows = [DucTableRowEntry(key=row_id, value=DucTableRow(id=row_id, height=row_height, style_overrides=None)) for row_id in row_ids] - # Create cells - cells = [] - for j, row_id in enumerate(row_ids): - for i, col_id in enumerate(column_ids): - cells.append(DucTableCellEntry( - key=f"{row_id}_{col_id}", - value=DucTableCell( - row_id=row_id, - column_id=col_id, - data=data[j][i] if j < len(data) and i < len(data[j]) else "", - locked=False, - span=DucTableCellSpan(columns=1, rows=1), - style_overrides=None - ) - )) - - # Create the table element - element_params = { - "style": self.extra.get('style'), - "column_order": column_ids, - "row_order": row_ids, - "columns": columns, - "rows": rows, - "cells": cells, - "header_row_count": self.extra.get('header_row_count', 0), - "auto_size": self.extra.get('auto_size') or DucTableAutoSize(columns=True, rows=True), - } - return _create_element_wrapper( - DucTableElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucTextElement, base_params, element_params, + self.extra.get('explicit_properties_override')) -# Table element builder class TableElementBuilder(ElementSpecificBuilder): - def with_columns(self, columns: List[DucTableColumn]): - self.extra["columns"] = columns - return self - - def with_rows(self, rows: List[DucTableRow]): - self.extra["rows"] = rows - return self - - def with_cells(self, cells: List[DucTableCell]): - self.extra["cells"] = cells - return self - + def with_file_id(self, file_id: str): + self.extra["file_id"] = file_id; return self def with_table_style(self, style: Optional[DucTableStyle]): - self.extra["style"] = style - return self - - def with_header_row_count(self, header_row_count: int): - self.extra["header_row_count"] = header_row_count - return self - - def with_auto_size(self, auto_size: Optional[DucTableAutoSize]): - self.extra["auto_size"] = auto_size - return self + self.extra["style"] = style; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() - # Ensure style is always set - style = self.extra.get('style') - if style is None: - from ducpy.builders.style_builders import (create_simple_styles, - create_text_style) - style = DucTableStyle( - header_row_style=DucTableCellStyle( - text_style=create_text_style(), - margins=Margins(top=0.0, right=0.0, bottom=0.0, left=0.0), - alignment=TABLE_CELL_ALIGNMENT.MIDDLE_LEFT - ), - data_row_style=DucTableCellStyle( - text_style=create_text_style(), - margins=Margins(top=0.0, right=0.0, bottom=0.0, left=0.0), - alignment=TABLE_CELL_ALIGNMENT.MIDDLE_LEFT - ), - data_column_style=DucTableCellStyle( - text_style=create_text_style(), - margins=Margins(top=0.0, right=0.0, bottom=0.0, left=0.0), - alignment=TABLE_CELL_ALIGNMENT.MIDDLE_LEFT - ), - flow_direction=TABLE_FLOW_DIRECTION.DOWN - ) - - # Extract column_order and row_order from the provided columns and rows - columns_list = self.extra.get('columns', []) - rows_list = self.extra.get('rows', []) - column_order = [col.key for col in columns_list] - row_order = [row.key for row in rows_list] - element_params = { - "column_order": column_order, - "row_order": row_order, - "columns": columns_list, - "rows": rows_list, - "cells": self.extra.get('cells', []), - "style": style, - "header_row_count": self.extra.get('header_row_count', 1), - "auto_size": self.extra.get('auto_size', DucTableAutoSize(columns=True, rows=True)), + "style": self.extra.get('style'), + "file_id": self.extra.get('file_id'), } - return _create_element_wrapper( - DucTableElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucTableElement, base_params, element_params, + self.extra.get('explicit_properties_override')) -# Frame element builder class FrameElementBuilder(ElementSpecificBuilder): def with_stack_base(self, stack_base: Optional[DucStackBase]): - self.extra["stack_base"] = stack_base - return self - + self.extra["stack_base"] = stack_base; return self def with_clip(self, clip: bool): - self.extra["clip"] = clip - return self - + self.extra["clip"] = clip; return self def with_label_visible(self, label_visible: bool): - self.extra["label_visible"] = label_visible - return self - - def with_standard_override(self, standard_override: Optional["Standard"]): - self.extra["standard_override"] = standard_override - return self + self.extra["label_visible"] = label_visible; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() @@ -1450,41 +598,22 @@ def build(self) -> ElementWrapper: "stack_base": self.extra.get('stack_base'), "clip": self.extra.get('clip', False), "label_visible": self.extra.get('label_visible', True), - "standard_override": self.extra.get('standard_override'), } - return _create_element_wrapper( - DucFrameElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucFrameElement, base_params, element_params, + self.extra.get('explicit_properties_override')) -# Plot element builder class PlotElementBuilder(ElementSpecificBuilder): def with_margins(self, margins: Optional[Margins]): - self.extra["margins"] = margins - return self - + self.extra["margins"] = margins; return self def with_style(self, style: Optional[DucPlotStyle]): - self.extra["style"] = style - return self - + self.extra["style"] = style; return self def with_stack_base(self, stack_base: Optional[DucStackBase]): - self.extra["stack_base"] = stack_base - return self - + self.extra["stack_base"] = stack_base; return self def with_clip(self, clip: bool): - self.extra["clip"] = clip - return self - + self.extra["clip"] = clip; return self def with_label_visible(self, label_visible: bool): - self.extra["label_visible"] = label_visible - return self - - def with_standard_override(self, standard_override: Optional["Standard"]): - self.extra["standard_override"] = standard_override - return self + self.extra["label_visible"] = label_visible; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() @@ -1492,171 +621,63 @@ def build(self) -> ElementWrapper: "stack_base": self.extra.get('stack_base'), "clip": self.extra.get('clip', False), "label_visible": self.extra.get('label_visible', True), - "standard_override": self.extra.get('standard_override'), "style": self.extra.get('style'), "margins": self.extra.get('margins') } - return _create_element_wrapper( - DucPlotElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - + return _create_element_wrapper(DucPlotElement, base_params, element_params, + self.extra.get('explicit_properties_override')) -# Viewport element builder -class ViewportElementBuilder(ElementSpecificBuilder): - def with_points(self, points: List[tuple]): - self.extra["points"] = points - return self - def with_view(self, view: DucView): - self.extra["view"] = view - return self - - def with_view_scale(self, scale: float): - self.extra["scale"] = scale - return self - - def with_viewport_style(self, style: Optional[DucViewportStyle]): - self.extra["style"] = style - return self - - def with_stack_base(self, stack_base: Optional[DucStackBase]): - self.extra["stack_base"] = stack_base - return self - - def with_standard_override(self, standard_override: Optional["Standard"]): - self.extra["standard_override"] = standard_override - return self - - def with_shade_plot(self, shade_plot: Optional[VIEWPORT_SHADE_PLOT]): - self.extra["shade_plot"] = shade_plot - return self - - def with_frozen_group_ids(self, frozen_group_ids: Optional[List[str]]): - self.extra["frozen_group_ids"] = frozen_group_ids - return self - - def with_start_binding(self, start_binding: Optional[DucPointBinding]): - self.extra["start_binding"] = start_binding - return self - - def with_end_binding(self, end_binding: Optional[DucPointBinding]): - self.extra["end_binding"] = end_binding - return self - - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "points": self.extra.get('points', []), - "start_binding": self.extra.get('start_binding'), - "end_binding": self.extra.get('end_binding'), - "stack_base": self.extra.get('stack_base'), - "style": self.extra.get('style'), - "view": self.extra.get('view'), - "scale": self.extra.get('scale', 1.0), - "shade_plot": self.extra.get('shade_plot'), - "frozen_group_ids": self.extra.get('frozen_group_ids', []), - "standard_override": self.extra.get('standard_override') - } - return _create_element_wrapper( - DucViewportElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -# FreeDraw element builder class FreeDrawElementBuilder(ElementSpecificBuilder): def with_points(self, points: list): - self.extra["points"] = points - return self - + self.extra["points"] = points; return self def with_pressures(self, pressures: list): - self.extra["pressures"] = pressures - return self - + self.extra["pressures"] = pressures; return self def with_size_thickness(self, size: float): - self.extra["size"] = size - return self - + self.extra["size"] = size; return self def with_thinning(self, thinning: float): - self.extra["thinning"] = thinning - return self - + self.extra["thinning"] = thinning; return self def with_smoothing(self, smoothing: float): - self.extra["smoothing"] = smoothing - return self - + self.extra["smoothing"] = smoothing; return self def with_streamline(self, streamline: float): - self.extra["streamline"] = streamline - return self - + self.extra["streamline"] = streamline; return self def with_easing(self, easing: str): - self.extra["easing"] = easing - return self - + self.extra["easing"] = easing; return self def with_simulate_pressure(self, simulate_pressure: bool): - self.extra["simulate_pressure"] = simulate_pressure - return self - + self.extra["simulate_pressure"] = simulate_pressure; return self def with_start_cap(self, cap: bool): - self.extra["start_cap"] = cap - return self - + self.extra["start_cap"] = cap; return self def with_start_taper(self, taper: float): - self.extra["start_taper"] = taper - return self - + self.extra["start_taper"] = taper; return self def with_start_easing(self, easing: str): - self.extra["start_easing"] = easing - return self - + self.extra["start_easing"] = easing; return self def with_end_cap(self, cap: bool): - self.extra["end_cap"] = cap - return self - + self.extra["end_cap"] = cap; return self def with_end_taper(self, taper: float): - self.extra["end_taper"] = taper - return self - + self.extra["end_taper"] = taper; return self def with_end_easing(self, easing: str): - self.extra["end_easing"] = easing - return self - - def with_last_committed_point(self, last_committed_point: Optional[DucPoint]): - self.extra["last_committed_point"] = last_committed_point - return self - + self.extra["end_easing"] = easing; return self + def with_last_committed_point(self, lcp: Optional[DucPoint]): + self.extra["last_committed_point"] = lcp; return self def with_svg_path(self, svg_path: Optional[str]): - self.extra["svg_path"] = svg_path - return self + self.extra["svg_path"] = svg_path; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() - - start_cap = self.extra.get('start_cap') - start_taper = self.extra.get('start_taper') - start_easing = self.extra.get('start_easing') + start_ends = None - if start_cap is not None or start_taper is not None or start_easing is not None: + if any(self.extra.get(k) is not None for k in ('start_cap', 'start_taper', 'start_easing')): start_ends = DucFreeDrawEnds( - cap=start_cap if start_cap is not None else True, # Default to True if not provided - taper=start_taper if start_taper is not None else 0.0, - easing=start_easing if start_easing is not None else "linear" + cap=self.extra.get('start_cap', True), + taper=self.extra.get('start_taper', 0.0), + easing=self.extra.get('start_easing', "linear") ) - - end_cap = self.extra.get('end_cap') - end_taper = self.extra.get('end_taper') - end_easing = self.extra.get('end_easing') end_ends = None - if end_cap is not None or end_taper is not None or end_easing is not None: + if any(self.extra.get(k) is not None for k in ('end_cap', 'end_taper', 'end_easing')): end_ends = DucFreeDrawEnds( - cap=end_cap if end_cap is not None else True, # Default to True if not provided - taper=end_taper if end_taper is not None else 0.0, - easing=end_easing if end_easing is not None else "linear" + cap=self.extra.get('end_cap', True), + taper=self.extra.get('end_taper', 0.0), + easing=self.extra.get('end_easing', "linear") ) element_params = { @@ -1668,574 +689,69 @@ def build(self) -> ElementWrapper: "streamline": self.extra.get('streamline', 0.0), "easing": self.extra.get('easing', "linear"), "simulate_pressure": self.extra.get('simulate_pressure', False), - "start": start_ends, - "end": end_ends, + "start": start_ends, + "end": end_ends, "last_committed_point": self.extra.get('last_committed_point'), "svg_path": self.extra.get('svg_path'), } - return _create_element_wrapper( - DucFreeDrawElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucFreeDrawElement, base_params, element_params, + self.extra.get('explicit_properties_override')) -# Doc element builder class DocElementBuilder(ElementSpecificBuilder): def with_text(self, text: str): - self.extra["text"] = text - return self - + self.extra["text"] = text; return self def with_doc_style(self, style: Optional[DucDocStyle]): - self.extra["style"] = style - return self - - def with_columns_layout(self, columns: Optional[ColumnLayout]): - self.extra["columns"] = columns - return self - - def with_auto_resize(self, auto_resize: bool): - self.extra["auto_resize"] = auto_resize - return self - - def with_flow_direction(self, flow_direction: Optional[TEXT_FLOW_DIRECTION]): - self.extra["flow_direction"] = flow_direction - return self - - def with_dynamic(self, dynamic: Optional[List[DucTextDynamicPart]]): - self.extra["dynamic"] = dynamic - return self + self.extra["style"] = style; return self + def with_file_id(self, file_id: str): + self.extra["file_id"] = file_id; return self + def with_grid_config(self, grid_config: DocumentGridConfig): + self.extra["grid_config"] = grid_config; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() element_params = { "style": self.extra.get('style'), "text": self.extra.get('text', ""), - "dynamic": self.extra.get('dynamic', []), - "columns": self.extra.get('columns'), - "auto_resize": self.extra.get('auto_resize', False), - "flow_direction": self.extra.get('flow_direction') - } - return _create_element_wrapper( - DucDocElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -# Dimension builders -class LinearDimensionBuilder(ElementSpecificBuilder): - def with_origin1(self, origin1: GeometricPoint): - self.extra["origin1"] = origin1 - return self - - def with_origin2(self, origin2: GeometricPoint): - self.extra["origin2"] = origin2 - return self - - def with_location(self, location: GeometricPoint): - self.extra["location"] = location - return self - - def with_dimension_style(self, style: Optional[DucDimensionStyle]): - self.extra["style"] = style - return self - - def with_text_override(self, text_override: Optional[str]): - self.extra["text_override"] = text_override - return self - - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "style": self.extra.get('style'), - "origin1": self.extra.get('origin1'), - "origin2": self.extra.get('origin2'), - "location": self.extra.get('location'), - "oblique_angle": self.extra.get('oblique_angle', 0.0), - "dimension_type": self.extra.get('dimension_type', DIMENSION_TYPE.LINEAR), - "ordinate_axis": self.extra.get('ordinate_axis'), - "bindings": self.extra.get('bindings'), - "text_override": self.extra.get('text_override'), - "baseline_data": self.extra.get('baseline_data'), - "continue_data": self.extra.get('continue_data') - } - return _create_element_wrapper( - DucDimensionElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -class AlignedDimensionBuilder(LinearDimensionBuilder): - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "origin1": self.extra.get('origin1'), - "origin2": self.extra.get('origin2'), - "location": self.extra.get('location'), - "dimension_type": DIMENSION_TYPE.ALIGNED, - "oblique_angle": self.extra.get('oblique_angle', 0.0), - "style": self.extra.get('style'), - "text_override": self.extra.get('text_override'), - "ordinate_axis": self.extra.get('ordinate_axis'), - "bindings": self.extra.get('bindings'), - "baseline_data": self.extra.get('baseline_data'), - "continue_data": self.extra.get('continue_data'), - } - return _create_element_wrapper( - DucDimensionElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -class AngularDimensionBuilder(LinearDimensionBuilder): - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "origin1": self.extra.get('origin1'), - "origin2": self.extra.get('origin2'), - "location": self.extra.get('location'), - "dimension_type": DIMENSION_TYPE.ANGULAR, - "oblique_angle": self.extra.get('oblique_angle', 0.0), - "style": self.extra.get('style'), - "text_override": self.extra.get('text_override'), - "ordinate_axis": self.extra.get('ordinate_axis'), - "bindings": self.extra.get('bindings'), - "baseline_data": self.extra.get('baseline_data'), - "continue_data": self.extra.get('continue_data'), - } - return _create_element_wrapper( - DucDimensionElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -class RadiusDimensionBuilder(LinearDimensionBuilder): - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "origin1": self.extra.get('origin1'), - "origin2": self.extra.get('origin2'), - "location": self.extra.get('location'), - "dimension_type": DIMENSION_TYPE.RADIUS, - "oblique_angle": self.extra.get('oblique_angle', 0.0), - "style": self.extra.get('style'), - "text_override": self.extra.get('text_override'), - "ordinate_axis": self.extra.get('ordinate_axis'), - "bindings": self.extra.get('bindings'), - "baseline_data": self.extra.get('baseline_data'), - "continue_data": self.extra.get('continue_data'), - } - return _create_element_wrapper( - DucDimensionElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -class DiameterDimensionBuilder(LinearDimensionBuilder): - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "origin1": self.extra.get('origin1'), - "origin2": self.extra.get('origin2'), - "location": self.extra.get('location'), - "dimension_type": DIMENSION_TYPE.DIAMETER, - "oblique_angle": self.extra.get('oblique_angle', 0.0), - "style": self.extra.get('style'), - "text_override": self.extra.get('text_override'), - "ordinate_axis": self.extra.get('ordinate_axis'), - "bindings": self.extra.get('bindings'), - "baseline_data": self.extra.get('baseline_data'), - "continue_data": self.extra.get('continue_data'), - } - return _create_element_wrapper( - DucDimensionElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -class ArcLengthDimensionBuilder(LinearDimensionBuilder): - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "origin1": self.extra.get('origin1'), - "origin2": self.extra.get('origin2'), - "location": self.extra.get('location'), - "dimension_type": DIMENSION_TYPE.ARC_LENGTH, - "oblique_angle": self.extra.get('oblique_angle', 0.0), - "style": self.extra.get('style'), - "text_override": self.extra.get('text_override'), - "ordinate_axis": self.extra.get('ordinate_axis'), - "bindings": self.extra.get('bindings'), - "baseline_data": self.extra.get('baseline_data'), - "continue_data": self.extra.get('continue_data'), - } - return _create_element_wrapper( - DucDimensionElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -class CenterMarkDimensionBuilder(LinearDimensionBuilder): - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "origin1": self.extra.get('origin1'), - "origin2": self.extra.get('origin2'), - "location": self.extra.get('location'), - "dimension_type": DIMENSION_TYPE.CENTER_MARK, - "oblique_angle": self.extra.get('oblique_angle', 0.0), - "style": self.extra.get('style'), - "text_override": self.extra.get('text_override'), - "ordinate_axis": self.extra.get('ordinate_axis'), - "bindings": self.extra.get('bindings'), - "baseline_data": self.extra.get('baseline_data'), - "continue_data": self.extra.get('continue_data'), - } - return _create_element_wrapper( - DucDimensionElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -class RotatedDimensionBuilder(LinearDimensionBuilder): - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "origin1": self.extra.get('origin1'), - "origin2": self.extra.get('origin2'), - "location": self.extra.get('location'), - "dimension_type": DIMENSION_TYPE.ROTATED, - "oblique_angle": self.extra.get('oblique_angle', 0.0), - "style": self.extra.get('style'), - "text_override": self.extra.get('text_override'), - "ordinate_axis": self.extra.get('ordinate_axis'), - "bindings": self.extra.get('bindings'), - "baseline_data": self.extra.get('baseline_data'), - "continue_data": self.extra.get('continue_data'), - } - return _create_element_wrapper( - DucDimensionElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -class SpacingDimensionBuilder(LinearDimensionBuilder): - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "origin1": self.extra.get('origin1'), - "origin2": self.extra.get('origin2'), - "location": self.extra.get('location'), - "dimension_type": DIMENSION_TYPE.SPACING, - "oblique_angle": self.extra.get('oblique_angle', 0.0), - "style": self.extra.get('style'), - "text_override": self.extra.get('text_override'), - "ordinate_axis": self.extra.get('ordinate_axis'), - "bindings": self.extra.get('bindings'), - "baseline_data": self.extra.get('baseline_data'), - "continue_data": self.extra.get('continue_data'), - } - return _create_element_wrapper( - DucDimensionElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -class ContinueDimensionBuilder(LinearDimensionBuilder): - def with_continue_from_dimension_id(self, continue_from_dimension_id: str): - self.extra["continue_from_dimension_id"] = continue_from_dimension_id - return self - - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "origin1": self.extra.get('origin1'), - "origin2": self.extra.get('origin2'), - "location": self.extra.get('location'), - "dimension_type": DIMENSION_TYPE.CONTINUE, - "oblique_angle": self.extra.get('oblique_angle', 0.0), - "style": self.extra.get('style'), - "text_override": self.extra.get('text_override'), - "ordinate_axis": self.extra.get('ordinate_axis'), - "bindings": self.extra.get('bindings'), - "baseline_data": self.extra.get('baseline_data'), - "continue_data": self.extra.get('continue_data'), - } - return _create_element_wrapper( - DucDimensionElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -class BaselineDimensionBuilder(LinearDimensionBuilder): - def with_base_dimension_id(self, base_dimension_id: str): - self.extra["base_dimension_id"] = base_dimension_id - return self - - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "origin1": self.extra.get('origin1'), - "origin2": self.extra.get('origin2'), - "location": self.extra.get('location'), - "dimension_type": DIMENSION_TYPE.BASELINE, - "oblique_angle": self.extra.get('oblique_angle', 0.0), - "style": self.extra.get('style'), - "text_override": self.extra.get('text_override'), - "ordinate_axis": self.extra.get('ordinate_axis'), - "bindings": self.extra.get('bindings'), - "baseline_data": self.extra.get('baseline_data'), - "continue_data": self.extra.get('continue_data'), - } - return _create_element_wrapper( - DucDimensionElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -class JoggedLinearDimensionBuilder(LinearDimensionBuilder): - def with_jog_x(self, jog_x: float): - self.extra["jog_x"] = jog_x - return self - - def with_jog_y(self, jog_y: float): - self.extra["jog_y"] = jog_y - return self - - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "origin1": self.extra.get('origin1'), - "origin2": self.extra.get('origin2'), - "location": self.extra.get('location'), - "dimension_type": DIMENSION_TYPE.JOGGED_LINEAR, - "oblique_angle": self.extra.get('oblique_angle', 0.0), - "jog_x": self.extra.get('jog_x'), - "jog_y": self.extra.get('jog_y'), - "style": self.extra.get('style'), - "text_override": self.extra.get('text_override'), - "ordinate_axis": self.extra.get('ordinate_axis'), - "bindings": self.extra.get('bindings'), - "baseline_data": self.extra.get('baseline_data'), - "continue_data": self.extra.get('continue_data'), - } - return _create_element_wrapper( - DucDimensionElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -# Leader element builder -class LeaderElementBuilder(ElementSpecificBuilder): - def with_content_anchor_x(self, content_anchor_x: float): - self.extra["content_anchor_x"] = content_anchor_x - return self - - def with_content_anchor_y(self, content_anchor_y: float): - self.extra["content_anchor_y"] = content_anchor_y - return self - - def with_content(self, content: Optional[LeaderContent]): - self.extra["content"] = content - return self - - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "points": self.extra.get('points', []), - "start_binding": self.extra.get('start_binding'), - "end_binding": self.extra.get('end_binding'), - "style": self.extra.get('style'), - "content_anchor_x": self.extra.get('content_anchor_x', 0.0), - "content_anchor_y": self.extra.get('content_anchor_y', 0.0), - "content": self.extra.get('content') - } - # Create leader style with default dogleg - leader_style = element_params.get('style') - if leader_style is None: - from ducpy.builders.style_builders import (create_simple_styles, - create_text_style) - text_style = create_text_style() - leader_style = DucLeaderStyle( - text_style=text_style, - text_attachment=VERTICAL_ALIGN.TOP, - block_attachment=BLOCK_ATTACHMENT.CENTER_EXTENTS, - dogleg=self.extra.get('dogleg', 0.0), # Set default dogleg here - heads_override=None - ) - element_params['style'] = leader_style # Update element_params with the new style - return _create_element_wrapper( - DucLeaderElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - -# Feature Control Frame element builder -class FeatureControlFrameElementBuilder(ElementSpecificBuilder): - def with_segments(self, segments: List[FCFSegmentRow]): - self.extra["rows"] = segments - return self - - def with_frame_modifiers(self, frame_modifiers: Optional[FCFFrameModifiers]): - self.extra["frame_modifiers"] = frame_modifiers - return self - - def with_leader_element_id(self, leader_element_id: Optional[str]): - self.extra["leader_element_id"] = leader_element_id - return self - - def with_datum_definition(self, datum_definition: Optional[FCFDatumDefinition]): - self.extra["datum_definition"] = datum_definition - return self - - def with_style(self, style: Optional[DucFeatureControlFrameStyle]): - self.extra["style"] = style - return self - - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "style": self.extra.get('style', DucFeatureControlFrameStyle( - text_style=create_text_style(), - layout=FCFLayoutStyle(padding=2.0, segment_spacing=1.0, row_spacing=1.0), - symbols=FCFSymbolStyle(scale=1.0), - datum_style=FCFDatumStyle(bracket_style=None) - )), - "rows": self.extra.get('rows', []), - "frame_modifiers": self.extra.get('frame_modifiers'), - "leader_element_id": self.extra.get('leader_element_id'), - "datum_definition": self.extra.get('datum_definition') - } - return _create_element_wrapper( - DucFeatureControlFrameElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - - - - -# Mermaid element builder -class MermaidElementBuilder(ElementSpecificBuilder): - def with_source(self, source: str): - self.extra["source"] = source - return self - - def with_theme(self, theme: Optional[str]): - self.extra["theme"] = theme - return self - - def with_svg_path(self, svg_path: Optional[str]): - self.extra["svg_path"] = svg_path - return self - - def build(self) -> ElementWrapper: - base_params = self.base.__dict__.copy() - element_params = { - "source": self.extra.get('source', ''), - "theme": self.extra.get('theme'), - "svg_path": self.extra.get('svg_path') + "file_id": self.extra.get('file_id'), + "grid_config": self.extra.get('grid_config'), } - return _create_element_wrapper( - DucMermaidElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucDocElement, base_params, element_params, + self.extra.get('explicit_properties_override')) -# Embeddable element builder class EmbeddableElementBuilder(ElementSpecificBuilder): def with_link(self, link: str): - self.extra["link"] = link - return self + self.extra["link"] = link; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() - # Set the link property on the base params if provided if 'link' in self.extra: base_params['link'] = self.extra['link'] - element_params = {} - return _create_element_wrapper( - DucEmbeddableElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) + return _create_element_wrapper(DucEmbeddableElement, base_params, {}, + self.extra.get('explicit_properties_override')) -# Xray element builder -class XrayElementBuilder(ElementSpecificBuilder): - def with_origin_x(self, origin_x: float): - self.extra["origin_x"] = origin_x - return self - - def with_origin_y(self, origin_y: float): - self.extra["origin_y"] = origin_y - return self - - def with_direction_x(self, direction_x: float): - self.extra["direction_x"] = direction_x - return self - - def with_direction_y(self, direction_y: float): - self.extra["direction_y"] = direction_y - return self - - def with_color(self, color: str): - self.extra["color"] = color - return self - - def with_start_from_origin(self, start_from_origin: bool): - self.extra["start_from_origin"] = start_from_origin - return self +class ModelElementBuilder(ElementSpecificBuilder): + def with_model_type(self, model_type: str): + self.extra["model_type"] = model_type; return self + def with_code(self, code: str): + self.extra["code"] = code; return self + def with_svg_path(self, svg_path: str): + self.extra["svg_path"] = svg_path; return self + def with_file_ids(self, file_ids: List[str]): + self.extra["file_ids"] = file_ids; return self + def with_viewer_state(self, viewer_state): + self.extra["viewer_state"] = viewer_state; return self def build(self) -> ElementWrapper: base_params = self.base.__dict__.copy() element_params = { - "origin_x": self.extra.get("origin_x", 0.0), - "origin_y": self.extra.get("origin_y", 0.0), - "direction_x": self.extra.get("direction_x", 1.0), - "direction_y": self.extra.get("direction_y", 0.0), - "color": self.extra.get("color", "#FF0000"), - "start_from_origin": self.extra.get("start_from_origin", False), + "file_ids": self.extra.get('file_ids', []), + "model_type": self.extra.get('model_type'), + "code": self.extra.get('code'), + "svg_path": self.extra.get('svg_path'), + "viewer_state": self.extra.get('viewer_state'), } - return _create_element_wrapper( - DucXRayElement, - base_params, - element_params, - self.extra.get('explicit_properties_override') - ) - - + return _create_element_wrapper(DucModelElement, base_params, element_params, + self.extra.get('explicit_properties_override')) diff --git a/packages/ducpy/src/ducpy/builders/mutate_builder.py b/packages/ducpy/src/ducpy/builders/mutate_builder.py index 9eb4aa93..aec4c511 100644 --- a/packages/ducpy/src/ducpy/builders/mutate_builder.py +++ b/packages/ducpy/src/ducpy/builders/mutate_builder.py @@ -1,6 +1,8 @@ +from ducpy.classes.DataStateClass import (Checkpoint, Delta, + DucExternalFileEntry, DucGlobalState, + DucLocalState, VersionGraph) +from ducpy.classes.ElementsClass import ElementWrapper from ducpy.utils import recursive_mutate -from ducpy.classes.DataStateClass import VersionGraph, Checkpoint, Delta, DucGlobalState, DucLocalState, DucExternalFileEntry, GridSettings, SnapSettings -from ducpy.classes.ElementsClass import DucView, DucUcs, ElementWrapper from ducpy.utils.rand_utils import random_versioning @@ -15,8 +17,6 @@ def mutate_element(el, **kwargs): if isinstance(el, ElementWrapper): target_obj = el.element - # Apply versioning updates only if the target object has a 'base' attribute - # or is a top-level element (ElementWrapper itself, which has base via .element) if hasattr(target_obj, 'base') or isinstance(el, ElementWrapper): versioning = random_versioning() kwargs.update(versioning) @@ -24,7 +24,7 @@ def mutate_element(el, **kwargs): recursive_mutate(target_obj, kwargs) return el -# Mutate helpers for state classes + def mutate_version_graph(graph: VersionGraph, **kwargs): recursive_mutate(graph, kwargs) return graph @@ -48,19 +48,3 @@ def mutate_local_state(state: DucLocalState, **kwargs): def mutate_external_file(file_entry: DucExternalFileEntry, **kwargs): recursive_mutate(file_entry, kwargs) return file_entry - -def mutate_grid_settings(grid: GridSettings, **kwargs): - recursive_mutate(grid, kwargs) - return grid - -def mutate_snap_settings(snap: SnapSettings, **kwargs): - recursive_mutate(snap, kwargs) - return snap - -def mutate_view(view: DucView, **kwargs): - recursive_mutate(view, kwargs) - return view - -def mutate_ucs(ucs: DucUcs, **kwargs): - recursive_mutate(ucs, kwargs) - return ucs diff --git a/packages/ducpy/src/ducpy/builders/sql_builder.py b/packages/ducpy/src/ducpy/builders/sql_builder.py new file mode 100644 index 00000000..e3f3c9f1 --- /dev/null +++ b/packages/ducpy/src/ducpy/builders/sql_builder.py @@ -0,0 +1,202 @@ +""" +Thin wrapper to open .duc files as SQLite databases and run raw SQL. + +A .duc file is a standard SQLite database. This builder just handles +opening/creating/exporting and exposes the raw ``sqlite3.Connection`` +so you can write whatever SQL you want. + +Usage:: + + import ducpy as duc + + # Open existing .duc + with duc.DucSQL("drawing.duc") as db: + rows = db.sql("SELECT id, label FROM elements WHERE element_type = ?", "rectangle") + db.sql("UPDATE elements SET label = ? WHERE id = ?", "new-label", rows[0]["id"]) + + # Create new .duc from scratch + with duc.DucSQL.new() as db: + db.sql("INSERT INTO elements (id, element_type, x, y, width, height) VALUES (?,?,?,?,?,?)", + "r1", "rectangle", 0, 0, 100, 50) + db.save("output.duc") + + # From bytes + with duc.DucSQL.from_bytes(raw) as db: + print(db.sql("SELECT COUNT(*) AS n FROM elements")[0]["n"]) + modified = db.to_bytes() +""" + +from __future__ import annotations + +import os +import sqlite3 +import tempfile +from pathlib import Path +from typing import Any, List, Optional, Union + +__all__ = ["DucSQL"] + + +def _find_schema_dir() -> Optional[Path]: + current = Path(__file__).resolve() + for parent in current.parents: + candidate = parent / "schema" + if (candidate / "duc.sql").exists(): + return candidate + return None + + +def _read_schema_sql() -> str: + schema_dir = _find_schema_dir() + if schema_dir is None: + raise FileNotFoundError( + "Could not locate schema/duc.sql. " + "Ensure you are running from within the DUC repository." + ) + parts: list[str] = [] + for filename in ("duc.sql", "version_control.sql", "search.sql"): + path = schema_dir / filename + if path.exists(): + parts.append(path.read_text(encoding="utf-8")) + return "\n".join(parts) + + +def _apply_pragmas(conn: sqlite3.Connection) -> None: + conn.execute("PRAGMA journal_mode = WAL") + conn.execute("PRAGMA foreign_keys = ON") + conn.execute("PRAGMA synchronous = NORMAL") + + +class DucSQL: + """Raw SQL access to a ``.duc`` SQLite database. + + Attributes: + conn: The underlying :class:`sqlite3.Connection`. + Use it directly for cursor-level ops, ``conn.executemany``, etc. + """ + + def __init__(self, path: Union[str, Path]): + """Open an existing ``.duc`` file.""" + path = str(path) + if not os.path.exists(path): + raise FileNotFoundError(f"File not found: {path}") + self.conn: sqlite3.Connection = sqlite3.connect(path) + self.conn.row_factory = sqlite3.Row + _apply_pragmas(self.conn) + self._path: Optional[str] = path + self._temp: Optional[str] = None + self._closed = False + + @classmethod + def new(cls, path: Union[str, Path, None] = None) -> DucSQL: + """Create a new ``.duc`` database with the full schema bootstrapped. + + Pass a *path* to write to disk, or omit for in-memory. + """ + target = str(path) if path else ":memory:" + inst = object.__new__(cls) + inst.conn = sqlite3.connect(target) + inst.conn.row_factory = sqlite3.Row + inst.conn.executescript(_read_schema_sql()) + inst._path = target if path else None + inst._temp = None + inst._closed = False + return inst + + @classmethod + def from_bytes(cls, data: bytes) -> DucSQL: + """Open a ``.duc`` from raw bytes (temp file, cleaned up on close).""" + tmp = tempfile.NamedTemporaryFile(suffix=".duc", delete=False) + try: + tmp.write(data) + tmp.close() + inst = object.__new__(cls) + inst.conn = sqlite3.connect(tmp.name) + inst.conn.row_factory = sqlite3.Row + _apply_pragmas(inst.conn) + inst._path = tmp.name + inst._temp = tmp.name + inst._closed = False + return inst + except Exception: + os.unlink(tmp.name) + raise + + # ------------------------------------------------------------------ + # SQL execution + # ------------------------------------------------------------------ + + def sql(self, query: str, *args: Any) -> List[sqlite3.Row]: + """Run a SQL statement with positional ``?`` params. Returns rows.""" + return self.conn.execute(query, args).fetchall() + + def sql_dict(self, query: str, params: dict) -> List[sqlite3.Row]: + """Run a SQL statement with named ``:key`` params. Returns rows.""" + return self.conn.execute(query, params).fetchall() + + def commit(self) -> None: + self.conn.commit() + + def rollback(self) -> None: + self.conn.rollback() + + # ------------------------------------------------------------------ + # Export + # ------------------------------------------------------------------ + + def save(self, path: Union[str, Path, None] = None) -> None: + """Write the database to a file. Omit *path* to save in-place.""" + self.commit() + target = str(path) if path else self._path + if not target: + raise ValueError("No path — use save(path) or to_bytes().") + if target == self._path: + self.conn.execute("PRAGMA wal_checkpoint(TRUNCATE)") + else: + dst = sqlite3.connect(target) + try: + self.conn.backup(dst) + finally: + dst.close() + + def to_bytes(self) -> bytes: + """Export the database as raw bytes.""" + self.commit() + tmp = tempfile.NamedTemporaryFile(suffix=".duc", delete=False) + try: + tmp.close() + dst = sqlite3.connect(tmp.name) + self.conn.backup(dst) + dst.close() + with open(tmp.name, "rb") as f: + return f.read() + finally: + os.unlink(tmp.name) + + # ------------------------------------------------------------------ + # Lifecycle + # ------------------------------------------------------------------ + + def close(self) -> None: + if not getattr(self, "_closed", True): + self.conn.close() + self._closed = True + if self._temp and os.path.exists(self._temp): + os.unlink(self._temp) + + def __enter__(self) -> DucSQL: + return self + + def __exit__(self, *exc: Any) -> None: + if not self._closed: + if exc[0] is None: + self.commit() + self.close() + + def __del__(self) -> None: + self.close() + + def __repr__(self) -> str: + loc = self._path or ":memory:" + state = "closed" if self._closed else "open" + return f"DucSQL({loc!r}, {state})" diff --git a/packages/ducpy/src/ducpy/builders/state_builders.py b/packages/ducpy/src/ducpy/builders/state_builders.py index 92fbf696..0488cb96 100644 --- a/packages/ducpy/src/ducpy/builders/state_builders.py +++ b/packages/ducpy/src/ducpy/builders/state_builders.py @@ -1,59 +1,25 @@ """ Helper functions for creating DUC state-related objects with a user-friendly API. Follows the same hierarchical builder pattern as element_builders.py. +Only types from types.rs / duc.sql are supported. """ -from typing import List, Optional, Dict, Any, Union, TYPE_CHECKING import time -import uuid -import math -from dataclasses import dataclass, field -from ducpy.utils.mutate_utils import recursive_mutate - -if TYPE_CHECKING: - from ..classes.StandardsClass import Standard - -from ..classes.DataStateClass import ( - DucGlobalState, DucLocalState, DisplayPrecision, - VersionGraph, VersionGraphMetadata, Checkpoint, Delta, JSONPatchOperation, - DucExternalFileData, DucExternalFileEntry -) -from ..classes.StandardsClass import ( - GridSettings, SnapSettings, GridStyle, PolarGridSettings, IsometricGridSettings, - SnapOverride, DynamicSnapSettings, PolarTrackingSettings, TrackingLineStyle, - LayerSnapFilters, SnapMarkerSettings, SnapMarkerStyle, SnapMarkerStyleEntry, - Identifier, Standard, StandardViewSettings, StandardOverrides, UnitPrecision, - StandardStyles, IdentifiedGridSettings, IdentifiedSnapSettings, - DucCommonStyle, DucTextStyle, DucDocStyle, IdentifiedCommonStyle, IdentifiedTextStyle, IdentifiedDocStyle, - LinearUnitSystem, AngularUnitSystem, AlternateUnits, PrimaryUnits, StandardUnits, - DimensionValidationRules, LayerValidationRules, StandardValidation -) -from ..classes.ElementsClass import ( - DucView, DucUcs, DucPoint, GeometricPoint, DucGroup, DucStackBase, DucLayer, DucRegion, DucLayerOverrides, DucStackLikeStyles, - LeaderTextBlockContent, LeaderBlockContent, LeaderContent, StringValueEntry, ToleranceClause, DatumReference, FeatureControlFrameSegment, - DucBlockAttributeDefinition, DucBlockAttributeDefinitionEntry, DucBlock, ElementWrapper -) -from ..Duc.PRUNING_LEVEL import PRUNING_LEVEL -from ..Duc.GRID_TYPE import GRID_TYPE -from ..Duc.GRID_DISPLAY_TYPE import GRID_DISPLAY_TYPE -from ..Duc.SNAP_MODE import SNAP_MODE -from ..Duc.OBJECT_SNAP_MODE import OBJECT_SNAP_MODE -from ..Duc.SNAP_MARKER_SHAPE import SNAP_MARKER_SHAPE -from ..Duc.BOOLEAN_OPERATION import BOOLEAN_OPERATION -from ..Duc.SNAP_OVERRIDE_BEHAVIOR import SNAP_OVERRIDE_BEHAVIOR -from ..Duc.UNIT_SYSTEM import UNIT_SYSTEM -from ..Duc.DIMENSION_UNITS_FORMAT import DIMENSION_UNITS_FORMAT -from ..Duc.DECIMAL_SEPARATOR import DECIMAL_SEPARATOR -from ..Duc.ANGULAR_UNITS_FORMAT import ANGULAR_UNITS_FORMAT +from dataclasses import dataclass +from typing import Any, List, Optional + from ducpy.utils.rand_utils import generate_random_id -from ..Duc.FEATURE_MODIFIER import FEATURE_MODIFIER -from ..Duc.TOLERANCE_ZONE_TYPE import TOLERANCE_ZONE_TYPE -from ..Duc.MATERIAL_CONDITION import MATERIAL_CONDITION -from ..classes.ElementsClass import DatumReference -from ..Duc.GDT_SYMBOL import GDT_SYMBOL -from ..classes.ElementsClass import FeatureControlFrameSegment -from ..classes.ElementsClass import DucBlockAttributeDefinition, DucBlockAttributeDefinitionEntry - -# Base dataclass for common parameters + +from ..classes.DataStateClass import (Checkpoint, Delta, DucExternalFileData, + DucExternalFileEntry, DucGlobalState, + DucLocalState, VersionGraph, + VersionGraphMetadata) +from ..classes.ElementsClass import (DucBlock, DucBlockMetadata, DucGroup, + DucLayer, DucLayerOverrides, DucRegion, + DucStackBase, DucStackLikeStyles, + ElementWrapper, StringValueEntry) +from ..enums import BOOLEAN_OPERATION, PRUNING_LEVEL, TEXT_ALIGN + + @dataclass class BaseStateParams: id: Optional[str] = None @@ -62,7 +28,7 @@ class BaseStateParams: version: str = "1.0" readonly: bool = False -# Base builder class + class StateBuilder: def __init__(self): self.base = BaseStateParams() @@ -92,19 +58,12 @@ def with_extra(self, **kwargs): self.extra.update(kwargs) return self - # Build methods that return specific builders def build_global_state(self): return GlobalStateBuilder(self.base, self.extra) def build_local_state(self): return LocalStateBuilder(self.base, self.extra) - def build_view(self): - return ViewBuilder(self.base, self.extra) - - def build_ucs(self): - return UcsBuilder(self.base, self.extra) - def build_group(self): return GroupBuilder(self.base, self.extra) @@ -114,15 +73,6 @@ def build_layer(self): def build_region(self): return RegionBuilder(self.base, self.extra) - def build_standard(self): - return StandardBuilder(self.base, self.extra) - - def build_grid_settings(self): - return GridSettingsBuilder(self.base, self.extra) - - def build_snap_settings(self): - return SnapSettingsBuilder(self.base, self.extra) - def build_version_graph(self): return VersionGraphBuilder(self.base, self.extra) @@ -138,14 +88,18 @@ def build_external_file(self): def build_stack_base(self): return StackBaseBuilder(self.base, self.extra) -# Base class for specific builders + class StateSpecificBuilder: def __init__(self, base: BaseStateParams, extra: dict): self.base = base self.extra = extra.copy() -# Global State Builder + class GlobalStateBuilder(StateSpecificBuilder): + def with_name(self, name: str): + self.base.name = name + return self + def with_view_background_color(self, color: str): self.extra["view_background_color"] = color return self @@ -154,34 +108,10 @@ def with_main_scope(self, scope: str): self.extra["main_scope"] = scope return self - def with_dash_spacing_scale(self, scale: float): - self.extra["dash_spacing_scale"] = scale - return self - - def with_is_dash_spacing_affected_by_viewport_scale(self, affected: bool): - self.extra["is_dash_spacing_affected_by_viewport_scale"] = affected - return self - def with_scope_exponent_threshold(self, threshold: int): self.extra["scope_exponent_threshold"] = threshold return self - def with_dimensions_associative_by_default(self, associative: bool): - self.extra["dimensions_associative_by_default"] = associative - return self - - def with_use_annotative_scaling(self, use_annotative: bool): - self.extra["use_annotative_scaling"] = use_annotative - return self - - def with_linear_precision(self, precision: int): - self.extra["linear_precision"] = precision - return self - - def with_angular_precision(self, precision: int): - self.extra["angular_precision"] = precision - return self - def with_pruning_level(self, level: PRUNING_LEVEL): self.extra["pruning_level"] = level return self @@ -189,16 +119,12 @@ def with_pruning_level(self, level: PRUNING_LEVEL): def build(self) -> DucGlobalState: return create_global_state_from_base(self.base, **self.extra) -# Local State Builder + class LocalStateBuilder(StateSpecificBuilder): def with_scope(self, scope: str): self.extra["scope"] = scope return self - def with_active_standard_id(self, standard_id: str): - self.extra["active_standard_id"] = standard_id - return self - def with_scroll_x(self, scroll_x: float): self.extra["scroll_x"] = scroll_x return self @@ -235,64 +161,38 @@ def with_outline_mode_enabled(self, enabled: bool): self.extra["outline_mode_enabled"] = enabled return self - def build(self) -> DucLocalState: - return create_local_state_from_base(self.base, **self.extra) - -# View Builder -class ViewBuilder(StateSpecificBuilder): - def with_scroll_x(self, scroll_x: float): - self.extra["scroll_x"] = scroll_x - return self - - def with_scroll_y(self, scroll_y: float): - self.extra["scroll_y"] = scroll_y - return self - - def with_zoom(self, zoom: float): - self.extra["zoom"] = zoom + def with_manual_save_mode(self, enabled: bool): + self.extra["manual_save_mode"] = enabled return self - def with_twist_angle(self, angle: float): - self.extra["twist_angle"] = angle + def with_decimal_places(self, places: int): + self.extra["decimal_places"] = places return self - def with_center_x(self, center_x: float): - self.extra["center_x"] = center_x + def with_current_item_opacity(self, opacity: float): + self.extra["current_item_opacity"] = opacity return self - def with_center_y(self, center_y: float): - self.extra["center_y"] = center_y + def with_current_item_font_family(self, font_family: str): + self.extra["current_item_font_family"] = font_family return self - def with_center_point(self, center_point: DucPoint): - self.extra["center_point"] = center_point + def with_current_item_font_size(self, font_size: float): + self.extra["current_item_font_size"] = font_size return self - def with_scope(self, scope: str): - self.extra["scope"] = scope + def with_current_item_text_align(self, text_align: TEXT_ALIGN): + self.extra["current_item_text_align"] = text_align return self - def build(self) -> DucView: - return create_view_from_base(self.base, **self.extra) - -# UCS Builder -class UcsBuilder(StateSpecificBuilder): - def with_origin_x(self, origin_x: float): - self.extra["origin_x"] = origin_x + def with_current_item_roundness(self, roundness: float): + self.extra["current_item_roundness"] = roundness return self - def with_origin_y(self, origin_y: float): - self.extra["origin_y"] = origin_y - return self - - def with_angle(self, angle: float): - self.extra["angle"] = angle - return self + def build(self) -> DucLocalState: + return create_local_state_from_base(self.base, **self.extra) - def build(self) -> DucUcs: - return create_ucs_from_base(self.base, **self.extra) -# Group Builder class GroupBuilder(StateSpecificBuilder): def with_label(self, label: str): self.extra["label"] = label @@ -318,10 +218,6 @@ def with_opacity(self, opacity: float): self.extra["opacity"] = opacity return self - def with_labeling_color(self, color: str): - self.extra["labeling_color"] = color - return self - def with_id(self, id: str): self.base.id = id return self @@ -329,7 +225,7 @@ def with_id(self, id: str): def build(self) -> DucGroup: return create_group_from_base(self.base, **self.extra) -# Layer Builder + class LayerBuilder(StateSpecificBuilder): def with_label(self, label: str): self.extra["label"] = label @@ -359,10 +255,6 @@ def with_opacity(self, opacity: float): self.extra["opacity"] = opacity return self - def with_labeling_color(self, color: str): - self.extra["labeling_color"] = color - return self - def with_stroke_color(self, color: str): self.extra["stroke_color"] = color return self @@ -378,7 +270,7 @@ def with_id(self, id: str): def build(self) -> DucLayer: return create_layer_from_base(self.base, **self.extra) -# Region Builder + class RegionBuilder(StateSpecificBuilder): def with_label(self, label: str): self.extra["label"] = label @@ -408,10 +300,6 @@ def with_opacity(self, opacity: float): self.extra["opacity"] = opacity return self - def with_labeling_color(self, color: str): - self.extra["labeling_color"] = color - return self - def with_id(self, id: str): self.base.id = id return self @@ -419,262 +307,7 @@ def with_id(self, id: str): def build(self) -> DucRegion: return create_region_from_base(self.base, **self.extra) -# Standard Builder -class StandardBuilder(StateSpecificBuilder): - def with_validation(self, validation: StandardValidation): - self.extra["validation"] = validation - return self - - def with_units(self, units: StandardUnits): - self.extra["units"] = units - return self - - def with_styles(self, styles: StandardStyles): - self.extra["styles"] = styles - return self - - def with_overrides(self, overrides: StandardOverrides): - self.extra["overrides"] = overrides - return self - - def with_view_settings(self, view_settings: StandardViewSettings): - self.extra["view_settings"] = view_settings - return self - - def with_id(self, id: str): - self.base.id = id - return self - - def with_name(self, name: str): - self.base.name = name - return self - - def with_description(self, description: str): - self.base.description = description - return self - - def with_version(self, version: str): - self.base.version = version - return self - - def with_readonly(self, readonly: bool): - self.base.readonly = readonly - return self - - def build(self) -> Standard: - return create_standard_from_base(self.base, **self.extra) - -# Grid Settings Builder -class GridSettingsBuilder(StateSpecificBuilder): - def with_grid_type(self, grid_type: GRID_TYPE): - self.extra["grid_type"] = grid_type - return self - - def with_x_spacing(self, spacing: float): - self.extra["x_spacing"] = spacing - return self - - def with_y_spacing(self, spacing: float): - self.extra["y_spacing"] = spacing - return self - - def with_major_line_interval(self, interval: int): - self.extra["major_line_interval"] = interval - return self - - def with_show_grid(self, show: bool): - self.extra["show_grid"] = show - return self - - def with_snap_to_grid(self, snap: bool): - self.extra["snap_to_grid"] = snap - return self - - def with_is_adaptive(self, adaptive: bool): - self.extra["is_adaptive"] = adaptive - return self - - def with_subdivisions(self, subdivisions: int): - self.extra["subdivisions"] = subdivisions - return self - - def with_origin_x(self, origin_x: float): - self.extra["origin_x"] = origin_x - return self - - def with_origin_y(self, origin_y: float): - self.extra["origin_y"] = origin_y - return self - - def with_rotation(self, rotation: float): - self.extra["rotation"] = rotation - return self - - def with_follow_ucs(self, follow: bool): - self.extra["follow_ucs"] = follow - return self - - def with_show_minor(self, show: bool): - self.extra["show_minor"] = show - return self - - def with_min_zoom(self, min_zoom: float): - self.extra["min_zoom"] = min_zoom - return self - - def with_max_zoom(self, max_zoom: float): - self.extra["max_zoom"] = max_zoom - return self - - def with_auto_hide(self, auto_hide: bool): - self.extra["auto_hide"] = auto_hide - return self - - def with_enable_snapping(self, enable_snapping: bool): - self.extra["enable_snapping"] = enable_snapping - return self - - def with_readonly(self, readonly: bool): - self.extra["readonly"] = readonly - return self - - def with_display_type(self, display_type: GRID_DISPLAY_TYPE): - self.extra["display_type"] = display_type - return self - - def with_major_color(self, color: str): - self.extra["major_color"] = color - return self - - def with_minor_color(self, color: str): - self.extra["minor_color"] = color - return self - - def with_major_style(self, style: GridStyle): - self.extra["major_style"] = style - return self - - def with_minor_style(self, style: GridStyle): - self.extra["minor_style"] = style - return self - - def with_polar_settings(self, settings: PolarGridSettings): - self.extra["polar_settings"] = settings - return self - - def with_isometric_settings(self, settings: IsometricGridSettings): - self.extra["isometric_settings"] = settings - return self - - def build(self) -> GridSettings: - return create_grid_settings_from_base(self.base, **self.extra) - -# Snap Settings Builder -class SnapSettingsBuilder(StateSpecificBuilder): - def with_enabled(self, enabled: bool): - self.extra["enabled"] = enabled - return self - - def with_snap_modes(self, modes: List[SNAP_MODE]): - self.extra["snap_modes"] = modes - return self - def with_object_snap_modes(self, modes: List[OBJECT_SNAP_MODE]): - self.extra["object_snap_modes"] = modes - return self - - def with_snap_tolerance(self, tolerance: float): - self.extra["snap_tolerance"] = tolerance - return self - - def with_object_snap_aperture(self, aperture: int): - self.extra["object_snap_aperture"] = aperture - return self - - def with_tracking_enabled(self, enabled: bool): - self.extra["tracking_enabled"] = enabled - return self - - def with_readonly(self, readonly: bool): - self.extra["readonly"] = readonly - return self - - def with_twist_angle(self, angle: float): - self.extra["twist_angle"] = angle - return self - - def with_is_ortho_mode_on(self, ortho: bool): - self.extra["is_ortho_mode_on"] = ortho - return self - - def with_is_object_snap_on(self, snap_on: bool): - self.extra["is_object_snap_on"] = snap_on - return self - - def with_show_tracking_lines(self, show: bool): - self.extra["show_tracking_lines"] = show - return self - - def with_construction_snap_enabled(self, enabled: bool): - self.extra["construction_snap_enabled"] = enabled - return self - - def with_incremental_distance(self, distance: float): - self.extra["incremental_distance"] = distance - return self - - def with_magnetic_strength(self, strength: float): - self.extra["magnetic_strength"] = strength - return self - - def with_snap_mode(self, mode: SNAP_MODE): - self.extra["snap_mode"] = mode - return self - - def with_active_object_snap_modes(self, modes: List[OBJECT_SNAP_MODE]): - self.extra["active_object_snap_modes"] = modes - return self - - def with_snap_priority(self, priority: List[OBJECT_SNAP_MODE]): - self.extra["snap_priority"] = priority - return self - - def with_dynamic_snap(self, dynamic_snap: DynamicSnapSettings): - self.extra["dynamic_snap"] = dynamic_snap - return self - - def with_snap_markers(self, snap_markers: SnapMarkerSettings): - self.extra["snap_markers"] = snap_markers - return self - - def with_tracking_line_style(self, style: TrackingLineStyle): - self.extra["tracking_line_style"] = style - return self - - def with_temporary_overrides(self, overrides: List[SnapOverride]): - self.extra["temporary_overrides"] = overrides - return self - - def with_layer_snap_filters(self, filters: LayerSnapFilters): - self.extra["layer_snap_filters"] = filters - return self - - def with_element_type_filters(self, filters: List[str]): - self.extra["element_type_filters"] = filters - return self - - def with_snap_to_grid_intersections(self, snap: bool): - self.extra["snap_to_grid_intersections"] = snap - return self - - def with_polar_tracking(self, settings: PolarTrackingSettings): - self.extra["polar_tracking"] = settings - return self - - def build(self) -> SnapSettings: - return create_snap_settings_from_base(self.base, **self.extra) - -# Version Graph Builder class VersionGraphBuilder(StateSpecificBuilder): def with_checkpoints(self, checkpoints: List[Checkpoint]): self.extra["checkpoints"] = checkpoints @@ -695,7 +328,7 @@ def with_latest_version_id(self, version_id: str): def build(self) -> VersionGraph: return create_version_graph_from_base(self.base, **self.extra) -# Checkpoint Builder + class CheckpointBuilder(StateSpecificBuilder): def with_id(self, id: str): self.base.id = id @@ -720,14 +353,14 @@ def with_description(self, description: str): def build(self) -> Checkpoint: return create_checkpoint_from_base(self.base, **self.extra) -# Delta Builder + class DeltaBuilder(StateSpecificBuilder): def with_id(self, id: str): self.base.id = id return self - def with_patch(self, patch: List[JSONPatchOperation]): - self.extra["patch"] = patch + def with_payload(self, payload: bytes): + self.extra["payload"] = payload return self def with_parent_id(self, parent_id: str): @@ -745,7 +378,7 @@ def with_description(self, description: str): def build(self) -> Delta: return create_delta_from_base(self.base, **self.extra) -# External File Builder + class ExternalFileBuilder(StateSpecificBuilder): def with_key(self, key: str): self.extra["key"] = key @@ -766,7 +399,7 @@ def with_last_retrieved(self, last_retrieved: int): def build(self) -> DucExternalFileEntry: return create_external_file_from_base(self.base, **self.extra) -# Stack Base Builder (newly added) + class StackBaseBuilder(StateSpecificBuilder): def with_label(self, label: str): self.extra["label"] = label @@ -795,75 +428,49 @@ def with_styles(self, styles: DucStackLikeStyles): def build(self) -> DucStackBase: return create_stack_base_from_base(self.base, **self.extra) -# Create functions for all state types + +# =============== CREATE FUNCTIONS =============== + def create_global_state_from_base(base: BaseStateParams, **kwargs) -> DucGlobalState: - display_precision = DisplayPrecision( - linear=kwargs.get('linear_precision', 2), - angular=kwargs.get('angular_precision', 2) - ) return DucGlobalState( + name=base.name or None, view_background_color=kwargs.get('view_background_color', "#FFFFFF"), main_scope=kwargs.get('main_scope', "mm"), - dash_spacing_scale=kwargs.get('dash_spacing_scale', 1.0), - is_dash_spacing_affected_by_viewport_scale=kwargs.get('is_dash_spacing_affected_by_viewport_scale', False), scope_exponent_threshold=kwargs.get('scope_exponent_threshold', 6), - dimensions_associative_by_default=kwargs.get('dimensions_associative_by_default', True), - use_annotative_scaling=kwargs.get('use_annotative_scaling', False), - display_precision=display_precision, - name=base.name + pruning_level=kwargs.get('pruning_level', None), ) + def create_local_state_from_base(base: BaseStateParams, **kwargs) -> DucLocalState: return DucLocalState( scope=kwargs.get('scope', "mm"), - active_standard_id=kwargs.get('active_standard_id', "default"), scroll_x=kwargs.get('scroll_x', 0.0), scroll_y=kwargs.get('scroll_y', 0.0), zoom=kwargs.get('zoom', 1.0), is_binding_enabled=kwargs.get('is_binding_enabled', True), - pen_mode=kwargs.get('pen_mode', False), - view_mode_enabled=kwargs.get('view_mode_enabled', False), - objects_snap_mode_enabled=kwargs.get('objects_snap_mode_enabled', True), - grid_mode_enabled=kwargs.get('grid_mode_enabled', True), - outline_mode_enabled=kwargs.get('outline_mode_enabled', False), - active_grid_settings=kwargs.get('active_grid_settings', None), - active_snap_settings=kwargs.get('active_snap_settings', None), current_item_stroke=kwargs.get('current_item_stroke', None), current_item_background=kwargs.get('current_item_background', None), - current_item_opacity=kwargs.get('current_item_opacity', None), - current_item_font_family=kwargs.get('current_item_font_family', None), - current_item_font_size=kwargs.get('current_item_font_size', None), + current_item_opacity=kwargs.get('current_item_opacity', 1.0), + current_item_font_family=kwargs.get('current_item_font_family', "Virgil"), + current_item_font_size=kwargs.get('current_item_font_size', 20.0), current_item_text_align=kwargs.get('current_item_text_align', None), - current_item_roundness=kwargs.get('current_item_roundness', None), + current_item_roundness=kwargs.get('current_item_roundness', 0.0), current_item_start_line_head=kwargs.get('current_item_start_line_head', None), current_item_end_line_head=kwargs.get('current_item_end_line_head', None), - manual_save_mode=kwargs.get('manual_save_mode', None) - ) - -def create_view_from_base(base: BaseStateParams, **kwargs) -> DucView: - center_point = kwargs.get('center_point') - if center_point is None: - center_point = DucPoint(x=kwargs.get('center_x', 0.0), y=kwargs.get('center_y', 0.0), mirroring=None) - return DucView( - scroll_x=kwargs.get('scroll_x', 0.0), - scroll_y=kwargs.get('scroll_y', 0.0), - zoom=kwargs.get('zoom', 1.0), - twist_angle=kwargs.get('twist_angle', 0.0), - center_point=center_point, - scope=kwargs.get('scope', "mm") + pen_mode=kwargs.get('pen_mode', False), + view_mode_enabled=kwargs.get('view_mode_enabled', False), + objects_snap_mode_enabled=kwargs.get('objects_snap_mode_enabled', True), + grid_mode_enabled=kwargs.get('grid_mode_enabled', True), + outline_mode_enabled=kwargs.get('outline_mode_enabled', False), + manual_save_mode=kwargs.get('manual_save_mode', None), + decimal_places=kwargs.get('decimal_places', 2), ) -def create_ucs_from_base(base: BaseStateParams, **kwargs) -> DucUcs: - origin = GeometricPoint(x=kwargs.get('origin_x', 0.0), y=kwargs.get('origin_y', 0.0)) - return DucUcs( - origin=origin, - angle=kwargs.get('angle', 0.0) - ) def create_group_from_base(base: BaseStateParams, **kwargs) -> DucGroup: if base.id is None: base.id = generate_random_id() - + stack_base = DucStackBase( label=kwargs.get('label', ""), is_collapsed=kwargs.get('is_collapsed', False), @@ -871,21 +478,21 @@ def create_group_from_base(base: BaseStateParams, **kwargs) -> DucGroup: is_visible=kwargs.get('is_visible', True), locked=kwargs.get('locked', False), styles=DucStackLikeStyles( - opacity=kwargs.get('opacity', 1.0), - labeling_color=kwargs.get('labeling_color', "#000000") + opacity=kwargs.get('opacity', 1.0) ), description=base.description ) - + return DucGroup( id=base.id, stack_base=stack_base ) + def create_layer_from_base(base: BaseStateParams, **kwargs) -> DucLayer: if base.id is None: base.id = generate_random_id() - + stack_base = DucStackBase( label=kwargs.get('label', ""), is_collapsed=kwargs.get('is_collapsed', False), @@ -893,39 +500,34 @@ def create_layer_from_base(base: BaseStateParams, **kwargs) -> DucLayer: is_visible=kwargs.get('is_visible', True), locked=kwargs.get('locked', False), styles=DucStackLikeStyles( - opacity=kwargs.get('opacity', 1.0), - labeling_color=kwargs.get('labeling_color', "#000000") + opacity=kwargs.get('opacity', 1.0) ), description=base.description ) - - # Create layer overrides using style builders - from .style_builders import create_solid_content, create_background, create_stroke - + + from .style_builders import (create_background, create_solid_content, + create_stroke) + stroke_content = create_solid_content( color=kwargs.get('stroke_color', "#000000"), opacity=1.0, visible=True ) - + background_content = create_solid_content( color=kwargs.get('background_color', "#FFFFFF"), opacity=1.0, visible=True ) - - stroke = create_stroke( - content=stroke_content, - width=1.0 - ) - + + stroke = create_stroke(content=stroke_content, width=1.0) background = create_background(background_content) - + overrides = DucLayerOverrides( stroke=stroke, background=background ) - + return DucLayer( id=base.id, stack_base=stack_base, @@ -933,10 +535,11 @@ def create_layer_from_base(base: BaseStateParams, **kwargs) -> DucLayer: overrides=overrides ) + def create_region_from_base(base: BaseStateParams, **kwargs) -> DucRegion: if base.id is None: base.id = generate_random_id() - + stack_base = DucStackBase( label=kwargs.get('label', ""), is_collapsed=kwargs.get('is_collapsed', False), @@ -944,115 +547,36 @@ def create_region_from_base(base: BaseStateParams, **kwargs) -> DucRegion: is_visible=kwargs.get('is_visible', True), locked=kwargs.get('locked', False), styles=DucStackLikeStyles( - opacity=kwargs.get('opacity', 1.0), - labeling_color=kwargs.get('labeling_color', "#000000") + opacity=kwargs.get('opacity', 1.0) ), description=base.description ) - + return DucRegion( id=base.id, stack_base=stack_base, boolean_operation=kwargs.get('boolean_operation', BOOLEAN_OPERATION.UNION) ) -def create_standard_from_base(base: BaseStateParams, **kwargs) -> Standard: - standard_overrides = kwargs.get('overrides') - if standard_overrides is None: - unit_precision = kwargs.get('unit_precision') - if unit_precision is None: - unit_precision = UnitPrecision(linear=2, angular=2, area=2, volume=2) - standard_overrides = StandardOverrides( - unit_precision=unit_precision, - main_scope=kwargs.get('main_scope', ""), - elements_stroke_width_override=None, - common_style_id=None, - stack_like_style_id=None, - text_style_id=None, - dimension_style_id=None, - leader_style_id=None, - feature_control_frame_style_id=None, - table_style_id=None, - doc_style_id=None, - viewport_style_id=None, - plot_style_id=None, - hatch_style_id=None, - active_grid_settings_id=None, - active_snap_settings_id=None, - dash_line_override=None - ) - return Standard( - identifier=create_identifier(base.id or generate_random_id(), base.name, base.description), - version=base.version, - readonly=base.readonly, - view_settings=kwargs.get('view_settings'), - overrides=standard_overrides, - styles=kwargs.get('styles'), - units=kwargs.get('units'), - validation=kwargs.get('validation') - ) - -def create_grid_settings_from_base(base: BaseStateParams, **kwargs) -> GridSettings: - return GridSettings( - is_adaptive=kwargs.get('is_adaptive', False), - x_spacing=kwargs.get('x_spacing', 10.0), - y_spacing=kwargs.get('y_spacing', 10.0), - subdivisions=kwargs.get('subdivisions', 10), - origin=GeometricPoint(x=kwargs.get('origin_x', 0.0), y=kwargs.get('origin_y', 0.0)), - rotation=kwargs.get('rotation', 0.0), - follow_ucs=kwargs.get('follow_ucs', True), - major_style=kwargs.get('major_style', GridStyle(color=kwargs.get('major_color', "#808080"), opacity=1.0, dash_pattern=None)), - minor_style=kwargs.get('minor_style', GridStyle(color=kwargs.get('minor_color', "#C0C0C0"), opacity=1.0, dash_pattern=None)), - show_minor=kwargs.get('show_minor', True), - min_zoom=kwargs.get('min_zoom', 0.1), - max_zoom=kwargs.get('max_zoom', 100.0), - auto_hide=kwargs.get('auto_hide', False), - enable_snapping=kwargs.get('enable_snapping', False), - readonly=base.readonly, - type=kwargs.get('grid_type', kwargs.get('type', GRID_TYPE.RECTANGULAR)), - display_type=kwargs.get('display_type', GRID_DISPLAY_TYPE.LINES), - polar_settings=kwargs.get('polar_settings'), - isometric_settings=kwargs.get('isometric_settings') - ) - -def create_snap_settings_from_base(base: BaseStateParams, **kwargs) -> SnapSettings: - return SnapSettings( - active_object_snap_modes=kwargs.get('active_object_snap_modes', []), - snap_tolerance=kwargs.get('snap_tolerance', 10.0), - object_snap_aperture=kwargs.get('object_snap_aperture', 0), - readonly=kwargs.get('readonly', base.readonly), - twist_angle=kwargs.get('twist_angle', 0.0), - is_ortho_mode_on=kwargs.get('is_ortho_mode_on', False), - is_object_snap_on=kwargs.get('is_object_snap_on', True), - show_tracking_lines=kwargs.get('show_tracking_lines', True), - dynamic_snap=kwargs.get('dynamic_snap', DynamicSnapSettings(enabled_during_drag=False, enabled_during_rotation=False, enabled_during_scale=False)), - snap_markers=kwargs.get('snap_markers', SnapMarkerSettings(enabled=False, size=0, styles=[], duration=None)), - construction_snap_enabled=kwargs.get('construction_snap_enabled', True), - tracking_line_style=kwargs.get('tracking_line_style', None), - temporary_overrides=kwargs.get('temporary_overrides', None), - incremental_distance=kwargs.get('incremental_distance', None), - magnetic_strength=kwargs.get('magnetic_strength', None), - layer_snap_filters=kwargs.get('layer_snap_filters', None), - element_type_filters=kwargs.get('element_type_filters', None), - snap_mode=kwargs.get('snap_mode', SNAP_MODE.RUNNING), - snap_to_grid_intersections=kwargs.get('snap_to_grid_intersections', None), - snap_priority=kwargs.get('snap_priority', []), - polar_tracking=kwargs.get('polar_tracking', PolarTrackingSettings(enabled=False, angles=[], track_from_last_point=False, show_polar_coordinates=False, increment_angle=None)) - ) def create_version_graph_from_base(base: BaseStateParams, **kwargs) -> VersionGraph: metadata = VersionGraphMetadata( + current_version=0, + current_schema_version=0, + chain_count=0, last_pruned=int(time.time() * 1000), total_size=0, ) return VersionGraph( checkpoints=kwargs.get('checkpoints', []), deltas=kwargs.get('deltas', []), + chains=kwargs.get('chains', []), metadata=metadata, user_checkpoint_version_id=kwargs.get('user_checkpoint_version_id', ""), latest_version_id=kwargs.get('latest_version_id', "") ) + def create_checkpoint_from_base(base: BaseStateParams, **kwargs) -> Checkpoint: return Checkpoint( id=base.id or generate_random_id(), @@ -1066,6 +590,7 @@ def create_checkpoint_from_base(base: BaseStateParams, **kwargs) -> Checkpoint: size_bytes=len(kwargs.get('data', b"")) ) + def create_delta_from_base(base: BaseStateParams, **kwargs) -> Delta: return Delta( id=base.id or generate_random_id(), @@ -1075,9 +600,11 @@ def create_delta_from_base(base: BaseStateParams, **kwargs) -> Delta: description=base.description, user_id=kwargs.get('user_id'), type=kwargs.get('type', "delta"), - patch=kwargs.get('patch', []) + payload=kwargs.get('payload', b""), + size_bytes=len(kwargs.get('payload', b"")) ) + def create_external_file_from_base(base: BaseStateParams, **kwargs) -> DucExternalFileEntry: file_data = DucExternalFileData( mime_type=kwargs.get('mime_type', ""), @@ -1091,7 +618,7 @@ def create_external_file_from_base(base: BaseStateParams, **kwargs) -> DucExtern value=file_data ) -# Stack Base Builder (newly added) + def create_stack_base_from_base(base: BaseStateParams, **kwargs) -> DucStackBase: return DucStackBase( label=kwargs.get('label', ""), @@ -1099,263 +626,17 @@ def create_stack_base_from_base(base: BaseStateParams, **kwargs) -> DucStackBase is_plot=kwargs.get('is_plot', False), is_visible=kwargs.get('is_visible', True), locked=kwargs.get('locked', False), - styles=kwargs.get('styles', DucStackLikeStyles(opacity=1.0, labeling_color="#000000")), + styles=kwargs.get('styles', DucStackLikeStyles(opacity=1.0)), description=base.description ) -# Additional helper functions from standard_builders.py -def create_identifier(id: str, name: str, description: str = "") -> Identifier: - return Identifier(id=id, name=name, description=description) - -def create_standard_overrides(**kwargs) -> StandardOverrides: - return StandardOverrides( - unit_precision=kwargs.get('unit_precision'), - main_scope=kwargs.get('main_scope'), - elements_stroke_width_override=kwargs.get('elements_stroke_width_override'), - common_style_id=kwargs.get('common_style_id'), - stack_like_style_id=kwargs.get('stack_like_style_id'), - text_style_id=kwargs.get('text_style_id'), - dimension_style_id=kwargs.get('dimension_style_id'), - leader_style_id=kwargs.get('leader_style_id'), - feature_control_frame_style_id=kwargs.get('feature_control_frame_style_id'), - table_style_id=kwargs.get('table_style_id'), - doc_style_id=kwargs.get('doc_style_id'), - viewport_style_id=kwargs.get('viewport_style_id'), - plot_style_id=kwargs.get('plot_style_id'), - hatch_style_id=kwargs.get('hatch_style_id'), - active_grid_settings_id=kwargs.get('active_grid_settings_id'), - active_snap_settings_id=kwargs.get('active_snap_settings_id'), - dash_line_override=kwargs.get('dash_line_override') - ) - -def create_standard_view_settings(**kwargs) -> StandardViewSettings: - return StandardViewSettings( - views=kwargs.get('views', []), - ucs=kwargs.get('ucs', []), - grid_settings=kwargs.get('grid_settings', []), - snap_settings=kwargs.get('snap_settings', []) - ) - -def create_standard_styles(**kwargs) -> StandardStyles: - return StandardStyles( - common_styles=kwargs.get('common_styles', []), - stack_like_styles=kwargs.get('stack_like_styles', []), - text_styles=kwargs.get('text_styles', []), - dimension_styles=kwargs.get('dimension_styles', []), - leader_styles=kwargs.get('leader_styles', []), - feature_control_frame_styles=kwargs.get('feature_control_frame_styles', []), - table_styles=kwargs.get('table_styles', []), - doc_styles=kwargs.get('doc_styles', []), - viewport_styles=kwargs.get('viewport_styles', []), - hatch_styles=kwargs.get('hatch_styles', []), - xray_styles=kwargs.get('xray_styles', []) - ) - -def create_standard_units(**kwargs) -> StandardUnits: - return StandardUnits( - primary_units=kwargs.get('primary_units'), - alternate_units=kwargs.get('alternate_units') - ) - -def create_standard_validation(**kwargs) -> StandardValidation: - return StandardValidation( - dimension_rules=kwargs.get('dimension_rules'), - layer_rules=kwargs.get('layer_rules') - ) - -def create_identified_grid_settings( - id: str, - name: str, - description: str, - settings: GridSettings -) -> IdentifiedGridSettings: - """Create an identified grid settings object.""" - identifier = create_identifier(id, name, description) - return IdentifiedGridSettings( - id=identifier, - settings=settings - ) - -def create_identified_snap_settings( - id: str, - name: str, - description: str, - settings: SnapSettings -) -> IdentifiedSnapSettings: - """Create an identified snap settings object.""" - identifier = create_identifier(id, name, description) - return IdentifiedSnapSettings( - id=identifier, - settings=settings - ) - -def create_polar_grid_settings(**kwargs) -> PolarGridSettings: - return PolarGridSettings( - radial_divisions=kwargs.get('radial_divisions'), - radial_spacing=kwargs.get('radial_spacing'), - show_labels=kwargs.get('show_labels', False) # Default to False if not provided - ) - -def create_isometric_grid_settings(**kwargs) -> IsometricGridSettings: - return IsometricGridSettings(**kwargs) - -def create_snap_override(**kwargs) -> SnapOverride: - return SnapOverride(**kwargs) - -def create_dynamic_snap_settings(**kwargs) -> DynamicSnapSettings: - return DynamicSnapSettings(**kwargs) - -def create_polar_tracking_settings( - enabled: bool = False, - angles: Optional[List[float]] = None, - increment_angle: Optional[float] = None, - track_from_last_point: bool = False, - show_polar_coordinates: bool = False -) -> PolarTrackingSettings: - """Create polar tracking settings.""" - if angles is None: - angles = [] - return PolarTrackingSettings( - enabled=enabled, - angles=angles, - increment_angle=increment_angle, - track_from_last_point=track_from_last_point, - show_polar_coordinates=show_polar_coordinates - ) - -def create_tracking_line_style(**kwargs) -> TrackingLineStyle: - return TrackingLineStyle(**kwargs) - -def create_layer_snap_filters(**kwargs) -> LayerSnapFilters: - return LayerSnapFilters(**kwargs) - -def create_snap_marker_style(**kwargs) -> SnapMarkerStyle: - return SnapMarkerStyle(**kwargs) - -def create_snap_marker_style_entry(**kwargs) -> SnapMarkerStyleEntry: - return SnapMarkerStyleEntry(**kwargs) - -def create_snap_marker_settings(**kwargs) -> SnapMarkerSettings: - return SnapMarkerSettings(**kwargs) - -def create_linear_unit_system(**kwargs) -> LinearUnitSystem: - return LinearUnitSystem(**kwargs) - -def create_angular_unit_system(**kwargs) -> AngularUnitSystem: - return AngularUnitSystem(**kwargs) - -def create_alternate_units(**kwargs) -> AlternateUnits: - return AlternateUnits(**kwargs) - -def create_primary_units(**kwargs) -> PrimaryUnits: - return PrimaryUnits(**kwargs) - -def create_dimension_validation_rules(**kwargs) -> DimensionValidationRules: - return DimensionValidationRules(**kwargs) - -def create_layer_validation_rules(**kwargs) -> LayerValidationRules: - return LayerValidationRules(**kwargs) - -def create_json_patch_operation( - op: str, - path: str, - value: Any = None -) -> JSONPatchOperation: - """Create a JSON Patch operation for version control deltas.""" - return JSONPatchOperation( - op=op, - path=path, - from_path=None, - value=value - ) - -def create_leader_text_content(text: str) -> LeaderTextBlockContent: - """Create a leader text content for leader elements.""" - return LeaderTextBlockContent(text=text) - -def create_leader_block_content(block_id: str, attribute_values: Optional[List[StringValueEntry]] = None, element_overrides: Optional[List[StringValueEntry]] = None) -> LeaderBlockContent: - """Create a leader block content for leader elements.""" - return LeaderBlockContent( - block_id=block_id, - attribute_values=attribute_values, - element_overrides=element_overrides - ) - -def create_leader_content(content: Union[LeaderTextBlockContent, LeaderBlockContent]) -> LeaderContent: - """Create a leader content wrapper for leader elements.""" - return LeaderContent(content=content) - -def create_tolerance_clause( - value: str, - feature_modifiers: Optional[List[FEATURE_MODIFIER]] = None, - zone_type: Optional[TOLERANCE_ZONE_TYPE] = None, - material_condition: Optional[MATERIAL_CONDITION] = None -) -> ToleranceClause: - """Create a tolerance clause for feature control frames.""" - return ToleranceClause( - value=value, - feature_modifiers=feature_modifiers or [], - zone_type=zone_type, - material_condition=material_condition - ) - -def create_datum_reference( - letters: str, - modifier: Optional[MATERIAL_CONDITION] = None -) -> DatumReference: - """Create a datum reference for feature control frames.""" - return DatumReference( - letters=letters, - modifier=modifier - ) - -def create_feature_control_frame_segment( - symbol: GDT_SYMBOL, - tolerance: ToleranceClause, - datums: List[DatumReference] -) -> FeatureControlFrameSegment: - """Create a feature control frame segment.""" - return FeatureControlFrameSegment( - tolerance=tolerance, - datums=datums, - symbol=symbol - ) - -def create_block_attribute_definition_entry( - key: str, - tag: str, - default_value: str, - is_constant: bool = False, - prompt: Optional[str] = None -) -> DucBlockAttributeDefinitionEntry: - """Create a block attribute definition entry.""" - definition = DucBlockAttributeDefinition( - tag=tag, - default_value=default_value, - is_constant=is_constant, - prompt=prompt - ) - return DucBlockAttributeDefinitionEntry( - key=key, - value=definition - ) def create_block( id: str, label: str, - elements: List[ElementWrapper], - attribute_definitions: Optional[List[DucBlockAttributeDefinitionEntry]] = None, + elements: Optional[List[ElementWrapper]] = None, description: Optional[str] = None ) -> DucBlock: - """Create a block with elements and attribute definitions. - - Note: The elements parameter is for reference only and will not be stored in the block itself. - In the DUC format, blocks and elements are stored separately in the ExportedDataState. - """ - import time - from ducpy.classes.ElementsClass import DucBlockMetadata - - # Create default metadata metadata = DucBlockMetadata( source="ducpy", usage_count=0, @@ -1369,78 +650,11 @@ def create_block( label=label, version=1, description=description, - attribute_definitions=attribute_definitions or [], metadata=metadata, thumbnail=None ) + def create_string_value_entry(key: str, value: str) -> StringValueEntry: - """Create a string value entry for block attributes.""" return StringValueEntry(key=key, value=value) -def create_standard_complete( - id: str, - name: str, - description: str = "", - version: str = "1.0", - readonly: bool = False, - units: Optional[StandardUnits] = None, - validation: Optional[StandardValidation] = None, - overrides: Optional[StandardOverrides] = None, - styles: Optional[StandardStyles] = None, - view_settings: Optional[StandardViewSettings] = None, - grid_settings: Optional[GridSettings] = None, - snap_settings: Optional[SnapSettings] = None, - polar_tracking_settings: Optional[PolarTrackingSettings] = None -) -> Standard: - """Create a complete standard with all components.""" - identifier = Identifier(id=id, name=name, description=description) - # Ensure overrides is always an instance of StandardOverrides - if overrides is None: - unit_precision = None - if unit_precision is None: - unit_precision = UnitPrecision(linear=2, angular=2, area=2, volume=2) - overrides = StandardOverrides( - unit_precision=unit_precision, - main_scope="", - elements_stroke_width_override=None, - common_style_id=None, - stack_like_style_id=None, - text_style_id=None, - dimension_style_id=None, - leader_style_id=None, - feature_control_frame_style_id=None, - table_style_id=None, - doc_style_id=None, - viewport_style_id=None, - plot_style_id=None, - hatch_style_id=None, - active_grid_settings_id=None, - active_snap_settings_id=None, - dash_line_override=None - ) - if styles is None: - styles = StandardStyles( - common_styles=[], - stack_like_styles=[], - text_styles=[], - dimension_styles=[], - leader_styles=[], - feature_control_frame_styles=[], - table_styles=[], - doc_styles=[], - viewport_styles=[], - hatch_styles=[], - xray_styles=[] - ) - return Standard( - identifier=identifier, - version=version, - readonly=readonly, - units=units, - validation=validation, - overrides=overrides, - styles=styles, - view_settings=view_settings - ) - diff --git a/packages/ducpy/src/ducpy/builders/style_builders.py b/packages/ducpy/src/ducpy/builders/style_builders.py index bb92c8fc..12456413 100644 --- a/packages/ducpy/src/ducpy/builders/style_builders.py +++ b/packages/ducpy/src/ducpy/builders/style_builders.py @@ -2,34 +2,25 @@ Helper functions for creating element styles with a user-friendly API. Each ELEMENT_CONTENT_PREFERENCE has its own dedicated method. """ -from typing import List, Optional, Union -from ..classes.ElementsClass import ( - DucElementStylesBase, ElementBackground, ElementStroke, ElementContentBase, - StrokeStyle, StrokeSides, TilingProperties, DucHatchStyle, DucImageFilter, - DucPoint, CustomHatchPattern, DucTextStyle, LineSpacing, DucDocStyle, - ParagraphFormatting, StackFormat, StackFormatProperties, TextColumn, ColumnLayout, - Margins, DucTableCellStyle, DucTableStyle, TABLE_CELL_ALIGNMENT, TABLE_FLOW_DIRECTION -) -from ..Duc.ELEMENT_CONTENT_PREFERENCE import ELEMENT_CONTENT_PREFERENCE -from ..Duc.STROKE_PREFERENCE import STROKE_PREFERENCE -from ..Duc.STROKE_PLACEMENT import STROKE_PLACEMENT -from ..Duc.STROKE_JOIN import STROKE_JOIN -from ..Duc.STROKE_CAP import STROKE_CAP -from ..Duc.STROKE_SIDE_PREFERENCE import STROKE_SIDE_PREFERENCE -from ..Duc.BLENDING import BLENDING -from ..Duc.HATCH_STYLE import HATCH_STYLE -from ..Duc.TEXT_ALIGN import TEXT_ALIGN -from ..Duc.VERTICAL_ALIGN import VERTICAL_ALIGN -from ..Duc.LINE_SPACING_TYPE import LINE_SPACING_TYPE -from ..Duc.COLUMN_TYPE import COLUMN_TYPE -from ..Duc.STACKED_TEXT_ALIGN import STACKED_TEXT_ALIGN - - -# Utility functions for creating default objects +from typing import List, Optional + +from ..classes.ElementsClass import (CustomHatchPattern, DucDocStyle, + DucElementStylesBase, DucHatchStyle, + DucImageFilter, DucPoint, DucTableStyle, + DucTextStyle, ElementBackground, + ElementContentBase, ElementStroke, + LineSpacing, Margins, StrokeSides, + StrokeStyle, TilingProperties) +from ..enums import (BLENDING, ELEMENT_CONTENT_PREFERENCE, HATCH_STYLE, + LINE_SPACING_TYPE, STROKE_CAP, STROKE_JOIN, + STROKE_PLACEMENT, STROKE_PREFERENCE, + STROKE_SIDE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN) + + def _create_default_tiling_properties() -> TilingProperties: - """Create default tiling properties.""" + """Create default tiling settings used by content builders.""" return TilingProperties( - size_in_percent=100.0, + size_in_percent=100.0, angle=0.0, spacing=1.0, offset_x=0.0, @@ -37,33 +28,29 @@ def _create_default_tiling_properties() -> TilingProperties: ) def _create_default_hatch_style() -> DucHatchStyle: - """Create default hatch style.""" + """Create a neutral/default hatch style.""" return DucHatchStyle( - pattern_name="", - pattern_scale=1.0, + hatch_style=HATCH_STYLE.NORMAL, + pattern_name="", + pattern_scale=1.0, pattern_angle=0.0, pattern_origin=DucPoint(x=0.0, y=0.0, mirroring=None), pattern_double=False, - hatch_style=HATCH_STYLE.NORMAL, - custom_pattern=CustomHatchPattern(name="", description="", lines=[]) + custom_pattern=CustomHatchPattern(name="", lines=[]) ) def _create_default_image_filter() -> DucImageFilter: - """Create default image filter.""" + """Create a neutral image filter (no brightness/contrast changes).""" return DucImageFilter(brightness=1.0, contrast=1.0) def create_solid_content(color: str, opacity: float = 1.0, visible: bool = True) -> ElementContentBase: - """ - Create solid color content. - + """Create solid color content. + Args: - color: Hex color string (e.g., "#FF0000") - opacity: Content opacity (0.0 to 1.0) - visible: Whether content is visible - - Returns: - ElementContentBase: Solid color content + color: Hex color string (for example, "#FF0000"). + opacity: Content opacity from 0.0 to 1.0. + visible: Whether content should be visible. """ return ElementContentBase( src=color, @@ -72,21 +59,17 @@ def create_solid_content(color: str, opacity: float = 1.0, visible: bool = True) tiling=_create_default_tiling_properties(), hatch=_create_default_hatch_style(), image_filter=_create_default_image_filter(), - preference=None # Keep None to avoid type issues for now + preference=None ) def create_fill_content(color: str, opacity: float = 1.0, visible: bool = True) -> ElementContentBase: - """ - Create fill content (solid color or gradient). - + """Create generic fill content. + Args: - color: Hex color string or gradient definition - opacity: Content opacity (0.0 to 1.0) - visible: Whether content is visible - - Returns: - ElementContentBase: Fill content + color: Color or fill source string. + opacity: Content opacity from 0.0 to 1.0. + visible: Whether content should be visible. """ return ElementContentBase( src=color, @@ -95,27 +78,23 @@ def create_fill_content(color: str, opacity: float = 1.0, visible: bool = True) tiling=_create_default_tiling_properties(), hatch=_create_default_hatch_style(), image_filter=_create_default_image_filter(), - preference=None # Keep None to avoid type issues for now + preference=None ) def create_image_content( - image_src: str, - opacity: float = 1.0, + image_src: str, + opacity: float = 1.0, visible: bool = True, - fit_mode: Optional[str] = None # Changed to str to avoid enum issues + fit_mode: Optional[str] = None ) -> ElementContentBase: - """ - Create image content with various fit modes. - + """Create image content. + Args: - image_src: Can be a fileId, url, or frame element's content `@el/${elementId}` - opacity: Content opacity (0.0 to 1.0) - visible: Whether content is visible - fit_mode: How image fits (FIT, TILE, STRETCH) - string for now - - Returns: - ElementContentBase: Image content + image_src: Image source (file id, URL, or supported element reference). + opacity: Content opacity from 0.0 to 1.0. + visible: Whether content should be visible. + fit_mode: Reserved for fit mode behavior. """ return ElementContentBase( src=image_src, @@ -124,7 +103,7 @@ def create_image_content( tiling=_create_default_tiling_properties(), hatch=_create_default_hatch_style(), image_filter=_create_default_image_filter(), - preference=None # Keep None to avoid type issues for now + preference=None ) @@ -133,16 +112,12 @@ def create_hatch_content( opacity: float = 1.0, visible: bool = True ) -> ElementContentBase: - """ - Create hatch pattern content. - + """Create hatch pattern content. + Args: - pattern: Hatch pattern definition - opacity: Content opacity (0.0 to 1.0) - visible: Whether content is visible - - Returns: - ElementContentBase: Hatch content + pattern: Hatch pattern source/identifier. + opacity: Content opacity from 0.0 to 1.0. + visible: Whether content should be visible. """ return ElementContentBase( src=pattern, @@ -151,20 +126,14 @@ def create_hatch_content( tiling=_create_default_tiling_properties(), hatch=_create_default_hatch_style(), image_filter=_create_default_image_filter(), - preference=None # Keep None to avoid type issues for now + preference=None ) def create_background(content: Optional[ElementContentBase] = None) -> ElementBackground: - """ - Create element background from content. - - Args: - content: Content created by create_solid_content, create_image_content, etc. - If None, creates a default solid white background. - - Returns: - ElementBackground: Background with the specified content + """Create a background wrapper from content. + + If no content is provided, a solid white background is used. """ if content is None: content = create_solid_content("#FFFFFF", opacity=1.0, visible=True) @@ -178,23 +147,12 @@ def create_stroke( style: Optional[StrokeStyle] = None, sides: Optional[StrokeSides] = None ) -> ElementStroke: - """ - Create element stroke from content. - - Args: - content: Content created by create_solid_content, etc. - If None, creates a default solid black stroke. - width: Stroke width - placement: Where to place the stroke (INSIDE, CENTER, OUTSIDE) - style: Custom stroke style (defaults to solid) - sides: Custom stroke sides (defaults to all sides) - - Returns: - ElementStroke: Stroke with the specified content and properties + """Create a stroke wrapper from content and stroke settings. + + If content is omitted, a solid black stroke is used. """ if content is None: content = create_solid_content("#000000", opacity=1.0, visible=True) - if style is None: style = StrokeStyle( dash=[], @@ -205,13 +163,11 @@ def create_stroke( dash_cap=STROKE_CAP.ROUND, miter_limit=4.0 ) - if sides is None: sides = StrokeSides( values=[], preference=STROKE_SIDE_PREFERENCE.ALL ) - return ElementStroke( content=content, width=width, @@ -228,18 +184,9 @@ def create_simple_styles( strokes: Optional[List[ElementStroke]] = None, blending: Optional[BLENDING] = None ) -> DucElementStylesBase: - """ - Create element styles from pre-built backgrounds and strokes. - - Args: - roundness: Corner roundness for rectangles - opacity: Element opacity (0.0 to 1.0) - backgrounds: List of backgrounds created with create_background() - strokes: List of strokes created with create_stroke() - blending: Blending mode - - Returns: - DucElementStylesBase: Configured styles + """Create base element styles from backgrounds and strokes. + + Falls back to one default background and one default stroke when omitted. """ return DucElementStylesBase( roundness=roundness, @@ -250,44 +197,39 @@ def create_simple_styles( ) -# Flexible style creation functions def create_fill_style(content, roundness: float = 0.0, opacity: float = 1.0) -> DucElementStylesBase: - """Create a fill style with the given content (solid, image, hatch, etc).""" + """Create styles configured with fill only.""" background = create_background(content) return create_simple_styles(roundness=roundness, opacity=opacity, backgrounds=[background]) def create_stroke_style(content, width: float = 1.0, placement: STROKE_PLACEMENT = STROKE_PLACEMENT.INSIDE, opacity: float = 1.0) -> DucElementStylesBase: - """Create a stroke style with the given content and width.""" + """Create styles configured with stroke only.""" stroke = create_stroke(content, width=width, placement=placement) return create_simple_styles(opacity=opacity, strokes=[stroke]) def create_fill_and_stroke_style( - fill_content: ElementContentBase, - stroke_content: ElementContentBase, - stroke_width: float = 1.0, + fill_content: ElementContentBase, + stroke_content: ElementContentBase, + stroke_width: float = 1.0, roundness: float = 0.0, opacity: float = 1.0, placement: STROKE_PLACEMENT = STROKE_PLACEMENT.INSIDE ) -> DucElementStylesBase: - """Create a style with both fill and stroke using the provided contents.""" + """Create styles configured with both fill and stroke.""" background = create_background(fill_content) stroke = create_stroke(stroke_content, width=stroke_width, placement=placement) return create_simple_styles(roundness=roundness, opacity=opacity, backgrounds=[background], strokes=[stroke]) -# Content creation helpers for common cases def create_solid_style(color: str, opacity: float = 1.0): - """Create solid content for use with create_fill_style or create_stroke_style.""" + """Convenience helper that returns solid content for style composition.""" return create_solid_content(color, opacity) def create_hatch_style(pattern: str, opacity: float = 1.0): - """Create hatch content for use with create_fill_style or create_stroke_style.""" + """Convenience helper that returns hatch content for style composition.""" return create_hatch_content(pattern, opacity) -# === Text and Document Style Builders === - def create_text_style( - base_style: Optional[DucElementStylesBase] = None, font_family: str = "Arial", font_size: float = 12, is_ltr: bool = True, @@ -300,45 +242,24 @@ def create_text_style( width_factor: float = 1.0, is_upside_down: bool = False, is_backwards: bool = False, - paper_text_height: Optional[float] = None ) -> DucTextStyle: + """Create a text style instance. + + This helper provides safe defaults for alignment and line spacing. """ - Create a text style for table cells or other text elements. - - Args: - base_style: Base element style - font_family: Font family name - font_size: Font size - is_ltr: Left-to-right text direction - text_align: Horizontal text alignment - vertical_align: Vertical text alignment - line_height: Line height multiplier - line_spacing_value: Line spacing value - line_spacing_type: Line spacing type - oblique_angle: Text oblique angle - width_factor: Text width factor - is_upside_down: Whether text is upside down - is_backwards: Whether text is backwards - paper_text_height: Paper text height - """ - if base_style is None: - base_style = create_simple_styles() - if text_align is None: text_align = TEXT_ALIGN.LEFT - if vertical_align is None: vertical_align = VERTICAL_ALIGN.TOP - if line_spacing_type is None: line_spacing_type = LINE_SPACING_TYPE.MULTIPLE - + line_spacing = LineSpacing(value=line_spacing_value, type=line_spacing_type) - + return DucTextStyle( is_ltr=is_ltr, font_family=font_family, - big_font_family=font_family, # Use same font for big text + big_font_family=font_family, line_height=line_height, line_spacing=line_spacing, oblique_angle=oblique_angle, @@ -348,116 +269,18 @@ def create_text_style( is_backwards=is_backwards, text_align=text_align, vertical_align=vertical_align, - paper_text_height=paper_text_height - ) - - -def create_paragraph_formatting( - first_line_indent: float = 0.0, - hanging_indent: float = 0.0, - left_indent: float = 0.0, - right_indent: float = 0.0, - space_before: float = 0.0, - space_after: float = 0.0, - tab_stops: Optional[List[float]] = None -) -> ParagraphFormatting: - """Create paragraph formatting settings.""" - if tab_stops is None: - tab_stops = [] - - return ParagraphFormatting( - first_line_indent=first_line_indent, - hanging_indent=hanging_indent, - left_indent=left_indent, - right_indent=right_indent, - space_before=space_before, - space_after=space_after, - tab_stops=tab_stops - ) - - -def create_stack_format_properties( - upper_scale: float = 0.7, - lower_scale: float = 0.7, - alignment: Optional[STACKED_TEXT_ALIGN] = None -) -> StackFormatProperties: - """Create stack format properties for stacked text.""" - if alignment is None: - alignment = STACKED_TEXT_ALIGN.CENTER - - return StackFormatProperties( - upper_scale=upper_scale, - lower_scale=lower_scale, - alignment=alignment ) -def create_stack_format( - auto_stack: bool = True, - stack_chars: Optional[List[str]] = None, - properties: Optional[StackFormatProperties] = None -) -> StackFormat: - """Create stack format for fractions and special text.""" - if stack_chars is None: - stack_chars = ["/", "\\", "#"] - - if properties is None: - properties = create_stack_format_properties() - - return StackFormat( - auto_stack=auto_stack, - stack_chars=stack_chars, - properties=properties - ) - +def create_doc_style() -> DucDocStyle: + """DucDocStyle is empty in the current schema.""" + return DucDocStyle() -def create_doc_style( - text_style: Optional[DucTextStyle] = None, - paragraph: Optional[ParagraphFormatting] = None, - stack_format: Optional[StackFormat] = None -) -> DucDocStyle: - """Create document style.""" - if text_style is None: - text_style = create_text_style() - - if paragraph is None: - paragraph = create_paragraph_formatting() - - if stack_format is None: - stack_format = create_stack_format() - - return DucDocStyle( - text_style=text_style, - paragraph=paragraph, - stack_format=stack_format - ) +def create_table_style() -> DucTableStyle: + """DucTableStyle is empty in the current schema.""" + return DucTableStyle() -def create_text_column( - width: float, - gutter: float = 0.0 -) -> TextColumn: - """Create a text column definition.""" - return TextColumn(width=width, gutter=gutter) - - -def create_column_layout( - definitions: Optional[List[TextColumn]] = None, - auto_height: bool = True, - column_type: Optional[COLUMN_TYPE] = None -) -> ColumnLayout: - """Create column layout for multi-column text.""" - if definitions is None: - definitions = [create_text_column(width=200)] - - if column_type is None: - column_type = COLUMN_TYPE.STATIC_COLUMNS - - return ColumnLayout( - definitions=definitions, - auto_height=auto_height, - type=column_type - ) def create_margins( top: float = 0.0, @@ -465,59 +288,5 @@ def create_margins( bottom: float = 0.0, left: float = 0.0 ) -> Margins: - """Create margin settings.""" - return Margins( - top=top, - right=right, - bottom=bottom, - left=left - ) - -def create_table_cell_style( - base_style: Optional[DucElementStylesBase] = None, - text_style: Optional[DucTextStyle] = None, - margins: Optional[Margins] = None, - alignment: Optional[TABLE_CELL_ALIGNMENT] = None -) -> DucTableCellStyle: - """Create table cell style.""" - if base_style is None: - base_style = create_simple_styles() - if text_style is None: - text_style = create_text_style() - if margins is None: - margins = create_margins() # Use new builder - if alignment is None: - alignment = TABLE_CELL_ALIGNMENT.MIDDLE_LEFT - - return DucTableCellStyle( - base_style=base_style, - text_style=text_style, - margins=margins, - alignment=alignment - ) - -def create_table_style( - base_style: Optional[DucElementStylesBase] = None, - header_row_style: Optional[DucTableCellStyle] = None, - data_row_style: Optional[DucTableCellStyle] = None, - data_column_style: Optional[DucTableCellStyle] = None, - flow_direction: Optional[TABLE_FLOW_DIRECTION] = None -) -> DucTableStyle: - """Create table style.""" - if base_style is None: - base_style = create_simple_styles() - if header_row_style is None: - header_row_style = create_table_cell_style() # Use new builder - if data_row_style is None: - data_row_style = create_table_cell_style() # Use new builder - if data_column_style is None: - data_column_style = create_table_cell_style() # Use new builder - if flow_direction is None: - flow_direction = TABLE_FLOW_DIRECTION.DOWN - - return DucTableStyle( - header_row_style=header_row_style, - data_row_style=data_row_style, - data_column_style=data_column_style, - flow_direction=flow_direction - ) + """Create margin values in top/right/bottom/left order.""" + return Margins(top=top, right=right, bottom=bottom, left=left) diff --git a/packages/ducpy/src/ducpy/classes/DataStateClass.py b/packages/ducpy/src/ducpy/classes/DataStateClass.py index 1bfb1d07..02e79ba0 100644 --- a/packages/ducpy/src/ducpy/classes/DataStateClass.py +++ b/packages/ducpy/src/ducpy/classes/DataStateClass.py @@ -1,18 +1,16 @@ from dataclasses import dataclass, field -from typing import List, Optional, Dict, Union, Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union -from ducpy.Duc.PRUNING_LEVEL import PRUNING_LEVEL -from ducpy.Duc.TEXT_ALIGN import TEXT_ALIGN +from ducpy.enums import PRUNING_LEVEL, TEXT_ALIGN if TYPE_CHECKING: from ducpy.classes.ElementsClass import ElementWrapper - from ducpy.classes.StandardsClass import Standard -from ducpy.classes.ElementsClass import (DucBlock, DucBlockCollection, DucBlockInstance, DucGroup, DucHead, DucLayer, - DucRegion, ElementBackground, - ElementStroke, ElementWrapper, - GeometricPoint) -from ducpy.classes.StandardsClass import GridSettings, SnapSettings, Standard +from ducpy.classes.ElementsClass import (DucBlock, DucBlockCollection, + DucBlockInstance, DucGroup, DucHead, + DucLayer, DucRegion, + ElementBackground, ElementStroke, + ElementWrapper, GeometricPoint) @dataclass @@ -20,28 +18,17 @@ class DictionaryEntry: key: str value: str -@dataclass -class DisplayPrecision: - linear: int - angular: int - @dataclass class DucGlobalState: view_background_color: str main_scope: str - dash_spacing_scale: float - is_dash_spacing_affected_by_viewport_scale: bool scope_exponent_threshold: int - dimensions_associative_by_default: bool - use_annotative_scaling: bool - display_precision: DisplayPrecision name: Optional[str] pruning_level: Optional[PRUNING_LEVEL] = None @dataclass class DucLocalState: scope: str - active_standard_id: str scroll_x: float scroll_y: float zoom: float @@ -51,8 +38,6 @@ class DucLocalState: objects_snap_mode_enabled: bool grid_mode_enabled: bool outline_mode_enabled: bool - active_grid_settings: Optional[List[str]] - active_snap_settings: Optional[str] current_item_stroke: Optional["ElementStroke"] current_item_background: Optional["ElementBackground"] current_item_opacity: Optional[float] @@ -63,13 +48,7 @@ class DucLocalState: current_item_start_line_head: Optional["DucHead"] current_item_end_line_head: Optional["DucHead"] manual_save_mode: Optional[bool] = None - -@dataclass -class JSONPatchOperation: - op: str - path: str - from_path: Optional[str] - value: Any # Value can be any JSON-serializable type + decimal_places: int = 2 @dataclass class VersionBase: @@ -82,21 +61,45 @@ class VersionBase: @dataclass class Checkpoint(VersionBase): - data: bytes - size_bytes: int - type: str + version_number: int = 0 + schema_version: int = 0 + is_schema_boundary: bool = False + data: bytes = b'' + size_bytes: int = 0 + type: str = 'checkpoint' @dataclass class Delta(VersionBase): - patch: List[JSONPatchOperation] - type: str - - def __post_init__(self): - if self.patch is None: - self.patch = [] + version_number: int = 0 + schema_version: int = 0 + base_checkpoint_id: str = '' + payload: bytes = b'' + size_bytes: int = 0 + type: str = 'delta' + +@dataclass +class SchemaMigration: + from_schema_version: int + to_schema_version: int + migration_name: str + applied_at: int + migration_checksum: Optional[str] = None + boundary_checkpoint_id: Optional[str] = None + +@dataclass +class VersionChain: + id: str + schema_version: int + start_version: int + end_version: Optional[int] = None + migration: Optional[SchemaMigration] = None + root_checkpoint_id: Optional[str] = None @dataclass class VersionGraphMetadata: + current_version: int + current_schema_version: int + chain_count: int last_pruned: int total_size: int @@ -104,10 +107,16 @@ class VersionGraphMetadata: class VersionGraph: checkpoints: List[Checkpoint] deltas: List[Delta] + chains: List[VersionChain] metadata: VersionGraphMetadata user_checkpoint_version_id: str latest_version_id: str +@dataclass +class DisplayPrecision: + linear: int = 2 + angular: int = 2 + @dataclass class DucExternalFileData: mime_type: str @@ -134,7 +143,6 @@ class ExportedDataState: groups: List["DucGroup"] regions: List["DucRegion"] layers: List["DucLayer"] - standards: List[Standard] dictionary: Dict[str, str] duc_local_state: Optional[DucLocalState] duc_global_state: Optional[DucGlobalState] diff --git a/packages/ducpy/src/ducpy/classes/ElementsClass.py b/packages/ducpy/src/ducpy/classes/ElementsClass.py index 1683df44..1d709af3 100644 --- a/packages/ducpy/src/ducpy/classes/ElementsClass.py +++ b/packages/ducpy/src/ducpy/classes/ElementsClass.py @@ -1,81 +1,34 @@ from dataclasses import dataclass -from typing import List, Optional, Dict, Union, Any, TYPE_CHECKING - -from ducpy.Duc.ANGULAR_UNITS_FORMAT import ANGULAR_UNITS_FORMAT -from ducpy.Duc.BEZIER_MIRRORING import BEZIER_MIRRORING -from ducpy.Duc.BLENDING import BLENDING -from ducpy.Duc.BLOCK_ATTACHMENT import BLOCK_ATTACHMENT -from ducpy.Duc.BOOLEAN_OPERATION import BOOLEAN_OPERATION -from ducpy.Duc.COLUMN_TYPE import COLUMN_TYPE -from ducpy.Duc.DATUM_BRACKET_STYLE import DATUM_BRACKET_STYLE -from ducpy.Duc.DOCUMENT_GRID_ALIGN_ITEMS import DOCUMENT_GRID_ALIGN_ITEMS -from ducpy.Duc.DIMENSION_FIT_RULE import DIMENSION_FIT_RULE -from ducpy.Duc.DIMENSION_TEXT_PLACEMENT import DIMENSION_TEXT_PLACEMENT -from ducpy.Duc.DIMENSION_TYPE import DIMENSION_TYPE -from ducpy.Duc.ELEMENT_CONTENT_PREFERENCE import ELEMENT_CONTENT_PREFERENCE -from ducpy.Duc.FEATURE_MODIFIER import FEATURE_MODIFIER -from ducpy.Duc.GDT_SYMBOL import GDT_SYMBOL -from ducpy.Duc.HATCH_STYLE import HATCH_STYLE -from ducpy.Duc.IMAGE_STATUS import IMAGE_STATUS -from ducpy.Duc.LINE_HEAD import LINE_HEAD -from ducpy.Duc.LINE_SPACING_TYPE import LINE_SPACING_TYPE -from ducpy.Duc.MARK_ELLIPSE_CENTER import MARK_ELLIPSE_CENTER -from ducpy.Duc.MATERIAL_CONDITION import MATERIAL_CONDITION -from ducpy.Duc.STACKED_TEXT_ALIGN import STACKED_TEXT_ALIGN -from ducpy.Duc.STROKE_CAP import STROKE_CAP -from ducpy.Duc.STROKE_JOIN import STROKE_JOIN -from ducpy.Duc.STROKE_PLACEMENT import STROKE_PLACEMENT -from ducpy.Duc.STROKE_PREFERENCE import STROKE_PREFERENCE -from ducpy.Duc.STROKE_SIDE_PREFERENCE import STROKE_SIDE_PREFERENCE -from ducpy.Duc.TABLE_CELL_ALIGNMENT import TABLE_CELL_ALIGNMENT -from ducpy.Duc.TABLE_FLOW_DIRECTION import TABLE_FLOW_DIRECTION -from ducpy.Duc.TEXT_ALIGN import TEXT_ALIGN -from ducpy.Duc.TEXT_FIELD_SOURCE_PROPERTY import TEXT_FIELD_SOURCE_PROPERTY -from ducpy.Duc.TEXT_FIELD_SOURCE_TYPE import TEXT_FIELD_SOURCE_TYPE -from ducpy.Duc.TEXT_FLOW_DIRECTION import TEXT_FLOW_DIRECTION -from ducpy.Duc.TOLERANCE_DISPLAY import TOLERANCE_DISPLAY -from ducpy.Duc.TOLERANCE_TYPE import TOLERANCE_TYPE -from ducpy.Duc.TOLERANCE_ZONE_TYPE import TOLERANCE_ZONE_TYPE -from ducpy.Duc.VIEWPORT_SHADE_PLOT import VIEWPORT_SHADE_PLOT -from ducpy.Duc.AXIS import AXIS -from ducpy.Duc.PARAMETRIC_SOURCE_TYPE import PARAMETRIC_SOURCE_TYPE -from ducpy.Duc.LEADER_CONTENT_TYPE import LEADER_CONTENT_TYPE -from ducpy.Duc.VERTICAL_ALIGN import VERTICAL_ALIGN - -if TYPE_CHECKING: - from ducpy.classes.StandardsClass import Standard, PrimaryUnits - - -@dataclass -class Identifier: - id: str - name: str - description: str +from typing import Any, List, Optional, Union + +from ducpy.enums import (BEZIER_MIRRORING, BLENDING, BOOLEAN_OPERATION, + ELEMENT_CONTENT_PREFERENCE, HATCH_STYLE, IMAGE_STATUS, + LINE_HEAD, LINE_SPACING_TYPE, STROKE_CAP, STROKE_JOIN, + STROKE_PLACEMENT, STROKE_PREFERENCE, + STROKE_SIDE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN) + +# =============== UTILITY & GEOMETRY TYPES =============== @dataclass -class GeometricPoint: - x: float - y: float +class DictionaryEntry: + key: str + value: str @dataclass -class DucUcs: - origin: GeometricPoint - angle: float +class StringValueEntry: + key: str + value: str @dataclass -class DucPoint: +class GeometricPoint: x: float y: float - mirroring: Optional[BEZIER_MIRRORING] @dataclass -class DucView: - scroll_x: float - scroll_y: float - zoom: float - twist_angle: float - center_point: DucPoint - scope: str +class DucPoint: + x: float + y: float + mirroring: Optional[BEZIER_MIRRORING] = None @dataclass class Margins: @@ -84,13 +37,101 @@ class Margins: bottom: float left: float + +# =============== 3D VIEWER STATE =============== + +@dataclass +class Viewer3DClipPlane: + enabled: bool + value: float + normal: Optional[List[float]] = None + +@dataclass +class Viewer3DMaterial: + metalness: float + roughness: float + default_opacity: float + edge_color: int + ambient_intensity: float + direct_intensity: float + +@dataclass +class Viewer3DZebra: + active: bool + stripe_count: int + stripe_direction: float + color_scheme: str + opacity: float + mapping_mode: str + +@dataclass +class Viewer3DCamera: + control: str + ortho: bool + up: str + position: List[float] + quaternion: List[float] + target: List[float] + zoom: float + pan_speed: float + rotate_speed: float + zoom_speed: float + holroyd: bool + +@dataclass +class Viewer3DGridPlanes: + xy: bool + xz: bool + yz: bool + +@dataclass +class Viewer3DGrid: + """Tagged union: {"type": "uniform", "value": bool} or {"type": "perPlane", "value": Viewer3DGridPlanes}""" + type: str + value: Any + +@dataclass +class Viewer3DDisplay: + wireframe: bool + transparent: bool + black_edges: bool + grid: Viewer3DGrid + axes_visible: bool + axes_at_origin: bool + +@dataclass +class Viewer3DClipping: + x: Viewer3DClipPlane + y: Viewer3DClipPlane + z: Viewer3DClipPlane + intersection: bool + show_planes: bool + object_color_caps: bool + +@dataclass +class Viewer3DExplode: + active: bool + value: float + +@dataclass +class Viewer3DState: + camera: Viewer3DCamera + display: Viewer3DDisplay + material: Viewer3DMaterial + clipping: Viewer3DClipping + explode: Viewer3DExplode + zebra: Viewer3DZebra + + +# =============== STYLING & CONTENT =============== + @dataclass class TilingProperties: size_in_percent: float angle: float - spacing: Optional[float] - offset_x: Optional[float] - offset_y: Optional[float] + spacing: Optional[float] = None + offset_x: Optional[float] = None + offset_y: Optional[float] = None @dataclass class HatchPatternLine: @@ -102,18 +143,18 @@ class HatchPatternLine: @dataclass class CustomHatchPattern: name: str - description: str lines: List[HatchPatternLine] + description: Optional[str] = None @dataclass class DucHatchStyle: + hatch_style: HATCH_STYLE pattern_name: str pattern_scale: float pattern_angle: float pattern_origin: DucPoint pattern_double: bool - hatch_style: HATCH_STYLE - custom_pattern: Optional[CustomHatchPattern] + custom_pattern: Optional[CustomHatchPattern] = None @dataclass class DucImageFilter: @@ -125,33 +166,33 @@ class ElementContentBase: src: str visible: bool opacity: float - tiling: Optional[TilingProperties] - hatch: Optional[DucHatchStyle] - image_filter: Optional[DucImageFilter] - preference: Optional[ELEMENT_CONTENT_PREFERENCE] + preference: Optional[ELEMENT_CONTENT_PREFERENCE] = None + tiling: Optional[TilingProperties] = None + hatch: Optional[DucHatchStyle] = None + image_filter: Optional[DucImageFilter] = None @dataclass class StrokeStyle: - preference: STROKE_PREFERENCE - dash: Optional[List[float]] - dash_line_override: Optional[str] - cap: Optional[STROKE_CAP] - join: Optional[STROKE_JOIN] - dash_cap: Optional[STROKE_CAP] - miter_limit: Optional[float] + preference: Optional[STROKE_PREFERENCE] = None + cap: Optional[STROKE_CAP] = None + join: Optional[STROKE_JOIN] = None + dash: Optional[List[float]] = None + dash_line_override: Optional[str] = None + dash_cap: Optional[STROKE_CAP] = None + miter_limit: Optional[float] = None @dataclass class StrokeSides: - preference: STROKE_SIDE_PREFERENCE - values: Optional[List[float]] + preference: Optional[STROKE_SIDE_PREFERENCE] = None + values: Optional[List[float]] = None @dataclass class ElementStroke: content: ElementContentBase width: float style: StrokeStyle - placement: STROKE_PLACEMENT - stroke_sides: Optional[StrokeSides] + placement: Optional[STROKE_PLACEMENT] = None + stroke_sides: Optional[StrokeSides] = None @dataclass class ElementBackground: @@ -165,6 +206,9 @@ class DucElementStylesBase: opacity: float blending: Optional[BLENDING] = None + +# =============== BASE ELEMENT & COMMON ELEMENT COMPONENTS =============== + @dataclass class BoundElement: id: str @@ -187,27 +231,26 @@ class DucElementBase: version_nonce: int updated: int is_plot: bool - is_annotative: bool is_deleted: bool group_ids: List[str] block_ids: List[str] region_ids: List[str] z_index: float locked: bool - description: Optional[str] - index: Optional[str] - link: Optional[str] - layer_id: Optional[str] - frame_id: Optional[str] - bound_elements: Optional[List[BoundElement]] - custom_data: Optional[Dict[str, Any]] + description: Optional[str] = None + index: Optional[str] = None instance_id: Optional[str] = None + layer_id: Optional[str] = None + frame_id: Optional[str] = None + bound_elements: Optional[List[BoundElement]] = None + link: Optional[str] = None + custom_data: Optional[str] = None @dataclass class DucHead: size: float - type: LINE_HEAD - block_id: Optional[str] + type: Optional[LINE_HEAD] = None + block_id: Optional[str] = None @dataclass class PointBindingPoint: @@ -217,16 +260,16 @@ class PointBindingPoint: @dataclass class DucPointBinding: element_id: str - focus: Optional[float] + focus: float gap: float - fixed_point: Optional[GeometricPoint] - point: Optional[PointBindingPoint] - head: Optional[DucHead] + fixed_point: Optional[GeometricPoint] = None + point: Optional[PointBindingPoint] = None + head: Optional[DucHead] = None @dataclass class DucLineReference: index: int - handle: Optional[GeometricPoint] + handle: Optional[GeometricPoint] = None @dataclass class DucLine: @@ -236,8 +279,8 @@ class DucLine: @dataclass class DucPath: line_indices: List[int] - background: Optional[ElementBackground] - stroke: Optional[ElementStroke] + background: Optional[ElementBackground] = None + stroke: Optional[ElementStroke] = None @dataclass class DucLinearElementBase: @@ -245,15 +288,13 @@ class DucLinearElementBase: points: List[DucPoint] lines: List[DucLine] path_overrides: List[DucPath] - last_committed_point: Optional[DucPoint] - start_binding: Optional[DucPointBinding] - end_binding: Optional[DucPointBinding] + last_committed_point: Optional[DucPoint] = None + start_binding: Optional[DucPointBinding] = None + end_binding: Optional[DucPointBinding] = None @dataclass class DucStackLikeStyles: opacity: float - labeling_color: str - blending: Optional[BLENDING] = None @dataclass class DucStackBase: @@ -263,26 +304,30 @@ class DucStackBase: is_visible: bool locked: bool styles: DucStackLikeStyles - description: str + description: Optional[str] = None @dataclass class DucStackElementBase: base: DucElementBase - stack_base: "DucStackBase" + stack_base: DucStackBase clip: bool label_visible: bool - standard_override: Optional[str] + + +# =============== ELEMENT-SPECIFIC STYLES =============== @dataclass class LineSpacing: value: float - type: LINE_SPACING_TYPE + type: Optional[LINE_SPACING_TYPE] = None @dataclass class DucTextStyle: is_ltr: bool font_family: str big_font_family: str + text_align: TEXT_ALIGN + vertical_align: VERTICAL_ALIGN line_height: float line_spacing: LineSpacing oblique_angle: float @@ -290,133 +335,21 @@ class DucTextStyle: width_factor: float is_upside_down: bool is_backwards: bool - text_align: TEXT_ALIGN - vertical_align: VERTICAL_ALIGN - paper_text_height: Optional[float] - -@dataclass -class DucTableCellStyle: - base_style: DucElementStylesBase - text_style: DucTextStyle - margins: Margins - alignment: TABLE_CELL_ALIGNMENT @dataclass class DucTableStyle: - header_row_style: DucTableCellStyle - data_row_style: DucTableCellStyle - data_column_style: DucTableCellStyle - flow_direction: TABLE_FLOW_DIRECTION - -@dataclass -class DucLeaderStyle: - text_style: DucTextStyle - text_attachment: VERTICAL_ALIGN - block_attachment: BLOCK_ATTACHMENT - dogleg: Optional[float] - heads_override: Optional[List[DucHead]] - -@dataclass -class DimensionToleranceStyle: - enabled: bool - upper_value: float - lower_value: float - precision: int - display_method: TOLERANCE_DISPLAY - text_style: Optional[DucTextStyle] - -@dataclass -class DimensionFitStyle: - force_text_inside: bool - rule: DIMENSION_FIT_RULE - text_placement: DIMENSION_TEXT_PLACEMENT - -@dataclass -class DimensionLineStyle: - stroke: ElementStroke - text_gap: float - -@dataclass -class DimensionExtLineStyle: - stroke: ElementStroke - overshoot: float - offset: float - -@dataclass -class DimensionSymbolStyle: - center_mark_size: float - center_mark_type: MARK_ELLIPSE_CENTER - heads_override: Optional[List[DucHead]] - -@dataclass -class DucDimensionStyle: - dim_line: DimensionLineStyle - ext_line: DimensionExtLineStyle - text_style: DucTextStyle - symbols: DimensionSymbolStyle - tolerance: DimensionToleranceStyle - fit: DimensionFitStyle - -@dataclass -class FCFLayoutStyle: - padding: float - segment_spacing: float - row_spacing: float - -@dataclass -class FCFSymbolStyle: - scale: float - -@dataclass -class FCFDatumStyle: - bracket_style: Optional[DATUM_BRACKET_STYLE] - -@dataclass -class DucFeatureControlFrameStyle: - text_style: DucTextStyle - layout: FCFLayoutStyle - symbols: FCFSymbolStyle - datum_style: FCFDatumStyle - -@dataclass -class ParagraphFormatting: - first_line_indent: float - hanging_indent: float - left_indent: float - right_indent: float - space_before: float - space_after: float - tab_stops: List[float] - -@dataclass -class StackFormatProperties: - upper_scale: float - lower_scale: float - alignment: Optional[STACKED_TEXT_ALIGN] - -@dataclass -class StackFormat: - auto_stack: bool - stack_chars: List[str] - properties: StackFormatProperties + pass @dataclass class DucDocStyle: - text_style: DucTextStyle - paragraph: ParagraphFormatting - stack_format: StackFormat - -@dataclass -class DucViewportStyle: - scale_indicator_visible: bool + pass @dataclass class DucPlotStyle: pass -@dataclass -class DucXRayStyle: - color: str + +# =============== ELEMENT DEFINITIONS =============== @dataclass class DucRectangleElement: @@ -444,80 +377,28 @@ class DocumentGridConfig: columns: int gap_x: float gap_y: float - align_items: DOCUMENT_GRID_ALIGN_ITEMS first_page_alone: bool scale: float @dataclass class DucPdfElement: base: DucElementBase - file_id: Optional[str] grid_config: DocumentGridConfig + file_id: Optional[str] = None @dataclass -class DucMermaidElement: +class DucDocElement: base: DucElementBase - source: str - theme: Optional[str] - svg_path: Optional[str] - -@dataclass -class DucTableColumn: - id: str - width: float - style_overrides: Optional[DucTableCellStyle] - -@dataclass -class DucTableRow: - id: str - height: float - style_overrides: Optional[DucTableCellStyle] - -@dataclass -class DucTableCellSpan: - columns: int - rows: int - -@dataclass -class DucTableCell: - row_id: str - column_id: str - data: str - locked: bool - span: Optional[DucTableCellSpan] - style_overrides: Optional[DucTableCellStyle] - -@dataclass -class DucTableColumnEntry: - key: str - value: DucTableColumn - -@dataclass -class DucTableRowEntry: - key: str - value: DucTableRow - -@dataclass -class DucTableCellEntry: - key: str - value: DucTableCell - -@dataclass -class DucTableAutoSize: - columns: bool - rows: bool + style: DucDocStyle + text: str + grid_config: DocumentGridConfig + file_id: Optional[str] = None @dataclass class DucTableElement: base: DucElementBase style: DucTableStyle - column_order: List[str] - row_order: List[str] - columns: List[DucTableColumnEntry] - rows: List[DucTableRowEntry] - cells: List[DucTableCellEntry] - header_row_count: int - auto_size: DucTableAutoSize + file_id: Optional[str] = None @dataclass class ImageCrop: @@ -531,41 +412,20 @@ class ImageCrop: @dataclass class DucImageElement: base: DucElementBase - scale: List[float] status: IMAGE_STATUS - file_id: Optional[str] - crop: Optional[ImageCrop] - filter: Optional[DucImageFilter] - -@dataclass -class DucTextDynamicElementSource: - element_id: str - property: TEXT_FIELD_SOURCE_PROPERTY - -@dataclass -class DucTextDynamicDictionarySource: - key: str - -@dataclass -class DucTextDynamicSource: - source: Union[DucTextDynamicElementSource, DucTextDynamicDictionarySource] - -@dataclass -class DucTextDynamicPart: - tag: str - source: DucTextDynamicSource - cached_value: str - formatting: Optional["PrimaryUnits"] + scale: List[float] + file_id: Optional[str] = None + crop: Optional[ImageCrop] = None + filter: Optional[DucImageFilter] = None @dataclass class DucTextElement: base: DucElementBase style: DucTextStyle text: str - dynamic: List[DucTextDynamicPart] auto_resize: bool original_text: str - container_id: Optional[str] + container_id: Optional[str] = None @dataclass class DucLinearElement: @@ -594,45 +454,36 @@ class DucFreeDrawElement: easing: str pressures: List[float] simulate_pressure: bool - last_committed_point: Optional[DucPoint] - start: Optional[DucFreeDrawEnds] - end: Optional[DucFreeDrawEnds] - svg_path: Optional[str] + start: Optional[DucFreeDrawEnds] = None + end: Optional[DucFreeDrawEnds] = None + last_committed_point: Optional[DucPoint] = None + svg_path: Optional[str] = None @dataclass -class DucBlockAttributeDefinition: - tag: str - default_value: str - is_constant: bool - prompt: Optional[str] +class DucFrameElement: + stack_element_base: DucStackElementBase @dataclass -class DucBlockAttributeDefinitionEntry: - key: str - value: DucBlockAttributeDefinition +class PlotLayout: + margins: Margins @dataclass -class DucBlockMetadata: - source: str - usage_count: int - created_at: int - updated_at: int - localization: Optional[str] +class DucPlotElement: + stack_element_base: DucStackElementBase + style: DucPlotStyle + layout: PlotLayout @dataclass -class DucBlock: - id: str - label: str - version: int - attribute_definitions: List[DucBlockAttributeDefinitionEntry] - description: Optional[str] - metadata: Optional[DucBlockMetadata] - thumbnail: Optional[bytes] +class DucModelElement: + base: DucElementBase + file_ids: List[str] + model_type: Optional[str] = None + code: Optional[str] = None + svg_path: Optional[str] = None + viewer_state: Optional[Viewer3DState] = None -@dataclass -class StringValueEntry: - key: str - value: str + +# =============== BLOCK DEFINITIONS =============== @dataclass class DucBlockDuplicationArray: @@ -641,15 +492,30 @@ class DucBlockDuplicationArray: row_spacing: float col_spacing: float +@dataclass +class DucBlockMetadata: + usage_count: int + created_at: int + updated_at: int + source: Optional[str] = None + localization: Optional[str] = None + +@dataclass +class DucBlock: + id: str + label: str + version: int + description: Optional[str] = None + metadata: Optional[DucBlockMetadata] = None + thumbnail: Optional[bytes] = None + @dataclass class DucBlockInstance: id: str block_id: str version: int - element_overrides: Optional[List[StringValueEntry]] - attribute_values: Optional[List[StringValueEntry]] - duplication_array: Optional[DucBlockDuplicationArray] - + element_overrides: Optional[List[StringValueEntry]] = None + duplication_array: Optional[DucBlockDuplicationArray] = None @dataclass class DucBlockCollectionEntry: @@ -661,199 +527,11 @@ class DucBlockCollection: id: str label: str children: List[DucBlockCollectionEntry] - metadata: Optional[DucBlockMetadata] - thumbnail: Optional[bytes] - -@dataclass -class DucFrameElement: - stack_element_base: DucStackElementBase + metadata: Optional[DucBlockMetadata] = None + thumbnail: Optional[bytes] = None -@dataclass -class PlotLayout: - margins: Margins -@dataclass -class DucPlotElement: - stack_element_base: DucStackElementBase - style: DucPlotStyle - layout: PlotLayout - -@dataclass -class DucViewportElement: - linear_base: DucLinearElementBase - stack_base: DucStackBase - style: DucViewportStyle - view: DucView - scale: float - shade_plot: VIEWPORT_SHADE_PLOT - frozen_group_ids: List[str] - standard_override: Optional[str] - -@dataclass -class DucXRayElement: - base: DucElementBase - style: DucXRayStyle - origin: DucPoint - direction: DucPoint - start_from_origin: bool - -@dataclass -class LeaderTextBlockContent: - text: str - -@dataclass -class LeaderBlockContent: - block_id: str - attribute_values: Optional[List[StringValueEntry]] - element_overrides: Optional[List[StringValueEntry]] - -@dataclass -class LeaderContent: - content: Union[LeaderTextBlockContent, LeaderBlockContent] - -@dataclass -class DucLeaderElement: - linear_base: DucLinearElementBase - style: DucLeaderStyle - content_anchor: GeometricPoint - content: Optional[LeaderContent] - -@dataclass -class DimensionDefinitionPoints: - origin1: GeometricPoint - location: GeometricPoint - origin2: Optional[GeometricPoint] - center: Optional[GeometricPoint] - jog: Optional[GeometricPoint] - -@dataclass -class DimensionBindings: - origin1: Optional[DucPointBinding] - origin2: Optional[DucPointBinding] - center: Optional[DucPointBinding] - -@dataclass -class DimensionBaselineData: - base_dimension_id: Optional[str] - -@dataclass -class DimensionContinueData: - continue_from_dimension_id: Optional[str] - -@dataclass -class DucDimensionElement: - base: DucElementBase - style: DucDimensionStyle - definition_points: DimensionDefinitionPoints - oblique_angle: float - dimension_type: DIMENSION_TYPE - ordinate_axis: Optional[AXIS] - bindings: Optional[DimensionBindings] - text_override: Optional[str] - text_position: Optional[GeometricPoint] - tolerance_override: Optional[DimensionToleranceStyle] - baseline_data: Optional[DimensionBaselineData] - continue_data: Optional[DimensionContinueData] - -@dataclass -class DatumReference: - letters: str - modifier: Optional[MATERIAL_CONDITION] - -@dataclass -class ToleranceClause: - value: str - feature_modifiers: List[FEATURE_MODIFIER] - zone_type: Optional[TOLERANCE_ZONE_TYPE] - material_condition: Optional[MATERIAL_CONDITION] - -@dataclass -class FeatureControlFrameSegment: - tolerance: ToleranceClause - datums: List[DatumReference] - symbol: GDT_SYMBOL - -@dataclass -class FCFSegmentRow: - segments: List[FeatureControlFrameSegment] - -@dataclass -class FCFBetweenModifier: - start: str - end: str - -@dataclass -class FCFProjectedZoneModifier: - value: float - -@dataclass -class FCFFrameModifiers: - between: Optional[FCFBetweenModifier] - projected_tolerance_zone: Optional[FCFProjectedZoneModifier] - all_around: Optional[bool] - all_over: Optional[bool] - continuous_feature: Optional[bool] - -@dataclass -class FCFDatumDefinition: - letter: str - feature_binding: Optional[DucPointBinding] - -@dataclass -class DucFeatureControlFrameElement: - base: DucElementBase - style: DucFeatureControlFrameStyle - rows: List[FCFSegmentRow] - frame_modifiers: Optional[FCFFrameModifiers] - leader_element_id: Optional[str] - datum_definition: Optional[FCFDatumDefinition] - -@dataclass -class TextColumn: - width: float - gutter: float - -@dataclass -class ColumnLayout: - definitions: List[TextColumn] - auto_height: bool - type: COLUMN_TYPE - -@dataclass -class DucDocElement: - base: DucElementBase - style: DucDocStyle - text: str - dynamic: List[DucTextDynamicPart] - columns: ColumnLayout - auto_resize: bool - flow_direction: TEXT_FLOW_DIRECTION - file_id: Optional[str] - grid_config: DocumentGridConfig - - -@dataclass -class DucCommonStyle: - background: ElementBackground - stroke: ElementStroke - -@dataclass -class ParametricSource: - type: PARAMETRIC_SOURCE_TYPE - code: str - file_id: str - -@dataclass -class DucParametricElement: - base: DucElementBase - source: ParametricSource - -@dataclass -class DucModelElement: - base: DucElementBase - source: str - svg_path: Optional[str] - file_ids: List[str] +# =============== GROUPS, REGIONS & LAYERS =============== @dataclass class DucGroup: @@ -876,16 +554,18 @@ class DucLayer: id: str stack_base: DucStackBase readonly: bool - overrides: DucLayerOverrides + overrides: Optional[DucLayerOverrides] = None + + +# =============== ELEMENT UNION =============== -# Element Union DucElement = Union[ DucRectangleElement, DucPolygonElement, DucEllipseElement, DucEmbeddableElement, DucPdfElement, - DucMermaidElement, + DucDocElement, DucTableElement, DucImageElement, DucTextElement, @@ -894,14 +574,7 @@ class DucLayer: DucFreeDrawElement, DucFrameElement, DucPlotElement, - DucViewportElement, - DucXRayElement, - DucLeaderElement, - DucDimensionElement, - DucFeatureControlFrameElement, - DucDocElement, - DucParametricElement, - DucModelElement + DucModelElement, ] @dataclass diff --git a/packages/ducpy/src/ducpy/classes/StandardsClass.py b/packages/ducpy/src/ducpy/classes/StandardsClass.py deleted file mode 100644 index e2c01afa..00000000 --- a/packages/ducpy/src/ducpy/classes/StandardsClass.py +++ /dev/null @@ -1,314 +0,0 @@ -from dataclasses import dataclass, field -from typing import List, Optional, Dict, Union, Any, TYPE_CHECKING - -from ducpy.Duc.GRID_TYPE import GRID_TYPE -from ducpy.Duc.GRID_DISPLAY_TYPE import GRID_DISPLAY_TYPE -from ducpy.Duc.SNAP_MODE import SNAP_MODE -from ducpy.Duc.OBJECT_SNAP_MODE import OBJECT_SNAP_MODE -from ducpy.Duc.SNAP_OVERRIDE_BEHAVIOR import SNAP_OVERRIDE_BEHAVIOR -from ducpy.Duc.SNAP_MARKER_SHAPE import SNAP_MARKER_SHAPE -from ducpy.Duc.UNIT_SYSTEM import UNIT_SYSTEM -from ducpy.Duc.DIMENSION_UNITS_FORMAT import DIMENSION_UNITS_FORMAT -from ducpy.Duc.DECIMAL_SEPARATOR import DECIMAL_SEPARATOR -from ducpy.Duc.ANGULAR_UNITS_FORMAT import ANGULAR_UNITS_FORMAT -from ducpy.Duc.PRUNING_LEVEL import PRUNING_LEVEL - -from ducpy.classes.ElementsClass import ( - DucCommonStyle, DucStackLikeStyles, DucTextStyle, DucDimensionStyle, - DucLeaderStyle, DucFeatureControlFrameStyle, DucTableStyle, DucDocStyle, - DucViewportStyle, DucHatchStyle, DucXRayStyle, DucUcs, DucView, Identifier -) - -@dataclass -class GridStyle: - color: str - opacity: float - dash_pattern: Optional[List[float]] - -@dataclass -class PolarGridSettings: - radial_divisions: int - radial_spacing: float - show_labels: bool - -@dataclass -class IsometricGridSettings: - left_angle: float - right_angle: float - -@dataclass -class GridSettings: - is_adaptive: bool - x_spacing: float - y_spacing: float - subdivisions: int - origin: "GeometricPoint" - rotation: float - follow_ucs: bool - major_style: GridStyle - minor_style: GridStyle - show_minor: bool - min_zoom: float - max_zoom: float - auto_hide: bool - enable_snapping: bool - readonly: bool - type: GRID_TYPE - display_type: GRID_DISPLAY_TYPE - polar_settings: Optional[PolarGridSettings] - isometric_settings: Optional[IsometricGridSettings] - -@dataclass -class SnapOverride: - key: str - behavior: Optional[SNAP_OVERRIDE_BEHAVIOR] - -@dataclass -class DynamicSnapSettings: - enabled_during_drag: bool - enabled_during_rotation: bool - enabled_during_scale: bool - -@dataclass -class PolarTrackingSettings: - enabled: bool - angles: List[float] - track_from_last_point: bool - show_polar_coordinates: bool - increment_angle: Optional[float] - -@dataclass -class TrackingLineStyle: - color: str - opacity: float - dash_pattern: List[float] - -@dataclass -class LayerSnapFilters: - include_layers: List[str] - exclude_layers: List[str] - -@dataclass -class SnapMarkerStyle: - shape: SNAP_MARKER_SHAPE - color: str - -@dataclass -class SnapMarkerStyleEntry: - key: OBJECT_SNAP_MODE - value: SnapMarkerStyle - -@dataclass -class SnapMarkerSettings: - enabled: bool - size: int - styles: List[SnapMarkerStyleEntry] - duration: Optional[int] = None - -@dataclass -class SnapSettings: - readonly: bool - twist_angle: float - snap_tolerance: int - object_snap_aperture: int - is_ortho_mode_on: bool - polar_tracking: PolarTrackingSettings - is_object_snap_on: bool - active_object_snap_modes: List[OBJECT_SNAP_MODE] - snap_priority: List[OBJECT_SNAP_MODE] - show_tracking_lines: bool - dynamic_snap: DynamicSnapSettings - snap_markers: SnapMarkerSettings - construction_snap_enabled: bool - tracking_line_style: Optional[TrackingLineStyle] - temporary_overrides: Optional[List[SnapOverride]] - incremental_distance: Optional[float] - magnetic_strength: Optional[float] - layer_snap_filters: Optional[LayerSnapFilters] - element_type_filters: Optional[List[str]] - snap_mode: Optional[SNAP_MODE] - snap_to_grid_intersections: Optional[bool] - -@dataclass -class UnitSystemBase: - precision: int - suppress_leading_zeros: bool - suppress_trailing_zeros: bool - system: UNIT_SYSTEM - -@dataclass -class LinearUnitSystem(UnitSystemBase): - suppress_zero_feet: bool - suppress_zero_inches: bool - format: DIMENSION_UNITS_FORMAT - decimal_separator: DECIMAL_SEPARATOR - -@dataclass -class AngularUnitSystem(UnitSystemBase): - format: ANGULAR_UNITS_FORMAT - -@dataclass -class AlternateUnits(UnitSystemBase): - is_visible: bool - multiplier: float - format: DIMENSION_UNITS_FORMAT - -@dataclass -class PrimaryUnits: - linear: Optional[LinearUnitSystem] - angular: Optional[AngularUnitSystem] - -@dataclass -class StandardUnits: - primary_units: PrimaryUnits - alternate_units: AlternateUnits - -@dataclass -class UnitPrecision: - linear: int - angular: int - area: int - volume: int - -@dataclass -class StandardOverrides: - unit_precision: Optional[UnitPrecision] - main_scope: Optional[str] - elements_stroke_width_override: Optional[float] - common_style_id: Optional[str] - stack_like_style_id: Optional[str] - text_style_id: Optional[str] - dimension_style_id: Optional[str] - leader_style_id: Optional[str] - feature_control_frame_style_id: Optional[str] - table_style_id: Optional[str] - doc_style_id: Optional[str] - viewport_style_id: Optional[str] - plot_style_id: Optional[str] - hatch_style_id: Optional[str] - active_grid_settings_id: Optional[List[str]] - active_snap_settings_id: Optional[str] - dash_line_override: Optional[str] - -@dataclass -class IdentifiedCommonStyle: - id: Identifier - style: "DucCommonStyle" - -@dataclass -class IdentifiedStackLikeStyle: - id: Identifier - style: "DucStackLikeStyles" - -@dataclass -class IdentifiedTextStyle: - id: Identifier - style: "DucTextStyle" - -@dataclass -class IdentifiedDimensionStyle: - id: Identifier - style: "DucDimensionStyle" - -@dataclass -class IdentifiedLeaderStyle: - id: Identifier - style: "DucLeaderStyle" - -@dataclass -class IdentifiedFCFStyle: - id: Identifier - style: "DucFeatureControlFrameStyle" - -@dataclass -class IdentifiedTableStyle: - id: Identifier - style: "DucTableStyle" - -@dataclass -class IdentifiedDocStyle: - id: Identifier - style: "DucDocStyle" - -@dataclass -class IdentifiedViewportStyle: - id: Identifier - style: "DucViewportStyle" - -@dataclass -class IdentifiedHatchStyle: - id: Identifier - style: "DucHatchStyle" - -@dataclass -class IdentifiedXRayStyle: - id: Identifier - style: "DucXRayStyle" - -@dataclass -class StandardStyles: - common_styles: List[IdentifiedCommonStyle] = field(default_factory=list) - stack_like_styles: List[IdentifiedStackLikeStyle] = field(default_factory=list) - text_styles: List[IdentifiedTextStyle] = field(default_factory=list) - dimension_styles: List[IdentifiedDimensionStyle] = field(default_factory=list) - leader_styles: List[IdentifiedLeaderStyle] = field(default_factory=list) - feature_control_frame_styles: List[IdentifiedFCFStyle] = field(default_factory=list) - table_styles: List[IdentifiedTableStyle] = field(default_factory=list) - doc_styles: List[IdentifiedDocStyle] = field(default_factory=list) - viewport_styles: List[IdentifiedViewportStyle] = field(default_factory=list) - hatch_styles: List[IdentifiedHatchStyle] = field(default_factory=list) - xray_styles: List[IdentifiedXRayStyle] = field(default_factory=list) - -@dataclass -class IdentifiedGridSettings: - id: Identifier - settings: "GridSettings" - -@dataclass -class IdentifiedSnapSettings: - id: Identifier - settings: "SnapSettings" - -@dataclass -class IdentifiedUcs: - id: Identifier - ucs: "DucUcs" - -@dataclass -class IdentifiedView: - id: Identifier - view: "DucView" - -@dataclass -class StandardViewSettings: - views: List[IdentifiedView] - ucs: List[IdentifiedUcs] - grid_settings: List[IdentifiedGridSettings] - snap_settings: List[IdentifiedSnapSettings] - -@dataclass -class DimensionValidationRules: - min_text_height: float - max_text_height: float - allowed_precisions: List[int] - -@dataclass -class LayerValidationRules: - prohibited_layer_names: List[str] - -@dataclass -class StandardValidation: - dimension_rules: Optional[DimensionValidationRules] - layer_rules: Optional[LayerValidationRules] - -@dataclass -class Standard: - identifier: Identifier - version: str - readonly: bool - overrides: Optional[StandardOverrides] - styles: Optional[StandardStyles] - view_settings: Optional[StandardViewSettings] - units: Optional[StandardUnits] - validation: Optional[StandardValidation] - diff --git a/packages/ducpy/src/ducpy/classes/__init__.py b/packages/ducpy/src/ducpy/classes/__init__.py index 81c54852..6c1de94f 100644 --- a/packages/ducpy/src/ducpy/classes/__init__.py +++ b/packages/ducpy/src/ducpy/classes/__init__.py @@ -1,4 +1,3 @@ # Export class modules -from .StandardsClass import * from .DataStateClass import * -from .ElementsClass import * \ No newline at end of file +from .ElementsClass import * diff --git a/packages/ducpy/src/ducpy/enums.py b/packages/ducpy/src/ducpy/enums.py new file mode 100644 index 00000000..75ee512c --- /dev/null +++ b/packages/ducpy/src/ducpy/enums.py @@ -0,0 +1,125 @@ +""" +Native enum definitions for DUC types. +Source of truth: types.rs / duc.sql +""" +from enum import IntEnum + + +class VERTICAL_ALIGN(IntEnum): + TOP = 10 + MIDDLE = 11 + BOTTOM = 12 + + +class TEXT_ALIGN(IntEnum): + LEFT = 10 + CENTER = 11 + RIGHT = 12 + + +class LINE_SPACING_TYPE(IntEnum): + AT_LEAST = 10 + EXACTLY = 11 + MULTIPLE = 12 + + +class STROKE_PLACEMENT(IntEnum): + INSIDE = 10 + CENTER = 11 + OUTSIDE = 12 + + +class STROKE_PREFERENCE(IntEnum): + SOLID = 10 + DASHED = 11 + DOTTED = 12 + CUSTOM = 13 + + +class STROKE_SIDE_PREFERENCE(IntEnum): + TOP = 10 + BOTTOM = 11 + LEFT = 12 + RIGHT = 13 + CUSTOM = 14 + ALL = 15 + + +class STROKE_CAP(IntEnum): + BUTT = 10 + ROUND = 11 + SQUARE = 12 + + +class STROKE_JOIN(IntEnum): + MITER = 10 + ROUND = 11 + BEVEL = 12 + + +class LINE_HEAD(IntEnum): + ARROW = 10 + BAR = 11 + CIRCLE = 12 + CIRCLE_OUTLINED = 13 + TRIANGLE = 14 + TRIANGLE_OUTLINED = 15 + DIAMOND = 16 + DIAMOND_OUTLINED = 17 + CROSS = 18 + OPEN_ARROW = 19 + REVERSED_ARROW = 20 + REVERSED_TRIANGLE = 21 + REVERSED_TRIANGLE_OUTLINED = 22 + CONE = 23 + HALF_CONE = 24 + + +class BEZIER_MIRRORING(IntEnum): + NONE = 10 + ANGLE = 11 + ANGLE_LENGTH = 12 + + +class BLENDING(IntEnum): + MULTIPLY = 11 + SCREEN = 12 + OVERLAY = 13 + DARKEN = 14 + LIGHTEN = 15 + DIFFERENCE = 16 + EXCLUSION = 17 + + +class ELEMENT_CONTENT_PREFERENCE(IntEnum): + SOLID = 12 + FILL = 14 + FIT = 15 + TILE = 16 + STRETCH = 17 + HATCH = 18 + + +class HATCH_STYLE(IntEnum): + NORMAL = 10 + OUTER = 11 + IGNORE = 12 + + +class IMAGE_STATUS(IntEnum): + PENDING = 10 + SAVED = 11 + ERROR = 12 + + +class PRUNING_LEVEL(IntEnum): + CONSERVATIVE = 10 + BALANCED = 20 + AGGRESSIVE = 30 + + +class BOOLEAN_OPERATION(IntEnum): + UNION = 10 + SUBTRACT = 11 + INTERSECT = 12 + EXCLUDE = 13 diff --git a/packages/ducpy/src/ducpy/parse.py b/packages/ducpy/src/ducpy/parse.py index 09a2595d..73423894 100644 --- a/packages/ducpy/src/ducpy/parse.py +++ b/packages/ducpy/src/ducpy/parse.py @@ -1,2590 +1,106 @@ -# parse.py -# Comprehensive FlatBuffers -> dataclasses parser for Duc schema +""" +Parse .duc files using the Rust native extension (ducpy_native). -from __future__ import annotations - -import gzip -import json -from typing import IO, Any, Dict, List, Optional, Union - -import flatbuffers -from ducpy.classes.DataStateClass import Checkpoint as DS_Checkpoint -from ducpy.classes.DataStateClass import Delta as DS_Delta -from ducpy.classes.DataStateClass import DictionaryEntry as DS_DictionaryEntry -from ducpy.classes.DataStateClass import \ - DisplayPrecision as DS_DisplayPrecision -from ducpy.classes.DataStateClass import \ - DucExternalFileData as DS_DucExternalFileData -from ducpy.classes.DataStateClass import \ - DucExternalFileEntry as DS_DucExternalFileEntry -from ducpy.classes.DataStateClass import DucGlobalState as DS_DucGlobalState -from ducpy.classes.DataStateClass import DucLocalState as DS_DucLocalState -from ducpy.classes.DataStateClass import \ - ExportedDataState as DS_ExportedDataState -from ducpy.classes.DataStateClass import \ - JSONPatchOperation as DS_JSONPatchOperation -from ducpy.classes.DataStateClass import VersionBase as DS_VersionBase -from ducpy.classes.DataStateClass import VersionGraph as DS_VersionGraph -from ducpy.classes.DataStateClass import \ - VersionGraphMetadata as DS_VersionGraphMetadata -from ducpy.classes.ElementsClass import BoundElement as DS_BoundElement -from ducpy.classes.ElementsClass import ColumnLayout as DS_ColumnLayout -from ducpy.classes.ElementsClass import \ - CustomHatchPattern as DS_CustomHatchPattern -from ducpy.classes.ElementsClass import DatumReference as DS_DatumReference -from ducpy.classes.ElementsClass import \ - DimensionBaselineData as DS_DimensionBaselineData -from ducpy.classes.ElementsClass import \ - DimensionBindings as DS_DimensionBindings -from ducpy.classes.ElementsClass import \ - DimensionContinueData as DS_DimensionContinueData -from ducpy.classes.ElementsClass import \ - DimensionDefinitionPoints as DS_DimensionDefinitionPoints -from ducpy.classes.ElementsClass import \ - DimensionExtLineStyle as DS_DimensionExtLineStyle -from ducpy.classes.ElementsClass import \ - DimensionFitStyle as DS_DimensionFitStyle -from ducpy.classes.ElementsClass import \ - DimensionLineStyle as DS_DimensionLineStyle -from ducpy.classes.ElementsClass import \ - DimensionSymbolStyle as DS_DimensionSymbolStyle -from ducpy.classes.ElementsClass import \ - DimensionToleranceStyle as DS_DimensionToleranceStyle -from ducpy.classes.ElementsClass import \ - DocumentGridConfig as DS_DocumentGridConfig -from ducpy.classes.ElementsClass import DucArrowElement as DS_DucArrowElement -from ducpy.classes.ElementsClass import DucBlock as DS_DucBlock -from ducpy.classes.ElementsClass import \ - DucBlockAttributeDefinition as DS_DucBlockAttributeDefinition -from ducpy.classes.ElementsClass import \ - DucBlockAttributeDefinitionEntry as DS_DucBlockAttributeDefinitionEntry -from ducpy.classes.ElementsClass import \ - DucBlockCollection as DS_DucBlockCollection -from ducpy.classes.ElementsClass import \ - DucBlockCollectionEntry as DS_DucBlockCollectionEntry -from ducpy.classes.ElementsClass import \ - DucBlockDuplicationArray as DS_DucBlockDuplicationArray -from ducpy.classes.ElementsClass import DucBlockInstance as DS_DucBlockInstance -from ducpy.classes.ElementsClass import DucBlockMetadata as DS_DucBlockMetadata -from ducpy.classes.ElementsClass import DucCommonStyle as DS_DucCommonStyle -from ducpy.classes.ElementsClass import \ - DucDimensionElement as DS_DucDimensionElement -from ducpy.classes.ElementsClass import \ - DucDimensionStyle as DS_DucDimensionStyle -from ducpy.classes.ElementsClass import DucDocElement as DS_DucDocElement -from ducpy.classes.ElementsClass import DucDocStyle as DS_DucDocStyle -from ducpy.classes.ElementsClass import DucElementBase as DS_DucElementBase -from ducpy.classes.ElementsClass import \ - DucElementStylesBase as DS_DucElementStylesBase -from ducpy.classes.ElementsClass import \ - DucEllipseElement as DS_DucEllipseElement -from ducpy.classes.ElementsClass import \ - DucEmbeddableElement as DS_DucEmbeddableElement -from ducpy.classes.ElementsClass import \ - DucFeatureControlFrameElement as DS_DucFeatureControlFrameElement -from ducpy.classes.ElementsClass import \ - DucFeatureControlFrameStyle as DS_DucFeatureControlFrameStyle -from ducpy.classes.ElementsClass import DucFrameElement as DS_DucFrameElement -from ducpy.classes.ElementsClass import \ - DucFreeDrawElement as DS_DucFreeDrawElement -from ducpy.classes.ElementsClass import DucFreeDrawEnds as DS_DucFreeDrawEnds -from ducpy.classes.ElementsClass import DucGroup as DS_DucGroup -from ducpy.classes.ElementsClass import DucHatchStyle as DS_DucHatchStyle -from ducpy.classes.ElementsClass import DucHead as DS_DucHead -from ducpy.classes.ElementsClass import DucImageElement as DS_DucImageElement -from ducpy.classes.ElementsClass import DucImageFilter as DS_DucImageFilter -from ducpy.classes.ElementsClass import DucLayer as DS_DucLayer -from ducpy.classes.ElementsClass import \ - DucLayerOverrides as DS_DucLayerOverrides -from ducpy.classes.ElementsClass import DucLeaderElement as DS_DucLeaderElement -from ducpy.classes.ElementsClass import DucLeaderStyle as DS_DucLeaderStyle -from ducpy.classes.ElementsClass import DucLine as DS_DucLine -from ducpy.classes.ElementsClass import DucLinearElement as DS_DucLinearElement -from ducpy.classes.ElementsClass import \ - DucLinearElementBase as DS_DucLinearElementBase -from ducpy.classes.ElementsClass import DucLineReference as DS_DucLineReference -from ducpy.classes.ElementsClass import \ - DucMermaidElement as DS_DucMermaidElement -from ducpy.classes.ElementsClass import DucModelElement as DS_DucModelElement -from ducpy.classes.ElementsClass import \ - DucParametricElement as DS_DucParametricElement -from ducpy.classes.ElementsClass import DucPath as DS_DucPath -from ducpy.classes.ElementsClass import DucPdfElement as DS_DucPdfElement -from ducpy.classes.ElementsClass import DucPlotElement as DS_DucPlotElement -from ducpy.classes.ElementsClass import DucPlotStyle as DS_DucPlotStyle -from ducpy.classes.ElementsClass import DucPoint as DS_DucPoint -from ducpy.classes.ElementsClass import DucPointBinding as DS_DucPointBinding -from ducpy.classes.ElementsClass import \ - DucPolygonElement as DS_DucPolygonElement -from ducpy.classes.ElementsClass import \ - DucRectangleElement as DS_DucRectangleElement -from ducpy.classes.ElementsClass import DucRegion as DS_DucRegion -from ducpy.classes.ElementsClass import DucStackBase as DS_DucStackBase -from ducpy.classes.ElementsClass import \ - DucStackElementBase as DS_DucStackElementBase -from ducpy.classes.ElementsClass import \ - DucStackLikeStyles as DS_DucStackLikeStyles -from ducpy.classes.ElementsClass import DucTableAutoSize as DS_DucTableAutoSize -from ducpy.classes.ElementsClass import DucTableCell as DS_DucTableCell -from ducpy.classes.ElementsClass import \ - DucTableCellEntry as DS_DucTableCellEntry -from ducpy.classes.ElementsClass import DucTableCellSpan as DS_DucTableCellSpan -from ducpy.classes.ElementsClass import \ - DucTableCellStyle as DS_DucTableCellStyle -from ducpy.classes.ElementsClass import DucTableColumn as DS_DucTableColumn -from ducpy.classes.ElementsClass import \ - DucTableColumnEntry as DS_DucTableColumnEntry -from ducpy.classes.ElementsClass import DucTableElement as DS_DucTableElement -from ducpy.classes.ElementsClass import DucTableRow as DS_DucTableRow -from ducpy.classes.ElementsClass import DucTableRowEntry as DS_DucTableRowEntry -from ducpy.classes.ElementsClass import DucTableStyle as DS_DucTableStyle -from ducpy.classes.ElementsClass import \ - DucTextDynamicDictionarySource as DS_DucTextDynamicDictionarySource -from ducpy.classes.ElementsClass import \ - DucTextDynamicElementSource as DS_DucTextDynamicElementSource -from ducpy.classes.ElementsClass import \ - DucTextDynamicPart as DS_DucTextDynamicPart -from ducpy.classes.ElementsClass import \ - DucTextDynamicSource as DS_DucTextDynamicSource -from ducpy.classes.ElementsClass import DucTextElement as DS_DucTextElement -from ducpy.classes.ElementsClass import DucTextStyle as DS_DucTextStyle -from ducpy.classes.ElementsClass import DucUcs as DS_DucUcs -from ducpy.classes.ElementsClass import DucView as DS_DucView -from ducpy.classes.ElementsClass import \ - DucViewportElement as DS_DucViewportElement -from ducpy.classes.ElementsClass import DucViewportStyle as DS_DucViewportStyle -from ducpy.classes.ElementsClass import DucXRayElement as DS_DucXRayElement -from ducpy.classes.ElementsClass import DucXRayStyle as DS_DucXRayStyle -from ducpy.classes.ElementsClass import \ - ElementBackground as DS_ElementBackground -from ducpy.classes.ElementsClass import \ - ElementContentBase as DS_ElementContentBase -from ducpy.classes.ElementsClass import ElementStroke as DS_ElementStroke -from ducpy.classes.ElementsClass import ElementWrapper as DS_ElementWrapper -from ducpy.classes.ElementsClass import \ - FCFBetweenModifier as DS_FCFBetweenModifier -from ducpy.classes.ElementsClass import \ - FCFDatumDefinition as DS_FCFDatumDefinition -from ducpy.classes.ElementsClass import FCFDatumStyle as DS_FCFDatumStyle -from ducpy.classes.ElementsClass import \ - FCFFrameModifiers as DS_FCFFrameModifiers -from ducpy.classes.ElementsClass import FCFLayoutStyle as DS_FCFLayoutStyle -from ducpy.classes.ElementsClass import \ - FCFProjectedZoneModifier as DS_FCFProjectedZoneModifier -from ducpy.classes.ElementsClass import FCFSegmentRow as DS_FCFSegmentRow -from ducpy.classes.ElementsClass import FCFSymbolStyle as DS_FCFSymbolStyle -from ducpy.classes.ElementsClass import \ - FeatureControlFrameSegment as DS_FeatureControlFrameSegment -from ducpy.classes.ElementsClass import GeometricPoint as DS_GeometricPoint -from ducpy.classes.ElementsClass import HatchPatternLine as DS_HatchPatternLine -from ducpy.classes.ElementsClass import ImageCrop as DS_ImageCrop -from ducpy.classes.ElementsClass import \ - LeaderBlockContent as DS_LeaderBlockContent -from ducpy.classes.ElementsClass import LeaderContent as DS_LeaderContent -from ducpy.classes.ElementsClass import \ - LeaderTextBlockContent as DS_LeaderTextBlockContent -from ducpy.classes.ElementsClass import LineSpacing as DS_LineSpacing -from ducpy.classes.ElementsClass import \ - ParagraphFormatting as DS_ParagraphFormatting -from ducpy.classes.ElementsClass import ParametricSource as DS_ParametricSource -from ducpy.classes.ElementsClass import PlotLayout as DS_PlotLayout -from ducpy.classes.ElementsClass import \ - PointBindingPoint as DS_PointBindingPoint -from ducpy.classes.ElementsClass import StackFormat as DS_StackFormat -from ducpy.classes.ElementsClass import \ - StackFormatProperties as DS_StackFormatProperties -from ducpy.classes.ElementsClass import StringValueEntry as DS_StringValueEntry -from ducpy.classes.ElementsClass import StrokeSides as DS_StrokeSides -from ducpy.classes.ElementsClass import StrokeStyle as DS_StrokeStyle -from ducpy.classes.ElementsClass import TextColumn as DS_TextColumn -from ducpy.classes.ElementsClass import TilingProperties as DS_TilingProperties -from ducpy.classes.ElementsClass import ToleranceClause as DS_ToleranceClause -from ducpy.classes.StandardsClass import AlternateUnits as DS_AlternateUnits -from ducpy.classes.StandardsClass import \ - AngularUnitSystem as DS_AngularUnitSystem -from ducpy.classes.StandardsClass import \ - DimensionValidationRules as DS_DimensionValidationRules -from ducpy.classes.StandardsClass import \ - DynamicSnapSettings as DS_DynamicSnapSettings -from ducpy.classes.StandardsClass import GridSettings as DS_GridSettings -from ducpy.classes.StandardsClass import GridStyle as DS_GridStyle -from ducpy.classes.StandardsClass import \ - IdentifiedCommonStyle as DS_IdentifiedCommonStyle -from ducpy.classes.StandardsClass import \ - IdentifiedDimensionStyle as DS_IdentifiedDimensionStyle -from ducpy.classes.StandardsClass import \ - IdentifiedDocStyle as DS_IdentifiedDocStyle -from ducpy.classes.StandardsClass import \ - IdentifiedFCFStyle as DS_IdentifiedFCFStyle -from ducpy.classes.StandardsClass import \ - IdentifiedGridSettings as DS_IdentifiedGridSettings -from ducpy.classes.StandardsClass import \ - IdentifiedHatchStyle as DS_IdentifiedHatchStyle -from ducpy.classes.StandardsClass import \ - IdentifiedLeaderStyle as DS_IdentifiedLeaderStyle -from ducpy.classes.StandardsClass import \ - IdentifiedSnapSettings as DS_IdentifiedSnapSettings -from ducpy.classes.StandardsClass import \ - IdentifiedStackLikeStyle as DS_IdentifiedStackLikeStyle -from ducpy.classes.StandardsClass import \ - IdentifiedTableStyle as DS_IdentifiedTableStyle -from ducpy.classes.StandardsClass import \ - IdentifiedTextStyle as DS_IdentifiedTextStyle -from ducpy.classes.StandardsClass import IdentifiedUcs as DS_IdentifiedUcs -from ducpy.classes.StandardsClass import IdentifiedView as DS_IdentifiedView -from ducpy.classes.StandardsClass import \ - IdentifiedViewportStyle as DS_IdentifiedViewportStyle -from ducpy.classes.StandardsClass import \ - IdentifiedXRayStyle as DS_IdentifiedXRayStyle -from ducpy.classes.StandardsClass import Identifier as DS_Identifier -from ducpy.classes.StandardsClass import \ - IsometricGridSettings as DS_IsometricGridSettings -from ducpy.classes.StandardsClass import \ - LayerSnapFilters as DS_LayerSnapFilters -from ducpy.classes.StandardsClass import \ - LayerValidationRules as DS_LayerValidationRules -from ducpy.classes.StandardsClass import \ - LinearUnitSystem as DS_LinearUnitSystem -from ducpy.classes.StandardsClass import \ - PolarGridSettings as DS_PolarGridSettings -from ducpy.classes.StandardsClass import \ - PolarTrackingSettings as DS_PolarTrackingSettings -from ducpy.classes.StandardsClass import PrimaryUnits as DS_PrimaryUnits -from ducpy.classes.StandardsClass import \ - SnapMarkerSettings as DS_SnapMarkerSettings -from ducpy.classes.StandardsClass import SnapMarkerStyle as DS_SnapMarkerStyle -from ducpy.classes.StandardsClass import \ - SnapMarkerStyleEntry as DS_SnapMarkerStyleEntry -from ducpy.classes.StandardsClass import SnapOverride as DS_SnapOverride -from ducpy.classes.StandardsClass import SnapSettings as DS_SnapSettings -from ducpy.classes.StandardsClass import Standard as DS_Standard -from ducpy.classes.StandardsClass import \ - StandardOverrides as DS_StandardOverrides -from ducpy.classes.StandardsClass import StandardStyles as DS_StandardStyles -from ducpy.classes.StandardsClass import StandardUnits as DS_StandardUnits -from ducpy.classes.StandardsClass import \ - StandardValidation as DS_StandardValidation -from ducpy.classes.StandardsClass import \ - StandardViewSettings as DS_StandardViewSettings -from ducpy.classes.StandardsClass import \ - TrackingLineStyle as DS_TrackingLineStyle -from ducpy.classes.StandardsClass import UnitPrecision as DS_UnitPrecision -from ducpy.classes.StandardsClass import UnitSystemBase as DS_UnitSystemBase -# Unions for runtime decisions -from ducpy.Duc import DucTextDynamicSourceData as FBS_DucTextDynamicSourceData -from ducpy.Duc import Element as FBS_Element -from ducpy.Duc import LeaderContentData as FBS_LeaderContentData -from ducpy.Duc._DucElementBase import _DucElementBase as FBSDucElementBase -from ducpy.Duc._DucElementStylesBase import \ - _DucElementStylesBase as FBSDucElementStylesBase -from ducpy.Duc._DucLinearElementBase import \ - _DucLinearElementBase as FBSDucLinearElementBase -from ducpy.Duc._DucStackBase import _DucStackBase as FBSDucStackBase -from ducpy.Duc._DucStackBase import _DucStackBase as FBSDucStackElementBase -from ducpy.Duc._UnitSystemBase import _UnitSystemBase as FBS_UnitSystemBase -from ducpy.Duc.AlternateUnits import AlternateUnits as FBSAlternateUnits -from ducpy.Duc.ANGULAR_UNITS_FORMAT import ANGULAR_UNITS_FORMAT -from ducpy.Duc.AngularUnitSystem import \ - AngularUnitSystem as FBSAngularUnitSystem -from ducpy.Duc.AXIS import AXIS -from ducpy.Duc.BEZIER_MIRRORING import BEZIER_MIRRORING -from ducpy.Duc.BLENDING import BLENDING -from ducpy.Duc.BLOCK_ATTACHMENT import BLOCK_ATTACHMENT -from ducpy.Duc.BOOLEAN_OPERATION import BOOLEAN_OPERATION -from ducpy.Duc.BoundElement import BoundElement as FBSBoundElement -from ducpy.Duc.Checkpoint import Checkpoint as FBSCheckpoint -from ducpy.Duc.COLUMN_TYPE import COLUMN_TYPE -from ducpy.Duc.ColumnLayout import ColumnLayout as FBSColumnLayout -from ducpy.Duc.CustomHatchPattern import \ - CustomHatchPattern as FBSCustomHatchPattern -from ducpy.Duc.DatumReference import DatumReference as FBSDatumReference -from ducpy.Duc.DECIMAL_SEPARATOR import DECIMAL_SEPARATOR -from ducpy.Duc.Delta import Delta as FBSDelta -from ducpy.Duc.DIMENSION_FIT_RULE import DIMENSION_FIT_RULE -from ducpy.Duc.DIMENSION_TEXT_PLACEMENT import DIMENSION_TEXT_PLACEMENT -from ducpy.Duc.DIMENSION_TYPE import DIMENSION_TYPE -from ducpy.Duc.DIMENSION_UNITS_FORMAT import DIMENSION_UNITS_FORMAT -from ducpy.Duc.DimensionBaselineData import \ - DimensionBaselineData as FBSDimensionBaselineData -from ducpy.Duc.DimensionBindings import \ - DimensionBindings as FBSDimensionBindings -from ducpy.Duc.DimensionContinueData import \ - DimensionContinueData as FBSDimensionContinueData -from ducpy.Duc.DimensionDefinitionPoints import \ - DimensionDefinitionPoints as FBSDimensionDefinitionPoints -from ducpy.Duc.DimensionExtLineStyle import \ - DimensionExtLineStyle as FBSDimensionExtLineStyle -from ducpy.Duc.DimensionFitStyle import \ - DimensionFitStyle as FBSDimensionFitStyle -from ducpy.Duc.DimensionLineStyle import \ - DimensionLineStyle as FBSDimensionLineStyle -from ducpy.Duc.DimensionSymbolStyle import \ - DimensionSymbolStyle as FBSDimensionSymbolStyle -from ducpy.Duc.DimensionToleranceStyle import \ - DimensionToleranceStyle as FBSDimensionToleranceStyle -from ducpy.Duc.DimensionValidationRules import \ - DimensionValidationRules as FBSDimensionValidationRules -from ducpy.Duc.DocumentGridConfig import \ - DocumentGridConfig as FBSDocumentGridConfig -from ducpy.Duc.DucArrowElement import DucArrowElement as FBSDucArrowElement -from ducpy.Duc.DucBlock import DucBlock as FBSDucBlock -from ducpy.Duc.DucBlockAttributeDefinition import \ - DucBlockAttributeDefinition as FBSDucBlockAttributeDefinition -from ducpy.Duc.DucBlockAttributeDefinitionEntry import \ - DucBlockAttributeDefinitionEntry as FBSDucBlockAttributeDefinitionEntry -from ducpy.Duc.DucBlockCollection import \ - DucBlockCollection as FBSDucBlockCollection -from ducpy.Duc.DucBlockCollectionEntry import \ - DucBlockCollectionEntry as FBSDucBlockCollectionEntry -from ducpy.Duc.DucBlockDuplicationArray import \ - DucBlockDuplicationArray as FBSDucBlockDuplicationArray -from ducpy.Duc.DucBlockInstanceElement import \ - DucBlockInstanceElement as FBSDucBlockInstanceElement -from ducpy.Duc.DucBlockMetadata import DucBlockMetadata as FBSDucBlockMetadata -from ducpy.Duc.DucCommonStyle import DucCommonStyle as FBSDucCommonStyle -from ducpy.Duc.DucDimensionElement import \ - DucDimensionElement as FBSDucDimensionElement -from ducpy.Duc.DucDimensionStyle import \ - DucDimensionStyle as FBSDucDimensionStyle -from ducpy.Duc.DucDocElement import DucDocElement as FBSDucDocElement -from ducpy.Duc.DucDocStyle import DucDocStyle as FBSDucDocStyle -from ducpy.Duc.DucEllipseElement import \ - DucEllipseElement as FBSDucEllipseElement -from ducpy.Duc.DucEmbeddableElement import \ - DucEmbeddableElement as FBSDucEmbeddableElement -# Version graph and external files -from ducpy.Duc.DucExternalFileData import \ - DucExternalFileData as FBSDucExternalFileData -from ducpy.Duc.DucExternalFileEntry import \ - DucExternalFileEntry as FBSDucExternalFileEntry -from ducpy.Duc.DucFeatureControlFrameElement import \ - DucFeatureControlFrameElement as FBSDucFeatureControlFrameElement -from ducpy.Duc.DucFeatureControlFrameStyle import \ - DucFeatureControlFrameStyle as FBSDucFeatureControlFrameStyle -from ducpy.Duc.DucFrameElement import DucFrameElement as FBSDucFrameElement -from ducpy.Duc.DucFreeDrawElement import \ - DucFreeDrawElement as FBSDucFreeDrawElement -from ducpy.Duc.DucFreeDrawEnds import DucFreeDrawEnds as FBSDucFreeDrawEnds -from ducpy.Duc.DucGroup import DucGroup as FBSDucGroup -from ducpy.Duc.DucHatchStyle import DucHatchStyle as FBSDucHatchStyle -from ducpy.Duc.DucHead import DucHead as FBSDucHead -from ducpy.Duc.DucImageElement import DucImageElement as FBSDucImageElement -from ducpy.Duc.DucImageFilter import DucImageFilter as FBSDucImageFilter -from ducpy.Duc.DucLayer import DucLayer as FBSDucLayer -from ducpy.Duc.DucLayerOverrides import \ - DucLayerOverrides as FBSDucLayerOverrides -from ducpy.Duc.DucLeaderElement import DucLeaderElement as FBSDucLeaderElement -from ducpy.Duc.DucLeaderStyle import DucLeaderStyle as FBSDucLeaderStyle -from ducpy.Duc.DucLine import DucLine as FBSDucLine -from ducpy.Duc.DucLinearElement import DucLinearElement as FBSDucLinearElement -from ducpy.Duc.DucLineReference import DucLineReference as FBSDucLineReference -from ducpy.Duc.DucMermaidElement import \ - DucMermaidElement as FBSDucMermaidElement -from ducpy.Duc.DucModelElement import DucModelElement as FBSDucModelElement -from ducpy.Duc.DucParametricElement import \ - DucParametricElement as FBSDucParametricElement -from ducpy.Duc.DucPath import DucPath as FBSDucPath -from ducpy.Duc.DucPdfElement import DucPdfElement as FBSDucPdfElement -from ducpy.Duc.DucPlotElement import DucPlotElement as FBSDucPlotElement -from ducpy.Duc.DucPlotStyle import DucPlotStyle as FBSDucPlotStyle -from ducpy.Duc.DucPoint import DucPoint as FBSDucPoint -from ducpy.Duc.DucPointBinding import DucPointBinding as FBSDucPointBinding -from ducpy.Duc.DucPolygonElement import \ - DucPolygonElement as FBSDucPolygonElement -from ducpy.Duc.DucRectangleElement import \ - DucRectangleElement as FBSDucRectangleElement -from ducpy.Duc.DucRegion import DucRegion as FBSDucRegion -from ducpy.Duc.DucTableAutoSize import DucTableAutoSize as FBSDucTableAutoSize -from ducpy.Duc.DucTableCell import DucTableCell as FBSDucTableCell -from ducpy.Duc.DucTableCellEntry import \ - DucTableCellEntry as FBSDucTableCellEntry -from ducpy.Duc.DucTableCellSpan import DucTableCellSpan as FBSDucTableCellSpan -from ducpy.Duc.DucTableCellStyle import \ - DucTableCellStyle as FBSDucTableCellStyle -from ducpy.Duc.DucTableColumn import DucTableColumn as FBSDucTableColumn -from ducpy.Duc.DucTableColumnEntry import \ - DucTableColumnEntry as FBSDucTableColumnEntry -from ducpy.Duc.DucTableElement import DucTableElement as FBSDucTableElement -from ducpy.Duc.DucTableRow import DucTableRow as FBSDucTableRow -from ducpy.Duc.DucTableRowEntry import DucTableRowEntry as FBSDucTableRowEntry -from ducpy.Duc.DucTableStyle import DucTableStyle as FBSDucTableStyle -from ducpy.Duc.DucTextDynamicDictionarySource import \ - DucTextDynamicDictionarySource as FBSDucTextDynamicDictionarySource -from ducpy.Duc.DucTextDynamicElementSource import \ - DucTextDynamicElementSource as FBSDucTextDynamicElementSource -from ducpy.Duc.DucTextDynamicPart import \ - DucTextDynamicPart as FBSDucTextDynamicPart -from ducpy.Duc.DucTextDynamicSource import \ - DucTextDynamicSource as FBSDucTextDynamicSource -from ducpy.Duc.DucTextElement import DucTextElement as FBSDucTextElement -from ducpy.Duc.DucTextStyle import DucTextStyle as FBSDucTextStyle -from ducpy.Duc.DucUcs import DucUcs as FBSDucUcs -from ducpy.Duc.DucView import DucView as FBSDucView -from ducpy.Duc.DucViewportElement import \ - DucViewportElement as FBSDucViewportElement -from ducpy.Duc.DucViewportStyle import DucViewportStyle as FBSDucViewportStyle -from ducpy.Duc.DucXRayElement import DucXRayElement as FBSDucXRayElement -from ducpy.Duc.DucXRayStyle import DucXRayStyle as FBSDucXRayStyle -from ducpy.Duc.DynamicSnapSettings import \ - DynamicSnapSettings as FBSDynamicSnapSettings -from ducpy.Duc.ELEMENT_CONTENT_PREFERENCE import ELEMENT_CONTENT_PREFERENCE -from ducpy.Duc.ElementBackground import \ - ElementBackground as FBSElementBackground -from ducpy.Duc.ElementContentBase import \ - ElementContentBase as FBSElementContentBase -from ducpy.Duc.ElementStroke import ElementStroke as FBSElementStroke -from ducpy.Duc.ElementWrapper import ElementWrapper as FBSElementWrapper -# FlatBuffers generated classes (reading API) -from ducpy.Duc.ExportedDataState import \ - ExportedDataState as FBSExportedDataState -from ducpy.Duc.FCFBetweenModifier import \ - FCFBetweenModifier as FBSFCFBetweenModifier -from ducpy.Duc.FCFDatumDefinition import \ - FCFDatumDefinition as FBSFCFDatumDefinition -from ducpy.Duc.FCFDatumStyle import FCFDatumStyle as FBSFCFDatumStyle -from ducpy.Duc.FCFFrameModifiers import \ - FCFFrameModifiers as FBSFCFFrameModifiers -from ducpy.Duc.FCFLayoutStyle import FCFLayoutStyle as FBSFCFLayoutStyle -from ducpy.Duc.FCFProjectedZoneModifier import \ - FCFProjectedZoneModifier as FBSFCFProjectedZoneModifier -from ducpy.Duc.FCFSegmentRow import FCFSegmentRow as FBSFCFSegmentRow -from ducpy.Duc.FCFSymbolStyle import FCFSymbolStyle as FBSFCFSymbolStyle -from ducpy.Duc.FeatureControlFrameSegment import \ - FeatureControlFrameSegment as FBSFeatureControlFrameSegment -from ducpy.Duc.GDT_SYMBOL import GDT_SYMBOL -from ducpy.Duc.GRID_DISPLAY_TYPE import GRID_DISPLAY_TYPE -from ducpy.Duc.GRID_TYPE import GRID_TYPE -from ducpy.Duc.GridSettings import GridSettings as FBSGridSettings -from ducpy.Duc.GridStyle import GridStyle as FBSGridStyle -from ducpy.Duc.HATCH_STYLE import HATCH_STYLE -from ducpy.Duc.HatchPatternLine import HatchPatternLine as FBSHatchPatternLine -from ducpy.Duc.IdentifiedCommonStyle import \ - IdentifiedCommonStyle as FBSIdentifiedCommonStyle -from ducpy.Duc.IdentifiedDimensionStyle import \ - IdentifiedDimensionStyle as FBSIdentifiedDimensionStyle -from ducpy.Duc.IdentifiedDocStyle import \ - IdentifiedDocStyle as FBSIdentifiedDocStyle -from ducpy.Duc.IdentifiedFCFStyle import \ - IdentifiedFCFStyle as FBSIdentifiedFCFStyle -from ducpy.Duc.IdentifiedGridSettings import \ - IdentifiedGridSettings as FBSIdentifiedGridSettings -from ducpy.Duc.IdentifiedHatchStyle import \ - IdentifiedHatchStyle as FBSIdentifiedHatchStyle -from ducpy.Duc.IdentifiedLeaderStyle import \ - IdentifiedLeaderStyle as FBSIdentifiedLeaderStyle -from ducpy.Duc.IdentifiedSnapSettings import \ - IdentifiedSnapSettings as FBSIdentifiedSnapSettings -from ducpy.Duc.IdentifiedStackLikeStyle import \ - IdentifiedStackLikeStyle as FBSIdentifiedStackLikeStyle -from ducpy.Duc.IdentifiedTableStyle import \ - IdentifiedTableStyle as FBSIdentifiedTableStyle -from ducpy.Duc.IdentifiedTextStyle import \ - IdentifiedTextStyle as FBSIdentifiedTextStyle -from ducpy.Duc.IdentifiedUcs import IdentifiedUcs as FBSIdentifiedUcs -from ducpy.Duc.IdentifiedView import IdentifiedView as FBSIdentifiedView -from ducpy.Duc.IdentifiedViewportStyle import \ - IdentifiedViewportStyle as FBSIdentifiedViewportStyle -from ducpy.Duc.IdentifiedXRayStyle import \ - IdentifiedXRayStyle as FBSIdentifiedXRayStyle -# Standards FB classes -from ducpy.Duc.Identifier import Identifier as FBSIdentifier -from ducpy.Duc.IMAGE_STATUS import IMAGE_STATUS -from ducpy.Duc.ImageCrop import ImageCrop as FBSImageCrop -from ducpy.Duc.IsometricGridSettings import \ - IsometricGridSettings as FBSIsometricGridSettings -from ducpy.Duc.JSONPatchOperation import \ - JSONPatchOperation as FBSJSONPatchOperation -from ducpy.Duc.LayerSnapFilters import LayerSnapFilters as FBSLayerSnapFilters -from ducpy.Duc.LayerValidationRules import \ - LayerValidationRules as FBSLayerValidationRules -from ducpy.Duc.LEADER_CONTENT_TYPE import LEADER_CONTENT_TYPE -from ducpy.Duc.LeaderBlockContent import \ - LeaderBlockContent as FBSLeaderBlockContent -from ducpy.Duc.LeaderContent import LeaderContent as FBSLeaderContent -from ducpy.Duc.LeaderTextBlockContent import \ - LeaderTextBlockContent as FBSLeaderTextBlockContent -from ducpy.Duc.LINE_HEAD import LINE_HEAD -from ducpy.Duc.LINE_SPACING_TYPE import LINE_SPACING_TYPE -from ducpy.Duc.LinearUnitSystem import LinearUnitSystem as FBSLinearUnitSystem -from ducpy.Duc.LineSpacing import LineSpacing as FBSLineSpacing -from ducpy.Duc.Margins import Margins as FBSMargins -from ducpy.Duc.MARK_ELLIPSE_CENTER import MARK_ELLIPSE_CENTER -from ducpy.Duc.MATERIAL_CONDITION import MATERIAL_CONDITION -from ducpy.Duc.OBJECT_SNAP_MODE import OBJECT_SNAP_MODE -from ducpy.Duc.PARAMETRIC_SOURCE_TYPE import PARAMETRIC_SOURCE_TYPE -from ducpy.Duc.ParametricSource import ParametricSource as FBSParametricSource -from ducpy.Duc.PlotLayout import PlotLayout as FBSPlotLayout -from ducpy.Duc.PointBindingPoint import \ - PointBindingPoint as FBSPointBindingPoint -from ducpy.Duc.PolarGridSettings import \ - PolarGridSettings as FBSPolarGridSettings -from ducpy.Duc.PolarTrackingSettings import \ - PolarTrackingSettings as FBSPolarTrackingSettings -from ducpy.Duc.PrimaryUnits import PrimaryUnits as FBSPrimaryUnits -from ducpy.Duc.PRUNING_LEVEL import PRUNING_LEVEL -from ducpy.Duc.SNAP_MARKER_SHAPE import SNAP_MARKER_SHAPE -from ducpy.Duc.SNAP_MODE import SNAP_MODE -from ducpy.Duc.SNAP_OVERRIDE_BEHAVIOR import SNAP_OVERRIDE_BEHAVIOR -from ducpy.Duc.SnapMarkerSettings import \ - SnapMarkerSettings as FBSSnapMarkerSettings -from ducpy.Duc.SnapMarkerStyle import SnapMarkerStyle as FBSSnapMarkerStyle -from ducpy.Duc.SnapMarkerStyleEntry import \ - SnapMarkerStyleEntry as FBSSnapMarkerStyleEntry -from ducpy.Duc.SnapOverride import SnapOverride as FBSSnapOverride -from ducpy.Duc.SnapSettings import SnapSettings as FBSSnapSettings -from ducpy.Duc.Standard import Standard as FBSStandard -from ducpy.Duc.StandardOverrides import \ - StandardOverrides as FBSStandardOverrides -from ducpy.Duc.StandardStyles import StandardStyles as FBSStandardStyles -from ducpy.Duc.StandardUnits import StandardUnits as FBSStandardUnits -from ducpy.Duc.StandardValidation import \ - StandardValidation as FBSStandardValidation -from ducpy.Duc.StandardViewSettings import \ - StandardViewSettings as FBSStandardViewSettings -from ducpy.Duc.StringValueEntry import StringValueEntry as FBSStringValueEntry -from ducpy.Duc.STROKE_CAP import STROKE_CAP -from ducpy.Duc.STROKE_JOIN import STROKE_JOIN -from ducpy.Duc.STROKE_PLACEMENT import STROKE_PLACEMENT -from ducpy.Duc.STROKE_PREFERENCE import STROKE_PREFERENCE -from ducpy.Duc.STROKE_SIDE_PREFERENCE import STROKE_SIDE_PREFERENCE -from ducpy.Duc.StrokeSides import StrokeSides as FBSStrokeSides -from ducpy.Duc.StrokeStyle import StrokeStyle as FBSStrokeStyle -from ducpy.Duc.TABLE_CELL_ALIGNMENT import TABLE_CELL_ALIGNMENT -from ducpy.Duc.TABLE_FLOW_DIRECTION import TABLE_FLOW_DIRECTION -# Enums (we only need types for Optional typing and constants occasionally) -from ducpy.Duc.TEXT_ALIGN import TEXT_ALIGN -# Import missing enums -from ducpy.Duc.TEXT_FIELD_SOURCE_TYPE import TEXT_FIELD_SOURCE_TYPE -from ducpy.Duc.TEXT_FLOW_DIRECTION import TEXT_FLOW_DIRECTION -from ducpy.Duc.TextColumn import TextColumn as FBSTextColumn -from ducpy.Duc.TilingProperties import TilingProperties as FBSTilingProperties -from ducpy.Duc.TOLERANCE_DISPLAY import TOLERANCE_DISPLAY -from ducpy.Duc.TOLERANCE_ZONE_TYPE import TOLERANCE_ZONE_TYPE -from ducpy.Duc.ToleranceClause import ToleranceClause as FBSToleranceClause -from ducpy.Duc.TrackingLineStyle import \ - TrackingLineStyle as FBSTrackingLineStyle -from ducpy.Duc.UNIT_SYSTEM import UNIT_SYSTEM -from ducpy.Duc.UnitPrecision import UnitPrecision as FBSUnitPrecision -from ducpy.Duc.VersionBase import VersionBase as FBSVersionBase -from ducpy.Duc.VersionGraph import VersionGraph as FBSVersionGraph -from ducpy.Duc.VersionGraphMetadata import \ - VersionGraphMetadata as FBSVersionGraphMetadata -from ducpy.Duc.VERTICAL_ALIGN import VERTICAL_ALIGN -from ducpy.Duc.VIEWPORT_SHADE_PLOT import VIEWPORT_SHADE_PLOT -from flatbuffers.table import Table - -# ============================================================================= -# Helpers -# ============================================================================= - -def _s(b: Optional[bytes]) -> Optional[str]: - return b.decode("utf-8") if b else None - -def _s_req(b: Optional[bytes]) -> str: - return b.decode("utf-8") if b else "" - -def _read_bytes_from_numpy(obj, length_method_name: str, numpy_method_name: str, item_method_name: str) -> bytes: - """ - Try to read a ubyte vector as bytes using AsNumpy() if available, - otherwise fallback to iterating items. - """ - length = getattr(obj, length_method_name)() - if length <= 0: - return b"" - try: - as_np = getattr(obj, numpy_method_name) - arr = as_np() - if arr is None: - raise RuntimeError("No numpy view") - return bytes(arr) - except Exception: - getter = getattr(obj, item_method_name) - return bytes(bytearray([getter(i) for i in range(length)])) - -def _read_float_vector(obj, length_name: str, item_name: str) -> List[float]: - n = getattr(obj, length_name)() - if n <= 0: - return [] - get = getattr(obj, item_name) - return [get(i) for i in range(n)] - -def _read_double_vector(obj, length_name: str, item_name: str) -> List[float]: - # Python generated code returns python floats for double as well - return _read_float_vector(obj, length_name, item_name) - -def _read_int_vector(obj, length_name: str, item_name: str) -> List[int]: - n = getattr(obj, length_name)() - if n <= 0: - return [] - get = getattr(obj, item_name) - return [get(i) for i in range(n)] - -def _read_str_vector(obj, length_name: str, item_name: str) -> List[str]: - n = getattr(obj, length_name)() - if n <= 0: - return [] - get = getattr(obj, item_name) - return [_s_req(get(i)) for i in range(n)] - -def _json_or_none(s: Optional[bytes]) -> Optional[Dict[str, Any]]: - if not s: - return None - try: - return json.loads(s.decode("utf-8")) - except Exception: - return None - -def _binary_json_or_none(data: Optional[bytes]) -> Optional[Any]: - """Parse gzip-compressed binary JSON data.""" - if not data: - return None - try: - decompressed = gzip.decompress(data) - return json.loads(decompressed.decode("utf-8")) - except Exception: - return None - -def _geopoint_struct_to_ds(gp) -> Optional[DS_GeometricPoint]: - if gp is None: - return None - # flatbuffers struct proxies usually expose X() and Y() - try: - return DS_GeometricPoint(x=gp.X(), y=gp.Y()) - except Exception: - return None - - -# ============================================================================= -# Basic small tables -# ============================================================================= - -def parse_fbs_dictionary_entry(obj) -> DS_DictionaryEntry: - return DS_DictionaryEntry( - key=_s_req(obj.Key()), - value=_s_req(obj.Value()), - ) - -def parse_fbs_string_value_entry(obj: FBSStringValueEntry) -> DS_StringValueEntry: - return DS_StringValueEntry( - key=_s_req(obj.Key()), - value=_s_req(obj.Value()), - ) - -def parse_fbs_identifier(obj: FBSIdentifier) -> DS_Identifier: - return DS_Identifier( - id=_s_req(obj.Id()), - name=_s_req(obj.Name()), - description=_s_req(obj.Description()), - ) - -# ============================================================================= -# Geometry and content -# ============================================================================= - -def parse_fbs_duc_point(obj: FBSDucPoint) -> DS_DucPoint: - return DS_DucPoint( - x=obj.X(), - y=obj.Y(), - mirroring=obj.Mirroring() if hasattr(obj, "Mirroring") else None, - ) - -def parse_fbs_margins(obj: FBSMargins): - # This function returns DS_Margins equivalent; but DS dataclasses embed this inside their own types. - # We'll return a simple structure for margins where used (DucTableCellStyle.margins, PlotLayout.margins). - from ducpy.classes.ElementsClass import \ - Margins as DS_Margins # local import to avoid name shadowing - return DS_Margins( - top=obj.Top(), - right=obj.Right(), - bottom=obj.Bottom(), - left=obj.Left(), - ) - -def parse_fbs_tiling_properties(obj: FBSTilingProperties) -> Optional[DS_TilingProperties]: - if obj is None: - return None - spacing = obj.Spacing() if hasattr(obj, "Spacing") else None - offset_x = obj.OffsetX() if hasattr(obj, "OffsetX") else None - offset_y = obj.OffsetY() if hasattr(obj, "OffsetY") else None - return DS_TilingProperties( - size_in_percent=obj.SizeInPercent(), - angle=obj.Angle(), - spacing=spacing, - offset_x=offset_x, - offset_y=offset_y, - ) - -def parse_fbs_hatch_pattern_line(obj: FBSHatchPatternLine): - from ducpy.classes.ElementsClass import \ - HatchPatternLine as DS_HatchPatternLine - origin = parse_fbs_duc_point(obj.Origin()) - offset = _read_double_vector(obj, "OffsetLength", "Offset") - dash = _read_double_vector(obj, "DashPatternLength", "DashPattern") - return DS_HatchPatternLine( - angle=obj.Angle(), - origin=origin, - offset=offset, - dash_pattern=dash, - ) - -def parse_fbs_custom_hatch_pattern(obj: FBSCustomHatchPattern): - if obj is None: - return None - from ducpy.classes.ElementsClass import \ - CustomHatchPattern as DS_CustomHatchPattern - lines = [parse_fbs_hatch_pattern_line(obj.Lines(i)) for i in range(obj.LinesLength())] - return DS_CustomHatchPattern( - name=_s_req(obj.Name()), - description=_s_req(obj.Description()), - lines=lines, - ) - -def parse_fbs_duc_hatch_style(obj: FBSDucHatchStyle) -> Optional[DS_DucHatchStyle]: - if obj is None: - return None - return DS_DucHatchStyle( - pattern_name=_s_req(obj.PatternName()), - pattern_scale=obj.PatternScale(), - pattern_angle=obj.PatternAngle(), - pattern_origin=parse_fbs_duc_point(obj.PatternOrigin()), - pattern_double=obj.PatternDouble(), - hatch_style=obj.HatchStyle() if hasattr(obj, "HatchStyle") else None, - custom_pattern=parse_fbs_custom_hatch_pattern(obj.CustomPattern()) if obj.CustomPattern() else None, - ) - -def parse_fbs_duc_image_filter(obj: FBSDucImageFilter) -> Optional[DS_DucImageFilter]: - if obj is None: - return None - return DS_DucImageFilter( - brightness=obj.Brightness(), - contrast=obj.Contrast(), - ) - -def parse_fbs_element_content_base(obj: FBSElementContentBase) -> DS_ElementContentBase: - tiling = parse_fbs_tiling_properties(obj.Tiling()) if obj.Tiling() else None - hatch = parse_fbs_duc_hatch_style(obj.Hatch()) if obj.Hatch() else None - img_filter = parse_fbs_duc_image_filter(obj.ImageFilter()) if obj.ImageFilter() else None - return DS_ElementContentBase( - src=_s_req(obj.Src()), - visible=obj.Visible(), - opacity=obj.Opacity(), - tiling=tiling, - hatch=hatch, - image_filter=img_filter, - preference=obj.Preference() if hasattr(obj, "Preference") else None, - ) - -def parse_fbs_stroke_style(obj: FBSStrokeStyle) -> DS_StrokeStyle: - if obj is None: - return DS_StrokeStyle( - preference=None, dash=None, dash_line_override=None, cap=None, join=None, dash_cap=None, miter_limit=None - ) - return DS_StrokeStyle( - preference=obj.Preference() if hasattr(obj, "Preference") else None, - dash=_read_double_vector(obj, "DashLength", "Dash") if obj else None, - dash_line_override=_s(obj.DashLineOverride()) if obj else None, - cap=obj.Cap() if obj and hasattr(obj, "Cap") else None, - join=obj.Join() if obj and hasattr(obj, "Join") else None, - dash_cap=obj.DashCap() if obj and hasattr(obj, "DashCap") else None, - miter_limit=obj.MiterLimit() if obj and hasattr(obj, "MiterLimit") else None, - ) - -def parse_fbs_stroke_sides(obj: FBSStrokeSides) -> Optional[DS_StrokeSides]: - if obj is None: - return None - return DS_StrokeSides( - preference=obj.Preference() if hasattr(obj, "Preference") else None, - values=_read_double_vector(obj, "ValuesLength", "Values"), - ) - -def parse_fbs_element_stroke(obj: FBSElementStroke) -> DS_ElementStroke: - return DS_ElementStroke( - content=parse_fbs_element_content_base(obj.Content()), - width=obj.Width(), - style=parse_fbs_stroke_style(obj.Style()), - placement=obj.Placement() if hasattr(obj, "Placement") else None, - stroke_sides=parse_fbs_stroke_sides(obj.StrokeSides()), - ) - -def parse_fbs_element_background(obj: FBSElementBackground) -> DS_ElementBackground: - if obj is None: - content = DS_ElementContentBase( - src="", visible=True, opacity=1.0, tiling=None, hatch=None, image_filter=None, preference=None - ) - return DS_ElementBackground(content=content) - return DS_ElementBackground( - content=parse_fbs_element_content_base(obj.Content()) - ) - -def parse_fbs_duc_element_styles_base(obj: FBSDucElementStylesBase) -> Optional[DS_DucElementStylesBase]: - if obj is None: - return None - - # Parse background - take first or create default - background = None - try: - if hasattr(obj, 'BackgroundLength') and obj.BackgroundLength() > 0: - bg_obj = obj.Background(0) - if bg_obj: - background = parse_fbs_element_background(bg_obj) - except Exception: - pass - - # If no background, create default - if background is None: - background = DS_ElementBackground(content=DS_ElementContentBase( - src="", visible=True, opacity=1.0, tiling=None, hatch=None, image_filter=None, preference=None - )) - - # Parse stroke - take first or create default - stroke = None - try: - if hasattr(obj, 'StrokeLength') and obj.StrokeLength() > 0: - stroke_obj = obj.Stroke(0) - if stroke_obj: - stroke = parse_fbs_element_stroke(stroke_obj) - except Exception: - pass - - # If no stroke, create default - if stroke is None: - stroke = DS_ElementStroke( - content=DS_ElementContentBase( - src="", visible=True, opacity=1.0, tiling=None, hatch=None, image_filter=None, preference=None - ), - width=1.0, - style=DS_StrokeStyle( - preference=None, dash=None, dash_line_override=None, cap=None, join=None, dash_cap=None, miter_limit=None - ), - placement=None, - stroke_sides=None - ) - - blending = obj.Blending() if hasattr(obj, "Blending") else None - return DS_DucElementStylesBase( - roundness=obj.Roundness() if hasattr(obj, "Roundness") else 0.0, - background=background, - stroke=stroke, - opacity=obj.Opacity() if hasattr(obj, "Opacity") else 1.0, - blending=blending, - ) - -# ============================================================================= -# Base element and shared components -# ============================================================================= - -def parse_fbs_bound_element(obj: FBSBoundElement) -> DS_BoundElement: - return DS_BoundElement( - id=_s_req(obj.Id()), - type=_s_req(obj.Type()), - ) - -def parse_fbs_duc_element_base(obj: FBSDucElementBase) -> DS_DucElementBase: - styles = parse_fbs_duc_element_styles_base(obj.Styles()) if obj.Styles() else None - group_ids = _read_str_vector(obj, "GroupIdsLength", "GroupIds") if hasattr(obj, "GroupIdsLength") else [] - block_ids = _read_str_vector(obj, "BlockIdsLength", "BlockIds") if hasattr(obj, "BlockIdsLength") else [] - region_ids = _read_str_vector(obj, "RegionIdsLength", "RegionIds") if hasattr(obj, "RegionIdsLength") else [] - bound_elements = [] - try: - if hasattr(obj, "BoundElementsLength"): - bound_elements = [parse_fbs_bound_element(obj.BoundElements(i)) for i in range(obj.BoundElementsLength())] - except Exception: - pass - # custom_data is now binary compressed JSON - custom_data = None - if hasattr(obj, "CustomData") and not obj.CustomDataIsNone(): - custom_data_bytes = _read_bytes_from_numpy(obj, "CustomDataLength", "CustomDataAsNumpy", "CustomData") - custom_data = _binary_json_or_none(custom_data_bytes) - return DS_DucElementBase( - id=_s_req(obj.Id()) if hasattr(obj, "Id") else "", - styles=styles, - x=obj.X() if hasattr(obj, "X") else 0.0, - y=obj.Y() if hasattr(obj, "Y") else 0.0, - width=obj.Width() if hasattr(obj, "Width") else 0.0, - height=obj.Height() if hasattr(obj, "Height") else 0.0, - angle=obj.Angle() if hasattr(obj, "Angle") else 0.0, - scope=_s_req(obj.Scope()) if hasattr(obj, "Scope") else "", - label=_s_req(obj.Label()) if hasattr(obj, "Label") else "", - is_visible=obj.IsVisible() if hasattr(obj, "IsVisible") else True, - seed=obj.Seed() if hasattr(obj, "Seed") else 0, - version=obj.Version() if hasattr(obj, "Version") else 0, - version_nonce=obj.VersionNonce() if hasattr(obj, "VersionNonce") else 0, - updated=obj.Updated() if hasattr(obj, "Updated") else 0, - is_plot=obj.IsPlot() if hasattr(obj, "IsPlot") else True, - is_annotative=obj.IsAnnotative() if hasattr(obj, "IsAnnotative") else False, - is_deleted=obj.IsDeleted() if hasattr(obj, "IsDeleted") else False, - group_ids=group_ids, - block_ids=block_ids, - region_ids=region_ids, - z_index=obj.ZIndex() if hasattr(obj, "ZIndex") else 0, - locked=obj.Locked() if hasattr(obj, "Locked") else False, - description=_s(obj.Description()) if hasattr(obj, "Description") else None, - index=_s(obj.Index()) if hasattr(obj, "Index") else None, - link=_s(obj.Link()) if hasattr(obj, "Link") else None, - layer_id=_s(obj.LayerId()) if hasattr(obj, "LayerId") else None, - frame_id=_s(obj.FrameId()) if hasattr(obj, "FrameId") else None, - bound_elements=bound_elements if bound_elements else None, - custom_data=custom_data, - instance_id=_s(obj.InstanceId()) if hasattr(obj, "InstanceId") else None, - ) - -def parse_fbs_duc_head(obj: FBSDucHead) -> DS_DucHead: - return DS_DucHead( - size=obj.Size(), - type=obj.Type() if hasattr(obj, "Type") else None, - block_id=_s(obj.BlockId()), - ) - -def parse_fbs_point_binding_point(obj: FBSPointBindingPoint) -> DS_PointBindingPoint: - return DS_PointBindingPoint( - index=obj.Index(), - offset=obj.Offset(), - ) - -def parse_fbs_duc_point_binding(obj: FBSDucPointBinding) -> Optional[DS_DucPointBinding]: - if obj is None: - return None - fixed = obj.FixedPoint() - focus_value = obj.Focus() if hasattr(obj, "Focus") else None - return DS_DucPointBinding( - element_id=_s_req(obj.ElementId()), - focus=focus_value, - gap=obj.Gap(), - fixed_point=_geopoint_struct_to_ds(fixed), - point=parse_fbs_point_binding_point(obj.Point()) if obj.Point() else None, - head=parse_fbs_duc_head(obj.Head()) if obj.Head() else None, - ) - -def parse_fbs_duc_line_reference(obj: FBSDucLineReference) -> DS_DucLineReference: - handle = obj.Handle() - return DS_DucLineReference( - index=obj.Index(), - handle=_geopoint_struct_to_ds(handle), - ) - -def parse_fbs_duc_line(obj: FBSDucLine) -> DS_DucLine: - return DS_DucLine( - start=parse_fbs_duc_line_reference(obj.Start()), - end=parse_fbs_duc_line_reference(obj.End()), - ) - -def parse_fbs_duc_path(obj: FBSDucPath) -> DS_DucPath: - line_indices = _read_int_vector(obj, "LineIndicesLength", "LineIndices") - return DS_DucPath( - line_indices=line_indices, - background=parse_fbs_element_background(obj.Background()) if obj.Background() else None, - stroke=parse_fbs_element_stroke(obj.Stroke()) if obj.Stroke() else None, - ) - -def parse_fbs_duc_linear_element_base(obj: FBSDucLinearElementBase) -> DS_DucLinearElementBase: - points = [parse_fbs_duc_point(obj.Points(i)) for i in range(obj.PointsLength())] - lines = [parse_fbs_duc_line(obj.Lines(i)) for i in range(obj.LinesLength())] - path_overrides = [parse_fbs_duc_path(obj.PathOverrides(i)) for i in range(obj.PathOverridesLength())] - return DS_DucLinearElementBase( - base=parse_fbs_duc_element_base(obj.Base()), - points=points, - lines=lines, - path_overrides=path_overrides, - last_committed_point=parse_fbs_duc_point(obj.LastCommittedPoint()) if obj.LastCommittedPoint() else None, - start_binding=parse_fbs_duc_point_binding(obj.StartBinding()) if obj.StartBinding() else None, - end_binding=parse_fbs_duc_point_binding(obj.EndBinding()) if obj.EndBinding() else None, - ) - -def parse_fbs_duc_stack_like_styles(obj) -> DS_DucStackLikeStyles: - blending = obj.Blending() if hasattr(obj, "Blending") and obj.Blending() is not None else None - return DS_DucStackLikeStyles( - opacity=obj.Opacity() if hasattr(obj, "Opacity") else 1.0, - labeling_color=_s_req(obj.LabelingColor()) if hasattr(obj, "LabelingColor") else "", - blending=blending, - ) - -def parse_fbs_duc_stack_base(obj: FBSDucStackBase) -> DS_DucStackBase: - styles = parse_fbs_duc_stack_like_styles(obj.Styles()) - return DS_DucStackBase( - label=_s_req(obj.Label()), - description=_s_req(obj.Description()), - is_collapsed=obj.IsCollapsed(), - is_plot=obj.IsPlot(), - is_visible=obj.IsVisible(), - locked=obj.Locked(), - styles=styles, - ) - -def parse_fbs_duc_stack_element_base(obj: FBSDucStackElementBase) -> DS_DucStackElementBase: - base = parse_fbs_duc_element_base(obj.Base()) - stack_base = parse_fbs_duc_stack_base(obj.StackBase()) - clip = obj.Clip() - label_visible = obj.LabelVisible() - standard_override = _s(obj.StandardOverride()) - return DS_DucStackElementBase( - base=base, - stack_base=stack_base, - clip=clip, - label_visible=label_visible, - standard_override=standard_override, - ) - -# ============================================================================= -# Element-specific styling -# ============================================================================= - -def parse_fbs_line_spacing(obj: FBSLineSpacing) -> Optional[DS_LineSpacing]: - if obj is None: - return None - return DS_LineSpacing( - value=obj.Value(), - type=obj.Type() if hasattr(obj, "Type") else None, - ) - -def parse_fbs_duc_text_style(obj: FBSDucTextStyle) -> DS_DucTextStyle: - return DS_DucTextStyle( - is_ltr=obj.IsLtr(), - font_family=_s_req(obj.FontFamily()), - big_font_family=_s_req(obj.BigFontFamily()), - line_height=obj.LineHeight(), - line_spacing=parse_fbs_line_spacing(obj.LineSpacing()) if obj.LineSpacing() else None, - oblique_angle=obj.ObliqueAngle(), - font_size=obj.FontSize(), - width_factor=obj.WidthFactor(), - is_upside_down=obj.IsUpsideDown(), - is_backwards=obj.IsBackwards(), - text_align=obj.TextAlign() if hasattr(obj, "TextAlign") else None, - vertical_align=obj.VerticalAlign() if hasattr(obj, "VerticalAlign") else None, - paper_text_height=obj.PaperTextHeight() if hasattr(obj, "PaperTextHeight") else None, - ) - -def parse_fbs_table_cell_style(obj: FBSDucTableCellStyle) -> DS_DucTableCellStyle: - return DS_DucTableCellStyle( - base_style=parse_fbs_duc_element_styles_base(obj.BaseStyle()), - text_style=parse_fbs_duc_text_style(obj.TextStyle()), - margins=parse_fbs_margins(obj.Margins()), - alignment=obj.Alignment() if hasattr(obj, "Alignment") else None, - ) - -def parse_fbs_table_style(obj: FBSDucTableStyle) -> Optional[DS_DucTableStyle]: - if obj is None: - return None - return DS_DucTableStyle( - header_row_style=parse_fbs_table_cell_style(obj.HeaderRowStyle()), - data_row_style=parse_fbs_table_cell_style(obj.DataRowStyle()), - data_column_style=parse_fbs_table_cell_style(obj.DataColumnStyle()), - flow_direction=obj.FlowDirection() if hasattr(obj, "FlowDirection") else None, - ) - -def parse_fbs_leader_style(obj: "FBSDucLeaderStyle") -> DS_DucLeaderStyle: - heads = [parse_fbs_duc_head(obj.HeadsOverride(i)) for i in range(obj.HeadsOverrideLength())] - return DS_DucLeaderStyle( - text_style=parse_fbs_duc_text_style(obj.TextStyle()), - text_attachment=obj.TextAttachment() if hasattr(obj, "TextAttachment") else None, - block_attachment=obj.BlockAttachment() if hasattr(obj, "BlockAttachment") else None, - dogleg=obj.Dogleg() if hasattr(obj, "Dogleg") else None, - heads_override=heads if heads else None, - ) - -def parse_fbs_dimension_tolerance_style(obj: FBSDimensionToleranceStyle) -> DS_DimensionToleranceStyle: - return DS_DimensionToleranceStyle( - enabled=obj.Enabled(), - upper_value=obj.UpperValue(), - lower_value=obj.LowerValue(), - precision=obj.Precision(), - display_method=obj.DisplayMethod() if hasattr(obj, "DisplayMethod") else None, - text_style=parse_fbs_duc_text_style(obj.TextStyle()) if obj.TextStyle() else None, - ) - -def parse_fbs_dimension_fit_style(obj: FBSDimensionFitStyle) -> DS_DimensionFitStyle: - return DS_DimensionFitStyle( - force_text_inside=obj.ForceTextInside(), - rule=obj.Rule() if hasattr(obj, "Rule") else None, - text_placement=obj.TextPlacement() if hasattr(obj, "TextPlacement") else None, - ) - -def parse_fbs_dimension_line_style(obj: FBSDimensionLineStyle) -> DS_DimensionLineStyle: - return DS_DimensionLineStyle( - stroke=parse_fbs_element_stroke(obj.Stroke()), - text_gap=obj.TextGap(), - ) - -def parse_fbs_dimension_ext_line_style(obj: FBSDimensionExtLineStyle) -> DS_DimensionExtLineStyle: - return DS_DimensionExtLineStyle( - stroke=parse_fbs_element_stroke(obj.Stroke()), - overshoot=obj.Overshoot(), - offset=obj.Offset(), - ) - -def parse_fbs_dimension_symbol_style(obj: FBSDimensionSymbolStyle) -> DS_DimensionSymbolStyle: - heads = [parse_fbs_duc_head(obj.HeadsOverride(i)) for i in range(obj.HeadsOverrideLength())] - return DS_DimensionSymbolStyle( - center_mark_size=obj.CenterMarkSize(), - center_mark_type=obj.CenterMarkType() if hasattr(obj, "CenterMarkType") else None, - heads_override=heads if heads else None, - ) - -def parse_fbs_dimension_style(obj: FBSDucDimensionStyle) -> DS_DucDimensionStyle: - return DS_DucDimensionStyle( - dim_line=parse_fbs_dimension_line_style(obj.DimLine()), - ext_line=parse_fbs_dimension_ext_line_style(obj.ExtLine()), - text_style=parse_fbs_duc_text_style(obj.TextStyle()), - symbols=parse_fbs_dimension_symbol_style(obj.Symbols()), - tolerance=parse_fbs_dimension_tolerance_style(obj.Tolerance()), - fit=parse_fbs_dimension_fit_style(obj.Fit()), - ) - -def parse_fbs_fcf_layout_style(obj: FBSFCFLayoutStyle) -> DS_FCFLayoutStyle: - return DS_FCFLayoutStyle( - padding=obj.Padding(), - segment_spacing=obj.SegmentSpacing(), - row_spacing=obj.RowSpacing(), - ) - -def parse_fbs_fcf_symbol_style(obj: FBSFCFSymbolStyle) -> DS_FCFSymbolStyle: - return DS_FCFSymbolStyle( - scale=obj.Scale(), - ) - -def parse_fbs_fcf_datum_style(obj: FBSFCFDatumStyle) -> DS_FCFDatumStyle: - return DS_FCFDatumStyle( - bracket_style=obj.BracketStyle() if hasattr(obj, "BracketStyle") else None - ) - -def parse_fbs_feature_control_frame_style(obj: FBSDucFeatureControlFrameStyle) -> DS_DucFeatureControlFrameStyle: - return DS_DucFeatureControlFrameStyle( - text_style=parse_fbs_duc_text_style(obj.TextStyle()), - layout=parse_fbs_fcf_layout_style(obj.Layout()), - symbols=parse_fbs_fcf_symbol_style(obj.Symbols()), - datum_style=parse_fbs_fcf_datum_style(obj.DatumStyle()), - ) - -def parse_fbs_paragraph_formatting(obj) -> DS_ParagraphFormatting: - return DS_ParagraphFormatting( - first_line_indent=obj.FirstLineIndent(), - hanging_indent=obj.HangingIndent(), - left_indent=obj.LeftIndent(), - right_indent=obj.RightIndent(), - space_before=obj.SpaceBefore(), - space_after=obj.SpaceAfter(), - tab_stops=_read_double_vector(obj, "TabStopsLength", "TabStops"), - ) - -def parse_fbs_stack_format_properties(obj) -> DS_StackFormatProperties: - return DS_StackFormatProperties( - upper_scale=obj.UpperScale(), - lower_scale=obj.LowerScale(), - alignment=obj.Alignment() if hasattr(obj, "Alignment") else None, - ) - -def parse_fbs_stack_format(obj) -> DS_StackFormat: - return DS_StackFormat( - auto_stack=obj.AutoStack(), - stack_chars=_read_str_vector(obj, "StackCharsLength", "StackChars"), - properties=parse_fbs_stack_format_properties(obj.Properties()), - ) - -def parse_fbs_doc_style(obj: FBSDucDocStyle) -> DS_DucDocStyle: - return DS_DucDocStyle( - text_style=parse_fbs_duc_text_style(obj.TextStyle()), - paragraph=parse_fbs_paragraph_formatting(obj.Paragraph()), - stack_format=parse_fbs_stack_format(obj.StackFormat()), - ) - -def parse_fbs_viewport_style(obj: FBSDucViewportStyle) -> DS_DucViewportStyle: - return DS_DucViewportStyle( - scale_indicator_visible=obj.ScaleIndicatorVisible(), - ) - -def parse_fbs_plot_style(obj: FBSDucPlotStyle) -> DS_DucPlotStyle: - return DS_DucPlotStyle( - ) - -def parse_fbs_xray_style(obj: FBSDucXRayStyle) -> DS_DucXRayStyle: - return DS_DucXRayStyle( - color=_s_req(obj.Color()), - ) - -# ============================================================================= -# Element definitions -# ============================================================================= - -def parse_fbs_rectangle(obj: FBSDucRectangleElement) -> DS_DucRectangleElement: - return DS_DucRectangleElement( - base=parse_fbs_duc_element_base(obj.Base()) - ) - -def parse_fbs_polygon(obj: FBSDucPolygonElement) -> DS_DucPolygonElement: - return DS_DucPolygonElement( - base=parse_fbs_duc_element_base(obj.Base()), - sides=obj.Sides(), - ) - -def parse_fbs_ellipse(obj: FBSDucEllipseElement) -> DS_DucEllipseElement: - return DS_DucEllipseElement( - base=parse_fbs_duc_element_base(obj.Base()), - ratio=obj.Ratio(), - start_angle=obj.StartAngle(), - end_angle=obj.EndAngle(), - show_aux_crosshair=obj.ShowAuxCrosshair(), - ) - -def parse_fbs_embeddable(obj: FBSDucEmbeddableElement) -> DS_DucEmbeddableElement: - return DS_DucEmbeddableElement( - base=parse_fbs_duc_element_base(obj.Base()) - ) - -def parse_fbs_document_grid_config(obj: FBSDocumentGridConfig) -> DS_DocumentGridConfig: - return DS_DocumentGridConfig( - columns=obj.Columns(), - gap_x=obj.GapX(), - gap_y=obj.GapY(), - align_items=obj.AlignItems(), - first_page_alone=obj.FirstPageAlone(), - scale=obj.Scale(), - ) - -def parse_fbs_pdf(obj: FBSDucPdfElement) -> DS_DucPdfElement: - grid_config = obj.GridConfig() - if grid_config: - parsed_grid_config = parse_fbs_document_grid_config(grid_config) - else: - parsed_grid_config = DS_DocumentGridConfig( - columns=1, - gap_x=0.0, - gap_y=0.0, - align_items=0, - first_page_alone=False, - scale=1.0, - ) - return DS_DucPdfElement( - base=parse_fbs_duc_element_base(obj.Base()), - file_id=_s(obj.FileId()), - grid_config=parsed_grid_config, - ) - -def parse_fbs_mermaid(obj: FBSDucMermaidElement) -> DS_DucMermaidElement: - return DS_DucMermaidElement( - base=parse_fbs_duc_element_base(obj.Base()), - source=_s_req(obj.Source()), - theme=_s(obj.Theme()), - svg_path=_s(obj.SvgPath()), - ) - -def parse_fbs_table_column(obj: FBSDucTableColumn) -> DS_DucTableColumn: - return DS_DucTableColumn( - id=_s_req(obj.Id()), - width=obj.Width(), - style_overrides=parse_fbs_table_cell_style(obj.StyleOverrides()) if obj.StyleOverrides() else None, - ) - -def parse_fbs_table_row(obj: FBSDucTableRow) -> DS_DucTableRow: - return DS_DucTableRow( - id=_s_req(obj.Id()), - height=obj.Height(), - style_overrides=parse_fbs_table_cell_style(obj.StyleOverrides()) if obj.StyleOverrides() else None, - ) - -def parse_fbs_table_cell_span(obj: FBSDucTableCellSpan) -> Optional[DS_DucTableCellSpan]: - if obj is None: - return None - return DS_DucTableCellSpan( - columns=obj.Columns(), - rows=obj.Rows(), - ) - -def parse_fbs_table_cell(obj: FBSDucTableCell) -> DS_DucTableCell: - return DS_DucTableCell( - row_id=_s_req(obj.RowId()), - column_id=_s_req(obj.ColumnId()), - data=_s_req(obj.Data()), - locked=obj.Locked(), - span=parse_fbs_table_cell_span(obj.Span()) if obj.Span() else None, - style_overrides=parse_fbs_table_cell_style(obj.StyleOverrides()) if obj.StyleOverrides() else None, - ) - -def parse_fbs_table_column_entry(obj: FBSDucTableColumnEntry) -> DS_DucTableColumnEntry: - return DS_DucTableColumnEntry( - key=_s_req(obj.Key()), - value=parse_fbs_table_column(obj.Value()) - ) - -def parse_fbs_table_row_entry(obj: FBSDucTableRowEntry) -> DS_DucTableRowEntry: - return DS_DucTableRowEntry( - key=_s_req(obj.Key()), - value=parse_fbs_table_row(obj.Value()) - ) - -def parse_fbs_table_cell_entry(obj: FBSDucTableCellEntry) -> DS_DucTableCellEntry: - return DS_DucTableCellEntry( - key=_s_req(obj.Key()), - value=parse_fbs_table_cell(obj.Value()) - ) - -def parse_fbs_table_auto_size(obj: FBSDucTableAutoSize) -> DS_DucTableAutoSize: - return DS_DucTableAutoSize( - columns=obj.Columns(), - rows=obj.Rows(), - ) - -def parse_fbs_table(obj: FBSDucTableElement) -> DS_DucTableElement: - columns = [parse_fbs_table_column_entry(obj.Columns(i)) for i in range(obj.ColumnsLength())] - rows = [parse_fbs_table_row_entry(obj.Rows(i)) for i in range(obj.RowsLength())] - cells = [parse_fbs_table_cell_entry(obj.Cells(i)) for i in range(obj.CellsLength())] - return DS_DucTableElement( - base=parse_fbs_duc_element_base(obj.Base()), - style=parse_fbs_table_style(obj.Style()), - column_order=_read_str_vector(obj, "ColumnOrderLength", "ColumnOrder"), - row_order=_read_str_vector(obj, "RowOrderLength", "RowOrder"), - columns=columns, - rows=rows, - cells=cells, - header_row_count=obj.HeaderRowCount(), - auto_size=parse_fbs_table_auto_size(obj.AutoSize()), - ) - -def parse_fbs_image_crop(obj: FBSImageCrop) -> DS_ImageCrop: - return DS_ImageCrop( - x=obj.X(), - y=obj.Y(), - width=obj.Width(), - height=obj.Height(), - natural_width=obj.NaturalWidth(), - natural_height=obj.NaturalHeight(), - ) - -def parse_fbs_image(obj: FBSDucImageElement) -> DS_DucImageElement: - scale = _read_double_vector(obj, "ScaleLength", "Scale") - return DS_DucImageElement( - base=parse_fbs_duc_element_base(obj.Base()), - scale=scale, - status=obj.Status() if hasattr(obj, "Status") else None, - file_id=_s(obj.FileId()), - crop=parse_fbs_image_crop(obj.Crop()) if obj.Crop() else None, - filter=parse_fbs_duc_image_filter(obj.Filter()) if obj.Filter() else None, - ) - -def parse_fbs_text_dynamic_element_source(obj: FBSDucTextDynamicElementSource) -> DS_DucTextDynamicElementSource: - return DS_DucTextDynamicElementSource( - element_id=_s_req(obj.ElementId()), - property=obj.Property() if hasattr(obj, "Property") else None, - ) - -def parse_fbs_text_dynamic_dictionary_source(obj: FBSDucTextDynamicDictionarySource) -> DS_DucTextDynamicDictionarySource: - return DS_DucTextDynamicDictionarySource( - key=_s_req(obj.Key()) - ) - -def parse_fbs_text_dynamic_source(obj: FBSDucTextDynamicSource) -> DS_DucTextDynamicSource: - # union data - source_type = obj.TextSourceType() if hasattr(obj, "TextSourceType") else 0 - if source_type == 1: # ELEMENT - t = FBSDucTextDynamicElementSource() - t.Init(obj.Source().Bytes, obj.Source().Pos) - return DS_DucTextDynamicSource(source=parse_fbs_text_dynamic_element_source(t)) - elif source_type == 2: # DICTIONARY - t = FBSDucTextDynamicDictionarySource() - t.Init(obj.Source().Bytes, obj.Source().Pos) - return DS_DucTextDynamicSource(source=parse_fbs_text_dynamic_dictionary_source(t)) - else: - return DS_DucTextDynamicSource(source=None) # unexpected, but keep typing - -def parse_fbs_primary_units(obj: FBSPrimaryUnits) -> DS_PrimaryUnits: - # Implemented in Standards parsing (Part 2), but we may parse from either place consistently - # We'll forward-declare here and override later if needed. For now, construct minimal. - from ducpy.classes.StandardsClass import PrimaryUnits as DS_PrimaryUnits - linear = None - if obj.Linear(): - from ducpy.Duc.LinearUnitSystem import \ - LinearUnitSystem as FBSLinearUnitSystem - - # full parse done later; here we just set to None to avoid circular. - angular = None - return DS_PrimaryUnits(linear=linear, angular=angular) - -def parse_fbs_text_dynamic_part(obj: FBSDucTextDynamicPart) -> DS_DucTextDynamicPart: - # For now, we don't parse the formatting since it's not a primary units object - # This would need proper implementation based on the actual schema - return DS_DucTextDynamicPart( - tag=_s_req(obj.Tag()), - source=parse_fbs_text_dynamic_source(obj.Source()), - cached_value=_s_req(obj.CachedValue()), - formatting=None, - ) - -def parse_fbs_text(obj: FBSDucTextElement) -> DS_DucTextElement: - dynamics = [parse_fbs_text_dynamic_part(obj.Dynamic(i)) for i in range(obj.DynamicLength())] - return DS_DucTextElement( - base=parse_fbs_duc_element_base(obj.Base()), - style=parse_fbs_duc_text_style(obj.Style()), - text=_s_req(obj.Text()), - dynamic=dynamics, - auto_resize=obj.AutoResize(), - original_text=_s_req(obj.OriginalText()), - container_id=_s(obj.ContainerId()), - ) - -def parse_fbs_linear(obj: FBSDucLinearElement) -> DS_DucLinearElement: - return DS_DucLinearElement( - linear_base=parse_fbs_duc_linear_element_base(obj.LinearBase()), - wipeout_below=obj.WipeoutBelow(), - ) - -def parse_fbs_arrow(obj: FBSDucArrowElement) -> DS_DucArrowElement: - return DS_DucArrowElement( - linear_base=parse_fbs_duc_linear_element_base(obj.LinearBase()), - elbowed=obj.Elbowed(), - ) - -def parse_fbs_free_draw_ends(obj: FBSDucFreeDrawEnds) -> DS_DucFreeDrawEnds: - return DS_DucFreeDrawEnds( - cap=obj.Cap(), - taper=obj.Taper(), - easing=_s_req(obj.Easing()), - ) - -def parse_fbs_free_draw(obj: FBSDucFreeDrawElement) -> DS_DucFreeDrawElement: - points = [parse_fbs_duc_point(obj.Points(i)) for i in range(obj.PointsLength())] - pressures = _read_float_vector(obj, "PressuresLength", "Pressures") - return DS_DucFreeDrawElement( - base=parse_fbs_duc_element_base(obj.Base()), - points=points, - size=obj.Size(), - thinning=obj.Thinning(), - smoothing=obj.Smoothing(), - streamline=obj.Streamline(), - easing=_s_req(obj.Easing()), - pressures=pressures, - simulate_pressure=obj.SimulatePressure(), - last_committed_point=parse_fbs_duc_point(obj.LastCommittedPoint()) if obj.LastCommittedPoint() else None, - start=parse_fbs_free_draw_ends(obj.Start()) if obj.Start() else None, - end=parse_fbs_free_draw_ends(obj.End()) if obj.End() else None, - svg_path=_s(obj.SvgPath()), - ) - -def parse_fbs_block_duplication_array(obj: FBSDucBlockDuplicationArray) -> DS_DucBlockDuplicationArray: - return DS_DucBlockDuplicationArray( - rows=obj.Rows(), - cols=obj.Cols(), - row_spacing=obj.RowSpacing(), - col_spacing=obj.ColSpacing(), - ) - -def parse_fbs_block_instance(obj: FBSDucBlockInstanceElement) -> DS_DucBlockInstanceElement: - element_overrides = [parse_fbs_string_value_entry(obj.ElementOverrides(i)) for i in range(obj.ElementOverridesLength())] - attribute_values = [parse_fbs_string_value_entry(obj.AttributeValues(i)) for i in range(obj.AttributeValuesLength())] - return DS_DucBlockInstanceElement( - base=parse_fbs_duc_element_base(obj.Base()), - block_id=_s_req(obj.BlockId()), - element_overrides=element_overrides if element_overrides else None, - attribute_values=attribute_values if attribute_values else None, - duplication_array=parse_fbs_block_duplication_array(obj.DuplicationArray()) if obj.DuplicationArray() else None, - ) - -def parse_fbs_frame(obj: FBSDucFrameElement) -> DS_DucFrameElement: - return DS_DucFrameElement( - stack_element_base=parse_fbs_duc_stack_element_base(obj.StackElementBase()) - ) - -def parse_fbs_plot(obj: FBSDucPlotElement) -> DS_DucPlotElement: - style = parse_fbs_plot_style(obj.Style()) - margins = parse_fbs_margins(obj.Layout().Margins()) - return DS_DucPlotElement( - stack_element_base=parse_fbs_duc_stack_element_base(obj.StackElementBase()), - style=style, - layout=DS_PlotLayout(margins=margins), - ) - -def parse_fbs_view(obj: FBSDucView): - from ducpy.classes.ElementsClass import DucView as DS_DucView - return DS_DucView( - scroll_x=obj.ScrollX(), - scroll_y=obj.ScrollY(), - zoom=obj.Zoom(), - twist_angle=obj.TwistAngle(), - center_point=parse_fbs_duc_point(obj.CenterPoint()), - scope=_s_req(obj.Scope()), - ) - -def parse_fbs_viewport(obj: FBSDucViewportElement) -> DS_DucViewportElement: - frozen = _read_str_vector(obj, "FrozenGroupIdsLength", "FrozenGroupIds") - return DS_DucViewportElement( - linear_base=parse_fbs_duc_linear_element_base(obj.LinearBase()), - stack_base=parse_fbs_duc_stack_base(obj.StackBase()), - style=parse_fbs_viewport_style(obj.Style()), - view=parse_fbs_view(obj.View()), - scale=obj.Scale(), - shade_plot=obj.ShadePlot() if hasattr(obj, "ShadePlot") else None, - frozen_group_ids=frozen, - standard_override=_s(obj.StandardOverride()), - ) - -def parse_fbs_xray(obj: FBSDucXRayElement) -> DS_DucXRayElement: - return DS_DucXRayElement( - base=parse_fbs_duc_element_base(obj.Base()), - style=parse_fbs_xray_style(obj.Style()), - origin=parse_fbs_duc_point(obj.Origin()), - direction=parse_fbs_duc_point(obj.Direction()), - start_from_origin=obj.StartFromOrigin(), - ) - -def parse_fbs_leader_content(obj: FBSLeaderContent) -> Optional[DS_LeaderContent]: - if obj is None: - return None - content_type = obj.LeaderContentType() if hasattr(obj, "LeaderContentType") else 0 - union_type = obj.ContentType() - table = Table(obj.Content().Bytes, obj.Content().Pos) - content: Optional[Union[DS_LeaderTextBlockContent, DS_LeaderBlockContent]] = None - if union_type == 0: # LeaderTextBlockContent (first in union) - t = FBSLeaderTextBlockContent() - t.Init(table.Bytes, table.Pos) - content = DS_LeaderTextBlockContent(text=_s_req(t.Text())) - elif union_type == 1: # LeaderBlockContent (second in union) - t = FBSLeaderBlockContent() - t.Init(table.Bytes, table.Pos) - attr = [parse_fbs_string_value_entry(t.AttributeValues(i)) for i in range(t.AttributeValuesLength())] - elem_over = [parse_fbs_string_value_entry(t.ElementOverrides(i)) for i in range(t.ElementOverridesLength())] - content = DS_LeaderBlockContent( - block_id=_s_req(t.BlockId()), - attribute_values=attr if attr else None, - element_overrides=elem_over if elem_over else None, - ) - return DS_LeaderContent(content=content) +Returns plain dicts with snake_case keys. Attribute-style access is available +via DucData wrapper. +""" -def parse_fbs_leader(obj: FBSDucLeaderElement) -> DS_DucLeaderElement: - ca = obj.ContentAnchor() - return DS_DucLeaderElement( - linear_base=parse_fbs_duc_linear_element_base(obj.LinearBase()), - style=parse_fbs_leader_style(obj.Style()), - content=parse_fbs_leader_content(obj.Content()) if obj.Content() else None, - content_anchor=DS_GeometricPoint(x=ca.X(), y=ca.Y()) if ca else DS_GeometricPoint(x=0.0, y=0.0), - ) - -def parse_fbs_dimension_definition_points(obj: FBSDimensionDefinitionPoints) -> DS_DimensionDefinitionPoints: - return DS_DimensionDefinitionPoints( - origin1=_geopoint_struct_to_ds(obj.Origin1()), - location=_geopoint_struct_to_ds(obj.Location()), - origin2=_geopoint_struct_to_ds(obj.Origin2()), - center=_geopoint_struct_to_ds(obj.Center()), - jog=_geopoint_struct_to_ds(obj.Jog()), - ) - -def parse_fbs_dimension_bindings(obj: FBSDimensionBindings) -> Optional[DS_DimensionBindings]: - if obj is None: - return None - return DS_DimensionBindings( - origin1=parse_fbs_duc_point_binding(obj.Origin1()) if obj.Origin1() else None, - origin2=parse_fbs_duc_point_binding(obj.Origin2()) if obj.Origin2() else None, - center=parse_fbs_duc_point_binding(obj.Center()) if obj.Center() else None, - ) - -def parse_fbs_dimension_baseline(obj: FBSDimensionBaselineData) -> Optional[DS_DimensionBaselineData]: - if obj is None: - return None - return DS_DimensionBaselineData( - base_dimension_id=_s(obj.BaseDimensionId()) - ) - -def parse_fbs_dimension_continue(obj: FBSDimensionContinueData) -> Optional[DS_DimensionContinueData]: - if obj is None: - return None - return DS_DimensionContinueData( - continue_from_dimension_id=_s(obj.ContinueFromDimensionId()) - ) - -def parse_fbs_datum_reference(obj: FBSDatumReference) -> DS_DatumReference: - return DS_DatumReference( - letters=_s_req(obj.Letters()), - modifier=obj.Modifier() if hasattr(obj, "Modifier") else None, - ) - -def parse_fbs_tolerance_clause(obj: FBSToleranceClause) -> DS_ToleranceClause: - feature_mods = _read_int_vector(obj, "FeatureModifiersLength", "FeatureModifiers") - return DS_ToleranceClause( - value=_s_req(obj.Value()), - feature_modifiers=feature_mods, - zone_type=obj.ZoneType() if hasattr(obj, "ZoneType") else None, - material_condition=obj.MaterialCondition() if hasattr(obj, "MaterialCondition") else None, - ) - -def parse_fbs_fcf_segment(obj: FBSFeatureControlFrameSegment) -> DS_FeatureControlFrameSegment: - tol = parse_fbs_tolerance_clause(obj.Tolerance()) - datums = [parse_fbs_datum_reference(obj.Datums(i)) for i in range(obj.DatumsLength())] - return DS_FeatureControlFrameSegment( - tolerance=tol, - datums=datums, - symbol=obj.Symbol() if hasattr(obj, "Symbol") else None, - ) - -def parse_fbs_fcf_between_modifier(obj: FBSFCFBetweenModifier) -> Optional[DS_FCFBetweenModifier]: - if obj is None: - return None - return DS_FCFBetweenModifier( - start=_s_req(obj.Start()), - end=_s_req(obj.End()), - ) - -def parse_fbs_fcf_projected_zone_modifier(obj: FBSFCFProjectedZoneModifier) -> Optional[DS_FCFProjectedZoneModifier]: - if obj is None: - return None - return DS_FCFProjectedZoneModifier( - value=obj.Value() - ) - -def parse_fbs_fcf_frame_modifiers(obj: FBSFCFFrameModifiers) -> Optional[DS_FCFFrameModifiers]: - if obj is None: - return None - return DS_FCFFrameModifiers( - between=parse_fbs_fcf_between_modifier(obj.Between()) if obj.Between() else None, - projected_tolerance_zone=parse_fbs_fcf_projected_zone_modifier(obj.ProjectedToleranceZone()) if obj.ProjectedToleranceZone() else None, - all_around=obj.AllAround() if hasattr(obj, "AllAround") else None, - all_over=obj.AllOver() if hasattr(obj, "AllOver") else None, - continuous_feature=obj.ContinuousFeature() if hasattr(obj, "ContinuousFeature") else None, - ) - -def parse_fbs_fcf_datum_definition(obj: FBSFCFDatumDefinition) -> Optional[DS_FCFDatumDefinition]: - if obj is None: - return None - return DS_FCFDatumDefinition( - letter=_s_req(obj.Letter()), - feature_binding=parse_fbs_duc_point_binding(obj.FeatureBinding()) if obj.FeatureBinding() else None, - ) - -def parse_fbs_fcf_segment_row(obj: FBSFCFSegmentRow) -> DS_FCFSegmentRow: - segs = [parse_fbs_fcf_segment(obj.Segments(i)) for i in range(obj.SegmentsLength())] - return DS_FCFSegmentRow( - segments=segs - ) - -def parse_fbs_feature_control_frame(obj: FBSDucFeatureControlFrameElement) -> DS_DucFeatureControlFrameElement: - rows = [parse_fbs_fcf_segment_row(obj.Rows(i)) for i in range(obj.RowsLength())] - return DS_DucFeatureControlFrameElement( - base=parse_fbs_duc_element_base(obj.Base()), - style=parse_fbs_feature_control_frame_style(obj.Style()), - rows=rows, - frame_modifiers=parse_fbs_fcf_frame_modifiers(obj.FrameModifiers()) if obj.FrameModifiers() else None, - leader_element_id=_s(obj.LeaderElementId()), - datum_definition=parse_fbs_fcf_datum_definition(obj.DatumDefinition()) if obj.DatumDefinition() else None, - ) - -def parse_fbs_text_column(obj: FBSTextColumn) -> DS_TextColumn: - return DS_TextColumn( - width=obj.Width(), - gutter=obj.Gutter(), - ) - -def parse_fbs_column_layout(obj: FBSColumnLayout) -> DS_ColumnLayout: - defs = [parse_fbs_text_column(obj.Definitions(i)) for i in range(obj.DefinitionsLength())] - return DS_ColumnLayout( - definitions=defs, - auto_height=obj.AutoHeight(), - type=obj.Type() if hasattr(obj, "Type") else None, - ) - -def parse_fbs_doc(obj: FBSDucDocElement) -> DS_DucDocElement: - dynamics = [parse_fbs_text_dynamic_part(obj.Dynamic(i)) for i in range(obj.DynamicLength())] - grid_config = obj.GridConfig() - if grid_config: - parsed_grid_config = parse_fbs_document_grid_config(grid_config) - else: - parsed_grid_config = DS_DocumentGridConfig( - columns=1, - gap_x=0.0, - gap_y=0.0, - align_items=0, - first_page_alone=False, - scale=1.0, - ) - return DS_DucDocElement( - base=parse_fbs_duc_element_base(obj.Base()), - style=parse_fbs_doc_style(obj.Style()), - text=_s_req(obj.Text()), - dynamic=dynamics, - columns=parse_fbs_column_layout(obj.Columns()), - auto_resize=obj.AutoResize(), - flow_direction=obj.FlowDirection() if hasattr(obj, "FlowDirection") else None, - file_id=_s(obj.FileId()), - grid_config=parsed_grid_config, - ) - -def parse_fbs_parametric_source(obj: FBSParametricSource) -> DS_ParametricSource: - return DS_ParametricSource( - type=obj.Type() if hasattr(obj, "Type") else None, - code=_s(obj.Code()), - file_id=_s(obj.FileId()), - ) - -def parse_fbs_parametric(obj: FBSDucParametricElement) -> DS_DucParametricElement: - return DS_DucParametricElement( - base=parse_fbs_duc_element_base(obj.Base()), - source=parse_fbs_parametric_source(obj.Source()) - ) - -def parse_fbs_model(obj: FBSDucModelElement) -> DS_DucModelElement: - file_ids = [obj.FileIds(i) for i in range(obj.FileIdsLength())] if obj.FileIdsLength() > 0 else [] - return DS_DucModelElement( - base=parse_fbs_duc_element_base(obj.Base()), - source=_s_req(obj.Source()), - svg_path=_s(obj.SvgPath()), - file_ids=file_ids, - ) - - -# ============================================================================= -# Element union and wrapper -# ============================================================================= - -def parse_duc_element_wrapper(obj: FBSElementWrapper) -> DS_ElementWrapper: - typ = obj.ElementType() - tbl = Table(obj.Element().Bytes, obj.Element().Pos) - - if typ == FBS_Element.Element.DucRectangleElement: - x = FBSDucRectangleElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_rectangle(x) - elif typ == FBS_Element.Element.DucPolygonElement: - x = FBSDucPolygonElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_polygon(x) - elif typ == FBS_Element.Element.DucEllipseElement: - x = FBSDucEllipseElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_ellipse(x) - elif typ == FBS_Element.Element.DucEmbeddableElement: - x = FBSDucEmbeddableElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_embeddable(x) - elif typ == FBS_Element.Element.DucPdfElement: - x = FBSDucPdfElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_pdf(x) - elif typ == FBS_Element.Element.DucMermaidElement: - x = FBSDucMermaidElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_mermaid(x) - elif typ == FBS_Element.Element.DucTableElement: - x = FBSDucTableElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_table(x) - elif typ == FBS_Element.Element.DucImageElement: - x = FBSDucImageElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_image(x) - elif typ == FBS_Element.Element.DucTextElement: - x = FBSDucTextElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_text(x) - elif typ == FBS_Element.Element.DucLinearElement: - x = FBSDucLinearElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_linear(x) - elif typ == FBS_Element.Element.DucArrowElement: - x = FBSDucArrowElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_arrow(x) - elif typ == FBS_Element.Element.DucFreeDrawElement: - x = FBSDucFreeDrawElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_free_draw(x) - elif typ == FBS_Element.Element.DucBlockInstanceElement: - x = FBSDucBlockInstanceElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_block_instance(x) - elif typ == FBS_Element.Element.DucFrameElement: - x = FBSDucFrameElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_frame(x) - elif typ == FBS_Element.Element.DucPlotElement: - x = FBSDucPlotElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_plot(x) - elif typ == FBS_Element.Element.DucViewportElement: - x = FBSDucViewportElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_viewport(x) - elif typ == FBS_Element.Element.DucXRayElement: - x = FBSDucXRayElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_xray(x) - elif typ == FBS_Element.Element.DucLeaderElement: - x = FBSDucLeaderElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_leader(x) - elif typ == FBS_Element.Element.DucDimensionElement: - x = FBSDucDimensionElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_dimension(x) - elif typ == FBS_Element.Element.DucFeatureControlFrameElement: - x = FBSDucFeatureControlFrameElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_feature_control_frame(x) - elif typ == FBS_Element.Element.DucDocElement: - x = FBSDucDocElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_doc(x) - elif typ == FBS_Element.Element.DucParametricElement: - x = FBSDucParametricElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_parametric(x) - elif typ == FBS_Element.Element.DucModelElement: - x = FBSDucModelElement(); x.Init(tbl.Bytes, tbl.Pos); el = parse_fbs_model(x) - else: - raise ValueError(f"Unknown Element union type: {typ}") - - return DS_ElementWrapper(element=el) - -def parse_fbs_dimension(obj: FBSDucDimensionElement) -> DS_DucDimensionElement: - return DS_DucDimensionElement( - base=parse_fbs_duc_element_base(obj.Base()), - style=parse_fbs_dimension_style(obj.Style()), - definition_points=parse_fbs_dimension_definition_points(obj.DefinitionPoints()), - oblique_angle=obj.ObliqueAngle(), - dimension_type=obj.DimensionType() if hasattr(obj, "DimensionType") else None, - ordinate_axis=obj.OrdinateAxis() if hasattr(obj, "OrdinateAxis") else None, - bindings=parse_fbs_dimension_bindings(obj.Bindings()) if obj.Bindings() else None, - text_override=_s(obj.TextOverride()), - text_position=_geopoint_struct_to_ds(obj.TextPosition()), - tolerance_override=parse_fbs_dimension_tolerance_style(obj.ToleranceOverride()) if obj.ToleranceOverride() else None, - baseline_data=parse_fbs_dimension_baseline(obj.BaselineData()) if obj.BaselineData() else None, - continue_data=parse_fbs_dimension_continue(obj.ContinueData()) if obj.ContinueData() else None, - ) - -# ============================ -# Part 2/6 continues here -# ============================ - -# ------------------------------ -# Blocks, groups, regions, layers -# ------------------------------ - -def parse_fbs_duc_block_attribute_definition(obj: FBSDucBlockAttributeDefinition) -> DS_DucBlockAttributeDefinition: - return DS_DucBlockAttributeDefinition( - tag=_s_req(obj.Tag()), - default_value=_s_req(obj.DefaultValue()), - is_constant=obj.IsConstant(), - prompt=_s(obj.Prompt()), - ) - -def parse_fbs_duc_block_attribute_definition_entry(obj: FBSDucBlockAttributeDefinitionEntry) -> DS_DucBlockAttributeDefinitionEntry: - return DS_DucBlockAttributeDefinitionEntry( - key=_s_req(obj.Key()), - value=parse_fbs_duc_block_attribute_definition(obj.Value()), - ) - -def parse_fbs_duc_block_metadata(obj: FBSDucBlockMetadata) -> DS_DucBlockMetadata: - # localization is now binary compressed JSON - localization = None - if hasattr(obj, "Localization") and not obj.LocalizationIsNone(): - localization_bytes = _read_bytes_from_numpy(obj, "LocalizationLength", "LocalizationAsNumpy", "Localization") - localization = _binary_json_or_none(localization_bytes) - - return DS_DucBlockMetadata( - source=_s_req(obj.Source()), - usage_count=obj.UsageCount(), - created_at=obj.CreatedAt(), - updated_at=obj.UpdatedAt(), - localization=localization, - ) - -def parse_fbs_duc_block(obj: FBSDucBlock) -> DS_DucBlock: - attrs = [parse_fbs_duc_block_attribute_definition_entry(obj.AttributeDefinitions(i)) for i in range(obj.AttributeDefinitionsLength())] - - metadata = None - if hasattr(obj, 'Metadata') and obj.Metadata(): - metadata = parse_fbs_duc_block_metadata(obj.Metadata()) - - thumbnail = None - if hasattr(obj, 'Thumbnail') and obj.ThumbnailLength() > 0: - thumbnail = obj.ThumbnailAsBytes() - - return DS_DucBlock( - id=_s_req(obj.Id()), - label=_s_req(obj.Label()), - version=obj.Version(), - attribute_definitions=attrs, - description=_s(obj.Description()), - metadata=metadata, - thumbnail=thumbnail, - ) - -def parse_fbs_duc_block_instance(el: FBSDucBlockInstance) -> DS_DucBlockInstance: - if not el: - return None - - elem_overrides_len = el.ElementOverridesLength() - elem_overrides = [] - for i in range(elem_overrides_len): - entry = el.ElementOverrides(i) - elem_overrides.append(parse_fbs_string_value_entry(entry)) - - attr_values_len = el.AttributeValuesLength() - attr_values = [] - for i in range(attr_values_len): - entry = el.AttributeValues(i) - attr_values.append(parse_fbs_string_value_entry(entry)) - - duplication_array = parse_fbs_block_duplication_array(el.DuplicationArray()) if el.DuplicationArray() else None - - return DS_DucBlockInstance( - id=el.Id().decode('utf-8') if el.Id() else "", - block_id=el.BlockId().decode('utf-8') if el.BlockId() else "", - element_overrides=elem_overrides, - attribute_values=attr_values, - duplication_array=duplication_array, - version=el.Version() - ) - -def parse_fbs_duc_block_collection_entry(obj: FBSDucBlockCollectionEntry) -> "DS_DucBlockCollectionEntry": - return DS_DucBlockCollectionEntry( - id=_s_req(obj.Id()), - is_collection=obj.IsCollection(), - ) - -def parse_fbs_duc_block_collection(obj: FBSDucBlockCollection) -> DS_DucBlockCollection: - children = [parse_fbs_duc_block_collection_entry(obj.Children(i)) for i in range(obj.ChildrenLength())] - - metadata = None - if hasattr(obj, 'Metadata') and obj.Metadata(): - metadata = parse_fbs_duc_block_metadata(obj.Metadata()) - - thumbnail = None - if hasattr(obj, 'Thumbnail') and obj.ThumbnailLength() > 0: - thumbnail = obj.ThumbnailAsBytes() - - return DS_DucBlockCollection( - id=_s_req(obj.Id()), - label=_s_req(obj.Label()), - children=children, - metadata=metadata, - thumbnail=thumbnail, - ) - -def parse_fbs_duc_group(obj: FBSDucGroup) -> DS_DucGroup: - return DS_DucGroup( - id=_s_req(obj.Id()), - stack_base=parse_fbs_duc_stack_base(obj.StackBase()) - ) - -def parse_fbs_duc_region(obj: FBSDucRegion) -> DS_DucRegion: - return DS_DucRegion( - id=_s_req(obj.Id()), - stack_base=parse_fbs_duc_stack_base(obj.StackBase()), - boolean_operation=obj.BooleanOperation() if hasattr(obj, "BooleanOperation") else None, - ) - -def parse_fbs_duc_layer_overrides(obj: FBSDucLayerOverrides) -> DS_DucLayerOverrides: - return DS_DucLayerOverrides( - stroke=parse_fbs_element_stroke(obj.Stroke()), - background=parse_fbs_element_background(obj.Background()), - ) - -def parse_fbs_duc_layer(obj: FBSDucLayer) -> DS_DucLayer: - return DS_DucLayer( - id=_s_req(obj.Id()), - stack_base=parse_fbs_duc_stack_base(obj.StackBase()), - readonly=obj.Readonly(), - overrides=parse_fbs_duc_layer_overrides(obj.Overrides()) - ) - -# ------------------------------ -# Standards: units and overrides -# ------------------------------ - -def parse_fbs_unit_system_base(obj: FBS_UnitSystemBase) -> DS_UnitSystemBase: - return DS_UnitSystemBase( - precision=obj.Precision(), - suppress_leading_zeros=obj.SuppressLeadingZeros(), - suppress_trailing_zeros=obj.SuppressTrailingZeros(), - system=obj.System() if hasattr(obj, "System") else None, - ) - -def parse_fbs_linear_unit_system(obj: FBSLinearUnitSystem) -> Optional[DS_LinearUnitSystem]: - if obj is None: - return None - base = obj.Base() - base_ds = parse_fbs_unit_system_base(base) - return DS_LinearUnitSystem( - precision=base_ds.precision, - suppress_leading_zeros=base_ds.suppress_leading_zeros, - suppress_trailing_zeros=base_ds.suppress_trailing_zeros, - system=base_ds.system, - suppress_zero_feet=obj.SuppressZeroFeet(), - suppress_zero_inches=obj.SuppressZeroInches(), - format=obj.Format() if hasattr(obj, "Format") else None, - decimal_separator=obj.DecimalSeparator() if hasattr(obj, "DecimalSeparator") else None, - ) - -def parse_fbs_angular_unit_system(obj: FBSAngularUnitSystem) -> Optional[DS_AngularUnitSystem]: - if obj is None: - return None - base = obj.Base() - base_ds = parse_fbs_unit_system_base(base) - return DS_AngularUnitSystem( - precision=base_ds.precision, - suppress_leading_zeros=base_ds.suppress_leading_zeros, - suppress_trailing_zeros=base_ds.suppress_trailing_zeros, - system=base_ds.system, - format=obj.Format() if hasattr(obj, "Format") else None, - ) - -def parse_fbs_alternate_units(obj: FBSAlternateUnits) -> Optional[DS_AlternateUnits]: - if obj is None: - return None - base = obj.Base() - base_ds = parse_fbs_unit_system_base(base) - return DS_AlternateUnits( - precision=base_ds.precision, - suppress_leading_zeros=base_ds.suppress_leading_zeros, - suppress_trailing_zeros=base_ds.suppress_trailing_zeros, - system=base_ds.system, - is_visible=obj.IsVisible(), - multiplier=obj.Multiplier(), - format=obj.Format() if hasattr(obj, "Format") else None, - ) - -def parse_fbs_primary_units(obj: FBSPrimaryUnits) -> DS_PrimaryUnits: - return DS_PrimaryUnits( - linear=parse_fbs_linear_unit_system(obj.Linear()) if obj.Linear() else None, - angular=parse_fbs_angular_unit_system(obj.Angular()) if obj.Angular() else None, - ) - -def parse_fbs_standard_units(obj: FBSStandardUnits) -> Optional[DS_StandardUnits]: - if obj is None: - return None - return DS_StandardUnits( - primary_units=parse_fbs_primary_units(obj.PrimaryUnits()) if obj.PrimaryUnits() else DS_PrimaryUnits(None, None), - alternate_units=parse_fbs_alternate_units(obj.AlternateUnits()) if obj.AlternateUnits() else None, - ) - -def parse_fbs_unit_precision(obj: FBSUnitPrecision) -> Optional[DS_UnitPrecision]: - if obj is None: - return None - return DS_UnitPrecision( - linear=obj.Linear(), - angular=obj.Angular(), - area=obj.Area(), - volume=obj.Volume(), - ) - -def parse_fbs_standard_overrides(obj: FBSStandardOverrides) -> Optional[DS_StandardOverrides]: - if obj is None: - return None - active_grid = _read_str_vector(obj, "ActiveGridSettingsIdLength", "ActiveGridSettingsId") - return DS_StandardOverrides( - unit_precision=parse_fbs_unit_precision(obj.UnitPrecision()) if obj.UnitPrecision() else None, - main_scope=_s(obj.MainScope()), - elements_stroke_width_override=obj.ElementsStrokeWidthOverride() if hasattr(obj, "ElementsStrokeWidthOverride") else None, - common_style_id=_s(obj.CommonStyleId()), - stack_like_style_id=_s(obj.StackLikeStyleId()), - text_style_id=_s(obj.TextStyleId()), - dimension_style_id=_s(obj.DimensionStyleId()), - leader_style_id=_s(obj.LeaderStyleId()), - feature_control_frame_style_id=_s(obj.FeatureControlFrameStyleId()), - table_style_id=_s(obj.TableStyleId()), - doc_style_id=_s(obj.DocStyleId()), - viewport_style_id=_s(obj.ViewportStyleId()), - plot_style_id=_s(obj.PlotStyleId()), - hatch_style_id=_s(obj.HatchStyleId()), - active_grid_settings_id=active_grid if active_grid else None, - active_snap_settings_id=_s(obj.ActiveSnapSettingsId()), - dash_line_override=_s(obj.DashLineOverride()), - ) - -# ------------------------------ -# Standards: styles -# ------------------------------ - -def parse_fbs_common_style(obj: FBSDucCommonStyle) -> DS_DucCommonStyle: - return DS_DucCommonStyle( - background=parse_fbs_element_background(obj.Background()), - stroke=parse_fbs_element_stroke(obj.Stroke()), - ) - -def parse_fbs_identified_common_style(obj: FBSIdentifiedCommonStyle) -> DS_IdentifiedCommonStyle: - return DS_IdentifiedCommonStyle( - id=parse_fbs_identifier(obj.Id()), - style=parse_fbs_common_style(obj.Style()), - ) - -def parse_fbs_identified_stack_like_style(obj: FBSIdentifiedStackLikeStyle) -> DS_IdentifiedStackLikeStyle: - return DS_IdentifiedStackLikeStyle( - id=parse_fbs_identifier(obj.Id()), - style=parse_fbs_duc_stack_like_styles(obj.Style()), - ) - -def parse_fbs_identified_text_style(obj: FBSIdentifiedTextStyle) -> DS_IdentifiedTextStyle: - return DS_IdentifiedTextStyle( - id=parse_fbs_identifier(obj.Id()), - style=parse_fbs_duc_text_style(obj.Style()), - ) - -def parse_fbs_identified_dimension_style(obj: FBSIdentifiedDimensionStyle) -> DS_IdentifiedDimensionStyle: - return DS_IdentifiedDimensionStyle( - id=parse_fbs_identifier(obj.Id()), - style=parse_fbs_dimension_style(obj.Style()), - ) - -def parse_fbs_identified_leader_style(obj: FBSIdentifiedLeaderStyle) -> DS_IdentifiedLeaderStyle: - return DS_IdentifiedLeaderStyle( - id=parse_fbs_identifier(obj.Id()), - style=parse_fbs_leader_style(obj.Style()), - ) - -def parse_fbs_identified_fcf_style(obj: FBSIdentifiedFCFStyle) -> DS_IdentifiedFCFStyle: - return DS_IdentifiedFCFStyle( - id=parse_fbs_identifier(obj.Id()), - style=parse_fbs_feature_control_frame_style(obj.Style()), - ) - -def parse_fbs_identified_table_style(obj: FBSIdentifiedTableStyle) -> DS_IdentifiedTableStyle: - return DS_IdentifiedTableStyle( - id=parse_fbs_identifier(obj.Id()), - style=parse_fbs_table_style(obj.Style()), - ) - -def parse_fbs_identified_doc_style(obj: FBSIdentifiedDocStyle) -> DS_IdentifiedDocStyle: - return DS_IdentifiedDocStyle( - id=parse_fbs_identifier(obj.Id()), - style=parse_fbs_doc_style(obj.Style()), - ) - -def parse_fbs_identified_viewport_style(obj: FBSIdentifiedViewportStyle) -> DS_IdentifiedViewportStyle: - return DS_IdentifiedViewportStyle( - id=parse_fbs_identifier(obj.Id()), - style=parse_fbs_viewport_style(obj.Style()), - ) - -def parse_fbs_identified_hatch_style(obj: FBSIdentifiedHatchStyle) -> DS_IdentifiedHatchStyle: - return DS_IdentifiedHatchStyle( - id=parse_fbs_identifier(obj.Id()), - style=parse_fbs_duc_hatch_style(obj.Style()), - ) - -def parse_fbs_identified_xray_style(obj: FBSIdentifiedXRayStyle) -> DS_IdentifiedXRayStyle: - return DS_IdentifiedXRayStyle( - id=parse_fbs_identifier(obj.Id()), - style=parse_fbs_xray_style(obj.Style()), - ) - -def parse_fbs_standard_styles(obj: FBSStandardStyles) -> Optional[DS_StandardStyles]: - if obj is None: - return None - common = [parse_fbs_identified_common_style(obj.CommonStyles(i)) for i in range(obj.CommonStylesLength())] - stack_like = [parse_fbs_identified_stack_like_style(obj.StackLikeStyles(i)) for i in range(obj.StackLikeStylesLength())] - text = [parse_fbs_identified_text_style(obj.TextStyles(i)) for i in range(obj.TextStylesLength())] - dim = [parse_fbs_identified_dimension_style(obj.DimensionStyles(i)) for i in range(obj.DimensionStylesLength())] - leader = [parse_fbs_identified_leader_style(obj.LeaderStyles(i)) for i in range(obj.LeaderStylesLength())] - fcf = [parse_fbs_identified_fcf_style(obj.FeatureControlFrameStyles(i)) for i in range(obj.FeatureControlFrameStylesLength())] - table = [parse_fbs_identified_table_style(obj.TableStyles(i)) for i in range(obj.TableStylesLength())] - doc = [parse_fbs_identified_doc_style(obj.DocStyles(i)) for i in range(obj.DocStylesLength())] - viewport = [parse_fbs_identified_viewport_style(obj.ViewportStyles(i)) for i in range(obj.ViewportStylesLength())] - hatch = [parse_fbs_identified_hatch_style(obj.HatchStyles(i)) for i in range(obj.HatchStylesLength())] - xray = [parse_fbs_identified_xray_style(obj.XrayStyles(i)) for i in range(obj.XrayStylesLength())] - return DS_StandardStyles( - common_styles=common, - stack_like_styles=stack_like, - text_styles=text, - dimension_styles=dim, - leader_styles=leader, - feature_control_frame_styles=fcf, - table_styles=table, - doc_styles=doc, - viewport_styles=viewport, - hatch_styles=hatch, - xray_styles=xray, - ) - -# ------------------------------ -# Standards: view settings -# ------------------------------ - -# bring DS_DucUcs and DS_DucView into scope -from ducpy.classes.ElementsClass import DucUcs as DS_DucUcs -from ducpy.classes.ElementsClass import DucView as DS_DucView - - -def parse_fbs_duc_ucs(obj: FBSDucUcs) -> DS_DucUcs: - origin = obj.Origin() - return DS_DucUcs( - origin=DS_GeometricPoint(x=origin.X(), y=origin.Y()) if origin else DS_GeometricPoint(0.0, 0.0), - angle=obj.Angle(), - ) - -def parse_fbs_grid_style(obj: FBSGridStyle) -> DS_GridStyle: - return DS_GridStyle( - color=_s_req(obj.Color()), - opacity=obj.Opacity(), - dash_pattern=_read_double_vector(obj, "DashPatternLength", "DashPattern"), - ) - -def parse_fbs_polar_grid_settings(obj: FBSPolarGridSettings) -> Optional[DS_PolarGridSettings]: - if obj is None: - return None - return DS_PolarGridSettings( - radial_divisions=obj.RadialDivisions(), - radial_spacing=obj.RadialSpacing(), - show_labels=obj.ShowLabels(), - ) - -def parse_fbs_isometric_grid_settings(obj: FBSIsometricGridSettings) -> Optional[DS_IsometricGridSettings]: - if obj is None: - return None - return DS_IsometricGridSettings( - left_angle=obj.LeftAngle(), - right_angle=obj.RightAngle(), - ) - -def parse_fbs_grid_settings(obj: FBSGridSettings) -> DS_GridSettings: - origin = obj.Origin() - return DS_GridSettings( - is_adaptive=obj.IsAdaptive(), - x_spacing=obj.XSpacing(), - y_spacing=obj.YSpacing(), - subdivisions=obj.Subdivisions(), - origin=DS_GeometricPoint(x=origin.X(), y=origin.Y()) if origin else DS_GeometricPoint(0.0, 0.0), - rotation=obj.Rotation(), - follow_ucs=obj.FollowUcs(), - major_style=parse_fbs_grid_style(obj.MajorStyle()), - minor_style=parse_fbs_grid_style(obj.MinorStyle()), - show_minor=obj.ShowMinor(), - min_zoom=obj.MinZoom(), - max_zoom=obj.MaxZoom(), - auto_hide=obj.AutoHide(), - enable_snapping=obj.EnableSnapping(), - readonly=obj.Readonly(), - type=obj.Type() if hasattr(obj, "Type") else None, - display_type=obj.DisplayType() if hasattr(obj, "DisplayType") else None, - polar_settings=parse_fbs_polar_grid_settings(obj.PolarSettings()) if obj.PolarSettings() else None, - isometric_settings=parse_fbs_isometric_grid_settings(obj.IsometricSettings()) if obj.IsometricSettings() else None, - ) - -def parse_fbs_snap_override(obj: FBSSnapOverride) -> DS_SnapOverride: - return DS_SnapOverride( - key=_s_req(obj.Key()), - behavior=obj.Behavior() if hasattr(obj, "Behavior") else None, - ) - -def parse_fbs_dynamic_snap_settings(obj: FBSDynamicSnapSettings) -> DS_DynamicSnapSettings: - return DS_DynamicSnapSettings( - enabled_during_drag=obj.EnabledDuringDrag(), - enabled_during_rotation=obj.EnabledDuringRotation(), - enabled_during_scale=obj.EnabledDuringScale(), - ) - -def parse_fbs_tracking_line_style(obj: FBSTrackingLineStyle) -> Optional[DS_TrackingLineStyle]: - if obj is None: - return None - return DS_TrackingLineStyle( - color=_s_req(obj.Color()), - opacity=obj.Opacity(), - dash_pattern=_read_double_vector(obj, "DashPatternLength", "DashPattern"), - ) - -def parse_fbs_polar_tracking_settings(obj: FBSPolarTrackingSettings) -> DS_PolarTrackingSettings: - return DS_PolarTrackingSettings( - enabled=obj.Enabled(), - angles=_read_double_vector(obj, "AnglesLength", "Angles"), - track_from_last_point=obj.TrackFromLastPoint(), - show_polar_coordinates=obj.ShowPolarCoordinates(), - increment_angle=obj.IncrementAngle() if hasattr(obj, "IncrementAngle") else None, - ) - -def parse_fbs_layer_snap_filters(obj: FBSLayerSnapFilters) -> Optional[DS_LayerSnapFilters]: - if obj is None: - return None - return DS_LayerSnapFilters( - include_layers=_read_str_vector(obj, "IncludeLayersLength", "IncludeLayers"), - exclude_layers=_read_str_vector(obj, "ExcludeLayersLength", "ExcludeLayers"), - ) - -def parse_fbs_snap_marker_style(obj: FBSSnapMarkerStyle) -> DS_SnapMarkerStyle: - return DS_SnapMarkerStyle( - shape=obj.Shape() if hasattr(obj, "Shape") else None, - color=_s_req(obj.Color()), - ) - -def parse_fbs_snap_marker_style_entry(obj: FBSSnapMarkerStyleEntry) -> DS_SnapMarkerStyleEntry: - return DS_SnapMarkerStyleEntry( - key=obj.Key() if hasattr(obj, "Key") else None, - value=parse_fbs_snap_marker_style(obj.Value()) - ) +from __future__ import annotations -def parse_fbs_snap_marker_settings(obj: FBSSnapMarkerSettings) -> DS_SnapMarkerSettings: - styles = [parse_fbs_snap_marker_style_entry(obj.Styles(i)) for i in range(obj.StylesLength())] - return DS_SnapMarkerSettings( - enabled=obj.Enabled(), - size=obj.Size(), - styles=styles, - duration=obj.Duration() if hasattr(obj, "Duration") else None, - ) +import logging +from typing import Any, BinaryIO, Dict, List, Optional, Union -def parse_fbs_snap_settings(obj: FBSSnapSettings) -> DS_SnapSettings: - active_modes = _read_int_vector(obj, "ActiveObjectSnapModesLength", "ActiveObjectSnapModes") - snap_priority = _read_int_vector(obj, "SnapPriorityLength", "SnapPriority") - overrides = [parse_fbs_snap_override(obj.TemporaryOverrides(i)) for i in range(obj.TemporaryOverridesLength())] - el_types = _read_str_vector(obj, "ElementTypeFiltersLength", "ElementTypeFilters") - return DS_SnapSettings( - readonly=obj.Readonly(), - twist_angle=obj.TwistAngle(), - snap_tolerance=obj.SnapTolerance(), - object_snap_aperture=obj.ObjectSnapAperture(), - is_ortho_mode_on=obj.IsOrthoModeOn(), - polar_tracking=parse_fbs_polar_tracking_settings(obj.PolarTracking()), - is_object_snap_on=obj.IsObjectSnapOn(), - active_object_snap_modes=active_modes, - snap_priority=snap_priority, - show_tracking_lines=obj.ShowTrackingLines(), - dynamic_snap=parse_fbs_dynamic_snap_settings(obj.DynamicSnap()), - snap_markers=parse_fbs_snap_marker_settings(obj.SnapMarkers()), - construction_snap_enabled=obj.ConstructionSnapEnabled(), - tracking_line_style=parse_fbs_tracking_line_style(obj.TrackingLineStyle()) if obj.TrackingLineStyle() else None, - temporary_overrides=overrides if overrides else None, - incremental_distance=obj.IncrementalDistance() if hasattr(obj, "IncrementalDistance") else None, - magnetic_strength=obj.MagneticStrength() if hasattr(obj, "MagneticStrength") else None, - layer_snap_filters=parse_fbs_layer_snap_filters(obj.LayerSnapFilters()) if obj.LayerSnapFilters() else None, - element_type_filters=el_types if el_types else None, - snap_mode=obj.SnapMode() if hasattr(obj, "SnapMode") else None, - snap_to_grid_intersections=obj.SnapToGridIntersections() if hasattr(obj, "SnapToGridIntersections") else None, - ) +import ducpy_native +from ducpy.utils.convert import deep_camel_to_snake -def parse_fbs_identified_grid_settings(obj: FBSIdentifiedGridSettings) -> DS_IdentifiedGridSettings: - return DS_IdentifiedGridSettings( - id=parse_fbs_identifier(obj.Id()), - settings=parse_fbs_grid_settings(obj.Settings()) - ) +logger = logging.getLogger(__name__) -def parse_fbs_identified_snap_settings(obj: FBSIdentifiedSnapSettings) -> DS_IdentifiedSnapSettings: - return DS_IdentifiedSnapSettings( - id=parse_fbs_identifier(obj.Id()), - settings=parse_fbs_snap_settings(obj.Settings()) - ) -def parse_fbs_identified_ucs(obj: FBSIdentifiedUcs) -> DS_IdentifiedUcs: - return DS_IdentifiedUcs( - id=parse_fbs_identifier(obj.Id()), - ucs=parse_fbs_duc_ucs(obj.Ucs()) - ) +class DucData(dict): + """Dict subclass allowing attribute-style access (``data.elements``).""" -def parse_fbs_identified_view(obj: FBSIdentifiedView) -> DS_IdentifiedView: - return DS_IdentifiedView( - id=parse_fbs_identifier(obj.Id()), - view=parse_fbs_view(obj.View()) - ) + def __getattr__(self, key: str) -> Any: + try: + return self[key] + except KeyError: + raise AttributeError(key) -def parse_fbs_standard_view_settings(obj: FBSStandardViewSettings) -> Optional[DS_StandardViewSettings]: - if obj is None: - return None - views = [parse_fbs_identified_view(obj.Views(i)) for i in range(obj.ViewsLength())] - ucs = [parse_fbs_identified_ucs(obj.Ucs(i)) for i in range(obj.UcsLength())] - grids = [parse_fbs_identified_grid_settings(obj.GridSettings(i)) for i in range(obj.GridSettingsLength())] - snaps = [parse_fbs_identified_snap_settings(obj.SnapSettings(i)) for i in range(obj.SnapSettingsLength())] - return DS_StandardViewSettings( - views=views, - ucs=ucs, - grid_settings=grids, - snap_settings=snaps, - ) + def __setattr__(self, key: str, value: Any) -> None: + self[key] = value -# ------------------------------ -# Standards: validation -# ------------------------------ + def __delattr__(self, key: str) -> None: + try: + del self[key] + except KeyError: + raise AttributeError(key) -def parse_fbs_dimension_validation_rules(obj: FBSDimensionValidationRules) -> Optional[DS_DimensionValidationRules]: - if obj is None: - return None - return DS_DimensionValidationRules( - min_text_height=obj.MinTextHeight(), - max_text_height=obj.MaxTextHeight(), - allowed_precisions=_read_int_vector(obj, "AllowedPrecisionsLength", "AllowedPrecisions"), - ) -def parse_fbs_layer_validation_rules(obj: FBSLayerValidationRules) -> Optional[DS_LayerValidationRules]: - if obj is None: - return None - return DS_LayerValidationRules( - prohibited_layer_names=_read_str_vector(obj, "ProhibitedLayerNamesLength", "ProhibitedLayerNames") - ) +def _wrap(obj: Any) -> Any: + """Recursively wrap dicts as DucData for attribute access.""" + if isinstance(obj, dict): + return DucData({k: _wrap(v) for k, v in obj.items()}) + if isinstance(obj, list): + return [_wrap(item) for item in obj] + return obj -def parse_fbs_standard_validation(obj: FBSStandardValidation) -> Optional[DS_StandardValidation]: - if obj is None: - return None - return DS_StandardValidation( - dimension_rules=parse_fbs_dimension_validation_rules(obj.DimensionRules()) if obj.DimensionRules() else None, - layer_rules=parse_fbs_layer_validation_rules(obj.LayerRules()) if obj.LayerRules() else None, - ) -# ------------------------------ -# Standard (table) -# ------------------------------ +def _read_bytes(source: Union[bytes, bytearray, BinaryIO, str]) -> bytes: + """Accept bytes, a file-like object, or a file path and return raw bytes.""" + if isinstance(source, (bytes, bytearray)): + return bytes(source) + if isinstance(source, str): + with open(source, "rb") as f: + return f.read() + return source.read() -def parse_fbs_standard(obj: FBSStandard) -> DS_Standard: - return DS_Standard( - identifier=parse_fbs_identifier(obj.Identifier()), - version=_s_req(obj.Version()), - readonly=obj.Readonly(), - overrides=parse_fbs_standard_overrides(obj.Overrides()) if obj.Overrides() else None, - styles=parse_fbs_standard_styles(obj.Styles()) if obj.Styles() else None, - view_settings=parse_fbs_standard_view_settings(obj.ViewSettings()) if obj.ViewSettings() else None, - units=parse_fbs_standard_units(obj.Units()) if obj.Units() else None, - validation=parse_fbs_standard_validation(obj.Validation()) if obj.Validation() else None, - ) - -# ============================ -# Part 3/6 continues here -# ============================ -# ----------------------------------------------------------------------------- -# Global/Local State -# ----------------------------------------------------------------------------- +def parse_duc(source: Union[bytes, bytearray, BinaryIO, str]) -> DucData: + """Parse a ``.duc`` file into a :class:`DucData` dict. -def parse_fbs_duc_global_state(obj) -> Optional[DS_DucGlobalState]: - if obj is None: - return None - # Display precision (linear, angular) - dp = DS_DisplayPrecision( - linear=obj.DisplayPrecisionLinear() if hasattr(obj, "DisplayPrecisionLinear") else 0, - angular=obj.DisplayPrecisionAngular() if hasattr(obj, "DisplayPrecisionAngular") else 0, - ) - return DS_DucGlobalState( - view_background_color=_s_req(obj.ViewBackgroundColor()), - main_scope=_s_req(obj.MainScope()), - dash_spacing_scale=obj.DashSpacingScale(), - is_dash_spacing_affected_by_viewport_scale=obj.IsDashSpacingAffectedByViewportScale(), - scope_exponent_threshold=obj.ScopeExponentThreshold(), - dimensions_associative_by_default=obj.DimensionsAssociativeByDefault(), - use_annotative_scaling=obj.UseAnnotativeScaling(), - display_precision=dp, - name=_s(obj.Name()), - pruning_level=obj.PruningLevel() if hasattr(obj, "PruningLevel") else PRUNING_LEVEL.BALANCED, - ) + Parameters + ---------- + source : bytes | file | str + Raw bytes, an open binary file, or a path to a ``.duc`` file. -def parse_fbs_duc_local_state(obj) -> Optional[DS_DucLocalState]: - if obj is None: - return None - active_grid = _read_str_vector(obj, "ActiveGridSettingsLength", "ActiveGridSettings") - return DS_DucLocalState( - scope=_s_req(obj.Scope()), - active_standard_id=_s_req(obj.ActiveStandardId()), - scroll_x=obj.ScrollX(), - scroll_y=obj.ScrollY(), - zoom=obj.Zoom(), - is_binding_enabled=obj.IsBindingEnabled(), - pen_mode=obj.PenMode(), - view_mode_enabled=obj.ViewModeEnabled(), - objects_snap_mode_enabled=obj.ObjectsSnapModeEnabled(), - grid_mode_enabled=obj.GridModeEnabled(), - outline_mode_enabled=obj.OutlineModeEnabled(), - active_grid_settings=active_grid if active_grid else None, - active_snap_settings=_s(obj.ActiveSnapSettings()), - current_item_stroke=parse_fbs_element_stroke(obj.CurrentItemStroke()) if obj.CurrentItemStroke() else None, - current_item_background=parse_fbs_element_background(obj.CurrentItemBackground()) if obj.CurrentItemBackground() else None, - current_item_opacity=obj.CurrentItemOpacity() if hasattr(obj, "CurrentItemOpacity") else None, - current_item_font_family=_s(obj.CurrentItemFontFamily()), - current_item_font_size=obj.CurrentItemFontSize() if hasattr(obj, "CurrentItemFontSize") else None, - current_item_text_align=obj.CurrentItemTextAlign() if hasattr(obj, "CurrentItemTextAlign") else None, - current_item_roundness=obj.CurrentItemRoundness() if hasattr(obj, "CurrentItemRoundness") else None, - current_item_start_line_head=parse_fbs_duc_head(obj.CurrentItemStartLineHead()) if obj.CurrentItemStartLineHead() else None, - current_item_end_line_head=parse_fbs_duc_head(obj.CurrentItemEndLineHead()) if obj.CurrentItemEndLineHead() else None, - manual_save_mode=obj.ManualSaveMode() if hasattr(obj, "ManualSaveMode") else None, - ) - -# ----------------------------------------------------------------------------- -# External Files -# ----------------------------------------------------------------------------- - -def parse_fbs_duc_external_file_data(obj: FBSDucExternalFileData) -> DS_DucExternalFileData: - data_bytes = _read_bytes_from_numpy(obj, "DataLength", "DataAsNumpy", "Data") - return DS_DucExternalFileData( - mime_type=_s_req(obj.MimeType()), - id=_s_req(obj.Id()), - data=data_bytes, - created=obj.Created(), - last_retrieved=obj.LastRetrieved() if hasattr(obj, "LastRetrieved") else None, - ) - -def parse_fbs_duc_external_file_entry(obj: FBSDucExternalFileEntry) -> DS_DucExternalFileEntry: - return DS_DucExternalFileEntry( - key=_s_req(obj.Key()), - value=parse_fbs_duc_external_file_data(obj.Value()), - ) - -# ----------------------------------------------------------------------------- -# Version graph -# ----------------------------------------------------------------------------- - -def _parse_version_base_kwargs(obj: FBSVersionBase) -> Dict[str, Any]: - return dict( - id=_s_req(obj.Id()), - parent_id=_s(obj.ParentId()), - timestamp=obj.Timestamp(), - description=_s(obj.Description()), - is_manual_save=obj.IsManualSave(), - user_id=_s(obj.UserId()), - ) + Returns + ------- + DucData + Attribute-accessible dict matching the ExportedDataState schema with + snake_case keys. + """ + buf = _read_bytes(source) + raw = ducpy_native.parse_duc(buf) + return _wrap(deep_camel_to_snake(raw)) -def parse_fbs_checkpoint(obj: FBSCheckpoint) -> DS_Checkpoint: - base = obj.Base() - base_kwargs = _parse_version_base_kwargs(base) - data_bytes = _read_bytes_from_numpy(obj, "DataLength", "DataAsNumpy", "Data") - return DS_Checkpoint( - type="checkpoint", - data=data_bytes, - size_bytes=obj.SizeBytes(), - **base_kwargs, - ) -def parse_fbs_json_patch_operation(obj: FBSJSONPatchOperation) -> DS_JSONPatchOperation: - # Value stored as serialized JSON string in schema - raw = _s(obj.Value()) or "" - try: - value: Any = json.loads(raw) - except Exception: - value = raw - return DS_JSONPatchOperation( - op=_s_req(obj.Op()), - path=_s_req(obj.Path()), - from_path=_s(obj.From()), - value=value, - ) +def parse_duc_lazy(source: Union[bytes, bytearray, BinaryIO, str]) -> DucData: + """Parse a ``.duc`` file lazily (external file data blobs are omitted). -def parse_fbs_delta(obj: FBSDelta) -> DS_Delta: - base = obj.Base() - base_kwargs = _parse_version_base_kwargs(base) - # patch is now binary compressed JSON data - patch_bytes = _read_bytes_from_numpy(obj, "PatchLength", "PatchAsNumpy", "Patch") - patch = _binary_json_or_none(patch_bytes) or [] - return DS_Delta( - type="delta", - patch=patch, - **base_kwargs, - ) + Use :func:`get_external_file` or :func:`list_external_files` to retrieve + external file data on demand. + """ + buf = _read_bytes(source) + raw = ducpy_native.parse_duc_lazy(buf) + return _wrap(deep_camel_to_snake(raw)) -def parse_fbs_version_graph_metadata(obj: FBSVersionGraphMetadata) -> Optional[DS_VersionGraphMetadata]: - if obj is None: - return None - return DS_VersionGraphMetadata( - last_pruned=obj.LastPruned(), - total_size=obj.TotalSize(), - ) -def parse_fbs_version_graph(obj: FBSVersionGraph) -> Optional[DS_VersionGraph]: - if obj is None: +def get_external_file( + source: Union[bytes, bytearray, BinaryIO, str], + file_id: str, +) -> Optional[DucData]: + """Fetch a single external file entry from a ``.duc`` buffer.""" + buf = _read_bytes(source) + raw = ducpy_native.get_external_file(buf, file_id) + if raw is None: return None - checkpoints = [parse_fbs_checkpoint(obj.Checkpoints(i)) for i in range(obj.CheckpointsLength())] - deltas = [parse_fbs_delta(obj.Deltas(i)) for i in range(obj.DeltasLength())] - metadata = parse_fbs_version_graph_metadata(obj.Metadata()) or DS_VersionGraphMetadata( - last_pruned=0, total_size=0 - ) - return DS_VersionGraph( - checkpoints=checkpoints, - deltas=deltas, - metadata=metadata, - user_checkpoint_version_id=_s_req(obj.UserCheckpointVersionId()) if obj.UserCheckpointVersionId() else "", - latest_version_id=_s_req(obj.LatestVersionId()) if obj.LatestVersionId() else "", - ) - -# ----------------------------------------------------------------------------- -# Root API -# ----------------------------------------------------------------------------- - -def parse_duc(blob: IO[bytes]) -> DS_ExportedDataState: - buffer = blob.read() - data = FBSExportedDataState.GetRootAsExportedDataState(buffer, 0) - - # Top-level collections - elements: List[DS_ElementWrapper] = [parse_duc_element_wrapper(data.Elements(i)) for i in range(data.ElementsLength())] - blocks: List[DS_DucBlock] = [parse_fbs_duc_block(data.Blocks(i)) for i in range(data.BlocksLength())] - block_instances: List[DS_DucBlockInstance] = [parse_fbs_duc_block_instance(data.BlockInstances(i)) for i in range(data.BlockInstancesLength())] - block_collections: List[DS_DucBlockCollection] = [parse_fbs_duc_block_collection(data.BlockCollections(i)) for i in range(data.BlockCollectionsLength())] - groups: List[DS_DucGroup] = [parse_fbs_duc_group(data.Groups(i)) for i in range(data.GroupsLength())] - regions: List[DS_DucRegion] = [parse_fbs_duc_region(data.Regions(i)) for i in range(data.RegionsLength())] - layers: List[DS_DucLayer] = [parse_fbs_duc_layer(data.Layers(i)) for i in range(data.LayersLength())] - standards: List[DS_Standard] = [parse_fbs_standard(data.Standards(i)) for i in range(data.StandardsLength())] - - duc_local_state: Optional[DS_DucLocalState] = parse_fbs_duc_local_state(data.DucLocalState()) if data.DucLocalState() else None - duc_global_state: Optional[DS_DucGlobalState] = parse_fbs_duc_global_state(data.DucGlobalState()) if data.DucGlobalState() else None - - files: List[DS_DucExternalFileEntry] = [parse_fbs_duc_external_file_entry(data.ExternalFiles(i)) for i in range(data.ExternalFilesLength())] - - version_graph: Optional[DS_VersionGraph] = parse_fbs_version_graph(data.VersionGraph()) if data.VersionGraph() else None - - dictionary_entries: List[DS_DictionaryEntry] = [parse_fbs_dictionary_entry(data.Dictionary(i)) for i in range(data.DictionaryLength())] - dictionary: Dict[str, str] = {e.key: e.value for e in dictionary_entries} + return _wrap(deep_camel_to_snake(raw)) - # Thumbnail bytes - thumbnail = _read_bytes_from_numpy(data, "ThumbnailLength", "ThumbnailAsNumpy", "Thumbnail") - # Id field - file_id = _s(data.Id()) if data.Id() else None +def list_external_files( + source: Union[bytes, bytearray, BinaryIO, str], +) -> List[DucData]: + """List metadata for all external files (without data blobs).""" + buf = _read_bytes(source) + raw = ducpy_native.list_external_files(buf) + return _wrap(deep_camel_to_snake(raw)) - return DS_ExportedDataState( - type=_s_req(data.Type()), - source=_s_req(data.Source()), - version=_s_req(data.Version()), - thumbnail=thumbnail, - dictionary=dictionary, - elements=elements, - blocks=blocks, - block_instances=block_instances, - block_collections=block_collections, - groups=groups, - regions=regions, - layers=layers, - standards=standards, - duc_local_state=duc_local_state, - duc_global_state=duc_global_state, - files=files, - version_graph=version_graph, - id=file_id, - ) diff --git a/packages/ducpy/src/ducpy/serialize.py b/packages/ducpy/src/ducpy/serialize.py index 6bc9d9c4..068a6406 100644 --- a/packages/ducpy/src/ducpy/serialize.py +++ b/packages/ducpy/src/ducpy/serialize.py @@ -1,3953 +1,163 @@ """ -Main serialization functions for duc.fbs schema. -This module provides the main serialization function that leverages all comprehensive classes. +Serialize DUC data using the Rust native extension (ducpy_native). """ -import flatbuffers -import logging -import json -import gzip -from typing import List, Dict, Union, Any, Optional +from __future__ import annotations -logger = logging.getLogger(__name__) +import logging +from dataclasses import asdict, is_dataclass +from typing import Any, Dict, List, Optional, Union -# Dataclasses (authoring model) -from ducpy.classes.DataStateClass import ( - ExportedDataState as DS_ExportedDataState, - DictionaryEntry as DS_DictionaryEntry, - DucLocalState as DS_DucLocalState, - DucGlobalState as DS_DucGlobalState, - VersionGraph as DS_VersionGraph, - DucExternalFileEntry as DS_DucExternalFileEntry, - DucExternalFileData as DS_DucExternalFileData, - Checkpoint as DS_Checkpoint, - Delta as DS_Delta, - VersionBase as DS_VersionBase, - JSONPatchOperation as DS_JSONPatchOperation, - VersionGraphMetadata as DS_VersionGraphMetadata, - DisplayPrecision as DS_DisplayPrecision, -) -from ducpy.classes.ElementsClass import ( - ElementWrapper as DS_ElementWrapper, - DucRectangleElement as DS_DucRectangleElement, - DucPolygonElement as DS_DucPolygonElement, - DucEllipseElement as DS_DucEllipseElement, - DucEmbeddableElement as DS_DucEmbeddableElement, - DucPdfElement as DS_DucPdfElement, - DucMermaidElement as DS_DucMermaidElement, - DucTableElement as DS_DucTableElement, - DucImageElement as DS_DucImageElement, - DucTextElement as DS_DucTextElement, - DucLinearElement as DS_DucLinearElement, - DucArrowElement as DS_DucArrowElement, - DucFreeDrawElement as DS_DucFreeDrawElement, - DucBlockInstance as DS_DucBlockInstance, - DucFrameElement as DS_DucFrameElement, - DucPlotElement as DS_DucPlotElement, - DucViewportElement as DS_DucViewportElement, - DucXRayElement as DS_DucXRayElement, - DucLeaderElement as DS_DucLeaderElement, - DucDimensionElement as DS_DucDimensionElement, - DucFeatureControlFrameElement as DS_DucFeatureControlFrameElement, - DucDocElement as DS_DucDocElement, - DucParametricElement as DS_DucParametricElement, - DucModelElement as DS_DucModelElement, - DucBlock as DS_DucBlock, - DucBlockCollection as DS_DucBlockCollection, - DucBlockCollectionEntry as DS_DucBlockCollectionEntry, - DucBlockMetadata as DS_DucBlockMetadata, - DucGroup as DS_DucGroup, - DucRegion as DS_DucRegion, - DucLayer as DS_DucLayer, - DocumentGridConfig as DS_DocumentGridConfig, - ElementBackground as DS_ElementBackground, - ElementStroke as DS_ElementStroke, - GeometricPoint as DS_GeometricPoint, - BoundElement as DS_BoundElement, - DucPoint as DS_DucPoint, - DucHead as DS_DucHead, - DucLine as DS_DucLine, - DucLineReference as DS_DucLineReference, - DucPath as DS_DucPath, - DucLinearElementBase as DS_DucLinearElementBase, - DucElementBase as DS_DucElementBase, - DucElementStylesBase as DS_DucElementStylesBase, - ElementContentBase as DS_ElementContentBase, - StrokeStyle as DS_StrokeStyle, - StrokeSides as DS_StrokeSides, - DucStackLikeStyles as DS_DucStackLikeStyles, - DucStackBase as DS_DucStackBase, - DucStackElementBase as DS_DucStackElementBase, - LineSpacing as DS_LineSpacing, - DucTextStyle as DS_DucTextStyle, - DucTableCellStyle as DS_DucTableCellStyle, - DucTableStyle as DS_DucTableStyle, - DucLeaderStyle as DS_DucLeaderStyle, - DimensionToleranceStyle as DS_DimensionToleranceStyle, - DimensionFitStyle as DS_DimensionFitStyle, - DimensionLineStyle as DS_DimensionLineStyle, - DimensionExtLineStyle as DS_DimensionExtLineStyle, - DimensionSymbolStyle as DS_DimensionSymbolStyle, - DucDimensionStyle as DS_DucDimensionStyle, - FCFLayoutStyle as DS_FCFLayoutStyle, - FCFSymbolStyle as DS_FCFSymbolStyle, - FCFDatumStyle as DS_FCFDatumStyle, - DucFeatureControlFrameStyle as DS_DucFeatureControlFrameStyle, - ParagraphFormatting as DS_ParagraphFormatting, - StackFormatProperties as DS_StackFormatProperties, - StackFormat as DS_StackFormat, - DucDocStyle as DS_DucDocStyle, - DucViewportStyle as DS_DucViewportStyle, - DucPlotStyle as DS_DucPlotStyle, - DucXRayStyle as DS_DucXRayStyle, - DucTableColumn as DS_DucTableColumn, - DucTableRow as DS_DucTableRow, - DucTableCell as DS_DucTableCell, - DucTableColumnEntry as DS_DucTableColumnEntry, - DucTableRowEntry as DS_DucTableRowEntry, - DucTableCellEntry as DS_DucTableCellEntry, - DucTableCellSpan as DS_DucTableCellSpan, - DucTableAutoSize as DS_DucTableAutoSize, - ImageCrop as DS_ImageCrop, - DucTextDynamicElementSource as DS_DucTextDynamicElementSource, - DucTextDynamicDictionarySource as DS_DucTextDynamicDictionarySource, - DucTextDynamicSource as DS_DucTextDynamicSource, - DucTextDynamicPart as DS_DucTextDynamicPart, - PointBindingPoint as DS_PointBindingPoint, - DucPointBinding as DS_DucPointBinding, - DucFreeDrawEnds as DS_DucFreeDrawEnds, - StringValueEntry as DS_StringValueEntry, - DucBlockDuplicationArray as DS_DucBlockDuplicationArray, - PlotLayout as DS_PlotLayout, - LeaderTextBlockContent as DS_LeaderTextBlockContent, - LeaderBlockContent as DS_LeaderBlockContent, - LeaderContent as DS_LeaderContent, - DimensionDefinitionPoints as DS_DimensionDefinitionPoints, - DimensionBindings as DS_DimensionBindings, - DimensionBaselineData as DS_DimensionBaselineData, - DimensionContinueData as DS_DimensionContinueData, - DatumReference as DS_DatumReference, - ToleranceClause as DS_ToleranceClause, - FeatureControlFrameSegment as DS_FeatureControlFrameSegment, - FCFSegmentRow as DS_FCFSegmentRow, - FCFBetweenModifier as DS_FCFBetweenModifier, - FCFProjectedZoneModifier as DS_FCFProjectedZoneModifier, - FCFFrameModifiers as DS_FCFFrameModifiers, - FCFDatumDefinition as DS_FCFDatumDefinition, - TextColumn as DS_TextColumn, - ColumnLayout as DS_ColumnLayout, - DucCommonStyle as DS_DucCommonStyle, - ParametricSource as DS_ParametricSource, - DucLayerOverrides as DS_DucLayerOverrides, - Margins as DS_Margins, - DucBlockAttributeDefinition as DS_DucBlockAttributeDefinition, - DucBlockAttributeDefinitionEntry as DS_DucBlockAttributeDefinitionEntry, - TilingProperties as DS_TilingProperties, - HatchPatternLine as DS_HatchPatternLine, - CustomHatchPattern as DS_CustomHatchPattern, - DucHatchStyle as DS_DucHatchStyle, - DucImageFilter as DS_DucImageFilter, -) -from ducpy.classes.StandardsClass import ( - Standard as DS_Standard, - Identifier as DS_Identifier, - GridSettings as DS_GridSettings, - GridStyle as DS_GridStyle, - PolarGridSettings as DS_PolarGridSettings, - IsometricGridSettings as DS_IsometricGridSettings, - SnapSettings as DS_SnapSettings, - SnapOverride as DS_SnapOverride, - DynamicSnapSettings as DS_DynamicSnapSettings, - PolarTrackingSettings as DS_PolarTrackingSettings, - TrackingLineStyle as DS_TrackingLineStyle, - LayerSnapFilters as DS_LayerSnapFilters, - SnapMarkerStyle as DS_SnapMarkerStyle, - SnapMarkerStyleEntry as DS_SnapMarkerStyleEntry, - SnapMarkerSettings as DS_SnapMarkerSettings, - UnitSystemBase as DS_UnitSystemBase, - LinearUnitSystem as DS_LinearUnitSystem, - AngularUnitSystem as DS_AngularUnitSystem, - AlternateUnits as DS_AlternateUnits, - PrimaryUnits as DS_PrimaryUnits, - StandardUnits as DS_StandardUnits, - UnitPrecision as DS_UnitPrecision, - StandardOverrides as DS_StandardOverrides, - IdentifiedCommonStyle as DS_IdentifiedCommonStyle, - IdentifiedStackLikeStyle as DS_IdentifiedStackLikeStyle, - IdentifiedTextStyle as DS_IdentifiedTextStyle, - IdentifiedDimensionStyle as DS_IdentifiedDimensionStyle, - IdentifiedLeaderStyle as DS_IdentifiedLeaderStyle, - IdentifiedFCFStyle as DS_IdentifiedFCFStyle, - IdentifiedTableStyle as DS_IdentifiedTableStyle, - IdentifiedDocStyle as DS_IdentifiedDocStyle, - IdentifiedViewportStyle as DS_IdentifiedViewportStyle, - IdentifiedHatchStyle as DS_IdentifiedHatchStyle, - IdentifiedXRayStyle as DS_IdentifiedXRayStyle, - StandardStyles as DS_StandardStyles, - IdentifiedGridSettings as DS_IdentifiedGridSettings, - IdentifiedSnapSettings as DS_IdentifiedSnapSettings, - IdentifiedUcs as DS_IdentifiedUcs, - IdentifiedView as DS_IdentifiedView, - StandardViewSettings as DS_StandardViewSettings, - DimensionValidationRules as DS_DimensionValidationRules, - LayerValidationRules as DS_LayerValidationRules, - StandardValidation as DS_StandardValidation, -) +import ducpy_native from ducpy._version import DUC_SCHEMA_VERSION +from ducpy.utils.convert import (deep_snake_to_camel, snake_to_camel, + to_serializable) -# Enums (generated by FlatBuffers) -from ducpy.Duc.TEXT_ALIGN import TEXT_ALIGN -from ducpy.Duc.VERTICAL_ALIGN import VERTICAL_ALIGN -from ducpy.Duc.LINE_SPACING_TYPE import LINE_SPACING_TYPE -from ducpy.Duc.STROKE_PREFERENCE import STROKE_PREFERENCE -from ducpy.Duc.STROKE_CAP import STROKE_CAP -from ducpy.Duc.STROKE_JOIN import STROKE_JOIN -from ducpy.Duc.STROKE_PLACEMENT import STROKE_PLACEMENT -from ducpy.Duc.STROKE_SIDE_PREFERENCE import STROKE_SIDE_PREFERENCE -from ducpy.Duc.ELEMENT_CONTENT_PREFERENCE import ELEMENT_CONTENT_PREFERENCE -from ducpy.Duc.BLENDING import BLENDING -from ducpy.Duc.LINE_HEAD import LINE_HEAD -from ducpy.Duc.BEZIER_MIRRORING import BEZIER_MIRRORING -from ducpy.Duc.IMAGE_STATUS import IMAGE_STATUS -from ducpy.Duc.TABLE_CELL_ALIGNMENT import TABLE_CELL_ALIGNMENT -from ducpy.Duc.TABLE_FLOW_DIRECTION import TABLE_FLOW_DIRECTION -from ducpy.Duc.VIEWPORT_SHADE_PLOT import VIEWPORT_SHADE_PLOT -from ducpy.Duc.HATCH_STYLE import HATCH_STYLE -from ducpy.Duc.BLOCK_ATTACHMENT import BLOCK_ATTACHMENT -from ducpy.Duc.TOLERANCE_DISPLAY import TOLERANCE_DISPLAY -from ducpy.Duc.DIMENSION_FIT_RULE import DIMENSION_FIT_RULE -from ducpy.Duc.DIMENSION_TEXT_PLACEMENT import DIMENSION_TEXT_PLACEMENT -from ducpy.Duc.MARK_ELLIPSE_CENTER import MARK_ELLIPSE_CENTER -from ducpy.Duc.DIMENSION_TYPE import DIMENSION_TYPE -from ducpy.Duc.AXIS import AXIS -from ducpy.Duc.GDT_SYMBOL import GDT_SYMBOL -from ducpy.Duc.MATERIAL_CONDITION import MATERIAL_CONDITION -from ducpy.Duc.TOLERANCE_ZONE_TYPE import TOLERANCE_ZONE_TYPE -from ducpy.Duc.COLUMN_TYPE import COLUMN_TYPE -from ducpy.Duc.TEXT_FLOW_DIRECTION import TEXT_FLOW_DIRECTION -from ducpy.Duc.PARAMETRIC_SOURCE_TYPE import PARAMETRIC_SOURCE_TYPE -from ducpy.Duc.LEADER_CONTENT_TYPE import LEADER_CONTENT_TYPE -from ducpy.Duc.BOOLEAN_OPERATION import BOOLEAN_OPERATION -from ducpy.Duc.TEXT_FIELD_SOURCE_TYPE import TEXT_FIELD_SOURCE_TYPE -from ducpy.Duc.UNIT_SYSTEM import UNIT_SYSTEM -from ducpy.Duc.DIMENSION_UNITS_FORMAT import DIMENSION_UNITS_FORMAT -from ducpy.Duc.ANGULAR_UNITS_FORMAT import ANGULAR_UNITS_FORMAT -from ducpy.Duc.DECIMAL_SEPARATOR import DECIMAL_SEPARATOR -from ducpy.Duc.GRID_TYPE import GRID_TYPE -from ducpy.Duc.GRID_DISPLAY_TYPE import GRID_DISPLAY_TYPE -from ducpy.Duc.OBJECT_SNAP_MODE import OBJECT_SNAP_MODE -from ducpy.Duc.SNAP_MODE import SNAP_MODE -from ducpy.Duc.SNAP_OVERRIDE_BEHAVIOR import SNAP_OVERRIDE_BEHAVIOR -from ducpy.Duc.SNAP_MARKER_SHAPE import SNAP_MARKER_SHAPE -from ducpy.Duc.PRUNING_LEVEL import PRUNING_LEVEL - -# Unions -from ducpy.Duc.Element import Element as FBS_Element -from ducpy.Duc.LeaderContentData import LeaderContentData as FBS_LeaderContentData -from ducpy.Duc.DucTextDynamicSourceData import DucTextDynamicSourceData as FBS_DucTextDynamicSourceData - -# Structs -from ducpy.Duc.GeometricPoint import CreateGeometricPoint - -# FlatBuffers tables (generated) -# Core and root -from ducpy.Duc.DictionaryEntry import ( - DictionaryEntryStart, DictionaryEntryAddKey, DictionaryEntryAddValue, DictionaryEntryEnd -) -from ducpy.Duc.DucUcs import ( - DucUcsStart, DucUcsAddOrigin, DucUcsAddAngle, DucUcsEnd -) -from ducpy.Duc.StringValueEntry import ( - StringValueEntryStart, StringValueEntryAddKey, StringValueEntryAddValue, StringValueEntryEnd -) -from ducpy.Duc.Identifier import ( - IdentifierStart, IdentifierAddId, IdentifierAddName, IdentifierAddDescription, IdentifierEnd -) -from ducpy.Duc.ExportedDataState import ( - ExportedDataStateStart, ExportedDataStateAddType, ExportedDataStateAddVersion, ExportedDataStateAddSource, - ExportedDataStateAddThumbnail, ExportedDataStateAddDictionary, ExportedDataStateAddElements, - ExportedDataStateAddBlocks, ExportedDataStateAddBlockInstances, ExportedDataStateAddBlockCollections, - ExportedDataStateAddGroups, ExportedDataStateAddRegions, - ExportedDataStateAddLayers, ExportedDataStateAddStandards, ExportedDataStateAddDucLocalState, - ExportedDataStateAddDucGlobalState, ExportedDataStateAddExternalFiles, ExportedDataStateAddVersionGraph, - ExportedDataStateAddId, ExportedDataStateEnd, ExportedDataStateStartElementsVector, ExportedDataStateStartBlocksVector, - ExportedDataStateStartBlockInstancesVector, ExportedDataStateStartBlockCollectionsVector, - ExportedDataStateStartGroupsVector, ExportedDataStateStartRegionsVector, ExportedDataStateStartLayersVector, - ExportedDataStateStartStandardsVector, ExportedDataStateStartExternalFilesVector, - ExportedDataStateStartDictionaryVector -) - -# Element common parts -from ducpy.Duc.ElementContentBase import ( - ElementContentBaseStart, ElementContentBaseAddPreference, ElementContentBaseAddSrc, - ElementContentBaseAddVisible, ElementContentBaseAddOpacity, ElementContentBaseAddTiling, - ElementContentBaseAddHatch, ElementContentBaseAddImageFilter, ElementContentBaseEnd -) -from ducpy.Duc.ElementStroke import ( - ElementStrokeStart, ElementStrokeAddContent, ElementStrokeAddWidth, ElementStrokeAddStyle, - ElementStrokeAddPlacement, ElementStrokeAddStrokeSides, ElementStrokeEnd -) -from ducpy.Duc.ElementBackground import ( - ElementBackgroundStart, ElementBackgroundAddContent, ElementBackgroundEnd -) -from ducpy.Duc.StrokeStyle import ( - StrokeStyleStart, StrokeStyleAddPreference, StrokeStyleAddDash, StrokeStyleAddDashLineOverride, - StrokeStyleAddCap, StrokeStyleAddJoin, StrokeStyleAddDashCap, StrokeStyleAddMiterLimit, StrokeStyleEnd, - StrokeStyleStartDashVector -) -from ducpy.Duc.StrokeSides import ( - StrokeSidesStart, StrokeSidesAddPreference, StrokeSidesAddValues, StrokeSidesEnd, - StrokeSidesStartValuesVector -) -from ducpy.Duc._DucElementStylesBase import ( - _DucElementStylesBaseStart, - _DucElementStylesBaseAddBackground, - _DucElementStylesBaseAddStroke, - _DucElementStylesBaseAddOpacity, - _DucElementStylesBaseAddRoundness, - _DucElementStylesBaseAddBlending, - _DucElementStylesBaseEnd, - _DucElementStylesBaseStartBackgroundVector, - _DucElementStylesBaseStartStrokeVector -) - -# Backwards-compatible aliases expected by the rest of this module -DucElementStylesBaseStart = _DucElementStylesBaseStart -DucElementStylesBaseAddRoundness = _DucElementStylesBaseAddRoundness -DucElementStylesBaseAddBlending = _DucElementStylesBaseAddBlending -DucElementStylesBaseAddBackground = _DucElementStylesBaseAddBackground -DucElementStylesBaseAddStroke = _DucElementStylesBaseAddStroke -DucElementStylesBaseAddOpacity = _DucElementStylesBaseAddOpacity -DucElementStylesBaseEnd = _DucElementStylesBaseEnd -DucElementStylesBaseStartBackgroundVector = _DucElementStylesBaseStartBackgroundVector -DucElementStylesBaseStartStrokeVector = _DucElementStylesBaseStartStrokeVector - -# Linear element base vectors -from ducpy.Duc._DucLinearElementBase import ( - _DucLinearElementBaseStart, - _DucLinearElementBaseAddBase, - _DucLinearElementBaseAddPoints, - _DucLinearElementBaseAddLines, - _DucLinearElementBaseAddPathOverrides, - _DucLinearElementBaseAddLastCommittedPoint, - _DucLinearElementBaseAddStartBinding, - _DucLinearElementBaseAddEndBinding, - _DucLinearElementBaseEnd, - _DucLinearElementBaseStartPointsVector, - _DucLinearElementBaseStartLinesVector, - _DucLinearElementBaseStartPathOverridesVector -) - -# Backwards-compatible aliases for linear element base -DucLinearElementBaseStart = _DucLinearElementBaseStart -DucLinearElementBaseAddBase = _DucLinearElementBaseAddBase -DucLinearElementBaseAddPoints = _DucLinearElementBaseAddPoints -DucLinearElementBaseAddLines = _DucLinearElementBaseAddLines -DucLinearElementBaseAddPathOverrides = _DucLinearElementBaseAddPathOverrides -DucLinearElementBaseAddLastCommittedPoint = _DucLinearElementBaseAddLastCommittedPoint -DucLinearElementBaseAddStartBinding = _DucLinearElementBaseAddStartBinding -DucLinearElementBaseAddEndBinding = _DucLinearElementBaseAddEndBinding -DucLinearElementBaseEnd = _DucLinearElementBaseEnd - -# Backwards-compatible aliases for linear element base vectors -DucLinearElementBaseStartPointsVector = _DucLinearElementBaseStartPointsVector -DucLinearElementBaseStartLinesVector = _DucLinearElementBaseStartLinesVector -DucLinearElementBaseStartPathOverridesVector = _DucLinearElementBaseStartPathOverridesVector - -from ducpy.Duc.BoundElement import ( - BoundElementStart, BoundElementAddId, BoundElementAddType, BoundElementEnd -) -from ducpy.Duc.DucPoint import ( - DucPointStart, DucPointAddX, DucPointAddY, DucPointAddMirroring, DucPointEnd -) -from ducpy.Duc.DucHead import ( - DucHeadStart, DucHeadAddType, DucHeadAddBlockId, DucHeadAddSize, DucHeadEnd -) -from ducpy.Duc.PointBindingPoint import ( - PointBindingPointStart, PointBindingPointAddIndex, PointBindingPointAddOffset, PointBindingPointEnd -) -from ducpy.Duc.DucPointBinding import ( - DucPointBindingStart, DucPointBindingAddElementId, DucPointBindingAddFocus, DucPointBindingAddGap, - DucPointBindingAddFixedPoint, DucPointBindingAddPoint, DucPointBindingAddHead, DucPointBindingEnd -) -from ducpy.Duc.DucLineReference import ( - DucLineReferenceStart, DucLineReferenceAddIndex, DucLineReferenceAddHandle, DucLineReferenceEnd -) -from ducpy.Duc.DucLine import ( - DucLineStart, DucLineAddStart, DucLineAddEnd, DucLineEnd -) -from ducpy.Duc.DucPath import ( - DucPathStart, DucPathAddLineIndices, DucPathAddBackground, DucPathAddStroke, DucPathEnd, - DucPathStartLineIndicesVector -) -from ducpy.Duc._DucElementBase import ( - _DucElementBase as FBSDucElementBase, - _DucElementBaseStart, - _DucElementBaseAddId, - _DucElementBaseAddStyles, - _DucElementBaseAddX, - _DucElementBaseAddY, - _DucElementBaseAddWidth, - _DucElementBaseAddHeight, - _DucElementBaseAddAngle, - _DucElementBaseAddScope, - _DucElementBaseAddLabel, - _DucElementBaseAddDescription, - _DucElementBaseAddIsVisible, - _DucElementBaseAddSeed, - _DucElementBaseAddVersion, - _DucElementBaseAddVersionNonce, - _DucElementBaseAddUpdated, - _DucElementBaseAddIndex, - _DucElementBaseAddIsPlot, - _DucElementBaseAddIsAnnotative, - _DucElementBaseAddIsDeleted, - _DucElementBaseAddGroupIds, - _DucElementBaseStartGroupIdsVector, - _DucElementBaseAddBlockIds, - _DucElementBaseStartBlockIdsVector, - _DucElementBaseAddRegionIds, - _DucElementBaseStartRegionIdsVector, - _DucElementBaseAddLayerId, - _DucElementBaseAddFrameId, - _DucElementBaseAddBoundElements, - _DucElementBaseStartBoundElementsVector, - _DucElementBaseAddZIndex, - _DucElementBaseAddLink, - _DucElementBaseAddLocked, - _DucElementBaseAddCustomData, - _DucElementBaseAddInstanceId, - _DucElementBaseEnd, - -) -from ducpy.Duc.DucStackLikeStyles import ( - DucStackLikeStylesStart, DucStackLikeStylesAddOpacity, DucStackLikeStylesAddLabelingColor, - DucStackLikeStylesEnd -) -from ducpy.Duc._DucStackBase import ( - _DucStackBaseStart, _DucStackBaseAddLabel, _DucStackBaseAddDescription, - _DucStackBaseAddIsCollapsed, _DucStackBaseAddIsPlot, _DucStackBaseAddIsVisible, - _DucStackBaseAddLocked, _DucStackBaseAddStyles, _DucStackBaseEnd -) -from ducpy.Duc._DucStackElementBase import ( - _DucStackElementBaseStart, _DucStackElementBaseAddBase, _DucStackElementBaseAddStackBase, - _DucStackElementBaseAddClip, _DucStackElementBaseAddLabelVisible, _DucStackElementBaseAddStandardOverride, - _DucStackElementBaseEnd -) - -# Backwards-compatible aliases expected by the rest of this module -DucStackElementBaseStart = _DucStackElementBaseStart -DucStackElementBaseAddBase = _DucStackElementBaseAddBase -DucStackElementBaseAddStackBase = _DucStackElementBaseAddStackBase -DucStackElementBaseAddClip = _DucStackElementBaseAddClip -DucStackElementBaseAddLabelVisible = _DucStackElementBaseAddLabelVisible -DucStackElementBaseAddStandardOverride = _DucStackElementBaseAddStandardOverride -DucStackElementBaseEnd = _DucStackElementBaseEnd - -# Misc style tables -from ducpy.Duc.LineSpacing import ( - LineSpacingStart, LineSpacingAddValue, LineSpacingAddType, LineSpacingEnd -) -from ducpy.Duc.DucTextStyle import ( - DucTextStyleStart, DucTextStyleAddIsLtr, DucTextStyleAddFontFamily, - DucTextStyleAddBigFontFamily, DucTextStyleAddTextAlign, DucTextStyleAddVerticalAlign, - DucTextStyleAddLineHeight, DucTextStyleAddLineSpacing, DucTextStyleAddObliqueAngle, DucTextStyleAddFontSize, - DucTextStyleAddPaperTextHeight, DucTextStyleAddWidthFactor, DucTextStyleAddIsUpsideDown, - DucTextStyleAddIsBackwards, DucTextStyleEnd -) -from ducpy.Duc.Margins import ( - MarginsStart, MarginsAddTop, MarginsAddRight, MarginsAddBottom, MarginsAddLeft, MarginsEnd -) -from ducpy.Duc.DucTableCellStyle import ( - DucTableCellStyleStart, DucTableCellStyleAddBaseStyle, DucTableCellStyleAddTextStyle, - DucTableCellStyleAddMargins, DucTableCellStyleAddAlignment, DucTableCellStyleEnd -) -from ducpy.Duc.DucTableStyle import ( - DucTableStyleStart, DucTableStyleAddFlowDirection, - DucTableStyleAddHeaderRowStyle, DucTableStyleAddDataRowStyle, DucTableStyleAddDataColumnStyle, DucTableStyleEnd -) -from ducpy.Duc.DucLeaderStyle import ( - DucLeaderStyleStart, DucLeaderStyleAddHeadsOverride, DucLeaderStyleAddDogleg, - DucLeaderStyleAddTextStyle, DucLeaderStyleAddTextAttachment, DucLeaderStyleAddBlockAttachment, DucLeaderStyleEnd, - DucLeaderStyleStartHeadsOverrideVector -) -from ducpy.Duc.DimensionToleranceStyle import ( - DimensionToleranceStyleStart, DimensionToleranceStyleAddEnabled, DimensionToleranceStyleAddDisplayMethod, - DimensionToleranceStyleAddUpperValue, DimensionToleranceStyleAddLowerValue, DimensionToleranceStyleAddPrecision, - DimensionToleranceStyleAddTextStyle, DimensionToleranceStyleEnd -) -from ducpy.Duc.DimensionFitStyle import ( - DimensionFitStyleStart, DimensionFitStyleAddRule, DimensionFitStyleAddTextPlacement, - DimensionFitStyleAddForceTextInside, DimensionFitStyleEnd -) -from ducpy.Duc.DimensionLineStyle import ( - DimensionLineStyleStart, DimensionLineStyleAddStroke, DimensionLineStyleAddTextGap, DimensionLineStyleEnd -) -from ducpy.Duc.DimensionExtLineStyle import ( - DimensionExtLineStyleStart, DimensionExtLineStyleAddStroke, DimensionExtLineStyleAddOvershoot, - DimensionExtLineStyleAddOffset, DimensionExtLineStyleEnd -) -from ducpy.Duc.DucDimensionStyle import ( - DucDimensionStyleStart, DucDimensionStyleAddDimLine, DucDimensionStyleAddExtLine, DucDimensionStyleAddTextStyle, - DucDimensionStyleAddSymbols, DucDimensionStyleAddTolerance, DucDimensionStyleAddFit, DucDimensionStyleEnd -) -from ducpy.Duc.DimensionSymbolStyle import ( - DimensionSymbolStyleStart, DimensionSymbolStyleAddHeadsOverride, DimensionSymbolStyleAddCenterMarkType, - DimensionSymbolStyleAddCenterMarkSize, DimensionSymbolStyleEnd, DimensionSymbolStyleStartHeadsOverrideVector -) -from ducpy.Duc.FCFLayoutStyle import ( - FCFLayoutStyleStart, FCFLayoutStyleAddPadding, FCFLayoutStyleAddSegmentSpacing, FCFLayoutStyleAddRowSpacing, - FCFLayoutStyleEnd -) -from ducpy.Duc.FCFSymbolStyle import ( - FCFSymbolStyleStart, FCFSymbolStyleAddScale, FCFSymbolStyleEnd -) -from ducpy.Duc.FCFDatumStyle import ( - FCFDatumStyleStart, FCFDatumStyleAddBracketStyle, FCFDatumStyleEnd -) -from ducpy.Duc.DucFeatureControlFrameStyle import ( - DucFeatureControlFrameStyleStart, DucFeatureControlFrameStyleAddTextStyle, - DucFeatureControlFrameStyleAddLayout, DucFeatureControlFrameStyleAddSymbols, DucFeatureControlFrameStyleAddDatumStyle, - DucFeatureControlFrameStyleEnd -) -from ducpy.Duc.ParagraphFormatting import ( - ParagraphFormattingStart, ParagraphFormattingAddFirstLineIndent, ParagraphFormattingAddHangingIndent, - ParagraphFormattingAddLeftIndent, ParagraphFormattingAddRightIndent, ParagraphFormattingAddSpaceBefore, - ParagraphFormattingAddSpaceAfter, ParagraphFormattingAddTabStops, ParagraphFormattingEnd, - ParagraphFormattingStartTabStopsVector -) -from ducpy.Duc.StackFormatProperties import ( - StackFormatPropertiesStart, StackFormatPropertiesAddUpperScale, StackFormatPropertiesAddLowerScale, - StackFormatPropertiesAddAlignment, StackFormatPropertiesEnd -) -from ducpy.Duc.StackFormat import ( - StackFormatStart, StackFormatAddAutoStack, StackFormatAddStackChars, StackFormatAddProperties, StackFormatEnd, - StackFormatStartStackCharsVector -) -from ducpy.Duc.DucDocStyle import ( - DucDocStyleStart, DucDocStyleAddTextStyle, DucDocStyleAddParagraph, DucDocStyleAddStackFormat, DucDocStyleEnd -) -from ducpy.Duc.DucViewportStyle import ( - DucViewportStyleStart, DucViewportStyleAddScaleIndicatorVisible, DucViewportStyleEnd -) -from ducpy.Duc.DucPlotStyle import ( - DucPlotStyleStart, DucPlotStyleEnd -) -from ducpy.Duc.DucXRayStyle import ( - DucXRayStyleStart, DucXRayStyleAddColor, DucXRayStyleEnd -) -from ducpy.Duc.TilingProperties import ( - TilingPropertiesStart, TilingPropertiesAddSizeInPercent, TilingPropertiesAddAngle, TilingPropertiesAddSpacing, - TilingPropertiesAddOffsetX, TilingPropertiesAddOffsetY, TilingPropertiesEnd -) -from ducpy.Duc.HatchPatternLine import ( - HatchPatternLineStart, HatchPatternLineAddAngle, HatchPatternLineAddOrigin, HatchPatternLineAddOffset, - HatchPatternLineAddDashPattern, HatchPatternLineEnd, HatchPatternLineStartOffsetVector, - HatchPatternLineStartDashPatternVector -) -from ducpy.Duc.CustomHatchPattern import ( - CustomHatchPatternStart, CustomHatchPatternAddName, CustomHatchPatternAddDescription, - CustomHatchPatternAddLines, CustomHatchPatternEnd, CustomHatchPatternStartLinesVector -) -from ducpy.Duc.DucHatchStyle import ( - DucHatchStyleStart, DucHatchStyleAddHatchStyle, DucHatchStyleAddPatternName, DucHatchStyleAddPatternScale, - DucHatchStyleAddPatternAngle, DucHatchStyleAddPatternOrigin, DucHatchStyleAddPatternDouble, - DucHatchStyleAddCustomPattern, DucHatchStyleEnd -) -from ducpy.Duc.DucImageFilter import ( - DucImageFilterStart, DucImageFilterAddBrightness, DucImageFilterAddContrast, DucImageFilterEnd -) - -# Element tables -from ducpy.Duc.DucRectangleElement import ( - DucRectangleElementStart, DucRectangleElementAddBase, DucRectangleElementEnd -) -from ducpy.Duc.DucPolygonElement import ( - DucPolygonElementStart, DucPolygonElementAddBase, DucPolygonElementAddSides, DucPolygonElementEnd -) -from ducpy.Duc.DucEllipseElement import ( - DucEllipseElementStart, DucEllipseElementAddBase, DucEllipseElementAddRatio, DucEllipseElementAddStartAngle, - DucEllipseElementAddEndAngle, DucEllipseElementAddShowAuxCrosshair, DucEllipseElementEnd -) -from ducpy.Duc.DucEmbeddableElement import ( - DucEmbeddableElementStart, DucEmbeddableElementAddBase, DucEmbeddableElementEnd -) -from ducpy.Duc.DucPdfElement import ( - DucPdfElementStart, DucPdfElementAddBase, DucPdfElementAddFileId, DucPdfElementAddGridConfig, DucPdfElementEnd -) -from ducpy.Duc.DocumentGridConfig import ( - DocumentGridConfigStart, DocumentGridConfigAddColumns, DocumentGridConfigAddGapX, DocumentGridConfigAddGapY, - DocumentGridConfigAddAlignItems, DocumentGridConfigAddFirstPageAlone, DocumentGridConfigAddScale, DocumentGridConfigEnd -) -from ducpy.Duc.DucMermaidElement import ( - DucMermaidElementStart, DucMermaidElementAddBase, DucMermaidElementAddSource, DucMermaidElementAddTheme, - DucMermaidElementAddSvgPath, DucMermaidElementEnd -) -from ducpy.Duc.DucTableColumn import ( - DucTableColumnStart, DucTableColumnAddId, DucTableColumnAddWidth, DucTableColumnAddStyleOverrides, - DucTableColumnEnd -) -from ducpy.Duc.DucTableRow import ( - DucTableRowStart, DucTableRowAddId, DucTableRowAddHeight, DucTableRowAddStyleOverrides, DucTableRowEnd -) -from ducpy.Duc.DucTableCellSpan import ( - DucTableCellSpanStart, DucTableCellSpanAddColumns, DucTableCellSpanAddRows, DucTableCellSpanEnd -) -from ducpy.Duc.DucTableCell import ( - DucTableCellStart, DucTableCellAddRowId, DucTableCellAddColumnId, DucTableCellAddData, DucTableCellAddSpan, - DucTableCellAddLocked, DucTableCellAddStyleOverrides, DucTableCellEnd -) -from ducpy.Duc.DucTableColumnEntry import ( - DucTableColumnEntryStart, DucTableColumnEntryAddKey, DucTableColumnEntryAddValue, DucTableColumnEntryEnd -) -from ducpy.Duc.DucTableRowEntry import ( - DucTableRowEntryStart, DucTableRowEntryAddKey, DucTableRowEntryAddValue, DucTableRowEntryEnd -) -from ducpy.Duc.DucTableCellEntry import ( - DucTableCellEntryStart, DucTableCellEntryAddKey, DucTableCellEntryAddValue, DucTableCellEntryEnd -) -from ducpy.Duc.DucTableAutoSize import ( - DucTableAutoSizeStart, DucTableAutoSizeAddColumns, DucTableAutoSizeAddRows, DucTableAutoSizeEnd -) -from ducpy.Duc.DucTableElement import ( - DucTableElementStart, DucTableElementAddBase, DucTableElementAddStyle, DucTableElementAddColumnOrder, - DucTableElementAddRowOrder, DucTableElementAddColumns, DucTableElementAddRows, DucTableElementAddCells, - DucTableElementAddHeaderRowCount, DucTableElementAddAutoSize, DucTableElementEnd, - DucTableElementStartColumnOrderVector, DucTableElementStartRowOrderVector, DucTableElementStartColumnsVector, - DucTableElementStartRowsVector, DucTableElementStartCellsVector -) -from ducpy.Duc.ImageCrop import ( - ImageCropStart, ImageCropAddX, ImageCropAddY, ImageCropAddWidth, ImageCropAddHeight, - ImageCropAddNaturalWidth, ImageCropAddNaturalHeight, ImageCropEnd -) -from ducpy.Duc.DucImageElement import ( - DucImageElementStart, DucImageElementAddBase, DucImageElementAddFileId, DucImageElementAddStatus, - DucImageElementAddScale, DucImageElementAddCrop, DucImageElementAddFilter, DucImageElementEnd, - DucImageElementStartScaleVector -) -from ducpy.Duc.DucTextDynamicElementSource import ( - DucTextDynamicElementSourceStart, DucTextDynamicElementSourceAddElementId, DucTextDynamicElementSourceAddProperty, - DucTextDynamicElementSourceEnd -) -from ducpy.Duc.DucTextDynamicDictionarySource import ( - DucTextDynamicDictionarySourceStart, DucTextDynamicDictionarySourceAddKey, DucTextDynamicDictionarySourceEnd -) -from ducpy.Duc.DucTextDynamicSource import ( - DucTextDynamicSourceStart, DucTextDynamicSourceAddTextSourceType, DucTextDynamicSourceAddSourceType, - DucTextDynamicSourceAddSource, DucTextDynamicSourceEnd -) -from ducpy.Duc.DucTextDynamicPart import ( - DucTextDynamicPartStart, DucTextDynamicPartAddTag, DucTextDynamicPartAddSource, DucTextDynamicPartAddFormatting, - DucTextDynamicPartAddCachedValue, DucTextDynamicPartEnd -) -from ducpy.Duc.DucTextElement import ( - DucTextElementStart, DucTextElementAddBase, DucTextElementAddStyle, DucTextElementAddText, - DucTextElementAddDynamic, DucTextElementAddAutoResize, DucTextElementAddContainerId, - DucTextElementAddOriginalText, DucTextElementEnd, DucTextElementStartDynamicVector -) -from ducpy.Duc._DucLinearElementBase import ( - _DucLinearElementBaseStart, _DucLinearElementBaseAddBase, _DucLinearElementBaseAddPoints, _DucLinearElementBaseAddLines, - _DucLinearElementBaseAddPathOverrides, _DucLinearElementBaseAddLastCommittedPoint, _DucLinearElementBaseAddStartBinding, - _DucLinearElementBaseAddEndBinding, _DucLinearElementBaseEnd, _DucLinearElementBaseStartPointsVector, - _DucLinearElementBaseStartLinesVector, _DucLinearElementBaseStartPathOverridesVector -) -from ducpy.Duc.DucLinearElement import ( - DucLinearElementStart, DucLinearElementAddLinearBase, DucLinearElementAddWipeoutBelow, DucLinearElementEnd -) -from ducpy.Duc.DucArrowElement import ( - DucArrowElementStart, DucArrowElementAddLinearBase, DucArrowElementAddElbowed, DucArrowElementEnd -) -from ducpy.Duc.DucFreeDrawEnds import ( - DucFreeDrawEndsStart, DucFreeDrawEndsAddCap, DucFreeDrawEndsAddTaper, DucFreeDrawEndsAddEasing, DucFreeDrawEndsEnd -) -from ducpy.Duc.DucFreeDrawElement import ( - DucFreeDrawElementStart, DucFreeDrawElementAddBase, DucFreeDrawElementAddPoints, DucFreeDrawElementAddSize, - DucFreeDrawElementAddThinning, DucFreeDrawElementAddSmoothing, DucFreeDrawElementAddStreamline, - DucFreeDrawElementAddEasing, DucFreeDrawElementAddStart, DucFreeDrawElementAddEnd, DucFreeDrawElementAddPressures, - DucFreeDrawElementAddSimulatePressure, DucFreeDrawElementAddLastCommittedPoint, DucFreeDrawElementAddSvgPath, - DucFreeDrawElementEnd, DucFreeDrawElementStartPointsVector, DucFreeDrawElementStartPressuresVector -) -from ducpy.Duc.DucBlockInstance import ( - DucBlockInstanceStart, DucBlockInstanceAddId, DucBlockInstanceAddBlockId, - DucBlockInstanceAddVersion, DucBlockInstanceAddElementOverrides, DucBlockInstanceAddAttributeValues, - DucBlockInstanceAddDuplicationArray, DucBlockInstanceEnd, DucBlockInstanceStartElementOverridesVector, - DucBlockInstanceStartAttributeValuesVector -) -from ducpy.Duc.DucBlockInstanceElement import ( - DucBlockInstanceElementStart, DucBlockInstanceElementEnd -) -from ducpy.Duc.DucBlockDuplicationArray import ( - DucBlockDuplicationArrayStart, DucBlockDuplicationArrayAddRows, DucBlockDuplicationArrayAddCols, - DucBlockDuplicationArrayAddRowSpacing, DucBlockDuplicationArrayAddColSpacing, DucBlockDuplicationArrayEnd -) -from ducpy.Duc.DucFrameElement import ( - DucFrameElementStart, DucFrameElementAddStackElementBase, DucFrameElementEnd -) -from ducpy.Duc.DucPlotStyle import ( - DucPlotStyleStart, DucPlotStyleEnd -) -from ducpy.Duc.PlotLayout import ( - PlotLayoutStart, PlotLayoutAddMargins, PlotLayoutEnd -) -from ducpy.Duc.DucPlotElement import ( - DucPlotElementStart, DucPlotElementAddStackElementBase, DucPlotElementAddStyle, DucPlotElementAddLayout, - DucPlotElementEnd -) -from ducpy.Duc.DucView import ( - DucViewStart, DucViewAddScrollX, DucViewAddScrollY, DucViewAddZoom, DucViewAddTwistAngle, - DucViewAddCenterPoint, DucViewAddScope, DucViewEnd -) -from ducpy.Duc.DucViewportStyle import ( - DucViewportStyleStart, DucViewportStyleAddScaleIndicatorVisible, DucViewportStyleEnd -) -from ducpy.Duc.DucViewportElement import ( - DucViewportElementStart, DucViewportElementAddLinearBase, DucViewportElementAddStackBase, - DucViewportElementAddStyle, DucViewportElementAddView, DucViewportElementAddScale, - DucViewportElementAddShadePlot, DucViewportElementAddFrozenGroupIds, DucViewportElementAddStandardOverride, - DucViewportElementEnd, DucViewportElementStartFrozenGroupIdsVector -) -from ducpy.Duc.DucXRayElement import ( - DucXRayElementStart, DucXRayElementAddBase, DucXRayElementAddStyle, DucXRayElementAddOrigin, - DucXRayElementAddDirection, DucXRayElementAddStartFromOrigin, DucXRayElementEnd -) -from ducpy.Duc.LeaderTextBlockContent import ( - LeaderTextBlockContentStart, LeaderTextBlockContentAddText, LeaderTextBlockContentEnd -) -from ducpy.Duc.LeaderBlockContent import ( - LeaderBlockContentStart, LeaderBlockContentAddBlockId, LeaderBlockContentAddAttributeValues, - LeaderBlockContentAddElementOverrides, LeaderBlockContentEnd, LeaderBlockContentStartAttributeValuesVector, - LeaderBlockContentStartElementOverridesVector -) -from ducpy.Duc.LeaderContent import ( - LeaderContentStart, LeaderContentAddLeaderContentType, LeaderContentAddContentType, - LeaderContentAddContent, LeaderContentEnd -) -from ducpy.Duc.DucLeaderElement import ( - DucLeaderElementStart, DucLeaderElementAddLinearBase, DucLeaderElementAddStyle, DucLeaderElementAddContent, - DucLeaderElementAddContentAnchor, DucLeaderElementEnd -) -from ducpy.Duc.DimensionDefinitionPoints import ( - DimensionDefinitionPointsStart, DimensionDefinitionPointsAddOrigin1, DimensionDefinitionPointsAddOrigin2, - DimensionDefinitionPointsAddLocation, DimensionDefinitionPointsAddCenter, DimensionDefinitionPointsAddJog, - DimensionDefinitionPointsEnd -) -from ducpy.Duc.DimensionBindings import ( - DimensionBindingsStart, DimensionBindingsAddOrigin1, DimensionBindingsAddOrigin2, - DimensionBindingsAddCenter, DimensionBindingsEnd -) -from ducpy.Duc.DimensionBaselineData import ( - DimensionBaselineDataStart, DimensionBaselineDataAddBaseDimensionId, DimensionBaselineDataEnd -) -from ducpy.Duc.DimensionContinueData import ( - DimensionContinueDataStart, DimensionContinueDataAddContinueFromDimensionId, DimensionContinueDataEnd -) -from ducpy.Duc.DucDimensionElement import ( - DucDimensionElementStart, DucDimensionElementAddBase, DucDimensionElementAddStyle, - DucDimensionElementAddDimensionType, DucDimensionElementAddDefinitionPoints, DucDimensionElementAddObliqueAngle, - DucDimensionElementAddOrdinateAxis, DucDimensionElementAddBindings, DucDimensionElementAddTextOverride, - DucDimensionElementAddTextPosition, DucDimensionElementAddToleranceOverride, DucDimensionElementAddBaselineData, - DucDimensionElementAddContinueData, DucDimensionElementEnd -) -from ducpy.Duc.DatumReference import ( - DatumReferenceStart, DatumReferenceAddLetters, DatumReferenceAddModifier, DatumReferenceEnd -) -from ducpy.Duc.ToleranceClause import ( - ToleranceClauseStart, ToleranceClauseAddValue, ToleranceClauseAddZoneType, ToleranceClauseAddFeatureModifiers, - ToleranceClauseAddMaterialCondition, ToleranceClauseEnd, ToleranceClauseStartFeatureModifiersVector -) -from ducpy.Duc.FeatureControlFrameSegment import ( - FeatureControlFrameSegmentStart, FeatureControlFrameSegmentAddSymbol, FeatureControlFrameSegmentAddTolerance, - FeatureControlFrameSegmentAddDatums, FeatureControlFrameSegmentEnd, FeatureControlFrameSegmentStartDatumsVector -) -from ducpy.Duc.FCFBetweenModifier import ( - FCFBetweenModifierStart, FCFBetweenModifierAddStart, FCFBetweenModifierAddEnd, FCFBetweenModifierEnd -) -from ducpy.Duc.FCFProjectedZoneModifier import ( - FCFProjectedZoneModifierStart, FCFProjectedZoneModifierAddValue, FCFProjectedZoneModifierEnd -) -from ducpy.Duc.FCFFrameModifiers import ( - FCFFrameModifiersStart, FCFFrameModifiersAddAllAround, FCFFrameModifiersAddAllOver, - FCFFrameModifiersAddContinuousFeature, FCFFrameModifiersAddBetween, FCFFrameModifiersAddProjectedToleranceZone, - FCFFrameModifiersEnd -) -from ducpy.Duc.FCFDatumDefinition import ( - FCFDatumDefinitionStart, FCFDatumDefinitionAddLetter, FCFDatumDefinitionAddFeatureBinding, FCFDatumDefinitionEnd -) -from ducpy.Duc.FCFSegmentRow import ( - FCFSegmentRowStart, FCFSegmentRowAddSegments, FCFSegmentRowEnd, FCFSegmentRowStartSegmentsVector -) -from ducpy.Duc.DucFeatureControlFrameElement import ( - DucFeatureControlFrameElementStart, DucFeatureControlFrameElementAddBase, DucFeatureControlFrameElementAddStyle, - DucFeatureControlFrameElementAddRows, DucFeatureControlFrameElementAddFrameModifiers, - DucFeatureControlFrameElementAddLeaderElementId, DucFeatureControlFrameElementAddDatumDefinition, - DucFeatureControlFrameElementEnd, DucFeatureControlFrameElementStartRowsVector -) -from ducpy.Duc.TextColumn import ( - TextColumnStart, TextColumnAddWidth, TextColumnAddGutter, TextColumnEnd -) -from ducpy.Duc.ColumnLayout import ( - ColumnLayoutStart, ColumnLayoutAddType, ColumnLayoutAddDefinitions, ColumnLayoutAddAutoHeight, ColumnLayoutEnd, - ColumnLayoutStartDefinitionsVector -) -from ducpy.Duc.DucDocElement import ( - DucDocElementStart, DucDocElementAddBase, DucDocElementAddStyle, DucDocElementAddText, DucDocElementAddDynamic, - DucDocElementAddFlowDirection, DucDocElementAddColumns, DucDocElementAddAutoResize, DucDocElementAddGridConfig, - DucDocElementAddFileId, DucDocElementEnd, DucDocElementStartDynamicVector -) -from ducpy.Duc.DucModelElement import ( - DucModelElementStart, DucModelElementAddBase, DucModelElementAddSource, DucModelElementAddSvgPath, - DucModelElementAddFileIds, DucModelElementStartFileIdsVector, DucModelElementEnd -) -from ducpy.Duc.ParametricSource import ( - ParametricSourceStart, ParametricSourceAddType, ParametricSourceAddCode, ParametricSourceAddFileId, - ParametricSourceEnd -) -from ducpy.Duc.DucParametricElement import ( - DucParametricElementStart, DucParametricElementAddBase, DucParametricElementAddSource, DucParametricElementEnd -) -from ducpy.Duc.ElementWrapper import ( - ElementWrapperStart, ElementWrapperAddElementType, ElementWrapperAddElement, ElementWrapperEnd -) - -# Groups, regions, layers (builders will be imported in Part 2 but used later) -from ducpy.Duc.DucGroup import DucGroupStart, DucGroupAddId, DucGroupAddStackBase, DucGroupEnd -from ducpy.Duc.DucRegion import DucRegionStart, DucRegionAddId, DucRegionAddStackBase, DucRegionAddBooleanOperation, DucRegionEnd -from ducpy.Duc.DucLayerOverrides import DucLayerOverridesStart, DucLayerOverridesAddStroke, DucLayerOverridesAddBackground, DucLayerOverridesEnd -from ducpy.Duc.DucLayer import DucLayerStart, DucLayerAddId, DucLayerAddStackBase, DucLayerAddReadonly, DucLayerAddOverrides, DucLayerEnd - -# Utility helpers - -def _str(builder: flatbuffers.Builder, s: Optional[str]) -> int: - return builder.CreateString(s) if s else 0 - -def _bytes_vec(builder: flatbuffers.Builder, b: Optional[bytes]) -> int: - return builder.CreateByteVector(b) if b else 0 - -# ============================================================================= -# Utility & geometry serializers -# ============================================================================= - -def serialize_fbs_dictionary_entry(builder: flatbuffers.Builder, entry: DS_DictionaryEntry) -> int: - key_offset = builder.CreateString(entry.key) - value_offset = builder.CreateString(entry.value) - DictionaryEntryStart(builder) - DictionaryEntryAddKey(builder, key_offset) - DictionaryEntryAddValue(builder, value_offset) - return DictionaryEntryEnd(builder) - -def serialize_fbs_string_value_entry(builder: flatbuffers.Builder, entry: DS_StringValueEntry) -> int: - key_offset = builder.CreateString(entry.key) - value_offset = builder.CreateString(entry.value) - StringValueEntryStart(builder) - StringValueEntryAddKey(builder, key_offset) - StringValueEntryAddValue(builder, value_offset) - return StringValueEntryEnd(builder) - -def serialize_fbs_identifier(builder: flatbuffers.Builder, identifier: DS_Identifier) -> int: - id_offset = builder.CreateString(identifier.id) - name_offset = builder.CreateString(identifier.name) - description_offset = builder.CreateString(identifier.description) - IdentifierStart(builder) - IdentifierAddId(builder, id_offset) - IdentifierAddName(builder, name_offset) - IdentifierAddDescription(builder, description_offset) - return IdentifierEnd(builder) - -def serialize_fbs_duc_point(builder: flatbuffers.Builder, point: Optional[DS_DucPoint]) -> int: - if point is None: - return 0 - DucPointStart(builder) - DucPointAddX(builder, point.x) - DucPointAddY(builder, point.y) - if point.mirroring is not None: - DucPointAddMirroring(builder, point.mirroring) - return DucPointEnd(builder) - -def serialize_fbs_margins(builder: flatbuffers.Builder, margins: Optional[DS_Margins]) -> int: - if margins is None: - return 0 - MarginsStart(builder) - MarginsAddTop(builder, margins.top) - MarginsAddRight(builder, margins.right) - MarginsAddBottom(builder, margins.bottom) - MarginsAddLeft(builder, margins.left) - return MarginsEnd(builder) - -from ducpy.classes.ElementsClass import DucView as DS_DucView -def serialize_fbs_duc_view(builder: flatbuffers.Builder, view: Optional["DS_DucView"]) -> int: - if view is None: - return 0 - center_point_offset = serialize_fbs_duc_point(builder, view.center_point) - scope_offset = builder.CreateString(view.scope) - DucViewStart(builder) - DucViewAddScrollX(builder, view.scroll_x) - DucViewAddScrollY(builder, view.scroll_y) - DucViewAddZoom(builder, view.zoom) - DucViewAddTwistAngle(builder, view.twist_angle) - DucViewAddCenterPoint(builder, center_point_offset) - DucViewAddScope(builder, scope_offset) - return DucViewEnd(builder) - -# ============================================================================= -# Styling & content -# ============================================================================= - -def serialize_fbs_tiling_properties(builder: flatbuffers.Builder, props: Optional["DS_TilingProperties"]) -> int: - if props is None: - return 0 - TilingPropertiesStart(builder) - TilingPropertiesAddSizeInPercent(builder, props.size_in_percent) - TilingPropertiesAddAngle(builder, props.angle) - if props.spacing is not None: TilingPropertiesAddSpacing(builder, props.spacing) - if props.offset_x is not None: TilingPropertiesAddOffsetX(builder, props.offset_x) - if props.offset_y is not None: TilingPropertiesAddOffsetY(builder, props.offset_y) - return TilingPropertiesEnd(builder) - -def serialize_fbs_hatch_pattern_line(builder: flatbuffers.Builder, line: "DS_HatchPatternLine") -> int: - origin_offset = serialize_fbs_duc_point(builder, line.origin) - - offset_vec = 0 - if line.offset: - HatchPatternLineStartOffsetVector(builder, len(line.offset)) - for v in reversed(line.offset): - builder.PrependFloat64(v) - offset_vec = builder.EndVector() - - dash_vec = 0 - if line.dash_pattern: - HatchPatternLineStartDashPatternVector(builder, len(line.dash_pattern)) - for v in reversed(line.dash_pattern): - builder.PrependFloat64(v) - dash_vec = builder.EndVector() - - HatchPatternLineStart(builder) - HatchPatternLineAddAngle(builder, line.angle) - HatchPatternLineAddOrigin(builder, origin_offset) - if offset_vec: HatchPatternLineAddOffset(builder, offset_vec) - if dash_vec: HatchPatternLineAddDashPattern(builder, dash_vec) - return HatchPatternLineEnd(builder) - -def serialize_fbs_custom_hatch_pattern(builder: flatbuffers.Builder, pattern: Optional["DS_CustomHatchPattern"]) -> int: - if pattern is None: - return 0 - name_offset = builder.CreateString(pattern.name) - description_offset = builder.CreateString(pattern.description) - lines_offsets = [serialize_fbs_hatch_pattern_line(builder, ln) for ln in (pattern.lines or [])] - CustomHatchPatternStartLinesVector(builder, len(lines_offsets)) - for off in reversed(lines_offsets): - builder.PrependUOffsetTRelative(off) - lines_vec = builder.EndVector() - - CustomHatchPatternStart(builder) - CustomHatchPatternAddName(builder, name_offset) - CustomHatchPatternAddDescription(builder, description_offset) - CustomHatchPatternAddLines(builder, lines_vec) - return CustomHatchPatternEnd(builder) - -def serialize_fbs_duc_hatch_style(builder: flatbuffers.Builder, style: Optional["DS_DucHatchStyle"]) -> int: - if style is None: - return 0 - from ducpy.classes.ElementsClass import DucHatchStyle as DS_DucHatchStyle # Import locally to avoid circular imports - pattern_name_offset = builder.CreateString(style.pattern_name) - pattern_origin_offset = serialize_fbs_duc_point(builder, style.pattern_origin) - custom_pattern_offset = serialize_fbs_custom_hatch_pattern(builder, style.custom_pattern) - DucHatchStyleStart(builder) - if style.hatch_style is not None: - DucHatchStyleAddHatchStyle(builder, style.hatch_style) - DucHatchStyleAddPatternName(builder, pattern_name_offset) - DucHatchStyleAddPatternScale(builder, style.pattern_scale) - DucHatchStyleAddPatternAngle(builder, style.pattern_angle) - DucHatchStyleAddPatternOrigin(builder, pattern_origin_offset) - DucHatchStyleAddPatternDouble(builder, style.pattern_double) - if custom_pattern_offset: - DucHatchStyleAddCustomPattern(builder, custom_pattern_offset) - return DucHatchStyleEnd(builder) - -def serialize_fbs_duc_image_filter(builder: flatbuffers.Builder, image_filter: Optional["DS_DucImageFilter"]) -> int: - if image_filter is None: - return 0 - DucImageFilterStart(builder) - DucImageFilterAddBrightness(builder, image_filter.brightness) - DucImageFilterAddContrast(builder, image_filter.contrast) - return DucImageFilterEnd(builder) - -def serialize_fbs_element_content_base(builder: flatbuffers.Builder, content: DS_ElementContentBase) -> int: - src_offset = builder.CreateString(content.src) - tiling_offset = serialize_fbs_tiling_properties(builder, content.tiling) - hatch_offset = serialize_fbs_duc_hatch_style(builder, content.hatch) - image_filter_offset = serialize_fbs_duc_image_filter(builder, content.image_filter) - ElementContentBaseStart(builder) - if content.preference is not None: - ElementContentBaseAddPreference(builder, content.preference) - ElementContentBaseAddSrc(builder, src_offset) - ElementContentBaseAddVisible(builder, content.visible) - ElementContentBaseAddOpacity(builder, content.opacity) - if tiling_offset: ElementContentBaseAddTiling(builder, tiling_offset) - if hatch_offset: ElementContentBaseAddHatch(builder, hatch_offset) - if image_filter_offset: ElementContentBaseAddImageFilter(builder, image_filter_offset) - return ElementContentBaseEnd(builder) - -def serialize_fbs_stroke_style(builder: flatbuffers.Builder, style: DS_StrokeStyle) -> int: - dash_vec = 0 - if style.dash: - StrokeStyleStartDashVector(builder, len(style.dash)) - for v in reversed(style.dash): - builder.PrependFloat64(v) - dash_vec = builder.EndVector() - - dash_line_override_offset = _str(builder, style.dash_line_override) - - StrokeStyleStart(builder) - if style.preference is not None: - StrokeStyleAddPreference(builder, style.preference) - if style.cap is not None: - StrokeStyleAddCap(builder, style.cap) - if style.join is not None: - StrokeStyleAddJoin(builder, style.join) - if dash_vec: - StrokeStyleAddDash(builder, dash_vec) - if dash_line_override_offset: - StrokeStyleAddDashLineOverride(builder, dash_line_override_offset) - if style.dash_cap is not None: - StrokeStyleAddDashCap(builder, style.dash_cap) - if style.miter_limit is not None: - StrokeStyleAddMiterLimit(builder, style.miter_limit) - return StrokeStyleEnd(builder) - -def serialize_fbs_stroke_sides(builder: flatbuffers.Builder, sides: Optional[DS_StrokeSides]) -> int: - if sides is None: - return 0 - values_vec = 0 - if sides.values: - StrokeSidesStartValuesVector(builder, len(sides.values)) - for v in reversed(sides.values): - builder.PrependFloat64(v) - values_vec = builder.EndVector() - StrokeSidesStart(builder) - if sides.preference is not None: - StrokeSidesAddPreference(builder, sides.preference) - if values_vec: - StrokeSidesAddValues(builder, values_vec) - return StrokeSidesEnd(builder) - -def serialize_fbs_element_stroke(builder: flatbuffers.Builder, stroke: DS_ElementStroke) -> int: - if isinstance(stroke, list): - # Handle case where stroke is a list - take first element or create default - if stroke and len(stroke) > 0: - stroke_obj = stroke[0] - content_offset = serialize_fbs_element_content_base(builder, stroke_obj.content) - style_offset = serialize_fbs_stroke_style(builder, stroke_obj.style) - sides_offset = serialize_fbs_stroke_sides(builder, stroke_obj.stroke_sides) - else: - # Create default content - default_content = DS_ElementContentBase( - src="", visible=True, opacity=1.0, tiling=None, hatch=None, image_filter=None, preference=None - ) - content_offset = serialize_fbs_element_content_base(builder, default_content) - style_offset = 0 - sides_offset = 0 - else: - content_offset = serialize_fbs_element_content_base(builder, stroke.content) - style_offset = serialize_fbs_stroke_style(builder, stroke.style) - sides_offset = serialize_fbs_stroke_sides(builder, stroke.stroke_sides) - - ElementStrokeStart(builder) - ElementStrokeAddContent(builder, content_offset) - ElementStrokeAddWidth(builder, stroke.width if not isinstance(stroke, list) else 1.0) - ElementStrokeAddStyle(builder, style_offset) - if not isinstance(stroke, list) and stroke.placement is not None: - ElementStrokeAddPlacement(builder, stroke.placement) - if sides_offset: - ElementStrokeAddStrokeSides(builder, sides_offset) - return ElementStrokeEnd(builder) - -def serialize_fbs_element_background(builder: flatbuffers.Builder, background: DS_ElementBackground) -> int: - if isinstance(background, list): - # Handle case where background is a list - take first element or create default - if background and len(background) > 0: - bg_obj = background[0] - content_offset = serialize_fbs_element_content_base(builder, bg_obj.content) - else: - # Create default content - default_content = DS_ElementContentBase( - src="", visible=True, opacity=1.0, tiling=None, hatch=None, image_filter=None, preference=None - ) - content_offset = serialize_fbs_element_content_base(builder, default_content) - else: - content_offset = serialize_fbs_element_content_base(builder, background.content) - - ElementBackgroundStart(builder) - ElementBackgroundAddContent(builder, content_offset) - return ElementBackgroundEnd(builder) - -def serialize_fbs_duc_element_styles_base(builder: flatbuffers.Builder, style: Optional[DS_DucElementStylesBase]) -> int: - if style is None: - return 0 - - # Create vectors with single elements since dataclass has single objects but FlatBuffers table has arrays - bg_offset = serialize_fbs_element_background(builder, style.background) - stroke_offset = serialize_fbs_element_stroke(builder, style.stroke) - - DucElementStylesBaseStartBackgroundVector(builder, 1) - builder.PrependUOffsetTRelative(bg_offset) - bg_vec = builder.EndVector() - - DucElementStylesBaseStartStrokeVector(builder, 1) - builder.PrependUOffsetTRelative(stroke_offset) - stroke_vec = builder.EndVector() - - DucElementStylesBaseStart(builder) - DucElementStylesBaseAddRoundness(builder, style.roundness) - DucElementStylesBaseAddBackground(builder, bg_vec) - DucElementStylesBaseAddStroke(builder, stroke_vec) - DucElementStylesBaseAddOpacity(builder, style.opacity) - if style.blending is not None: - DucElementStylesBaseAddBlending(builder, style.blending) - return DucElementStylesBaseEnd(builder) - -# ============================================================================= -# Base element & common components -# ============================================================================= - -def serialize_fbs_bound_element(builder: flatbuffers.Builder, element: DS_BoundElement) -> int: - id_offset = builder.CreateString(element.id) - type_offset = builder.CreateString(element.type) - BoundElementStart(builder) - BoundElementAddId(builder, id_offset) - BoundElementAddType(builder, type_offset) - return BoundElementEnd(builder) - -def serialize_fbs_duc_element_base(builder: flatbuffers.Builder, base: DS_DucElementBase) -> int: - id_offset = builder.CreateString(base.id) - styles_offset = serialize_fbs_duc_element_styles_base(builder, base.styles) - scope_offset = builder.CreateString(base.scope) - label_offset = builder.CreateString(base.label) - description_offset = _str(builder, base.description) - index_offset = _str(builder, base.index) - layer_id_offset = _str(builder, base.layer_id) - frame_id_offset = _str(builder, base.frame_id) - link_offset = _str(builder, base.link) - - group_ids_offsets = [builder.CreateString(g) for g in (base.group_ids or [])] - _DucElementBaseStartGroupIdsVector(builder, len(group_ids_offsets)) - for off in reversed(group_ids_offsets): - builder.PrependUOffsetTRelative(off) - group_ids_vec = builder.EndVector() - - block_ids_offsets = [builder.CreateString(b) for b in (base.block_ids or [])] - _DucElementBaseStartBlockIdsVector(builder, len(block_ids_offsets)) - for off in reversed(block_ids_offsets): - builder.PrependUOffsetTRelative(off) - block_ids_vec = builder.EndVector() - - region_ids_offsets = [builder.CreateString(r) for r in (base.region_ids or [])] - _DucElementBaseStartRegionIdsVector(builder, len(region_ids_offsets)) - for off in reversed(region_ids_offsets): - builder.PrependUOffsetTRelative(off) - region_ids_vec = builder.EndVector() - - bound_elements_offsets = [serialize_fbs_bound_element(builder, b) for b in (base.bound_elements or [])] - bound_elements_vec = 0 - if bound_elements_offsets: - # There is no helper for count here; flatbuffers expects vector as UOffsetTRelative array - # but generator created helper for this field: - # It is _DucElementBaseStartBoundElementsVector if generated. If not, we skip if empty. - _DucElementBaseStartBoundElementsVector(builder, len(bound_elements_offsets)) - for off in reversed(bound_elements_offsets): - builder.PrependUOffsetTRelative(off) - bound_elements_vec = builder.EndVector() - - custom_data_offset = 0 - if base.custom_data: - # Compress JSON and create byte vector for custom_data - json_str = json.dumps(base.custom_data) - compressed = gzip.compress(json_str.encode("utf-8")) - _DucElementBaseStartCustomDataVector(builder, len(compressed)) - for i in reversed(range(len(compressed))): - builder.PrependByte(compressed[i]) - custom_data_offset = builder.EndVector(len(compressed)) - - instance_id_offset = 0 - if base.instance_id: - instance_id_offset = builder.CreateString(base.instance_id) - - _DucElementBaseStart(builder) - _DucElementBaseAddId(builder, id_offset) - _DucElementBaseAddStyles(builder, styles_offset) - _DucElementBaseAddX(builder, base.x) - _DucElementBaseAddY(builder, base.y) - _DucElementBaseAddWidth(builder, base.width) - _DucElementBaseAddHeight(builder, base.height) - _DucElementBaseAddAngle(builder, base.angle) - _DucElementBaseAddScope(builder, scope_offset) - _DucElementBaseAddLabel(builder, label_offset) - if description_offset: _DucElementBaseAddDescription(builder, description_offset) - _DucElementBaseAddIsVisible(builder, base.is_visible) - _DucElementBaseAddSeed(builder, base.seed) - _DucElementBaseAddVersion(builder, base.version) - _DucElementBaseAddVersionNonce(builder, base.version_nonce) - _DucElementBaseAddUpdated(builder, base.updated) - if index_offset: _DucElementBaseAddIndex(builder, index_offset) - _DucElementBaseAddIsPlot(builder, base.is_plot) - _DucElementBaseAddIsAnnotative(builder, base.is_annotative) - _DucElementBaseAddIsDeleted(builder, base.is_deleted) - _DucElementBaseAddGroupIds(builder, group_ids_vec) - _DucElementBaseAddBlockIds(builder, block_ids_vec) - _DucElementBaseAddRegionIds(builder, region_ids_vec) - if layer_id_offset: _DucElementBaseAddLayerId(builder, layer_id_offset) - if frame_id_offset: _DucElementBaseAddFrameId(builder, frame_id_offset) - if bound_elements_vec: _DucElementBaseAddBoundElements(builder, bound_elements_vec) - _DucElementBaseAddZIndex(builder, base.z_index) - if link_offset: _DucElementBaseAddLink(builder, link_offset) - _DucElementBaseAddLocked(builder, base.locked) - if custom_data_offset: _DucElementBaseAddCustomData(builder, custom_data_offset) - if instance_id_offset: _DucElementBaseAddInstanceId(builder, instance_id_offset) - return _DucElementBaseEnd(builder) - -def serialize_fbs_duc_head(builder: flatbuffers.Builder, head: Optional[DS_DucHead]) -> int: - if not head: - return 0 - - block_id_offset = builder.CreateString(head.block_id) - - DucHeadStart(builder) - DucHeadAddType(builder, head.type) - DucHeadAddBlockId(builder, block_id_offset) - DucHeadAddSize(builder, head.size) - return DucHeadEnd(builder) - -def serialize_fbs_point_binding_point(builder: flatbuffers.Builder, pbp: Optional[DS_PointBindingPoint]) -> int: - if not pbp: - return 0 - - PointBindingPointStart(builder) - PointBindingPointAddIndex(builder, pbp.index) - PointBindingPointAddOffset(builder, pbp.offset) - return PointBindingPointEnd(builder) - -def serialize_fbs_duc_point_binding(builder: flatbuffers.Builder, binding: Optional[DS_DucPointBinding]) -> int: - if not binding: - return 0 - - element_id_offset = builder.CreateString(binding.element_id) - fixed_point_offset = serialize_fbs_duc_point(builder, binding.fixed_point) - point_offset = serialize_fbs_point_binding_point(builder, binding.point) - head_offset = serialize_fbs_duc_head(builder, binding.head) - - DucPointBindingStart(builder) - DucPointBindingAddElementId(builder, element_id_offset) - DucPointBindingAddFocus(builder, binding.focus) - DucPointBindingAddGap(builder, binding.gap) - if fixed_point_offset: DucPointBindingAddFixedPoint(builder, fixed_point_offset) - if point_offset: DucPointBindingAddPoint(builder, point_offset) - if head_offset: DucPointBindingAddHead(builder, head_offset) - return DucPointBindingEnd(builder) - -def serialize_fbs_duc_line_reference(builder: flatbuffers.Builder, ref: DS_DucLineReference) -> int: - DucLineReferenceStart(builder) - DucLineReferenceAddIndex(builder, ref.index) - if ref.handle: - # Create GeometricPoint struct properly - from ducpy.Duc.GeometricPoint import CreateGeometricPoint - handle_struct = CreateGeometricPoint(builder, ref.handle.x, ref.handle.y) - DucLineReferenceAddHandle(builder, handle_struct) - return DucLineReferenceEnd(builder) - -def serialize_fbs_duc_line(builder: flatbuffers.Builder, line: DS_DucLine) -> int: - start_offset = serialize_fbs_duc_line_reference(builder, line.start) - end_offset = serialize_fbs_duc_line_reference(builder, line.end) - DucLineStart(builder) - DucLineAddStart(builder, start_offset) - DucLineAddEnd(builder, end_offset) - return DucLineEnd(builder) - -def serialize_fbs_duc_path(builder: flatbuffers.Builder, path: DS_DucPath) -> int: - line_idx_vec = 0 - if path.line_indices: - DucPathStartLineIndicesVector(builder, len(path.line_indices)) - for i in reversed(path.line_indices): - builder.PrependInt32(i) - line_idx_vec = builder.EndVector() - background_offset = serialize_fbs_element_background(builder, path.background) if path.background else 0 - stroke_offset = serialize_fbs_element_stroke(builder, path.stroke) if path.stroke else 0 - DucPathStart(builder) - if line_idx_vec: DucPathAddLineIndices(builder, line_idx_vec) - if background_offset: DucPathAddBackground(builder, background_offset) - if stroke_offset: DucPathAddStroke(builder, stroke_offset) - return DucPathEnd(builder) - -def serialize_fbs_duc_linear_element_base(builder: flatbuffers.Builder, linear_base: DS_DucLinearElementBase) -> int: - base_offset = serialize_fbs_duc_element_base(builder, linear_base.base) - points_offsets = [serialize_fbs_duc_point(builder, p) for p in (linear_base.points or [])] - DucLinearElementBaseStartPointsVector(builder, len(points_offsets)) - for off in reversed(points_offsets): - builder.PrependUOffsetTRelative(off) - points_vec = builder.EndVector() - - lines_offsets = [serialize_fbs_duc_line(builder, ln) for ln in (linear_base.lines or [])] - DucLinearElementBaseStartLinesVector(builder, len(lines_offsets)) - for off in reversed(lines_offsets): - builder.PrependUOffsetTRelative(off) - lines_vec = builder.EndVector() - - path_overrides_offsets = [serialize_fbs_duc_path(builder, p) for p in (linear_base.path_overrides or [])] - DucLinearElementBaseStartPathOverridesVector(builder, len(path_overrides_offsets)) - for off in reversed(path_overrides_offsets): - builder.PrependUOffsetTRelative(off) - path_overrides_vec = builder.EndVector() - - last_point_offset = serialize_fbs_duc_point(builder, linear_base.last_committed_point) - start_binding_offset = serialize_fbs_duc_point_binding(builder, linear_base.start_binding) - end_binding_offset = serialize_fbs_duc_point_binding(builder, linear_base.end_binding) - - DucLinearElementBaseStart(builder) - DucLinearElementBaseAddBase(builder, base_offset) - DucLinearElementBaseAddPoints(builder, points_vec) - DucLinearElementBaseAddLines(builder, lines_vec) - DucLinearElementBaseAddPathOverrides(builder, path_overrides_vec) - if last_point_offset: DucLinearElementBaseAddLastCommittedPoint(builder, last_point_offset) - if start_binding_offset: DucLinearElementBaseAddStartBinding(builder, start_binding_offset) - if end_binding_offset: DucLinearElementBaseAddEndBinding(builder, end_binding_offset) - return DucLinearElementBaseEnd(builder) - -def serialize_fbs_duc_stack_like_styles(builder: flatbuffers.Builder, styles: DS_DucStackLikeStyles) -> int: - labeling_color_offset = builder.CreateString(styles.labeling_color) - DucStackLikeStylesStart(builder) - DucStackLikeStylesAddOpacity(builder, styles.opacity) - DucStackLikeStylesAddLabelingColor(builder, labeling_color_offset) - return DucStackLikeStylesEnd(builder) - -def serialize_fbs_duc_stack_base(builder: flatbuffers.Builder, stack_base: DS_DucStackBase) -> int: - label_offset = builder.CreateString(stack_base.label) - description_offset = builder.CreateString(stack_base.description) - styles_offset = serialize_fbs_duc_stack_like_styles(builder, stack_base.styles) - _DucStackBaseStart(builder) - _DucStackBaseAddLabel(builder, label_offset) - _DucStackBaseAddDescription(builder, description_offset) - _DucStackBaseAddIsCollapsed(builder, stack_base.is_collapsed) - _DucStackBaseAddIsPlot(builder, stack_base.is_plot) - _DucStackBaseAddIsVisible(builder, stack_base.is_visible) - _DucStackBaseAddLocked(builder, stack_base.locked) - _DucStackBaseAddStyles(builder, styles_offset) - return _DucStackBaseEnd(builder) - -def serialize_fbs_duc_stack_element_base(builder: flatbuffers.Builder, seb: DS_DucStackElementBase) -> int: - base_offset = serialize_fbs_duc_element_base(builder, seb.base) - stack_base_offset = serialize_fbs_duc_stack_base(builder, seb.stack_base) - standard_override_offset = _str(builder, seb.standard_override) - DucStackElementBaseStart(builder) - DucStackElementBaseAddBase(builder, base_offset) - DucStackElementBaseAddStackBase(builder, stack_base_offset) - DucStackElementBaseAddClip(builder, seb.clip) - DucStackElementBaseAddLabelVisible(builder, seb.label_visible) - if standard_override_offset: - DucStackElementBaseAddStandardOverride(builder, standard_override_offset) - return DucStackElementBaseEnd(builder) - -# ============================================================================= -# Element-specific style serializers -# ============================================================================= - -def serialize_fbs_line_spacing(builder: flatbuffers.Builder, ls: Optional[DS_LineSpacing]) -> int: - if ls is None: - return 0 - LineSpacingStart(builder) - LineSpacingAddValue(builder, ls.value) - if ls.type is not None: - LineSpacingAddType(builder, ls.type) - return LineSpacingEnd(builder) - -def serialize_fbs_duc_text_style(builder: flatbuffers.Builder, style: DS_DucTextStyle) -> int: - font_family_offset = builder.CreateString(style.font_family) - big_font_family_offset = builder.CreateString(style.big_font_family) - line_spacing_offset = serialize_fbs_line_spacing(builder, style.line_spacing) - DucTextStyleStart(builder) - DucTextStyleAddIsLtr(builder, style.is_ltr) - DucTextStyleAddFontFamily(builder, font_family_offset) - DucTextStyleAddBigFontFamily(builder, big_font_family_offset) - if style.text_align is not None: - DucTextStyleAddTextAlign(builder, style.text_align) - if style.vertical_align is not None: - DucTextStyleAddVerticalAlign(builder, style.vertical_align) - DucTextStyleAddLineHeight(builder, style.line_height) - DucTextStyleAddLineSpacing(builder, line_spacing_offset) - DucTextStyleAddObliqueAngle(builder, style.oblique_angle) - DucTextStyleAddFontSize(builder, style.font_size) - if style.paper_text_height is not None: - DucTextStyleAddPaperTextHeight(builder, style.paper_text_height) - DucTextStyleAddWidthFactor(builder, style.width_factor) - DucTextStyleAddIsUpsideDown(builder, style.is_upside_down) - DucTextStyleAddIsBackwards(builder, style.is_backwards) - return DucTextStyleEnd(builder) - -def serialize_fbs_table_cell_style(builder: flatbuffers.Builder, style: DS_DucTableCellStyle) -> int: - base_style_offset = serialize_fbs_duc_element_styles_base(builder, style.base_style) - text_style_offset = serialize_fbs_duc_text_style(builder, style.text_style) - margins_offset = serialize_fbs_margins(builder, style.margins) - DucTableCellStyleStart(builder) - DucTableCellStyleAddBaseStyle(builder, base_style_offset) - DucTableCellStyleAddTextStyle(builder, text_style_offset) - DucTableCellStyleAddMargins(builder, margins_offset) - if style.alignment is not None: - DucTableCellStyleAddAlignment(builder, style.alignment) - return DucTableCellStyleEnd(builder) - -def serialize_fbs_table_style(builder: flatbuffers.Builder, style: Optional[DS_DucTableStyle]) -> int: - if style is None: - return 0 - header_row_style_offset = serialize_fbs_table_cell_style(builder, style.header_row_style) - data_row_style_offset = serialize_fbs_table_cell_style(builder, style.data_row_style) - data_column_style_offset = serialize_fbs_table_cell_style(builder, style.data_column_style) - flow_direction = style.flow_direction if style.flow_direction is not None else TABLE_FLOW_DIRECTION.VERTICAL - DucTableStyleStart(builder) - DucTableStyleAddHeaderRowStyle(builder, header_row_style_offset) - DucTableStyleAddDataRowStyle(builder, data_row_style_offset) - DucTableStyleAddDataColumnStyle(builder, data_column_style_offset) - DucTableStyleAddFlowDirection(builder, flow_direction) - return DucTableStyleEnd(builder) - -def serialize_fbs_leader_style(builder: flatbuffers.Builder, style: DS_DucLeaderStyle) -> int: - text_style_offset = serialize_fbs_duc_text_style(builder, style.text_style) - heads_offsets = [serialize_fbs_duc_head(builder, h) for h in (style.heads_override or [])] - heads_vec = 0 - if heads_offsets: - DucLeaderStyleStartHeadsOverrideVector(builder, len(heads_offsets)) - for off in reversed(heads_offsets): - builder.PrependUOffsetTRelative(off) - heads_vec = builder.EndVector() - DucLeaderStyleStart(builder) - if heads_vec: - DucLeaderStyleAddHeadsOverride(builder, heads_vec) - if style.dogleg is not None: - DucLeaderStyleAddDogleg(builder, style.dogleg) - DucLeaderStyleAddTextStyle(builder, text_style_offset) - if style.text_attachment is not None: - DucLeaderStyleAddTextAttachment(builder, style.text_attachment) - if style.block_attachment is not None: - DucLeaderStyleAddBlockAttachment(builder, style.block_attachment) - return DucLeaderStyleEnd(builder) - -def serialize_fbs_dimension_tolerance_style(builder: flatbuffers.Builder, t: Optional[DS_DimensionToleranceStyle]) -> int: - if t is None: - return 0 - text_style_offset = serialize_fbs_duc_text_style(builder, t.text_style) if t.text_style else 0 - DimensionToleranceStyleStart(builder) - DimensionToleranceStyleAddEnabled(builder, t.enabled) - if t.display_method is not None: - DimensionToleranceStyleAddDisplayMethod(builder, t.display_method) - DimensionToleranceStyleAddUpperValue(builder, t.upper_value) - DimensionToleranceStyleAddLowerValue(builder, t.lower_value) - DimensionToleranceStyleAddPrecision(builder, t.precision) - if text_style_offset: - DimensionToleranceStyleAddTextStyle(builder, text_style_offset) - return DimensionToleranceStyleEnd(builder) - -def serialize_fbs_dimension_fit_style(builder: flatbuffers.Builder, f: DS_DimensionFitStyle) -> int: - DimensionFitStyleStart(builder) - if f.rule is not None: - DimensionFitStyleAddRule(builder, f.rule) - if f.text_placement is not None: - DimensionFitStyleAddTextPlacement(builder, f.text_placement) - DimensionFitStyleAddForceTextInside(builder, f.force_text_inside) - return DimensionFitStyleEnd(builder) - -def serialize_fbs_dimension_line_style(builder: flatbuffers.Builder, s: DS_DimensionLineStyle) -> int: - stroke_offset = serialize_fbs_element_stroke(builder, s.stroke) - DimensionLineStyleStart(builder) - DimensionLineStyleAddStroke(builder, stroke_offset) - DimensionLineStyleAddTextGap(builder, s.text_gap) - return DimensionLineStyleEnd(builder) - -def serialize_fbs_dimension_ext_line_style(builder: flatbuffers.Builder, s: DS_DimensionExtLineStyle) -> int: - stroke_offset = serialize_fbs_element_stroke(builder, s.stroke) - DimensionExtLineStyleStart(builder) - DimensionExtLineStyleAddStroke(builder, stroke_offset) - DimensionExtLineStyleAddOvershoot(builder, s.overshoot) - DimensionExtLineStyleAddOffset(builder, s.offset) - return DimensionExtLineStyleEnd(builder) - -def serialize_fbs_dimension_symbol_style(builder: flatbuffers.Builder, s: DS_DimensionSymbolStyle) -> int: - heads_offsets = [serialize_fbs_duc_head(builder, h) for h in (s.heads_override or [])] - heads_vec = 0 - if heads_offsets: - DimensionSymbolStyleStartHeadsOverrideVector(builder, len(heads_offsets)) - for off in reversed(heads_offsets): - builder.PrependUOffsetTRelative(off) - heads_vec = builder.EndVector() - DimensionSymbolStyleStart(builder) - if heads_vec: - DimensionSymbolStyleAddHeadsOverride(builder, heads_vec) - if s.center_mark_type is not None: - DimensionSymbolStyleAddCenterMarkType(builder, s.center_mark_type) - DimensionSymbolStyleAddCenterMarkSize(builder, s.center_mark_size) - return DimensionSymbolStyleEnd(builder) - -def serialize_fbs_dimension_style(builder: flatbuffers.Builder, s: DS_DucDimensionStyle) -> int: - dim_line_offset = serialize_fbs_dimension_line_style(builder, s.dim_line) - ext_line_offset = serialize_fbs_dimension_ext_line_style(builder, s.ext_line) - text_style_offset = serialize_fbs_duc_text_style(builder, s.text_style) - symbols_offset = serialize_fbs_dimension_symbol_style(builder, s.symbols) - tolerance_offset = serialize_fbs_dimension_tolerance_style(builder, s.tolerance) - fit_offset = serialize_fbs_dimension_fit_style(builder, s.fit) - DucDimensionStyleStart(builder) - DucDimensionStyleAddDimLine(builder, dim_line_offset) - DucDimensionStyleAddExtLine(builder, ext_line_offset) - DucDimensionStyleAddTextStyle(builder, text_style_offset) - DucDimensionStyleAddSymbols(builder, symbols_offset) - DucDimensionStyleAddTolerance(builder, tolerance_offset) - DucDimensionStyleAddFit(builder, fit_offset) - return DucDimensionStyleEnd(builder) - -def serialize_fbs_fcf_layout_style(builder: flatbuffers.Builder, s: DS_FCFLayoutStyle) -> int: - FCFLayoutStyleStart(builder) - FCFLayoutStyleAddPadding(builder, s.padding) - FCFLayoutStyleAddSegmentSpacing(builder, s.segment_spacing) - FCFLayoutStyleAddRowSpacing(builder, s.row_spacing) - return FCFLayoutStyleEnd(builder) - -def serialize_fbs_fcf_symbol_style(builder: flatbuffers.Builder, s: DS_FCFSymbolStyle) -> int: - FCFSymbolStyleStart(builder) - FCFSymbolStyleAddScale(builder, s.scale) - return FCFSymbolStyleEnd(builder) - -def serialize_fbs_fcf_datum_style(builder: flatbuffers.Builder, s: DS_FCFDatumStyle) -> int: - FCFDatumStyleStart(builder) - if s.bracket_style is not None: - FCFDatumStyleAddBracketStyle(builder, s.bracket_style) - return FCFDatumStyleEnd(builder) - -def serialize_fbs_feature_control_frame_style(builder: flatbuffers.Builder, s: DS_DucFeatureControlFrameStyle) -> int: - text_style_offset = serialize_fbs_duc_text_style(builder, s.text_style) - layout_offset = serialize_fbs_fcf_layout_style(builder, s.layout) - symbols_offset = serialize_fbs_fcf_symbol_style(builder, s.symbols) - datum_offset = serialize_fbs_fcf_datum_style(builder, s.datum_style) - DucFeatureControlFrameStyleStart(builder) - DucFeatureControlFrameStyleAddTextStyle(builder, text_style_offset) - DucFeatureControlFrameStyleAddLayout(builder, layout_offset) - DucFeatureControlFrameStyleAddSymbols(builder, symbols_offset) - DucFeatureControlFrameStyleAddDatumStyle(builder, datum_offset) - return DucFeatureControlFrameStyleEnd(builder) - -def serialize_fbs_paragraph_formatting(builder: flatbuffers.Builder, p: DS_ParagraphFormatting) -> int: - tab_vec = 0 - if p.tab_stops: - ParagraphFormattingStartTabStopsVector(builder, len(p.tab_stops)) - for v in reversed(p.tab_stops): - builder.PrependFloat64(v) - tab_vec = builder.EndVector() - ParagraphFormattingStart(builder) - ParagraphFormattingAddFirstLineIndent(builder, p.first_line_indent) - ParagraphFormattingAddHangingIndent(builder, p.hanging_indent) - ParagraphFormattingAddLeftIndent(builder, p.left_indent) - ParagraphFormattingAddRightIndent(builder, p.right_indent) - ParagraphFormattingAddSpaceBefore(builder, p.space_before) - ParagraphFormattingAddSpaceAfter(builder, p.space_after) - if tab_vec: - ParagraphFormattingAddTabStops(builder, tab_vec) - return ParagraphFormattingEnd(builder) - -def serialize_fbs_stack_format_properties(builder: flatbuffers.Builder, p: DS_StackFormatProperties) -> int: - StackFormatPropertiesStart(builder) - StackFormatPropertiesAddUpperScale(builder, p.upper_scale) - StackFormatPropertiesAddLowerScale(builder, p.lower_scale) - if p.alignment is not None: - StackFormatPropertiesAddAlignment(builder, p.alignment) - return StackFormatPropertiesEnd(builder) - -def serialize_fbs_stack_format(builder: flatbuffers.Builder, s: DS_StackFormat) -> int: - chars_vec = 0 - if s.stack_chars: - # Create all strings first before starting the vector - char_offsets = [builder.CreateString(ch) for ch in s.stack_chars] - StackFormatStartStackCharsVector(builder, len(char_offsets)) - for off in reversed(char_offsets): - builder.PrependUOffsetTRelative(off) - chars_vec = builder.EndVector() - props_offset = serialize_fbs_stack_format_properties(builder, s.properties) - StackFormatStart(builder) - StackFormatAddAutoStack(builder, s.auto_stack) - if chars_vec: - StackFormatAddStackChars(builder, chars_vec) - StackFormatAddProperties(builder, props_offset) - return StackFormatEnd(builder) - -def serialize_fbs_doc_style(builder: flatbuffers.Builder, s: DS_DucDocStyle) -> int: - text_style_offset = serialize_fbs_duc_text_style(builder, s.text_style) - paragraph_offset = serialize_fbs_paragraph_formatting(builder, s.paragraph) - stack_format_offset = serialize_fbs_stack_format(builder, s.stack_format) - DucDocStyleStart(builder) - DucDocStyleAddTextStyle(builder, text_style_offset) - DucDocStyleAddParagraph(builder, paragraph_offset) - DucDocStyleAddStackFormat(builder, stack_format_offset) - return DucDocStyleEnd(builder) - -def serialize_fbs_viewport_style(builder: flatbuffers.Builder, s: DS_DucViewportStyle) -> int: - DucViewportStyleStart(builder) - DucViewportStyleAddScaleIndicatorVisible(builder, s.scale_indicator_visible) - return DucViewportStyleEnd(builder) - -def serialize_fbs_plot_style(builder: flatbuffers.Builder, s: DS_DucPlotStyle) -> int: - DucPlotStyleStart(builder) - return DucPlotStyleEnd(builder) - -def serialize_fbs_xray_style(builder: flatbuffers.Builder, s: DS_DucXRayStyle) -> int: - color_offset = builder.CreateString(s.color) - DucXRayStyleStart(builder) - DucXRayStyleAddColor(builder, color_offset) - return DucXRayStyleEnd(builder) - -# ============================================================================= -# Element definitions -# ============================================================================= - -def serialize_fbs_rectangle(builder: flatbuffers.Builder, el: DS_DucRectangleElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - DucRectangleElementStart(builder) - DucRectangleElementAddBase(builder, base_offset) - return DucRectangleElementEnd(builder) - -def serialize_fbs_polygon(builder: flatbuffers.Builder, el: DS_DucPolygonElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - DucPolygonElementStart(builder) - DucPolygonElementAddBase(builder, base_offset) - DucPolygonElementAddSides(builder, el.sides) - return DucPolygonElementEnd(builder) - -def serialize_fbs_ellipse(builder: flatbuffers.Builder, el: DS_DucEllipseElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - DucEllipseElementStart(builder) - DucEllipseElementAddBase(builder, base_offset) - DucEllipseElementAddRatio(builder, el.ratio) - DucEllipseElementAddStartAngle(builder, el.start_angle) - DucEllipseElementAddEndAngle(builder, el.end_angle) - DucEllipseElementAddShowAuxCrosshair(builder, el.show_aux_crosshair) - return DucEllipseElementEnd(builder) - -def serialize_fbs_embeddable(builder: flatbuffers.Builder, el: DS_DucEmbeddableElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - DucEmbeddableElementStart(builder) - DucEmbeddableElementAddBase(builder, base_offset) - return DucEmbeddableElementEnd(builder) - -def serialize_fbs_document_grid_config(builder: flatbuffers.Builder, config: DS_DocumentGridConfig) -> int: - DocumentGridConfigStart(builder) - DocumentGridConfigAddColumns(builder, config.columns) - DocumentGridConfigAddGapX(builder, config.gap_x) - DocumentGridConfigAddGapY(builder, config.gap_y) - DocumentGridConfigAddAlignItems(builder, config.align_items) - DocumentGridConfigAddFirstPageAlone(builder, config.first_page_alone) - DocumentGridConfigAddScale(builder, config.scale) - return DocumentGridConfigEnd(builder) - -def serialize_fbs_pdf(builder: flatbuffers.Builder, el: DS_DucPdfElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - file_id_offset = _str(builder, el.file_id) - grid_config_offset = serialize_fbs_document_grid_config(builder, el.grid_config) - DucPdfElementStart(builder) - DucPdfElementAddBase(builder, base_offset) - if file_id_offset: - DucPdfElementAddFileId(builder, file_id_offset) - DucPdfElementAddGridConfig(builder, grid_config_offset) - return DucPdfElementEnd(builder) - -def serialize_fbs_mermaid(builder: flatbuffers.Builder, el: DS_DucMermaidElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - source_offset = builder.CreateString(el.source) - theme_offset = _str(builder, el.theme) - svg_offset = _str(builder, el.svg_path) - DucMermaidElementStart(builder) - DucMermaidElementAddBase(builder, base_offset) - DucMermaidElementAddSource(builder, source_offset) - if theme_offset: - DucMermaidElementAddTheme(builder, theme_offset) - if svg_offset: - DucMermaidElementAddSvgPath(builder, svg_offset) - return DucMermaidElementEnd(builder) - -def serialize_fbs_table_column(builder: flatbuffers.Builder, col: DS_DucTableColumn) -> int: - id_offset = builder.CreateString(col.id) - style_overrides_offset = serialize_fbs_table_cell_style(builder, col.style_overrides) if col.style_overrides else 0 - DucTableColumnStart(builder) - DucTableColumnAddId(builder, id_offset) - DucTableColumnAddWidth(builder, col.width) - if style_overrides_offset: - DucTableColumnAddStyleOverrides(builder, style_overrides_offset) - return DucTableColumnEnd(builder) - -def serialize_fbs_table_row(builder: flatbuffers.Builder, row: DS_DucTableRow) -> int: - id_offset = builder.CreateString(row.id) - style_overrides_offset = serialize_fbs_table_cell_style(builder, row.style_overrides) if row.style_overrides else 0 - DucTableRowStart(builder) - DucTableRowAddId(builder, id_offset) - DucTableRowAddHeight(builder, row.height) - if style_overrides_offset: - DucTableRowAddStyleOverrides(builder, style_overrides_offset) - return DucTableRowEnd(builder) - -def serialize_fbs_table_cell_span(builder: flatbuffers.Builder, span: Optional[DS_DucTableCellSpan]) -> int: - if span is None: - return 0 - DucTableCellSpanStart(builder) - DucTableCellSpanAddColumns(builder, span.columns) - DucTableCellSpanAddRows(builder, span.rows) - return DucTableCellSpanEnd(builder) - -def serialize_fbs_table_cell(builder: flatbuffers.Builder, cell: DS_DucTableCell) -> int: - row_id_offset = builder.CreateString(cell.row_id) - column_id_offset = builder.CreateString(cell.column_id) - data_offset = builder.CreateString(cell.data) - span_offset = serialize_fbs_table_cell_span(builder, cell.span) - style_overrides_offset = serialize_fbs_table_cell_style(builder, cell.style_overrides) if cell.style_overrides else 0 - DucTableCellStart(builder) - DucTableCellAddRowId(builder, row_id_offset) - DucTableCellAddColumnId(builder, column_id_offset) - DucTableCellAddData(builder, data_offset) - if span_offset: DucTableCellAddSpan(builder, span_offset) - DucTableCellAddLocked(builder, cell.locked) - if style_overrides_offset: DucTableCellAddStyleOverrides(builder, style_overrides_offset) - return DucTableCellEnd(builder) - -def serialize_fbs_table_column_entry(builder: flatbuffers.Builder, entry: DS_DucTableColumnEntry) -> int: - key_offset = builder.CreateString(entry.key) - value_offset = serialize_fbs_table_column(builder, entry.value) - DucTableColumnEntryStart(builder) - DucTableColumnEntryAddKey(builder, key_offset) - DucTableColumnEntryAddValue(builder, value_offset) - return DucTableColumnEntryEnd(builder) - -def serialize_fbs_table_row_entry(builder: flatbuffers.Builder, entry: DS_DucTableRowEntry) -> int: - key_offset = builder.CreateString(entry.key) - value_offset = serialize_fbs_table_row(builder, entry.value) - DucTableRowEntryStart(builder) - DucTableRowEntryAddKey(builder, key_offset) - DucTableRowEntryAddValue(builder, value_offset) - return DucTableRowEntryEnd(builder) - -def serialize_fbs_table_cell_entry(builder: flatbuffers.Builder, entry: DS_DucTableCellEntry) -> int: - key_offset = builder.CreateString(entry.key) - value_offset = serialize_fbs_table_cell(builder, entry.value) - DucTableCellEntryStart(builder) - DucTableCellEntryAddKey(builder, key_offset) - DucTableCellEntryAddValue(builder, value_offset) - return DucTableCellEntryEnd(builder) - -def serialize_fbs_table_auto_size(builder: flatbuffers.Builder, a: DS_DucTableAutoSize) -> int: - DucTableAutoSizeStart(builder) - DucTableAutoSizeAddColumns(builder, a.columns) - DucTableAutoSizeAddRows(builder, a.rows) - return DucTableAutoSizeEnd(builder) - -def serialize_fbs_table(builder: flatbuffers.Builder, el: DS_DucTableElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - style_offset = serialize_fbs_table_style(builder, el.style) - - col_order_offsets = [builder.CreateString(x) for x in (el.column_order or [])] - DucTableElementStartColumnOrderVector(builder, len(col_order_offsets)) - for off in reversed(col_order_offsets): - builder.PrependUOffsetTRelative(off) - col_order_vec = builder.EndVector() - - row_order_offsets = [builder.CreateString(x) for x in (el.row_order or [])] - DucTableElementStartRowOrderVector(builder, len(row_order_offsets)) - for off in reversed(row_order_offsets): - builder.PrependUOffsetTRelative(off) - row_order_vec = builder.EndVector() - - col_entries_offsets = [serialize_fbs_table_column_entry(builder, c) for c in (el.columns or [])] - DucTableElementStartColumnsVector(builder, len(col_entries_offsets)) - for off in reversed(col_entries_offsets): - builder.PrependUOffsetTRelative(off) - columns_vec = builder.EndVector() - - row_entries_offsets = [serialize_fbs_table_row_entry(builder, r) for r in (el.rows or [])] - DucTableElementStartRowsVector(builder, len(row_entries_offsets)) - for off in reversed(row_entries_offsets): - builder.PrependUOffsetTRelative(off) - rows_vec = builder.EndVector() - - cell_entries_offsets = [serialize_fbs_table_cell_entry(builder, c) for c in (el.cells or [])] - DucTableElementStartCellsVector(builder, len(cell_entries_offsets)) - for off in reversed(cell_entries_offsets): - builder.PrependUOffsetTRelative(off) - cells_vec = builder.EndVector() - - auto_size_offset = serialize_fbs_table_auto_size(builder, el.auto_size) - - DucTableElementStart(builder) - DucTableElementAddBase(builder, base_offset) - DucTableElementAddStyle(builder, style_offset) - DucTableElementAddColumnOrder(builder, col_order_vec) - DucTableElementAddRowOrder(builder, row_order_vec) - DucTableElementAddColumns(builder, columns_vec) - DucTableElementAddRows(builder, rows_vec) - DucTableElementAddCells(builder, cells_vec) - DucTableElementAddHeaderRowCount(builder, el.header_row_count) - DucTableElementAddAutoSize(builder, auto_size_offset) - return DucTableElementEnd(builder) - -def serialize_fbs_image_crop(builder: flatbuffers.Builder, crop: Optional[DS_ImageCrop]) -> int: - if crop is None: - return 0 - ImageCropStart(builder) - ImageCropAddX(builder, crop.x) - ImageCropAddY(builder, crop.y) - ImageCropAddWidth(builder, crop.width) - ImageCropAddHeight(builder, crop.height) - ImageCropAddNaturalWidth(builder, crop.natural_width) - ImageCropAddNaturalHeight(builder, crop.natural_height) - return ImageCropEnd(builder) - -def serialize_fbs_image(builder: flatbuffers.Builder, el: DS_DucImageElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - file_id_offset = _str(builder, el.file_id) - - scale_vec = 0 - if el.scale is not None and len(el.scale) > 0: - DucImageElementStartScaleVector(builder, len(el.scale)) - for v in reversed(el.scale): - builder.PrependFloat64(v) - scale_vec = builder.EndVector() - - crop_offset = serialize_fbs_image_crop(builder, el.crop) - filter_offset = serialize_fbs_duc_image_filter(builder, el.filter) - - DucImageElementStart(builder) - DucImageElementAddBase(builder, base_offset) - if file_id_offset: DucImageElementAddFileId(builder, file_id_offset) - if el.status is not None: DucImageElementAddStatus(builder, el.status) - if scale_vec: DucImageElementAddScale(builder, scale_vec) - if crop_offset: DucImageElementAddCrop(builder, crop_offset) - if filter_offset: DucImageElementAddFilter(builder, filter_offset) - return DucImageElementEnd(builder) - -def serialize_fbs_primary_units(builder: flatbuffers.Builder, pu: Optional["DS_PrimaryUnits"]) -> int: - # Implemented in Standards section (Part 2/5), but present here to satisfy forward reference - # We return 0 here and will override the function after definition in Part 2. - return 0 - -def serialize_fbs_text_dynamic_source(builder: flatbuffers.Builder, src: DS_DucTextDynamicSource) -> int: - # Determine type from underlying source value - source = src.source - if isinstance(source, DS_DucTextDynamicElementSource): - typ = FBS_DucTextDynamicSourceData.DucTextDynamicElementSource - DucTextDynamicElementSourceStart(builder) - DucTextDynamicElementSourceAddElementId(builder, builder.CreateString(source.element_id)) - DucTextDynamicElementSourceAddProperty(builder, source.property) - src_offset = DucTextDynamicElementSourceEnd(builder) - src_type_enum = TEXT_FIELD_SOURCE_TYPE.ELEMENT - elif isinstance(source, DS_DucTextDynamicDictionarySource): - typ = FBS_DucTextDynamicSourceData.DucTextDynamicDictionarySource - DucTextDynamicDictionarySourceStart(builder) - DucTextDynamicDictionarySourceAddKey(builder, builder.CreateString(source.key)) - src_offset = DucTextDynamicDictionarySourceEnd(builder) - src_type_enum = TEXT_FIELD_SOURCE_TYPE.DICTIONARY - else: - typ = 0 - src_offset = 0 - src_type_enum = 0 - - DucTextDynamicSourceStart(builder) - if src_type_enum: - DucTextDynamicSourceAddTextSourceType(builder, src_type_enum) - if typ and src_offset: - DucTextDynamicSourceAddSourceType(builder, typ) - DucTextDynamicSourceAddSource(builder, src_offset) - return DucTextDynamicSourceEnd(builder) - -def serialize_fbs_text_dynamic_part(builder: flatbuffers.Builder, part: DS_DucTextDynamicPart) -> int: - tag_offset = builder.CreateString(part.tag) - cached_value_offset = builder.CreateString(part.cached_value) - formatting_offset = serialize_fbs_primary_units(builder, part.formatting) if part.formatting else 0 - src_offset = serialize_fbs_text_dynamic_source(builder, part.source) - DucTextDynamicPartStart(builder) - DucTextDynamicPartAddTag(builder, tag_offset) - DucTextDynamicPartAddSource(builder, src_offset) - if formatting_offset: - DucTextDynamicPartAddFormatting(builder, formatting_offset) - DucTextDynamicPartAddCachedValue(builder, cached_value_offset) - return DucTextDynamicPartEnd(builder) - -def serialize_fbs_text(builder: flatbuffers.Builder, el: DS_DucTextElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - style_offset = serialize_fbs_duc_text_style(builder, el.style) - text_offset = builder.CreateString(el.text) - dynamic_offsets = [serialize_fbs_text_dynamic_part(builder, p) for p in (el.dynamic or [])] - dynamic_vec = 0 - if dynamic_offsets: - DucTextElementStartDynamicVector(builder, len(dynamic_offsets)) - for off in reversed(dynamic_offsets): - builder.PrependUOffsetTRelative(off) - dynamic_vec = builder.EndVector() - container_id_offset = _str(builder, el.container_id) - original_text_offset = builder.CreateString(el.original_text) - DucTextElementStart(builder) - DucTextElementAddBase(builder, base_offset) - DucTextElementAddStyle(builder, style_offset) - DucTextElementAddText(builder, text_offset) - if dynamic_vec: - DucTextElementAddDynamic(builder, dynamic_vec) - DucTextElementAddAutoResize(builder, el.auto_resize) - if container_id_offset: - DucTextElementAddContainerId(builder, container_id_offset) - DucTextElementAddOriginalText(builder, original_text_offset) - return DucTextElementEnd(builder) - -def serialize_fbs_linear(builder: flatbuffers.Builder, el: DS_DucLinearElement) -> int: - linear_base_offset = serialize_fbs_duc_linear_element_base(builder, el.linear_base) - DucLinearElementStart(builder) - DucLinearElementAddLinearBase(builder, linear_base_offset) - DucLinearElementAddWipeoutBelow(builder, el.wipeout_below) - return DucLinearElementEnd(builder) - -def serialize_fbs_arrow(builder: flatbuffers.Builder, el: DS_DucArrowElement) -> int: - linear_base_offset = serialize_fbs_duc_linear_element_base(builder, el.linear_base) - DucArrowElementStart(builder) - DucArrowElementAddLinearBase(builder, linear_base_offset) - DucArrowElementAddElbowed(builder, el.elbowed) - return DucArrowElementEnd(builder) - -def serialize_fbs_freedraw_ends(builder: flatbuffers.Builder, e: Optional[DS_DucFreeDrawEnds]) -> int: - if e is None: - return 0 - easing_offset = builder.CreateString(e.easing) - DucFreeDrawEndsStart(builder) - DucFreeDrawEndsAddCap(builder, e.cap) - DucFreeDrawEndsAddTaper(builder, e.taper) - DucFreeDrawEndsAddEasing(builder, easing_offset) - return DucFreeDrawEndsEnd(builder) - -def serialize_fbs_freedraw(builder: flatbuffers.Builder, el: DS_DucFreeDrawElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - points_offsets = [serialize_fbs_duc_point(builder, p) for p in (el.points or [])] - DucFreeDrawElementStartPointsVector(builder, len(points_offsets)) - for off in reversed(points_offsets): - builder.PrependUOffsetTRelative(off) - points_vec = builder.EndVector() - - pressures_vec = 0 - if el.pressures is not None and len(el.pressures) > 0: - DucFreeDrawElementStartPressuresVector(builder, len(el.pressures)) - for p in reversed(el.pressures): - builder.PrependFloat32(p) - pressures_vec = builder.EndVector() - - last_point_offset = serialize_fbs_duc_point(builder, el.last_committed_point) - start_offset = serialize_fbs_freedraw_ends(builder, el.start) - end_offset = serialize_fbs_freedraw_ends(builder, el.end) - svg_offset = _str(builder, el.svg_path) - easing_offset = builder.CreateString(el.easing) - - DucFreeDrawElementStart(builder) - DucFreeDrawElementAddBase(builder, base_offset) - DucFreeDrawElementAddPoints(builder, points_vec) - DucFreeDrawElementAddSize(builder, el.size) - DucFreeDrawElementAddThinning(builder, el.thinning) - DucFreeDrawElementAddSmoothing(builder, el.smoothing) - DucFreeDrawElementAddStreamline(builder, el.streamline) - DucFreeDrawElementAddEasing(builder, easing_offset) - if start_offset: DucFreeDrawElementAddStart(builder, start_offset) - if end_offset: DucFreeDrawElementAddEnd(builder, end_offset) - if pressures_vec: DucFreeDrawElementAddPressures(builder, pressures_vec) - DucFreeDrawElementAddSimulatePressure(builder, el.simulate_pressure) - if last_point_offset: DucFreeDrawElementAddLastCommittedPoint(builder, last_point_offset) - if svg_offset: DucFreeDrawElementAddSvgPath(builder, svg_offset) - return DucFreeDrawElementEnd(builder) - -def serialize_fbs_block_duplication_array(builder: flatbuffers.Builder, d: Optional[DS_DucBlockDuplicationArray]) -> int: - if d is None: - return 0 - DucBlockDuplicationArrayStart(builder) - DucBlockDuplicationArrayAddRows(builder, d.rows) - DucBlockDuplicationArrayAddCols(builder, d.cols) - DucBlockDuplicationArrayAddRowSpacing(builder, d.row_spacing) - DucBlockDuplicationArrayAddColSpacing(builder, d.col_spacing) - return DucBlockDuplicationArrayEnd(builder) - -def serialize_fbs_block_instance(builder: flatbuffers.Builder, el: DS_DucBlockInstance) -> int: - block_id_offset = builder.CreateString(el.block_id) - element_overrides_offsets = [serialize_fbs_string_value_entry(builder, o) for o in (el.element_overrides or [])] - elem_overrides_vec = 0 - if element_overrides_offsets: - DucBlockInstanceStartElementOverridesVector(builder, len(element_overrides_offsets)) - for off in reversed(element_overrides_offsets): - builder.PrependUOffsetTRelative(off) - elem_overrides_vec = builder.EndVector() - - attribute_values_offsets = [serialize_fbs_string_value_entry(builder, o) for o in (el.attribute_values or [])] - attr_values_vec = 0 - if attribute_values_offsets: - DucBlockInstanceStartAttributeValuesVector(builder, len(attribute_values_offsets)) - for off in reversed(attribute_values_offsets): - builder.PrependUOffsetTRelative(off) - attr_values_vec = builder.EndVector() - - dup_offset = serialize_fbs_block_duplication_array(builder, el.duplication_array) - id_offset = builder.CreateString(el.id) - - DucBlockInstanceStart(builder) - DucBlockInstanceAddId(builder, id_offset) - DucBlockInstanceAddBlockId(builder, block_id_offset) - DucBlockInstanceAddVersion(builder, el.version) - if elem_overrides_vec: DucBlockInstanceAddElementOverrides(builder, elem_overrides_vec) - if attr_values_vec: DucBlockInstanceAddAttributeValues(builder, attr_values_vec) - if dup_offset: DucBlockInstanceAddDuplicationArray(builder, dup_offset) - return DucBlockInstanceEnd(builder) - -def serialize_fbs_frame(builder: flatbuffers.Builder, el: DS_DucFrameElement) -> int: - seb_offset = serialize_fbs_duc_stack_element_base(builder, el.stack_element_base) - DucFrameElementStart(builder) - DucFrameElementAddStackElementBase(builder, seb_offset) - return DucFrameElementEnd(builder) - -def serialize_fbs_plot(builder: flatbuffers.Builder, el: DS_DucPlotElement) -> int: - seb_offset = serialize_fbs_duc_stack_element_base(builder, el.stack_element_base) - style_offset = serialize_fbs_plot_style(builder, el.style) - margins_offset = serialize_fbs_margins(builder, el.layout.margins) - PlotLayoutStart(builder) - PlotLayoutAddMargins(builder, margins_offset) - layout_offset = PlotLayoutEnd(builder) - DucPlotElementStart(builder) - DucPlotElementAddStackElementBase(builder, seb_offset) - DucPlotElementAddStyle(builder, style_offset) - DucPlotElementAddLayout(builder, layout_offset) - return DucPlotElementEnd(builder) - -def serialize_fbs_viewport(builder: flatbuffers.Builder, el: DS_DucViewportElement) -> int: - linear_base_offset = serialize_fbs_duc_linear_element_base(builder, el.linear_base) - stack_base_offset = serialize_fbs_duc_stack_base(builder, el.stack_base) - style_offset = serialize_fbs_viewport_style(builder, el.style) - view_offset = serialize_fbs_duc_view(builder, el.view) - frozen_offsets = [builder.CreateString(s) for s in (el.frozen_group_ids or [])] - frozen_vec = 0 - if frozen_offsets: - DucViewportElementStartFrozenGroupIdsVector(builder, len(frozen_offsets)) - for off in reversed(frozen_offsets): - builder.PrependUOffsetTRelative(off) - frozen_vec = builder.EndVector() - standard_override_offset = _str(builder, el.standard_override) - - DucViewportElementStart(builder) - DucViewportElementAddLinearBase(builder, linear_base_offset) - DucViewportElementAddStackBase(builder, stack_base_offset) - DucViewportElementAddStyle(builder, style_offset) - DucViewportElementAddView(builder, view_offset) - DucViewportElementAddScale(builder, el.scale) - if el.shade_plot is not None: - DucViewportElementAddShadePlot(builder, el.shade_plot) - if frozen_vec: - DucViewportElementAddFrozenGroupIds(builder, frozen_vec) - if standard_override_offset: - DucViewportElementAddStandardOverride(builder, standard_override_offset) - return DucViewportElementEnd(builder) - -def serialize_fbs_xray(builder: flatbuffers.Builder, el: DS_DucXRayElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - style_offset = serialize_fbs_xray_style(builder, el.style) - origin_offset = serialize_fbs_duc_point(builder, el.origin) - direction_offset = serialize_fbs_duc_point(builder, el.direction) - DucXRayElementStart(builder) - DucXRayElementAddBase(builder, base_offset) - DucXRayElementAddStyle(builder, style_offset) - DucXRayElementAddOrigin(builder, origin_offset) - DucXRayElementAddDirection(builder, direction_offset) - DucXRayElementAddStartFromOrigin(builder, el.start_from_origin) - return DucXRayElementEnd(builder) - -def serialize_fbs_leader_content(builder: flatbuffers.Builder, c: Optional[DS_LeaderContent]) -> int: - if c is None: - return 0 - # Determine union content - content_union_type = 0 - content_union_offset = 0 - leader_content_type = 0 - - if isinstance(c.content, DS_LeaderTextBlockContent): - content_union_type = FBS_LeaderContentData.LeaderTextBlockContent - leader_content_type = LEADER_CONTENT_TYPE.TEXT - text_offset = builder.CreateString(c.content.text) - LeaderTextBlockContentStart(builder) - LeaderTextBlockContentAddText(builder, text_offset) - content_union_offset = LeaderTextBlockContentEnd(builder) - elif isinstance(c.content, DS_LeaderBlockContent): - content_union_type = FBS_LeaderContentData.LeaderBlockContent - leader_content_type = LEADER_CONTENT_TYPE.BLOCK - block_id_offset = builder.CreateString(c.content.block_id) - attr_offsets = [serialize_fbs_string_value_entry(builder, sv) for sv in (c.content.attribute_values or [])] - elem_offsets = [serialize_fbs_string_value_entry(builder, sv) for sv in (c.content.element_overrides or [])] - attr_vec = 0 - if attr_offsets: - LeaderBlockContentStartAttributeValuesVector(builder, len(attr_offsets)) - for off in reversed(attr_offsets): - builder.PrependUOffsetTRelative(off) - attr_vec = builder.EndVector() - elem_vec = 0 - if elem_offsets: - LeaderBlockContentStartElementOverridesVector(builder, len(elem_offsets)) - for off in reversed(elem_offsets): - builder.PrependUOffsetTRelative(off) - elem_vec = builder.EndVector() - LeaderBlockContentStart(builder) - LeaderBlockContentAddBlockId(builder, block_id_offset) - if attr_vec: LeaderBlockContentAddAttributeValues(builder, attr_vec) - if elem_vec: LeaderBlockContentAddElementOverrides(builder, elem_vec) - content_union_offset = LeaderBlockContentEnd(builder) - - LeaderContentStart(builder) - if leader_content_type: - LeaderContentAddLeaderContentType(builder, leader_content_type) - if content_union_type and content_union_offset: - LeaderContentAddContentType(builder, content_union_type) - LeaderContentAddContent(builder, content_union_offset) - return LeaderContentEnd(builder) - -def serialize_fbs_leader(builder: flatbuffers.Builder, el: DS_DucLeaderElement) -> int: - linear_base_offset = serialize_fbs_duc_linear_element_base(builder, el.linear_base) - style_offset = serialize_fbs_leader_style(builder, el.style) - content_offset = serialize_fbs_leader_content(builder, el.content) - DucLeaderElementStart(builder) - DucLeaderElementAddLinearBase(builder, linear_base_offset) - DucLeaderElementAddStyle(builder, style_offset) - if content_offset: - DucLeaderElementAddContent(builder, content_offset) - # Create the struct right before adding it to avoid StructIsNotInlineError - anchor_struct = CreateGeometricPoint(builder, el.content_anchor.x, el.content_anchor.y) - DucLeaderElementAddContentAnchor(builder, anchor_struct) - return DucLeaderElementEnd(builder) - -def serialize_fbs_dimension_definition_points(builder: flatbuffers.Builder, d: DS_DimensionDefinitionPoints) -> int: - DimensionDefinitionPointsStart(builder) - if d.origin1: - DimensionDefinitionPointsAddOrigin1(builder, CreateGeometricPoint(builder, d.origin1.x, d.origin1.y)) - if d.origin2: - DimensionDefinitionPointsAddOrigin2(builder, CreateGeometricPoint(builder, d.origin2.x, d.origin2.y)) - if d.location: - DimensionDefinitionPointsAddLocation(builder, CreateGeometricPoint(builder, d.location.x, d.location.y)) - if d.center: - DimensionDefinitionPointsAddCenter(builder, CreateGeometricPoint(builder, d.center.x, d.center.y)) - if d.jog: - DimensionDefinitionPointsAddJog(builder, CreateGeometricPoint(builder, d.jog.x, d.jog.y)) - return DimensionDefinitionPointsEnd(builder) - -def serialize_fbs_dimension_bindings(builder: flatbuffers.Builder, b: Optional[DS_DimensionBindings]) -> int: - if b is None: - return 0 - origin1_offset = serialize_fbs_duc_point_binding(builder, b.origin1) - origin2_offset = serialize_fbs_duc_point_binding(builder, b.origin2) - center_offset = serialize_fbs_duc_point_binding(builder, b.center) - DimensionBindingsStart(builder) - if origin1_offset: DimensionBindingsAddOrigin1(builder, origin1_offset) - if origin2_offset: DimensionBindingsAddOrigin2(builder, origin2_offset) - if center_offset: DimensionBindingsAddCenter(builder, center_offset) - return DimensionBindingsEnd(builder) - -def serialize_fbs_dimension_baseline(builder: flatbuffers.Builder, b: Optional[DS_DimensionBaselineData]) -> int: - if b is None or not b.base_dimension_id: - return 0 - base_id_offset = builder.CreateString(b.base_dimension_id) - DimensionBaselineDataStart(builder) - DimensionBaselineDataAddBaseDimensionId(builder, base_id_offset) - return DimensionBaselineDataEnd(builder) - -def serialize_fbs_dimension_continue(builder: flatbuffers.Builder, c: Optional[DS_DimensionContinueData]) -> int: - if c is None or not c.continue_from_dimension_id: - return 0 - cont_id_offset = builder.CreateString(c.continue_from_dimension_id) - DimensionContinueDataStart(builder) - DimensionContinueDataAddContinueFromDimensionId(builder, cont_id_offset) - return DimensionContinueDataEnd(builder) - -def serialize_fbs_datum_reference(builder: flatbuffers.Builder, d: DS_DatumReference) -> int: - letters_offset = builder.CreateString(d.letters) - DatumReferenceStart(builder) - DatumReferenceAddLetters(builder, letters_offset) - if d.modifier is not None: - DatumReferenceAddModifier(builder, d.modifier) - return DatumReferenceEnd(builder) - -def serialize_fbs_tolerance_clause(builder: flatbuffers.Builder, t: DS_ToleranceClause) -> int: - value_offset = builder.CreateString(t.value) - fm_vec = 0 - if t.feature_modifiers: - ToleranceClauseStartFeatureModifiersVector(builder, len(t.feature_modifiers)) - for m in reversed(t.feature_modifiers): - builder.PrependUint8(m) - fm_vec = builder.EndVector() - ToleranceClauseStart(builder) - ToleranceClauseAddValue(builder, value_offset) - if t.zone_type is not None: - ToleranceClauseAddZoneType(builder, t.zone_type) - if fm_vec: - ToleranceClauseAddFeatureModifiers(builder, fm_vec) - if t.material_condition is not None: - ToleranceClauseAddMaterialCondition(builder, t.material_condition) - return ToleranceClauseEnd(builder) - -def serialize_fbs_fcf_segment(builder: flatbuffers.Builder, seg: DS_FeatureControlFrameSegment) -> int: - tol_offset = serialize_fbs_tolerance_clause(builder, seg.tolerance) - datum_offsets = [serialize_fbs_datum_reference(builder, d) for d in (seg.datums or [])] - datums_vec = 0 - if datum_offsets: - FeatureControlFrameSegmentStartDatumsVector(builder, len(datum_offsets)) - for off in reversed(datum_offsets): - builder.PrependUOffsetTRelative(off) - datums_vec = builder.EndVector() - FeatureControlFrameSegmentStart(builder) - if seg.symbol is not None: - FeatureControlFrameSegmentAddSymbol(builder, seg.symbol) - FeatureControlFrameSegmentAddTolerance(builder, tol_offset) - if datums_vec: - FeatureControlFrameSegmentAddDatums(builder, datums_vec) - return FeatureControlFrameSegmentEnd(builder) - -def serialize_fbs_fcf_between_modifier(builder: flatbuffers.Builder, b: Optional[DS_FCFBetweenModifier]) -> int: - if b is None: - return 0 - start_offset = builder.CreateString(b.start) - end_offset = builder.CreateString(b.end) - FCFBetweenModifierStart(builder) - FCFBetweenModifierAddStart(builder, start_offset) - FCFBetweenModifierAddEnd(builder, end_offset) - return FCFBetweenModifierEnd(builder) - -def serialize_fbs_fcf_projected_zone(builder: flatbuffers.Builder, p: Optional[DS_FCFProjectedZoneModifier]) -> int: - if p is None: - return 0 - FCFProjectedZoneModifierStart(builder) - FCFProjectedZoneModifierAddValue(builder, p.value) - return FCFProjectedZoneModifierEnd(builder) - -def serialize_fbs_fcf_frame_modifiers(builder: flatbuffers.Builder, m: Optional[DS_FCFFrameModifiers]) -> int: - if m is None: - return 0 - between_offset = serialize_fbs_fcf_between_modifier(builder, m.between) - proj_offset = serialize_fbs_fcf_projected_zone(builder, m.projected_tolerance_zone) - FCFFrameModifiersStart(builder) - if m.all_around is not None: - FCFFrameModifiersAddAllAround(builder, m.all_around) - if m.all_over is not None: - FCFFrameModifiersAddAllOver(builder, m.all_over) - if m.continuous_feature is not None: - FCFFrameModifiersAddContinuousFeature(builder, m.continuous_feature) - if between_offset: - FCFFrameModifiersAddBetween(builder, between_offset) - if proj_offset: - FCFFrameModifiersAddProjectedToleranceZone(builder, proj_offset) - return FCFFrameModifiersEnd(builder) - -def serialize_fbs_fcf_datum_definition(builder: flatbuffers.Builder, d: Optional[DS_FCFDatumDefinition]) -> int: - if d is None: - return 0 - letter_offset = builder.CreateString(d.letter) - binding_offset = serialize_fbs_duc_point_binding(builder, d.feature_binding) - FCFDatumDefinitionStart(builder) - FCFDatumDefinitionAddLetter(builder, letter_offset) - if binding_offset: - FCFDatumDefinitionAddFeatureBinding(builder, binding_offset) - return FCFDatumDefinitionEnd(builder) - -def serialize_fbs_fcf_segment_row(builder: flatbuffers.Builder, row: DS_FCFSegmentRow) -> int: - seg_offsets = [serialize_fbs_fcf_segment(builder, s) for s in (row.segments or [])] - FCFSegmentRowStartSegmentsVector(builder, len(seg_offsets)) - for off in reversed(seg_offsets): - builder.PrependUOffsetTRelative(off) - segs_vec = builder.EndVector() - FCFSegmentRowStart(builder) - FCFSegmentRowAddSegments(builder, segs_vec) - return FCFSegmentRowEnd(builder) - -def serialize_fbs_feature_control_frame(builder: flatbuffers.Builder, el: DS_DucFeatureControlFrameElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - style_offset = serialize_fbs_feature_control_frame_style(builder, el.style) - row_offsets = [serialize_fbs_fcf_segment_row(builder, r) for r in (el.rows or [])] - DucFeatureControlFrameElementStartRowsVector(builder, len(row_offsets)) - for off in reversed(row_offsets): - builder.PrependUOffsetTRelative(off) - rows_vec = builder.EndVector() - modifiers_offset = serialize_fbs_fcf_frame_modifiers(builder, el.frame_modifiers) - leader_id_offset = _str(builder, el.leader_element_id) - datum_def_offset = serialize_fbs_fcf_datum_definition(builder, el.datum_definition) - DucFeatureControlFrameElementStart(builder) - DucFeatureControlFrameElementAddBase(builder, base_offset) - DucFeatureControlFrameElementAddStyle(builder, style_offset) - DucFeatureControlFrameElementAddRows(builder, rows_vec) - if modifiers_offset: - DucFeatureControlFrameElementAddFrameModifiers(builder, modifiers_offset) - if leader_id_offset: - DucFeatureControlFrameElementAddLeaderElementId(builder, leader_id_offset) - if datum_def_offset: - DucFeatureControlFrameElementAddDatumDefinition(builder, datum_def_offset) - return DucFeatureControlFrameElementEnd(builder) - -def serialize_fbs_text_column(builder: flatbuffers.Builder, c: DS_TextColumn) -> int: - TextColumnStart(builder) - TextColumnAddWidth(builder, c.width) - TextColumnAddGutter(builder, c.gutter) - return TextColumnEnd(builder) - -def serialize_fbs_column_layout(builder: flatbuffers.Builder, c: DS_ColumnLayout) -> int: - defs_offsets = [serialize_fbs_text_column(builder, d) for d in (c.definitions or [])] - ColumnLayoutStartDefinitionsVector(builder, len(defs_offsets)) - for off in reversed(defs_offsets): - builder.PrependUOffsetTRelative(off) - defs_vec = builder.EndVector() - ColumnLayoutStart(builder) - if c.type is not None: - ColumnLayoutAddType(builder, c.type) - ColumnLayoutAddDefinitions(builder, defs_vec) - ColumnLayoutAddAutoHeight(builder, c.auto_height) - return ColumnLayoutEnd(builder) - -def serialize_fbs_doc(builder: flatbuffers.Builder, el: DS_DucDocElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - style_offset = serialize_fbs_doc_style(builder, el.style) - text_offset = builder.CreateString(el.text) - dynamic_offsets = [serialize_fbs_text_dynamic_part(builder, p) for p in (el.dynamic or [])] - dyn_vec = 0 - if dynamic_offsets: - DucDocElementStartDynamicVector(builder, len(dynamic_offsets)) - for off in reversed(dynamic_offsets): - builder.PrependUOffsetTRelative(off) - dyn_vec = builder.EndVector() - columns_offset = serialize_fbs_column_layout(builder, el.columns) - file_id_offset = _str(builder, el.file_id) - grid_config_offset = serialize_fbs_document_grid_config(builder, el.grid_config) - DucDocElementStart(builder) - DucDocElementAddBase(builder, base_offset) - DucDocElementAddStyle(builder, style_offset) - DucDocElementAddText(builder, text_offset) - if dyn_vec: DucDocElementAddDynamic(builder, dyn_vec) - if el.flow_direction is not None: - DucDocElementAddFlowDirection(builder, el.flow_direction) - DucDocElementAddColumns(builder, columns_offset) - DucDocElementAddAutoResize(builder, el.auto_resize) - if file_id_offset: - DucDocElementAddFileId(builder, file_id_offset) - DucDocElementAddGridConfig(builder, grid_config_offset) - return DucDocElementEnd(builder) - -def serialize_fbs_parametric_source(builder: flatbuffers.Builder, s: DS_ParametricSource) -> int: - code_offset = _str(builder, s.code) - file_id_offset = _str(builder, s.file_id) - ParametricSourceStart(builder) - if s.type is not None: - ParametricSourceAddType(builder, s.type) - if code_offset: - ParametricSourceAddCode(builder, code_offset) - if file_id_offset: - ParametricSourceAddFileId(builder, file_id_offset) - return ParametricSourceEnd(builder) - -def serialize_fbs_parametric(builder: flatbuffers.Builder, el: DS_DucParametricElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - source_offset = serialize_fbs_parametric_source(builder, el.source) - DucParametricElementStart(builder) - DucParametricElementAddBase(builder, base_offset) - DucParametricElementAddSource(builder, source_offset) - return DucParametricElementEnd(builder) - -def serialize_fbs_model(builder: flatbuffers.Builder, el: DS_DucModelElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - source_offset = builder.CreateString(el.source) - svg_offset = _str(builder, el.svg_path) - file_ids_vec = 0 - if el.file_ids: - DucModelElementStartFileIdsVector(builder, len(el.file_ids)) - for fid in reversed(el.file_ids): - builder.PrependUOffsetTRelative(builder.CreateString(fid)) - file_ids_vec = builder.EndVector() - DucModelElementStart(builder) - DucModelElementAddBase(builder, base_offset) - DucModelElementAddSource(builder, source_offset) - if svg_offset: - DucModelElementAddSvgPath(builder, svg_offset) - if file_ids_vec: - DucModelElementAddFileIds(builder, file_ids_vec) - return DucModelElementEnd(builder) - -# ============================================================================= -# Element union and wrapper -# ============================================================================= - -ELEMENT_TYPE_MAP = { - DS_DucRectangleElement: FBS_Element.DucRectangleElement, - DS_DucPolygonElement: FBS_Element.DucPolygonElement, - DS_DucEllipseElement: FBS_Element.DucEllipseElement, - DS_DucEmbeddableElement: FBS_Element.DucEmbeddableElement, - DS_DucPdfElement: FBS_Element.DucPdfElement, - DS_DucMermaidElement: FBS_Element.DucMermaidElement, - DS_DucTableElement: FBS_Element.DucTableElement, - DS_DucImageElement: FBS_Element.DucImageElement, - DS_DucTextElement: FBS_Element.DucTextElement, - DS_DucLinearElement: FBS_Element.DucLinearElement, - DS_DucArrowElement: FBS_Element.DucArrowElement, - DS_DucFreeDrawElement: FBS_Element.DucFreeDrawElement, - DS_DucFrameElement: FBS_Element.DucFrameElement, - DS_DucPlotElement: FBS_Element.DucPlotElement, - DS_DucViewportElement: FBS_Element.DucViewportElement, - DS_DucXRayElement: FBS_Element.DucXRayElement, - DS_DucLeaderElement: FBS_Element.DucLeaderElement, - DS_DucDimensionElement: FBS_Element.DucDimensionElement, - DS_DucFeatureControlFrameElement: FBS_Element.DucFeatureControlFrameElement, - DS_DucDocElement: FBS_Element.DucDocElement, - DS_DucParametricElement: FBS_Element.DucParametricElement, - DS_DucModelElement: FBS_Element.DucModelElement, -} - +logger = logging.getLogger(__name__) -ELEMENT_SERIALIZER_MAP = { - DS_DucRectangleElement: serialize_fbs_rectangle, - DS_DucPolygonElement: serialize_fbs_polygon, - DS_DucEllipseElement: serialize_fbs_ellipse, - DS_DucEmbeddableElement: serialize_fbs_embeddable, - DS_DucPdfElement: serialize_fbs_pdf, - DS_DucMermaidElement: serialize_fbs_mermaid, - DS_DucTableElement: serialize_fbs_table, - DS_DucImageElement: serialize_fbs_image, - DS_DucTextElement: serialize_fbs_text, - DS_DucLinearElement: serialize_fbs_linear, - DS_DucArrowElement: serialize_fbs_arrow, - DS_DucFreeDrawElement: serialize_fbs_freedraw, - DS_DucFrameElement: serialize_fbs_frame, - DS_DucPlotElement: serialize_fbs_plot, - DS_DucViewportElement: serialize_fbs_viewport, - DS_DucXRayElement: serialize_fbs_xray, - DS_DucLeaderElement: serialize_fbs_leader, - DS_DucDimensionElement: None, # defined below - DS_DucFeatureControlFrameElement: serialize_fbs_feature_control_frame, - DS_DucDocElement: serialize_fbs_doc, - DS_DucParametricElement: serialize_fbs_parametric, - DS_DucModelElement: serialize_fbs_model, +# Map Python element class names → Rust serde type tag strings. +_ELEMENT_CLASS_TO_TYPE: Dict[str, str] = { + "DucRectangleElement": "rectangle", + "DucPolygonElement": "polygon", + "DucEllipseElement": "ellipse", + "DucEmbeddableElement": "embeddable", + "DucPdfElement": "pdf", + "DucTableElement": "table", + "DucImageElement": "image", + "DucTextElement": "text", + "DucLinearElement": "line", + "DucArrowElement": "arrow", + "DucFreeDrawElement": "freedraw", + "DucFrameElement": "frame", + "DucPlotElement": "plot", + "DucDocElement": "doc", + "DucModelElement": "model", } -def serialize_fbs_dimension(builder: flatbuffers.Builder, el: DS_DucDimensionElement) -> int: - base_offset = serialize_fbs_duc_element_base(builder, el.base) - style_offset = serialize_fbs_dimension_style(builder, el.style) - def_points_offset = serialize_fbs_dimension_definition_points(builder, el.definition_points) - bindings_offset = serialize_fbs_dimension_bindings(builder, el.bindings) - text_override_offset = _str(builder, el.text_override) - text_pos_struct = 0 - if el.text_position: - text_pos_struct = CreateGeometricPoint(builder, el.text_position.x, el.text_position.y) - tol_override_offset = serialize_fbs_dimension_tolerance_style(builder, el.tolerance_override) - baseline_offset = serialize_fbs_dimension_baseline(builder, el.baseline_data) - continue_offset = serialize_fbs_dimension_continue(builder, el.continue_data) - - DucDimensionElementStart(builder) - DucDimensionElementAddBase(builder, base_offset) - DucDimensionElementAddStyle(builder, style_offset) - if el.dimension_type is not None: - DucDimensionElementAddDimensionType(builder, el.dimension_type) - DucDimensionElementAddDefinitionPoints(builder, def_points_offset) - DucDimensionElementAddObliqueAngle(builder, el.oblique_angle) - if el.ordinate_axis is not None: - DucDimensionElementAddOrdinateAxis(builder, el.ordinate_axis) - if bindings_offset: - DucDimensionElementAddBindings(builder, bindings_offset) - if text_override_offset: - DucDimensionElementAddTextOverride(builder, text_override_offset) - if text_pos_struct: - DucDimensionElementAddTextPosition(builder, text_pos_struct) - if tol_override_offset: - DucDimensionElementAddToleranceOverride(builder, tol_override_offset) - if baseline_offset: - DucDimensionElementAddBaselineData(builder, baseline_offset) - if continue_offset: - DucDimensionElementAddContinueData(builder, continue_offset) - return DucDimensionElementEnd(builder) - -# register dimension serializer -ELEMENT_SERIALIZER_MAP[DS_DucDimensionElement] = serialize_fbs_dimension - -def serialize_fbs_element_wrapper(builder: flatbuffers.Builder, wrapper: DS_ElementWrapper) -> int: - element = wrapper.element - typ = ELEMENT_TYPE_MAP.get(type(element)) - serializer = ELEMENT_SERIALIZER_MAP.get(type(element)) - if typ is None or serializer is None: - logger.warning(f"Unsupported element type for serialization: {type(element)}") - return 0 - elem_offset = serializer(builder, element) - ElementWrapperStart(builder) - ElementWrapperAddElementType(builder, typ) - ElementWrapperAddElement(builder, elem_offset) - return ElementWrapperEnd(builder) - - -# ============================ -# Part 2/5 continues here -# ============================ - -# Additional imports for Standards, Units, Overrides, Views and Validation -from ducpy.Duc._UnitSystemBase import ( - _UnitSystemBaseStart, _UnitSystemBaseAddSystem, _UnitSystemBaseAddPrecision, - _UnitSystemBaseAddSuppressLeadingZeros, _UnitSystemBaseAddSuppressTrailingZeros, _UnitSystemBaseEnd -) -from ducpy.Duc.UnitPrecision import ( - UnitPrecisionStart, UnitPrecisionAddLinear, UnitPrecisionAddAngular, UnitPrecisionAddArea, - UnitPrecisionAddVolume, UnitPrecisionEnd -) -from ducpy.Duc.StandardStyles import ( - StandardStylesStart, StandardStylesAddCommonStyles, StandardStylesAddStackLikeStyles, - StandardStylesAddTextStyles, StandardStylesAddDimensionStyles, StandardStylesAddLeaderStyles, - StandardStylesAddFeatureControlFrameStyles, StandardStylesAddTableStyles, StandardStylesAddDocStyles, - StandardStylesAddViewportStyles, StandardStylesAddHatchStyles, StandardStylesAddXrayStyles, StandardStylesEnd, - StandardStylesStartCommonStylesVector, StandardStylesStartStackLikeStylesVector, - StandardStylesStartTextStylesVector, StandardStylesStartDimensionStylesVector, - StandardStylesStartLeaderStylesVector, StandardStylesStartFeatureControlFrameStylesVector, - StandardStylesStartTableStylesVector, StandardStylesStartDocStylesVector, - StandardStylesStartViewportStylesVector, StandardStylesStartHatchStylesVector, - StandardStylesStartXrayStylesVector -) -from ducpy.Duc.DucCommonStyle import ( - DucCommonStyleStart, DucCommonStyleAddBackground, DucCommonStyleAddStroke, DucCommonStyleEnd -) -from ducpy.Duc.IdentifiedCommonStyle import ( - IdentifiedCommonStyleStart, IdentifiedCommonStyleAddId, IdentifiedCommonStyleAddStyle, IdentifiedCommonStyleEnd -) -from ducpy.Duc.IdentifiedStackLikeStyle import ( - IdentifiedStackLikeStyleStart, IdentifiedStackLikeStyleAddId, IdentifiedStackLikeStyleAddStyle, - IdentifiedStackLikeStyleEnd -) -from ducpy.Duc.IdentifiedTextStyle import ( - IdentifiedTextStyleStart, IdentifiedTextStyleAddId, IdentifiedTextStyleAddStyle, IdentifiedTextStyleEnd -) -from ducpy.Duc.IdentifiedDimensionStyle import ( - IdentifiedDimensionStyleStart, IdentifiedDimensionStyleAddId, IdentifiedDimensionStyleAddStyle, - IdentifiedDimensionStyleEnd -) -from ducpy.Duc.IdentifiedLeaderStyle import ( - IdentifiedLeaderStyleStart, IdentifiedLeaderStyleAddId, IdentifiedLeaderStyleAddStyle, IdentifiedLeaderStyleEnd -) -from ducpy.Duc.IdentifiedFCFStyle import ( - IdentifiedFCFStyleStart, IdentifiedFCFStyleAddId, IdentifiedFCFStyleAddStyle, IdentifiedFCFStyleEnd -) -from ducpy.Duc.IdentifiedTableStyle import ( - IdentifiedTableStyleStart, IdentifiedTableStyleAddId, IdentifiedTableStyleAddStyle, IdentifiedTableStyleEnd -) -from ducpy.Duc.IdentifiedDocStyle import ( - IdentifiedDocStyleStart, IdentifiedDocStyleAddId, IdentifiedDocStyleAddStyle, IdentifiedDocStyleEnd -) -from ducpy.Duc.IdentifiedViewportStyle import ( - IdentifiedViewportStyleStart, IdentifiedViewportStyleAddId, IdentifiedViewportStyleAddStyle, - IdentifiedViewportStyleEnd -) -from ducpy.Duc.IdentifiedHatchStyle import ( - IdentifiedHatchStyleStart, IdentifiedHatchStyleAddId, IdentifiedHatchStyleAddStyle, IdentifiedHatchStyleEnd -) -from ducpy.Duc.IdentifiedXRayStyle import ( - IdentifiedXRayStyleStart, IdentifiedXRayStyleAddId, IdentifiedXRayStyleAddStyle, IdentifiedXRayStyleEnd -) -from ducpy.Duc.StandardOverrides import ( - StandardOverridesStart, StandardOverridesAddMainScope, StandardOverridesAddElementsStrokeWidthOverride, - StandardOverridesAddCommonStyleId, StandardOverridesAddStackLikeStyleId, StandardOverridesAddTextStyleId, - StandardOverridesAddDimensionStyleId, StandardOverridesAddLeaderStyleId, StandardOverridesAddFeatureControlFrameStyleId, - StandardOverridesAddTableStyleId, StandardOverridesAddDocStyleId, StandardOverridesAddViewportStyleId, - StandardOverridesAddPlotStyleId, StandardOverridesAddHatchStyleId, StandardOverridesAddActiveGridSettingsId, - StandardOverridesAddActiveSnapSettingsId, StandardOverridesAddDashLineOverride, StandardOverridesAddUnitPrecision, - StandardOverridesEnd, StandardOverridesStartActiveGridSettingsIdVector -) -from ducpy.Duc.LinearUnitSystem import ( - LinearUnitSystemStart, LinearUnitSystemAddBase, LinearUnitSystemAddFormat, LinearUnitSystemAddDecimalSeparator, - LinearUnitSystemAddSuppressZeroFeet, LinearUnitSystemAddSuppressZeroInches, LinearUnitSystemEnd -) -from ducpy.Duc.AngularUnitSystem import ( - AngularUnitSystemStart, AngularUnitSystemAddBase, AngularUnitSystemAddFormat, AngularUnitSystemEnd -) -from ducpy.Duc.AlternateUnits import ( - AlternateUnitsStart, AlternateUnitsAddBase, AlternateUnitsAddFormat, AlternateUnitsAddIsVisible, - AlternateUnitsAddMultiplier, AlternateUnitsEnd -) -from ducpy.Duc.PrimaryUnits import ( - PrimaryUnitsStart, PrimaryUnitsAddLinear, PrimaryUnitsAddAngular, PrimaryUnitsEnd -) -from ducpy.Duc.StandardUnits import ( - StandardUnitsStart, StandardUnitsAddPrimaryUnits, StandardUnitsAddAlternateUnits, StandardUnitsEnd -) -from ducpy.Duc.GridStyle import ( - GridStyleStart, GridStyleAddColor, GridStyleAddOpacity, GridStyleAddDashPattern, GridStyleEnd, - GridStyleStartDashPatternVector -) -from ducpy.Duc.PolarGridSettings import ( - PolarGridSettingsStart, PolarGridSettingsAddRadialDivisions, PolarGridSettingsAddRadialSpacing, - PolarGridSettingsAddShowLabels, PolarGridSettingsEnd -) -from ducpy.Duc.IsometricGridSettings import ( - IsometricGridSettingsStart, IsometricGridSettingsAddLeftAngle, IsometricGridSettingsAddRightAngle, - IsometricGridSettingsEnd -) -from ducpy.Duc.GridSettings import ( - GridSettingsStart, GridSettingsAddType, GridSettingsAddReadonly, GridSettingsAddDisplayType, - GridSettingsAddIsAdaptive, GridSettingsAddXSpacing, GridSettingsAddYSpacing, GridSettingsAddSubdivisions, - GridSettingsAddOrigin, GridSettingsAddRotation, GridSettingsAddFollowUcs, GridSettingsAddMajorStyle, - GridSettingsAddMinorStyle, GridSettingsAddShowMinor, GridSettingsAddMinZoom, GridSettingsAddMaxZoom, - GridSettingsAddAutoHide, GridSettingsAddPolarSettings, GridSettingsAddIsometricSettings, - GridSettingsAddEnableSnapping, GridSettingsEnd -) -from ducpy.Duc.SnapOverride import ( - SnapOverrideStart, SnapOverrideAddKey, SnapOverrideAddBehavior, SnapOverrideEnd -) -from ducpy.Duc.DynamicSnapSettings import ( - DynamicSnapSettingsStart, DynamicSnapSettingsAddEnabledDuringDrag, DynamicSnapSettingsAddEnabledDuringRotation, - DynamicSnapSettingsAddEnabledDuringScale, DynamicSnapSettingsEnd -) -from ducpy.Duc.PolarTrackingSettings import ( - PolarTrackingSettingsStart, PolarTrackingSettingsAddEnabled, PolarTrackingSettingsAddAngles, - PolarTrackingSettingsAddIncrementAngle, PolarTrackingSettingsAddTrackFromLastPoint, - PolarTrackingSettingsAddShowPolarCoordinates, PolarTrackingSettingsEnd, PolarTrackingSettingsStartAnglesVector -) -from ducpy.Duc.TrackingLineStyle import ( - TrackingLineStyleStart, TrackingLineStyleAddColor, TrackingLineStyleAddOpacity, - TrackingLineStyleAddDashPattern, TrackingLineStyleEnd, TrackingLineStyleStartDashPatternVector -) -from ducpy.Duc.LayerSnapFilters import ( - LayerSnapFiltersStart, LayerSnapFiltersAddIncludeLayers, LayerSnapFiltersAddExcludeLayers, LayerSnapFiltersEnd, - LayerSnapFiltersStartIncludeLayersVector, LayerSnapFiltersStartExcludeLayersVector -) -from ducpy.Duc.SnapMarkerStyle import ( - SnapMarkerStyleStart, SnapMarkerStyleAddShape, SnapMarkerStyleAddColor, SnapMarkerStyleEnd -) -from ducpy.Duc.SnapMarkerStyleEntry import ( - SnapMarkerStyleEntryStart, SnapMarkerStyleEntryAddKey, SnapMarkerStyleEntryAddValue, SnapMarkerStyleEntryEnd -) -from ducpy.Duc.SnapMarkerSettings import ( - SnapMarkerSettingsStart, SnapMarkerSettingsAddEnabled, SnapMarkerSettingsAddSize, SnapMarkerSettingsAddDuration, - SnapMarkerSettingsAddStyles, SnapMarkerSettingsEnd, SnapMarkerSettingsStartStylesVector -) -from ducpy.Duc.SnapSettings import ( - SnapSettingsStart, SnapSettingsAddReadonly, SnapSettingsAddTwistAngle, SnapSettingsAddSnapTolerance, - SnapSettingsAddObjectSnapAperture, SnapSettingsAddIsOrthoModeOn, SnapSettingsAddPolarTracking, - SnapSettingsAddIsObjectSnapOn, SnapSettingsAddActiveObjectSnapModes, SnapSettingsAddSnapPriority, - SnapSettingsAddShowTrackingLines, SnapSettingsAddTrackingLineStyle, SnapSettingsAddDynamicSnap, - SnapSettingsAddTemporaryOverrides, SnapSettingsAddIncrementalDistance, SnapSettingsAddMagneticStrength, - SnapSettingsAddLayerSnapFilters, SnapSettingsAddElementTypeFilters, SnapSettingsAddSnapMode, - SnapSettingsAddSnapMarkers, SnapSettingsAddConstructionSnapEnabled, SnapSettingsAddSnapToGridIntersections, - SnapSettingsEnd, SnapSettingsStartActiveObjectSnapModesVector, SnapSettingsStartSnapPriorityVector, - SnapSettingsStartTemporaryOverridesVector, SnapSettingsStartElementTypeFiltersVector -) -from ducpy.Duc.IdentifiedGridSettings import ( - IdentifiedGridSettingsStart, IdentifiedGridSettingsAddId, IdentifiedGridSettingsAddSettings, - IdentifiedGridSettingsEnd -) -from ducpy.Duc.IdentifiedSnapSettings import ( - IdentifiedSnapSettingsStart, IdentifiedSnapSettingsAddId, IdentifiedSnapSettingsAddSettings, - IdentifiedSnapSettingsEnd -) -from ducpy.Duc.IdentifiedUcs import ( - IdentifiedUcsStart, IdentifiedUcsAddId, IdentifiedUcsAddUcs, IdentifiedUcsEnd -) -from ducpy.Duc.IdentifiedView import ( - IdentifiedViewStart, IdentifiedViewAddId, IdentifiedViewAddView, IdentifiedViewEnd -) -from ducpy.Duc.StandardViewSettings import ( - StandardViewSettingsStart, StandardViewSettingsAddViews, StandardViewSettingsAddUcs, - StandardViewSettingsAddGridSettings, StandardViewSettingsAddSnapSettings, StandardViewSettingsEnd, - StandardViewSettingsStartViewsVector, StandardViewSettingsStartUcsVector, - StandardViewSettingsStartGridSettingsVector, StandardViewSettingsStartSnapSettingsVector -) -from ducpy.Duc.DimensionValidationRules import ( - DimensionValidationRulesStart, DimensionValidationRulesAddMinTextHeight, DimensionValidationRulesAddMaxTextHeight, - DimensionValidationRulesAddAllowedPrecisions, DimensionValidationRulesEnd, - DimensionValidationRulesStartAllowedPrecisionsVector -) -from ducpy.Duc.LayerValidationRules import ( - LayerValidationRulesStart, LayerValidationRulesAddProhibitedLayerNames, LayerValidationRulesEnd, - LayerValidationRulesStartProhibitedLayerNamesVector -) -from ducpy.Duc.StandardValidation import ( - StandardValidationStart, StandardValidationAddDimensionRules, StandardValidationAddLayerRules, StandardValidationEnd -) -from ducpy.Duc.Standard import ( - StandardStart, StandardAddIdentifier, StandardAddVersion, StandardAddReadonly, StandardAddOverrides, - StandardAddStyles, StandardAddViewSettings, StandardAddUnits, StandardAddValidation, StandardEnd -) - -# Blocks, groups, regions, layers already partially imported in Part 1 -from ducpy.Duc.DucBlockAttributeDefinition import ( - DucBlockAttributeDefinitionStart, DucBlockAttributeDefinitionAddTag, DucBlockAttributeDefinitionAddPrompt, - DucBlockAttributeDefinitionAddDefaultValue, DucBlockAttributeDefinitionAddIsConstant, - DucBlockAttributeDefinitionEnd -) -from ducpy.Duc.DucBlockAttributeDefinitionEntry import ( - DucBlockAttributeDefinitionEntryStart, DucBlockAttributeDefinitionEntryAddKey, - DucBlockAttributeDefinitionEntryAddValue, DucBlockAttributeDefinitionEntryEnd -) -from ducpy.Duc.DucBlockMetadata import ( - DucBlockMetadataStart, DucBlockMetadataAddSource, DucBlockMetadataAddUsageCount, DucBlockMetadataAddCreatedAt, DucBlockMetadataAddUpdatedAt, DucBlockMetadataAddLocalization, DucBlockMetadataEnd -) -from ducpy.Duc.DucBlock import ( - DucBlockStart, DucBlockAddId, DucBlockAddLabel, DucBlockAddDescription, DucBlockAddVersion, DucBlockAddAttributeDefinitions, DucBlockAddMetadata, DucBlockAddThumbnail, DucBlockEnd, DucBlockStartAttributeDefinitionsVector, DucBlockStartThumbnailVector -) -from ducpy.Duc.DucBlockCollection import ( - DucBlockCollectionStart, DucBlockCollectionAddId, DucBlockCollectionAddLabel, DucBlockCollectionAddChildren, DucBlockCollectionAddMetadata, DucBlockCollectionAddThumbnail, DucBlockCollectionEnd, DucBlockCollectionStartChildrenVector, DucBlockCollectionStartThumbnailVector -) -from ducpy.Duc.DucBlockCollectionEntry import ( - DucBlockCollectionEntryStart, DucBlockCollectionEntryAddId, DucBlockCollectionEntryAddIsCollection, DucBlockCollectionEntryEnd -) - -# Global/Local State (vector helpers) -from ducpy.Duc.DucLocalState import ( - DucLocalStateAddManualSaveMode, DucLocalStateStart, DucLocalStateAddScope, DucLocalStateAddActiveStandardId, DucLocalStateAddScrollX, - DucLocalStateAddScrollY, DucLocalStateAddZoom, DucLocalStateAddActiveGridSettings, DucLocalStateAddActiveSnapSettings, - DucLocalStateAddIsBindingEnabled, DucLocalStateAddCurrentItemStroke, DucLocalStateAddCurrentItemBackground, - DucLocalStateAddCurrentItemOpacity, DucLocalStateAddCurrentItemFontFamily, DucLocalStateAddCurrentItemFontSize, - DucLocalStateAddCurrentItemTextAlign, DucLocalStateAddCurrentItemStartLineHead, DucLocalStateAddCurrentItemEndLineHead, - DucLocalStateAddCurrentItemRoundness, DucLocalStateAddPenMode, DucLocalStateAddViewModeEnabled, - DucLocalStateAddObjectsSnapModeEnabled, DucLocalStateAddGridModeEnabled, DucLocalStateAddOutlineModeEnabled, - DucLocalStateEnd, DucLocalStateStartActiveGridSettingsVector -) -from ducpy.Duc.DucGlobalState import ( - DucGlobalStateAddPruningLevel, DucGlobalStateStart, DucGlobalStateAddName, DucGlobalStateAddViewBackgroundColor, DucGlobalStateAddMainScope, - DucGlobalStateAddDashSpacingScale, DucGlobalStateAddIsDashSpacingAffectedByViewportScale, - DucGlobalStateAddScopeExponentThreshold, DucGlobalStateAddDimensionsAssociativeByDefault, - DucGlobalStateAddUseAnnotativeScaling, DucGlobalStateAddDisplayPrecisionLinear, - DucGlobalStateAddDisplayPrecisionAngular, DucGlobalStateEnd -) - -# External Files -from ducpy.Duc.DucExternalFileData import ( - DucExternalFileDataStart, DucExternalFileDataAddMimeType, DucExternalFileDataAddId, DucExternalFileDataAddData, - DucExternalFileDataAddCreated, DucExternalFileDataAddLastRetrieved, DucExternalFileDataEnd -) -from ducpy.Duc.DucExternalFileEntry import ( - DucExternalFileEntryStart, DucExternalFileEntryAddKey, DucExternalFileEntryAddValue, DucExternalFileEntryEnd -) - -# Version Graph -from ducpy.Duc.VersionBase import ( - VersionBaseStart, VersionBaseAddId, VersionBaseAddParentId, VersionBaseAddTimestamp, - VersionBaseAddDescription, VersionBaseAddIsManualSave, VersionBaseAddUserId, VersionBaseEnd -) -from ducpy.Duc.Checkpoint import ( - CheckpointStart, CheckpointAddBase, CheckpointAddData, CheckpointAddSizeBytes, CheckpointEnd -) -from ducpy.Duc.JSONPatchOperation import ( - JSONPatchOperationStart, JSONPatchOperationAddOp, JSONPatchOperationAddPath, JSONPatchOperationAddFrom, - JSONPatchOperationAddValue, JSONPatchOperationEnd -) -from ducpy.Duc.Delta import ( - DeltaStart, DeltaAddBase, DeltaAddPatch, DeltaAddSizeBytes, DeltaEnd, DeltaStartPatchVector -) -from ducpy.Duc.VersionGraphMetadata import ( - VersionGraphMetadataStart, VersionGraphMetadataAddLastPruned, - VersionGraphMetadataAddTotalSize, VersionGraphMetadataEnd -) -from ducpy.Duc.VersionGraph import ( - VersionGraphStart, VersionGraphAddUserCheckpointVersionId, VersionGraphAddLatestVersionId, - VersionGraphAddCheckpoints, VersionGraphAddDeltas, VersionGraphAddMetadata, VersionGraphEnd, - VersionGraphStartCheckpointsVector, VersionGraphStartDeltasVector -) - -# Root: ExportedDataState vector helpers for fields we use in Part 2 too (already imported in Part 1) - -# ----------------------------------------------------------------------------- -# Standards: Units -# ----------------------------------------------------------------------------- - -def serialize_fbs_unit_system_base(builder: flatbuffers.Builder, base: DS_UnitSystemBase) -> int: - _UnitSystemBaseStart(builder) - if base.system is not None: - _UnitSystemBaseAddSystem(builder, base.system) - _UnitSystemBaseAddPrecision(builder, base.precision) - _UnitSystemBaseAddSuppressLeadingZeros(builder, base.suppress_leading_zeros) - _UnitSystemBaseAddSuppressTrailingZeros(builder, base.suppress_trailing_zeros) - return _UnitSystemBaseEnd(builder) - -def serialize_fbs_linear_unit_system(builder: flatbuffers.Builder, l: Optional[DS_LinearUnitSystem]) -> int: - if l is None: - return 0 - base_offset = serialize_fbs_unit_system_base(builder, l) - LinearUnitSystemStart(builder) - LinearUnitSystemAddBase(builder, base_offset) - if l.format is not None: - LinearUnitSystemAddFormat(builder, l.format) - if l.decimal_separator is not None: - LinearUnitSystemAddDecimalSeparator(builder, l.decimal_separator) - LinearUnitSystemAddSuppressZeroFeet(builder, l.suppress_zero_feet) - LinearUnitSystemAddSuppressZeroInches(builder, l.suppress_zero_inches) - return LinearUnitSystemEnd(builder) - -def serialize_fbs_angular_unit_system(builder: flatbuffers.Builder, a: Optional[DS_AngularUnitSystem]) -> int: - if a is None: - return 0 - base_offset = serialize_fbs_unit_system_base(builder, a) - AngularUnitSystemStart(builder) - AngularUnitSystemAddBase(builder, base_offset) - if a.format is not None: - AngularUnitSystemAddFormat(builder, a.format) - return AngularUnitSystemEnd(builder) - -def serialize_fbs_alternate_units(builder: flatbuffers.Builder, a: Optional[DS_AlternateUnits]) -> int: - if a is None: - return 0 - base_offset = serialize_fbs_unit_system_base(builder, a) - AlternateUnitsStart(builder) - AlternateUnitsAddBase(builder, base_offset) - if a.format is not None: - AlternateUnitsAddFormat(builder, a.format) - AlternateUnitsAddIsVisible(builder, a.is_visible) - AlternateUnitsAddMultiplier(builder, a.multiplier) - return AlternateUnitsEnd(builder) - -def serialize_fbs_primary_units(builder: flatbuffers.Builder, pu: Optional[DS_PrimaryUnits]) -> int: - if pu is None: - return 0 - linear_offset = serialize_fbs_linear_unit_system(builder, pu.linear) - angular_offset = serialize_fbs_angular_unit_system(builder, pu.angular) - PrimaryUnitsStart(builder) - if linear_offset: - PrimaryUnitsAddLinear(builder, linear_offset) - if angular_offset: - PrimaryUnitsAddAngular(builder, angular_offset) - return PrimaryUnitsEnd(builder) - -def serialize_fbs_standard_units(builder: flatbuffers.Builder, u: Optional[DS_StandardUnits]) -> int: - if u is None: - return 0 - primary_offset = serialize_fbs_primary_units(builder, u.primary_units) - alternate_offset = serialize_fbs_alternate_units(builder, u.alternate_units) - StandardUnitsStart(builder) - if primary_offset: StandardUnitsAddPrimaryUnits(builder, primary_offset) - if alternate_offset: StandardUnitsAddAlternateUnits(builder, alternate_offset) - return StandardUnitsEnd(builder) - -# ----------------------------------------------------------------------------- -# Standards: Overrides -# ----------------------------------------------------------------------------- - -def serialize_fbs_unit_precision(builder: flatbuffers.Builder, up: Optional[DS_UnitPrecision]) -> int: - if up is None: - return 0 - UnitPrecisionStart(builder) - UnitPrecisionAddLinear(builder, up.linear) - UnitPrecisionAddAngular(builder, up.angular) - UnitPrecisionAddArea(builder, up.area) - UnitPrecisionAddVolume(builder, up.volume) - return UnitPrecisionEnd(builder) - -def serialize_fbs_standard_overrides(builder: flatbuffers.Builder, o: Optional[DS_StandardOverrides]) -> int: - if o is None: - return 0 - - # Create all strings first before starting any vectors - main_scope_offset = _str(builder, o.main_scope) - common_style_id_offset = _str(builder, o.common_style_id) - stack_like_style_id_offset = _str(builder, o.stack_like_style_id) - text_style_id_offset = _str(builder, o.text_style_id) - dim_style_id_offset = _str(builder, o.dimension_style_id) - leader_style_id_offset = _str(builder, o.leader_style_id) - fcf_style_id_offset = _str(builder, o.feature_control_frame_style_id) - table_style_id_offset = _str(builder, o.table_style_id) - doc_style_id_offset = _str(builder, o.doc_style_id) - viewport_style_id_offset = _str(builder, o.viewport_style_id) - plot_style_id_offset = _str(builder, o.plot_style_id) - hatch_style_id_offset = _str(builder, o.hatch_style_id) - active_snap_settings_id_offset = _str(builder, o.active_snap_settings_id) - dash_line_override_offset = _str(builder, o.dash_line_override) - unit_precision_offset = serialize_fbs_unit_precision(builder, o.unit_precision) - - # Create vector for active_grid_settings_id - active_grid_vec = 0 - if o.active_grid_settings_id: - # Create all strings first - grid_string_offsets = [builder.CreateString(s) for s in o.active_grid_settings_id] - StandardOverridesStartActiveGridSettingsIdVector(builder, len(grid_string_offsets)) - for off in reversed(grid_string_offsets): - builder.PrependUOffsetTRelative(off) - active_grid_vec = builder.EndVector() - - StandardOverridesStart(builder) - if unit_precision_offset: - StandardOverridesAddUnitPrecision(builder, unit_precision_offset) - if main_scope_offset: StandardOverridesAddMainScope(builder, main_scope_offset) - if o.elements_stroke_width_override is not None: - StandardOverridesAddElementsStrokeWidthOverride(builder, o.elements_stroke_width_override) - if common_style_id_offset: StandardOverridesAddCommonStyleId(builder, common_style_id_offset) - if stack_like_style_id_offset: StandardOverridesAddStackLikeStyleId(builder, stack_like_style_id_offset) - if text_style_id_offset: StandardOverridesAddTextStyleId(builder, text_style_id_offset) - if dim_style_id_offset: StandardOverridesAddDimensionStyleId(builder, dim_style_id_offset) - if leader_style_id_offset: StandardOverridesAddLeaderStyleId(builder, leader_style_id_offset) - if fcf_style_id_offset: StandardOverridesAddFeatureControlFrameStyleId(builder, fcf_style_id_offset) - if table_style_id_offset: StandardOverridesAddTableStyleId(builder, table_style_id_offset) - if doc_style_id_offset: StandardOverridesAddDocStyleId(builder, doc_style_id_offset) - if viewport_style_id_offset: StandardOverridesAddViewportStyleId(builder, viewport_style_id_offset) - if plot_style_id_offset: StandardOverridesAddPlotStyleId(builder, plot_style_id_offset) - if hatch_style_id_offset: StandardOverridesAddHatchStyleId(builder, hatch_style_id_offset) - if active_grid_vec: StandardOverridesAddActiveGridSettingsId(builder, active_grid_vec) - if active_snap_settings_id_offset: StandardOverridesAddActiveSnapSettingsId(builder, active_snap_settings_id_offset) - if dash_line_override_offset: StandardOverridesAddDashLineOverride(builder, dash_line_override_offset) - return StandardOverridesEnd(builder) - -# ----------------------------------------------------------------------------- -# Standards: Styles -# ----------------------------------------------------------------------------- - -def serialize_fbs_common_style(builder: flatbuffers.Builder, s: DS_DucCommonStyle) -> int: - bg_offset = serialize_fbs_element_background(builder, s.background) - stroke_offset = serialize_fbs_element_stroke(builder, s.stroke) - DucCommonStyleStart(builder) - DucCommonStyleAddBackground(builder, bg_offset) - DucCommonStyleAddStroke(builder, stroke_offset) - return DucCommonStyleEnd(builder) - -def serialize_fbs_identified_common_style(builder: flatbuffers.Builder, x: DS_IdentifiedCommonStyle) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - style_offset = serialize_fbs_common_style(builder, x.style) - IdentifiedCommonStyleStart(builder) - IdentifiedCommonStyleAddId(builder, id_offset) - IdentifiedCommonStyleAddStyle(builder, style_offset) - return IdentifiedCommonStyleEnd(builder) - -def serialize_fbs_identified_stack_like_style(builder: flatbuffers.Builder, x: DS_IdentifiedStackLikeStyle) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - style_offset = serialize_fbs_duc_stack_like_styles(builder, x.style) - IdentifiedStackLikeStyleStart(builder) - IdentifiedStackLikeStyleAddId(builder, id_offset) - IdentifiedStackLikeStyleAddStyle(builder, style_offset) - return IdentifiedStackLikeStyleEnd(builder) - -def serialize_fbs_identified_text_style(builder: flatbuffers.Builder, x: DS_IdentifiedTextStyle) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - style_offset = serialize_fbs_duc_text_style(builder, x.style) - IdentifiedTextStyleStart(builder) - IdentifiedTextStyleAddId(builder, id_offset) - IdentifiedTextStyleAddStyle(builder, style_offset) - return IdentifiedTextStyleEnd(builder) - -def serialize_fbs_identified_dimension_style(builder: flatbuffers.Builder, x: DS_IdentifiedDimensionStyle) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - style_offset = serialize_fbs_dimension_style(builder, x.style) - IdentifiedDimensionStyleStart(builder) - IdentifiedDimensionStyleAddId(builder, id_offset) - IdentifiedDimensionStyleAddStyle(builder, style_offset) - return IdentifiedDimensionStyleEnd(builder) - -def serialize_fbs_identified_leader_style(builder: flatbuffers.Builder, x: DS_IdentifiedLeaderStyle) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - style_offset = serialize_fbs_leader_style(builder, x.style) - IdentifiedLeaderStyleStart(builder) - IdentifiedLeaderStyleAddId(builder, id_offset) - IdentifiedLeaderStyleAddStyle(builder, style_offset) - return IdentifiedLeaderStyleEnd(builder) - -def serialize_fbs_identified_fcf_style(builder: flatbuffers.Builder, x: DS_IdentifiedFCFStyle) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - style_offset = serialize_fbs_feature_control_frame_style(builder, x.style) - IdentifiedFCFStyleStart(builder) - IdentifiedFCFStyleAddId(builder, id_offset) - IdentifiedFCFStyleAddStyle(builder, style_offset) - return IdentifiedFCFStyleEnd(builder) - -def serialize_fbs_identified_table_style(builder: flatbuffers.Builder, x: DS_IdentifiedTableStyle) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - style_offset = serialize_fbs_table_style(builder, x.style) - IdentifiedTableStyleStart(builder) - IdentifiedTableStyleAddId(builder, id_offset) - IdentifiedTableStyleAddStyle(builder, style_offset) - return IdentifiedTableStyleEnd(builder) - -def serialize_fbs_identified_doc_style(builder: flatbuffers.Builder, x: DS_IdentifiedDocStyle) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - style_offset = serialize_fbs_doc_style(builder, x.style) - IdentifiedDocStyleStart(builder) - IdentifiedDocStyleAddId(builder, id_offset) - IdentifiedDocStyleAddStyle(builder, style_offset) - return IdentifiedDocStyleEnd(builder) - -def serialize_fbs_identified_viewport_style(builder: flatbuffers.Builder, x: DS_IdentifiedViewportStyle) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - style_offset = serialize_fbs_viewport_style(builder, x.style) - IdentifiedViewportStyleStart(builder) - IdentifiedViewportStyleAddId(builder, id_offset) - IdentifiedViewportStyleAddStyle(builder, style_offset) - return IdentifiedViewportStyleEnd(builder) - -def serialize_fbs_identified_hatch_style(builder: flatbuffers.Builder, x: DS_IdentifiedHatchStyle) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - style_offset = serialize_fbs_duc_hatch_style(builder, x.style) - IdentifiedHatchStyleStart(builder) - IdentifiedHatchStyleAddId(builder, id_offset) - IdentifiedHatchStyleAddStyle(builder, style_offset) - return IdentifiedHatchStyleEnd(builder) - -def serialize_fbs_identified_xray_style(builder: flatbuffers.Builder, x: DS_IdentifiedXRayStyle) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - style_offset = serialize_fbs_xray_style(builder, x.style) - IdentifiedXRayStyleStart(builder) - IdentifiedXRayStyleAddId(builder, id_offset) - IdentifiedXRayStyleAddStyle(builder, style_offset) - return IdentifiedXRayStyleEnd(builder) - -def serialize_fbs_standard_styles(builder: flatbuffers.Builder, s: Optional[DS_StandardStyles]) -> int: - if s is None: - return 0 - common_offsets = [serialize_fbs_identified_common_style(builder, x) for x in (s.common_styles or [])] - stack_like_offsets = [serialize_fbs_identified_stack_like_style(builder, x) for x in (s.stack_like_styles or [])] - text_offsets = [serialize_fbs_identified_text_style(builder, x) for x in (s.text_styles or [])] - dim_offsets = [serialize_fbs_identified_dimension_style(builder, x) for x in (s.dimension_styles or [])] - leader_offsets = [serialize_fbs_identified_leader_style(builder, x) for x in (s.leader_styles or [])] - fcf_offsets = [serialize_fbs_identified_fcf_style(builder, x) for x in (s.feature_control_frame_styles or [])] - table_offsets = [serialize_fbs_identified_table_style(builder, x) for x in (s.table_styles or [])] - doc_offsets = [serialize_fbs_identified_doc_style(builder, x) for x in (s.doc_styles or [])] - viewport_offsets = [serialize_fbs_identified_viewport_style(builder, x) for x in (s.viewport_styles or [])] - hatch_offsets = [serialize_fbs_identified_hatch_style(builder, x) for x in (s.hatch_styles or [])] - xray_offsets = [serialize_fbs_identified_xray_style(builder, x) for x in (s.xray_styles or [])] - - # Create vectors - def _vec(start_fn, offsets): - if offsets is None: - return 0 - start_fn(builder, len(offsets)) - for off in reversed(offsets): - builder.PrependUOffsetTRelative(off) - return builder.EndVector() - - common_vec = _vec(StandardStylesStartCommonStylesVector, common_offsets) - stack_like_vec = _vec(StandardStylesStartStackLikeStylesVector, stack_like_offsets) - text_vec = _vec(StandardStylesStartTextStylesVector, text_offsets) - dim_vec = _vec(StandardStylesStartDimensionStylesVector, dim_offsets) - leader_vec = _vec(StandardStylesStartLeaderStylesVector, leader_offsets) - fcf_vec = _vec(StandardStylesStartFeatureControlFrameStylesVector, fcf_offsets) - table_vec = _vec(StandardStylesStartTableStylesVector, table_offsets) - doc_vec = _vec(StandardStylesStartDocStylesVector, doc_offsets) - viewport_vec = _vec(StandardStylesStartViewportStylesVector, viewport_offsets) - hatch_vec = _vec(StandardStylesStartHatchStylesVector, hatch_offsets) - xray_vec = _vec(StandardStylesStartXrayStylesVector, xray_offsets) - - StandardStylesStart(builder) - if common_vec: StandardStylesAddCommonStyles(builder, common_vec) - if stack_like_vec: StandardStylesAddStackLikeStyles(builder, stack_like_vec) - if text_vec: StandardStylesAddTextStyles(builder, text_vec) - if dim_vec: StandardStylesAddDimensionStyles(builder, dim_vec) - if leader_vec: StandardStylesAddLeaderStyles(builder, leader_vec) - if fcf_vec: StandardStylesAddFeatureControlFrameStyles(builder, fcf_vec) - if table_vec: StandardStylesAddTableStyles(builder, table_vec) - if doc_vec: StandardStylesAddDocStyles(builder, doc_vec) - if viewport_vec: StandardStylesAddViewportStyles(builder, viewport_vec) - if hatch_vec: StandardStylesAddHatchStyles(builder, hatch_vec) - if xray_vec: StandardStylesAddXrayStyles(builder, xray_vec) - return StandardStylesEnd(builder) - -# ----------------------------------------------------------------------------- -# Standards: View settings -# ----------------------------------------------------------------------------- - -def serialize_fbs_grid_style(builder: flatbuffers.Builder, s: DS_GridStyle) -> int: - color_offset = builder.CreateString(s.color) - dash_vec = 0 - if s.dash_pattern: - GridStyleStartDashPatternVector(builder, len(s.dash_pattern)) - for v in reversed(s.dash_pattern): - builder.PrependFloat64(v) - dash_vec = builder.EndVector() - GridStyleStart(builder) - GridStyleAddColor(builder, color_offset) - GridStyleAddOpacity(builder, s.opacity) - if dash_vec: - GridStyleAddDashPattern(builder, dash_vec) - return GridStyleEnd(builder) - -def serialize_fbs_polar_grid_settings(builder: flatbuffers.Builder, p: Optional[DS_PolarGridSettings]) -> int: - if p is None: - return 0 - PolarGridSettingsStart(builder) - PolarGridSettingsAddRadialDivisions(builder, p.radial_divisions) - PolarGridSettingsAddRadialSpacing(builder, p.radial_spacing) - PolarGridSettingsAddShowLabels(builder, p.show_labels) - return PolarGridSettingsEnd(builder) - -def serialize_fbs_isometric_grid_settings(builder: flatbuffers.Builder, i: Optional[DS_IsometricGridSettings]) -> int: - if i is None: - return 0 - IsometricGridSettingsStart(builder) - IsometricGridSettingsAddLeftAngle(builder, i.left_angle) - IsometricGridSettingsAddRightAngle(builder, i.right_angle) - return IsometricGridSettingsEnd(builder) - -from ducpy.classes.ElementsClass import DucUcs as DS_DucUcs -def serialize_fbs_duc_ucs(builder: flatbuffers.Builder, u: "DS_DucUcs") -> int: - # u.origin is GeometricPoint struct - DucUcsStart(builder) - if u.origin: - DucUcsAddOrigin(builder, CreateGeometricPoint(builder, u.origin.x, u.origin.y)) - DucUcsAddAngle(builder, u.angle) - return DucUcsEnd(builder) - -def serialize_fbs_grid_settings(builder: flatbuffers.Builder, s: DS_GridSettings) -> int: - # Handle optional fields first (tables) - major_style_offset = serialize_fbs_grid_style(builder, s.major_style) if s.major_style else 0 - minor_style_offset = serialize_fbs_grid_style(builder, s.minor_style) if s.minor_style else 0 - polar_settings_offset = serialize_fbs_polar_grid_settings(builder, s.polar_settings) if s.polar_settings else 0 - isometric_settings_offset = serialize_fbs_isometric_grid_settings(builder, s.isometric_settings) if s.isometric_settings else 0 - - # Start the GridSettings table first - GridSettingsStart(builder) - if s.type is not None: GridSettingsAddType(builder, s.type) - GridSettingsAddReadonly(builder, s.readonly) - if s.display_type is not None: GridSettingsAddDisplayType(builder, s.display_type) - GridSettingsAddIsAdaptive(builder, s.is_adaptive) - GridSettingsAddXSpacing(builder, s.x_spacing) - GridSettingsAddYSpacing(builder, s.y_spacing) - GridSettingsAddSubdivisions(builder, s.subdivisions) - # Create the GeometricPoint struct for origin (must be created right before adding) - if s.origin: - origin_struct = CreateGeometricPoint(builder, s.origin.x, s.origin.y) - GridSettingsAddOrigin(builder, origin_struct) - GridSettingsAddRotation(builder, s.rotation) - GridSettingsAddFollowUcs(builder, s.follow_ucs) - if major_style_offset: GridSettingsAddMajorStyle(builder, major_style_offset) - if minor_style_offset: GridSettingsAddMinorStyle(builder, minor_style_offset) - GridSettingsAddShowMinor(builder, s.show_minor) - GridSettingsAddMinZoom(builder, s.min_zoom) - GridSettingsAddMaxZoom(builder, s.max_zoom) - GridSettingsAddAutoHide(builder, s.auto_hide) - if polar_settings_offset: GridSettingsAddPolarSettings(builder, polar_settings_offset) - if isometric_settings_offset: GridSettingsAddIsometricSettings(builder, isometric_settings_offset) - GridSettingsAddEnableSnapping(builder, s.enable_snapping) - return GridSettingsEnd(builder) - -def serialize_fbs_snap_override(builder: flatbuffers.Builder, o: DS_SnapOverride) -> int: - key_offset = builder.CreateString(o.key) - SnapOverrideStart(builder) - SnapOverrideAddKey(builder, key_offset) - if o.behavior is not None: - SnapOverrideAddBehavior(builder, o.behavior) - return SnapOverrideEnd(builder) - -def serialize_fbs_dynamic_snap_settings(builder: flatbuffers.Builder, s: DS_DynamicSnapSettings) -> int: - DynamicSnapSettingsStart(builder) - DynamicSnapSettingsAddEnabledDuringDrag(builder, s.enabled_during_drag) - DynamicSnapSettingsAddEnabledDuringRotation(builder, s.enabled_during_rotation) - DynamicSnapSettingsAddEnabledDuringScale(builder, s.enabled_during_scale) - return DynamicSnapSettingsEnd(builder) - -def serialize_fbs_tracking_line_style(builder: flatbuffers.Builder, s: Optional[DS_TrackingLineStyle]) -> int: - if s is None: - return 0 - color_offset = builder.CreateString(s.color) - dash_vec = 0 - if s.dash_pattern: - TrackingLineStyleStartDashPatternVector(builder, len(s.dash_pattern)) - for v in reversed(s.dash_pattern): - builder.PrependFloat64(v) - dash_vec = builder.EndVector() - TrackingLineStyleStart(builder) - TrackingLineStyleAddColor(builder, color_offset) - TrackingLineStyleAddOpacity(builder, s.opacity) - if dash_vec: TrackingLineStyleAddDashPattern(builder, dash_vec) - return TrackingLineStyleEnd(builder) - -def serialize_fbs_polar_tracking_settings(builder: flatbuffers.Builder, s: DS_PolarTrackingSettings) -> int: - angles_vec = 0 - if s.angles: - PolarTrackingSettingsStartAnglesVector(builder, len(s.angles)) - for a in reversed(s.angles): - builder.PrependFloat64(a) - angles_vec = builder.EndVector() - PolarTrackingSettingsStart(builder) - PolarTrackingSettingsAddEnabled(builder, s.enabled) - if angles_vec: PolarTrackingSettingsAddAngles(builder, angles_vec) - if s.increment_angle is not None: - PolarTrackingSettingsAddIncrementAngle(builder, s.increment_angle) - PolarTrackingSettingsAddTrackFromLastPoint(builder, s.track_from_last_point) - PolarTrackingSettingsAddShowPolarCoordinates(builder, s.show_polar_coordinates) - return PolarTrackingSettingsEnd(builder) - -def serialize_fbs_layer_snap_filters(builder: flatbuffers.Builder, f: Optional[DS_LayerSnapFilters]) -> int: - if f is None: - return 0 - include_vec = 0 - if f.include_layers: - LayerSnapFiltersStartIncludeLayersVector(builder, len(f.include_layers)) - for s in reversed(f.include_layers): - builder.PrependUOffsetTRelative(builder.CreateString(s)) - include_vec = builder.EndVector() - exclude_vec = 0 - if f.exclude_layers: - LayerSnapFiltersStartExcludeLayersVector(builder, len(f.exclude_layers)) - for s in reversed(f.exclude_layers): - builder.PrependUOffsetTRelative(builder.CreateString(s)) - exclude_vec = builder.EndVector() - LayerSnapFiltersStart(builder) - if include_vec: LayerSnapFiltersAddIncludeLayers(builder, include_vec) - if exclude_vec: LayerSnapFiltersAddExcludeLayers(builder, exclude_vec) - return LayerSnapFiltersEnd(builder) - -def serialize_fbs_snap_marker_style(builder: flatbuffers.Builder, s: DS_SnapMarkerStyle) -> int: - color_offset = builder.CreateString(s.color) - SnapMarkerStyleStart(builder) - if s.shape is not None: SnapMarkerStyleAddShape(builder, s.shape) - SnapMarkerStyleAddColor(builder, color_offset) - return SnapMarkerStyleEnd(builder) - -def serialize_fbs_snap_marker_style_entry(builder: flatbuffers.Builder, e: DS_SnapMarkerStyleEntry) -> int: - value_offset = serialize_fbs_snap_marker_style(builder, e.value) - SnapMarkerStyleEntryStart(builder) - if e.key is not None: - SnapMarkerStyleEntryAddKey(builder, e.key) - SnapMarkerStyleEntryAddValue(builder, value_offset) - return SnapMarkerStyleEntryEnd(builder) - -def serialize_fbs_snap_marker_settings(builder: flatbuffers.Builder, s: DS_SnapMarkerSettings) -> int: - styles_offsets = [serialize_fbs_snap_marker_style_entry(builder, it) for it in (s.styles or [])] - styles_vec = 0 - if styles_offsets: - SnapMarkerSettingsStartStylesVector(builder, len(styles_offsets)) - for off in reversed(styles_offsets): - builder.PrependUOffsetTRelative(off) - styles_vec = builder.EndVector() - SnapMarkerSettingsStart(builder) - SnapMarkerSettingsAddEnabled(builder, s.enabled) - SnapMarkerSettingsAddSize(builder, s.size) - if s.duration is not None: - SnapMarkerSettingsAddDuration(builder, s.duration) - if styles_vec: - SnapMarkerSettingsAddStyles(builder, styles_vec) - return SnapMarkerSettingsEnd(builder) - -def serialize_fbs_snap_settings(builder: flatbuffers.Builder, s: DS_SnapSettings) -> int: - polar_tracking_offset = serialize_fbs_polar_tracking_settings(builder, s.polar_tracking) - dynamic_snap_offset = serialize_fbs_dynamic_snap_settings(builder, s.dynamic_snap) - tracking_line_style_offset = serialize_fbs_tracking_line_style(builder, s.tracking_line_style) - snap_markers_offset = serialize_fbs_snap_marker_settings(builder, s.snap_markers) - layer_filters_offset = serialize_fbs_layer_snap_filters(builder, s.layer_snap_filters) - - active_modes_vec = 0 - if s.active_object_snap_modes: - SnapSettingsStartActiveObjectSnapModesVector(builder, len(s.active_object_snap_modes)) - for m in reversed(s.active_object_snap_modes): - builder.PrependUint8(m) - active_modes_vec = builder.EndVector() - - priority_vec = 0 - if s.snap_priority: - SnapSettingsStartSnapPriorityVector(builder, len(s.snap_priority)) - for m in reversed(s.snap_priority): - builder.PrependUint8(m) - priority_vec = builder.EndVector() - - overrides_vec = 0 - if s.temporary_overrides: - SnapSettingsStartTemporaryOverridesVector(builder, len(s.temporary_overrides)) - for ov in reversed(s.temporary_overrides): - builder.PrependUOffsetTRelative(serialize_fbs_snap_override(builder, ov)) - overrides_vec = builder.EndVector() - - eltype_vec = 0 - if s.element_type_filters: - SnapSettingsStartElementTypeFiltersVector(builder, len(s.element_type_filters)) - for t in reversed(s.element_type_filters): - builder.PrependUOffsetTRelative(builder.CreateString(t)) - eltype_vec = builder.EndVector() - - SnapSettingsStart(builder) - SnapSettingsAddReadonly(builder, s.readonly) - SnapSettingsAddTwistAngle(builder, s.twist_angle) - SnapSettingsAddSnapTolerance(builder, s.snap_tolerance) - SnapSettingsAddObjectSnapAperture(builder, s.object_snap_aperture) - SnapSettingsAddIsOrthoModeOn(builder, s.is_ortho_mode_on) - SnapSettingsAddPolarTracking(builder, polar_tracking_offset) - SnapSettingsAddIsObjectSnapOn(builder, s.is_object_snap_on) - if active_modes_vec: SnapSettingsAddActiveObjectSnapModes(builder, active_modes_vec) - if priority_vec: SnapSettingsAddSnapPriority(builder, priority_vec) - SnapSettingsAddShowTrackingLines(builder, s.show_tracking_lines) - if tracking_line_style_offset: SnapSettingsAddTrackingLineStyle(builder, tracking_line_style_offset) - SnapSettingsAddDynamicSnap(builder, dynamic_snap_offset) - if overrides_vec: SnapSettingsAddTemporaryOverrides(builder, overrides_vec) - if s.incremental_distance is not None: - SnapSettingsAddIncrementalDistance(builder, s.incremental_distance) - if s.magnetic_strength is not None: - SnapSettingsAddMagneticStrength(builder, s.magnetic_strength) - if layer_filters_offset: SnapSettingsAddLayerSnapFilters(builder, layer_filters_offset) - if eltype_vec: SnapSettingsAddElementTypeFilters(builder, eltype_vec) - if s.snap_mode is not None: - SnapSettingsAddSnapMode(builder, s.snap_mode) - if snap_markers_offset: SnapSettingsAddSnapMarkers(builder, snap_markers_offset) - SnapSettingsAddConstructionSnapEnabled(builder, s.construction_snap_enabled) - if s.snap_to_grid_intersections is not None: - SnapSettingsAddSnapToGridIntersections(builder, s.snap_to_grid_intersections) - return SnapSettingsEnd(builder) - -def serialize_fbs_identified_grid_settings(builder: flatbuffers.Builder, x: DS_IdentifiedGridSettings) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - settings_offset = serialize_fbs_grid_settings(builder, x.settings) - IdentifiedGridSettingsStart(builder) - IdentifiedGridSettingsAddId(builder, id_offset) - IdentifiedGridSettingsAddSettings(builder, settings_offset) - return IdentifiedGridSettingsEnd(builder) - -def serialize_fbs_identified_snap_settings(builder: flatbuffers.Builder, x: DS_IdentifiedSnapSettings) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - settings_offset = serialize_fbs_snap_settings(builder, x.settings) - IdentifiedSnapSettingsStart(builder) - IdentifiedSnapSettingsAddId(builder, id_offset) - IdentifiedSnapSettingsAddSettings(builder, settings_offset) - return IdentifiedSnapSettingsEnd(builder) - -def serialize_fbs_identified_ucs(builder: flatbuffers.Builder, x: DS_IdentifiedUcs) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - ucs_offset = serialize_fbs_duc_ucs(builder, x.ucs) - IdentifiedUcsStart(builder) - IdentifiedUcsAddId(builder, id_offset) - IdentifiedUcsAddUcs(builder, ucs_offset) - return IdentifiedUcsEnd(builder) - -def serialize_fbs_identified_view(builder: flatbuffers.Builder, x: DS_IdentifiedView) -> int: - id_offset = serialize_fbs_identifier(builder, x.id) - view_offset = serialize_fbs_duc_view(builder, x.view) - IdentifiedViewStart(builder) - IdentifiedViewAddId(builder, id_offset) - IdentifiedViewAddView(builder, view_offset) - return IdentifiedViewEnd(builder) - -def serialize_fbs_standard_view_settings(builder: flatbuffers.Builder, s: Optional[DS_StandardViewSettings]) -> int: - if s is None: - return 0 - views_offsets = [serialize_fbs_identified_view(builder, v) for v in (s.views or [])] - ucs_offsets = [serialize_fbs_identified_ucs(builder, u) for u in (s.ucs or [])] - grid_offsets = [serialize_fbs_identified_grid_settings(builder, g) for g in (s.grid_settings or [])] - snap_offsets = [serialize_fbs_identified_snap_settings(builder, sn) for sn in (s.snap_settings or [])] - - def _vec(start_fn, offsets): - start_fn(builder, len(offsets)) - for off in reversed(offsets): - builder.PrependUOffsetTRelative(off) - return builder.EndVector() +# Keys in the asdict() output that should be flattened (merged into the parent), +# mirroring Rust's #[serde(flatten)] on base / styles / linear_base / stack_element_base. +_FLATTEN_KEYS = frozenset({"base", "styles", "linear_base", "stack_element_base"}) - views_vec = _vec(StandardViewSettingsStartViewsVector, views_offsets) if views_offsets else 0 - ucs_vec = _vec(StandardViewSettingsStartUcsVector, ucs_offsets) if ucs_offsets else 0 - grid_vec = _vec(StandardViewSettingsStartGridSettingsVector, grid_offsets) if grid_offsets else 0 - snap_vec = _vec(StandardViewSettingsStartSnapSettingsVector, snap_offsets) if snap_offsets else 0 - StandardViewSettingsStart(builder) - if views_vec: StandardViewSettingsAddViews(builder, views_vec) - if ucs_vec: StandardViewSettingsAddUcs(builder, ucs_vec) - if grid_vec: StandardViewSettingsAddGridSettings(builder, grid_vec) - if snap_vec: StandardViewSettingsAddSnapSettings(builder, snap_vec) - return StandardViewSettingsEnd(builder) - -# ----------------------------------------------------------------------------- -# Standards: Validation -# ----------------------------------------------------------------------------- - -def serialize_fbs_dimension_validation_rules(builder: flatbuffers.Builder, r: Optional[DS_DimensionValidationRules]) -> int: - if r is None: - return 0 - allowed_vec = 0 - if r.allowed_precisions: - DimensionValidationRulesStartAllowedPrecisionsVector(builder, len(r.allowed_precisions)) - for p in reversed(r.allowed_precisions): - builder.PrependInt32(p) - allowed_vec = builder.EndVector() - DimensionValidationRulesStart(builder) - DimensionValidationRulesAddMinTextHeight(builder, r.min_text_height) - DimensionValidationRulesAddMaxTextHeight(builder, r.max_text_height) - if allowed_vec: - DimensionValidationRulesAddAllowedPrecisions(builder, allowed_vec) - return DimensionValidationRulesEnd(builder) - -def serialize_fbs_layer_validation_rules(builder: flatbuffers.Builder, r: Optional[DS_LayerValidationRules]) -> int: - if r is None: - return 0 - names_vec = 0 - if r.prohibited_layer_names: - # Create all strings first - string_offsets = [builder.CreateString(n) for n in r.prohibited_layer_names] - LayerValidationRulesStartProhibitedLayerNamesVector(builder, len(string_offsets)) - for off in reversed(string_offsets): - builder.PrependUOffsetTRelative(off) - names_vec = builder.EndVector() - LayerValidationRulesStart(builder) - if names_vec: - LayerValidationRulesAddProhibitedLayerNames(builder, names_vec) - return LayerValidationRulesEnd(builder) - -def serialize_fbs_standard_validation(builder: flatbuffers.Builder, v: Optional[DS_StandardValidation]) -> int: - if v is None: - return 0 - dim_offset = serialize_fbs_dimension_validation_rules(builder, v.dimension_rules) - layer_offset = serialize_fbs_layer_validation_rules(builder, v.layer_rules) - StandardValidationStart(builder) - if dim_offset: StandardValidationAddDimensionRules(builder, dim_offset) - if layer_offset: StandardValidationAddLayerRules(builder, layer_offset) - return StandardValidationEnd(builder) - -# ----------------------------------------------------------------------------- -# Standard (all) -# ----------------------------------------------------------------------------- - -def serialize_fbs_standard(builder: flatbuffers.Builder, s: DS_Standard) -> int: - identifier_offset = serialize_fbs_identifier(builder, s.identifier) - version_offset = builder.CreateString(s.version) - overrides_offset = serialize_fbs_standard_overrides(builder, s.overrides) - styles_offset = serialize_fbs_standard_styles(builder, s.styles) - view_settings_offset = serialize_fbs_standard_view_settings(builder, s.view_settings) - units_offset = serialize_fbs_standard_units(builder, s.units) - validation_offset = serialize_fbs_standard_validation(builder, s.validation) - - StandardStart(builder) - StandardAddIdentifier(builder, identifier_offset) - StandardAddVersion(builder, version_offset) - StandardAddReadonly(builder, s.readonly) - if overrides_offset: StandardAddOverrides(builder, overrides_offset) - if styles_offset: StandardAddStyles(builder, styles_offset) - if view_settings_offset: StandardAddViewSettings(builder, view_settings_offset) - if units_offset: StandardAddUnits(builder, units_offset) - if validation_offset: StandardAddValidation(builder, validation_offset) - return StandardEnd(builder) - -# ----------------------------------------------------------------------------- -# Blocks, Groups, Regions, Layers -# ----------------------------------------------------------------------------- - -def serialize_fbs_block_attribute_definition(builder: flatbuffers.Builder, d: "DS_DucBlockAttributeDefinition") -> int: - tag_offset = builder.CreateString(d.tag) - prompt_offset = _str(builder, d.prompt) - default_value_offset = builder.CreateString(d.default_value) - DucBlockAttributeDefinitionStart(builder) - DucBlockAttributeDefinitionAddTag(builder, tag_offset) - if prompt_offset: DucBlockAttributeDefinitionAddPrompt(builder, prompt_offset) - DucBlockAttributeDefinitionAddDefaultValue(builder, default_value_offset) - DucBlockAttributeDefinitionAddIsConstant(builder, d.is_constant) - return DucBlockAttributeDefinitionEnd(builder) - -def serialize_fbs_block_attribute_definition_entry(builder: flatbuffers.Builder, e: DS_DucBlockAttributeDefinitionEntry) -> int: - key_offset = builder.CreateString(e.key) - value_offset = serialize_fbs_block_attribute_definition(builder, e.value) - DucBlockAttributeDefinitionEntryStart(builder) - DucBlockAttributeDefinitionEntryAddKey(builder, key_offset) - DucBlockAttributeDefinitionEntryAddValue(builder, value_offset) - return DucBlockAttributeDefinitionEntryEnd(builder) - -def serialize_fbs_block_metadata(builder: flatbuffers.Builder, metadata: DS_DucBlockMetadata) -> int: - source_offset = builder.CreateString(metadata.source) - - # Compress localization JSON and create byte vector - localization_offset = 0 - if metadata.localization: - json_str = json.dumps(metadata.localization) - compressed = gzip.compress(json_str.encode("utf-8")) - DucBlockMetadataStartLocalizationVector(builder, len(compressed)) - for i in reversed(range(len(compressed))): - builder.PrependByte(compressed[i]) - localization_offset = builder.EndVector(len(compressed)) - - DucBlockMetadataStart(builder) - DucBlockMetadataAddSource(builder, source_offset) - DucBlockMetadataAddUsageCount(builder, metadata.usage_count) - DucBlockMetadataAddCreatedAt(builder, metadata.created_at) - DucBlockMetadataAddUpdatedAt(builder, metadata.updated_at) - if localization_offset: - DucBlockMetadataAddLocalization(builder, localization_offset) - return DucBlockMetadataEnd(builder) - -def serialize_fbs_block(builder: flatbuffers.Builder, block: DS_DucBlock) -> int: - id_offset = builder.CreateString(block.id) - label_offset = builder.CreateString(block.label) - description_offset = _str(builder, block.description) - - attr_offsets = [serialize_fbs_block_attribute_definition_entry(builder, a) for a in (block.attribute_definitions or [])] - attr_vec = 0 - if attr_offsets: - DucBlockStartAttributeDefinitionsVector(builder, len(attr_offsets)) - for off in reversed(attr_offsets): - builder.PrependUOffsetTRelative(off) - attr_vec = builder.EndVector() - - # Serialize metadata if present - metadata_offset = 0 - if block.metadata: - metadata_offset = serialize_fbs_block_metadata(builder, block.metadata) - - # Serialize thumbnail if present - thumbnail_vec = 0 - if block.thumbnail: - DucBlockStartThumbnailVector(builder, len(block.thumbnail)) - for byte in reversed(block.thumbnail): - builder.PrependByte(byte) - thumbnail_vec = builder.EndVector() - - DucBlockStart(builder) - DucBlockAddId(builder, id_offset) - DucBlockAddLabel(builder, label_offset) - if description_offset: - DucBlockAddDescription(builder, description_offset) - DucBlockAddVersion(builder, block.version) - if attr_vec: - DucBlockAddAttributeDefinitions(builder, attr_vec) - if metadata_offset: - DucBlockAddMetadata(builder, metadata_offset) - if thumbnail_vec: - DucBlockAddThumbnail(builder, thumbnail_vec) - return DucBlockEnd(builder) - -def serialize_fbs_block_collection_entry(builder: flatbuffers.Builder, entry: DS_DucBlockCollectionEntry) -> int: - id_offset = builder.CreateString(entry.id) - DucBlockCollectionEntryStart(builder) - DucBlockCollectionEntryAddId(builder, id_offset) - DucBlockCollectionEntryAddIsCollection(builder, entry.is_collection) - return DucBlockCollectionEntryEnd(builder) - -def serialize_fbs_block_collection(builder: flatbuffers.Builder, collection: DS_DucBlockCollection) -> int: - id_offset = builder.CreateString(collection.id) - label_offset = builder.CreateString(collection.label) - - # Serialize children - child_offsets = [serialize_fbs_block_collection_entry(builder, child) for child in (collection.children or [])] - children_vec = 0 - if child_offsets: - DucBlockCollectionStartChildrenVector(builder, len(child_offsets)) - for off in reversed(child_offsets): - builder.PrependUOffsetTRelative(off) - children_vec = builder.EndVector() - - # Serialize metadata if present - metadata_offset = 0 - if collection.metadata: - metadata_offset = serialize_fbs_block_metadata(builder, collection.metadata) - - # Serialize thumbnail if present - thumbnail_vec = 0 - if collection.thumbnail: - DucBlockCollectionStartThumbnailVector(builder, len(collection.thumbnail)) - for byte in reversed(collection.thumbnail): - builder.PrependByte(byte) - thumbnail_vec = builder.EndVector() - - DucBlockCollectionStart(builder) - DucBlockCollectionAddId(builder, id_offset) - DucBlockCollectionAddLabel(builder, label_offset) - if children_vec: - DucBlockCollectionAddChildren(builder, children_vec) - if metadata_offset: - DucBlockCollectionAddMetadata(builder, metadata_offset) - if thumbnail_vec: - DucBlockCollectionAddThumbnail(builder, thumbnail_vec) - return DucBlockCollectionEnd(builder) - -def serialize_fbs_group(builder: flatbuffers.Builder, group: DS_DucGroup) -> int: - id_offset = builder.CreateString(group.id) - stack_base_offset = serialize_fbs_duc_stack_base(builder, group.stack_base) - DucGroupStart(builder) - DucGroupAddId(builder, id_offset) - DucGroupAddStackBase(builder, stack_base_offset) - return DucGroupEnd(builder) - -def serialize_fbs_region(builder: flatbuffers.Builder, region: DS_DucRegion) -> int: - id_offset = builder.CreateString(region.id) - stack_base_offset = serialize_fbs_duc_stack_base(builder, region.stack_base) - DucRegionStart(builder) - DucRegionAddId(builder, id_offset) - DucRegionAddStackBase(builder, stack_base_offset) - if region.boolean_operation is not None: - DucRegionAddBooleanOperation(builder, region.boolean_operation) - return DucRegionEnd(builder) - -def serialize_fbs_layer_overrides(builder: flatbuffers.Builder, o: DS_DucLayerOverrides) -> int: - stroke_offset = serialize_fbs_element_stroke(builder, o.stroke) - bg_offset = serialize_fbs_element_background(builder, o.background) - DucLayerOverridesStart(builder) - DucLayerOverridesAddStroke(builder, stroke_offset) - DucLayerOverridesAddBackground(builder, bg_offset) - return DucLayerOverridesEnd(builder) - -def serialize_fbs_layer(builder: flatbuffers.Builder, layer: DS_DucLayer) -> int: - id_offset = builder.CreateString(layer.id) - stack_base_offset = serialize_fbs_duc_stack_base(builder, layer.stack_base) - overrides_offset = serialize_fbs_layer_overrides(builder, layer.overrides) - DucLayerStart(builder) - DucLayerAddId(builder, id_offset) - DucLayerAddStackBase(builder, stack_base_offset) - DucLayerAddReadonly(builder, layer.readonly) - DucLayerAddOverrides(builder, overrides_offset) - return DucLayerEnd(builder) - -# ----------------------------------------------------------------------------- -# App & Document state -# ----------------------------------------------------------------------------- - -def serialize_fbs_duc_global_state(builder: flatbuffers.Builder, s: Optional[DS_DucGlobalState]) -> int: - if s is None: - return 0 - name_offset = _str(builder, s.name) - bg_offset = builder.CreateString(s.view_background_color) - scope_offset = builder.CreateString(s.main_scope) - DucGlobalStateStart(builder) - if name_offset: DucGlobalStateAddName(builder, name_offset) - DucGlobalStateAddViewBackgroundColor(builder, bg_offset) - DucGlobalStateAddMainScope(builder, scope_offset) - DucGlobalStateAddDashSpacingScale(builder, s.dash_spacing_scale) - DucGlobalStateAddIsDashSpacingAffectedByViewportScale(builder, s.is_dash_spacing_affected_by_viewport_scale) - DucGlobalStateAddScopeExponentThreshold(builder, s.scope_exponent_threshold) - DucGlobalStateAddDimensionsAssociativeByDefault(builder, s.dimensions_associative_by_default) - DucGlobalStateAddUseAnnotativeScaling(builder, s.use_annotative_scaling) - if s.display_precision: - DucGlobalStateAddDisplayPrecisionLinear(builder, s.display_precision.linear) - DucGlobalStateAddDisplayPrecisionAngular(builder, s.display_precision.angular) - if s.pruning_level is not None: DucGlobalStateAddPruningLevel(builder, s.pruning_level) - return DucGlobalStateEnd(builder) - -def serialize_fbs_duc_local_state(builder: flatbuffers.Builder, s: Optional[DS_DucLocalState]) -> int: - if s is None: - return 0 - scope_offset = builder.CreateString(s.scope) - active_standard_id_offset = builder.CreateString(s.active_standard_id) - active_grid_vec = 0 - if s.active_grid_settings: - DucLocalStateStartActiveGridSettingsVector(builder, len(s.active_grid_settings)) - for g in reversed(s.active_grid_settings): - builder.PrependUOffsetTRelative(builder.CreateString(g)) - active_grid_vec = builder.EndVector() - active_snap_settings_offset = _str(builder, s.active_snap_settings) - current_item_stroke_offset = serialize_fbs_element_stroke(builder, s.current_item_stroke) if s.current_item_stroke else 0 - - current_item_bg_offset = serialize_fbs_element_background(builder, s.current_item_background) if s.current_item_background else 0 - - current_item_font_family_offset = _str(builder, s.current_item_font_family) - current_item_start_head_offset = serialize_fbs_duc_head(builder, s.current_item_start_line_head) if s.current_item_start_line_head else 0 - - current_item_end_head_offset = serialize_fbs_duc_head(builder, s.current_item_end_line_head) if s.current_item_end_line_head else 0 - - - DucLocalStateStart(builder) - DucLocalStateAddScope(builder, scope_offset) - DucLocalStateAddActiveStandardId(builder, active_standard_id_offset) - DucLocalStateAddScrollX(builder, s.scroll_x) - DucLocalStateAddScrollY(builder, s.scroll_y) - DucLocalStateAddZoom(builder, s.zoom) - if active_grid_vec: DucLocalStateAddActiveGridSettings(builder, active_grid_vec) - if active_snap_settings_offset: DucLocalStateAddActiveSnapSettings(builder, active_snap_settings_offset) - - DucLocalStateAddIsBindingEnabled(builder, s.is_binding_enabled) - if current_item_stroke_offset: DucLocalStateAddCurrentItemStroke(builder, current_item_stroke_offset) - if current_item_bg_offset: DucLocalStateAddCurrentItemBackground(builder, current_item_bg_offset) - if s.current_item_opacity is not None: DucLocalStateAddCurrentItemOpacity(builder, s.current_item_opacity) - - if current_item_font_family_offset: DucLocalStateAddCurrentItemFontFamily(builder, current_item_font_family_offset) - - if s.current_item_font_size is not None: DucLocalStateAddCurrentItemFontSize(builder, s.current_item_font_size) - - if s.current_item_text_align is not None: DucLocalStateAddCurrentItemTextAlign(builder, s.current_item_text_align) - - if current_item_start_head_offset: DucLocalStateAddCurrentItemStartLineHead(builder, current_item_start_head_offset) - - if current_item_end_head_offset: DucLocalStateAddCurrentItemEndLineHead(builder, current_item_end_head_offset) - - if s.current_item_roundness is not None: DucLocalStateAddCurrentItemRoundness(builder, s.current_item_roundness) - - DucLocalStateAddPenMode(builder, s.pen_mode) - DucLocalStateAddViewModeEnabled(builder, s.view_mode_enabled) - DucLocalStateAddObjectsSnapModeEnabled(builder, s.objects_snap_mode_enabled) - DucLocalStateAddGridModeEnabled(builder, s.grid_mode_enabled) - DucLocalStateAddOutlineModeEnabled(builder, s.outline_mode_enabled); - if s.manual_save_mode is not None: DucLocalStateAddManualSaveMode(builder, s.manual_save_mode) - return DucLocalStateEnd(builder) - -# ----------------------------------------------------------------------------- -# External files -# ----------------------------------------------------------------------------- - -def serialize_fbs_external_file_data(builder: flatbuffers.Builder, d: DS_DucExternalFileData) -> int: - mime_offset = builder.CreateString(d.mime_type) - id_offset = builder.CreateString(d.id) - data_vec = builder.CreateByteVector(d.data) if d.data else 0 - DucExternalFileDataStart(builder) - DucExternalFileDataAddMimeType(builder, mime_offset) - DucExternalFileDataAddId(builder, id_offset) - if data_vec: DucExternalFileDataAddData(builder, data_vec) - DucExternalFileDataAddCreated(builder, d.created) - if d.last_retrieved is not None: - DucExternalFileDataAddLastRetrieved(builder, d.last_retrieved) - return DucExternalFileDataEnd(builder) - -def serialize_fbs_external_file_entry(builder: flatbuffers.Builder, e: DS_DucExternalFileEntry) -> int: - key_offset = builder.CreateString(e.key) - value_offset = serialize_fbs_external_file_data(builder, e.value) - DucExternalFileEntryStart(builder) - DucExternalFileEntryAddKey(builder, key_offset) - DucExternalFileEntryAddValue(builder, value_offset) - return DucExternalFileEntryEnd(builder) - -# ----------------------------------------------------------------------------- -# Version graph -# ----------------------------------------------------------------------------- - -def serialize_fbs_version_base(builder: flatbuffers.Builder, b: DS_VersionBase) -> int: - id_offset = builder.CreateString(b.id) - parent_id_offset = _str(builder, b.parent_id) - description_offset = _str(builder, b.description) - user_id_offset = _str(builder, b.user_id) - - VersionBaseStart(builder) - VersionBaseAddId(builder, id_offset) - if parent_id_offset: VersionBaseAddParentId(builder, parent_id_offset) - VersionBaseAddTimestamp(builder, b.timestamp) - if description_offset: VersionBaseAddDescription(builder, description_offset) - VersionBaseAddIsManualSave(builder, b.is_manual_save) - if user_id_offset: VersionBaseAddUserId(builder, user_id_offset) - return VersionBaseEnd(builder) - -def serialize_fbs_checkpoint(builder: flatbuffers.Builder, c: DS_Checkpoint) -> int: - base_offset = serialize_fbs_version_base(builder, c) - data_vec = builder.CreateByteVector(c.data) if c.data else 0 - CheckpointStart(builder) - CheckpointAddBase(builder, base_offset) - if data_vec: CheckpointAddData(builder, data_vec) - CheckpointAddSizeBytes(builder, c.size_bytes) - return CheckpointEnd(builder) - -def serialize_fbs_json_patch_operation(builder: flatbuffers.Builder, op: DS_JSONPatchOperation) -> int: - op_offset = builder.CreateString(op.op) - path_offset = builder.CreateString(op.path) - from_offset = _str(builder, op.from_path) # mapped from 'from_path' to 'from' in schema - value_json = json.dumps(op.value) if not isinstance(op.value, str) else op.value - value_offset = builder.CreateString(value_json) - JSONPatchOperationStart(builder) - JSONPatchOperationAddOp(builder, op_offset) - JSONPatchOperationAddPath(builder, path_offset) - if from_offset: JSONPatchOperationAddFrom(builder, from_offset) - JSONPatchOperationAddValue(builder, value_offset) - return JSONPatchOperationEnd(builder) - -def serialize_fbs_delta(builder: flatbuffers.Builder, d: DS_Delta) -> int: - base_offset = serialize_fbs_version_base(builder, d) - - # Convert JSONPatchOperation dataclasses to dicts for JSON serialization - from dataclasses import asdict, is_dataclass - patch_list = [] - for op in (d.patch or []): - if is_dataclass(op): - patch_list.append(asdict(op)) +def _flatten_dict(d: dict) -> dict: + """Recursively flatten nested dicts whose key is in ``_FLATTEN_KEYS``.""" + result: dict = {} + for k, v in d.items(): + if k in _FLATTEN_KEYS and isinstance(v, dict): + result.update(_flatten_dict(v)) else: - # Already a dict (from parsed data) - patch_list.append(op) - json_str = json.dumps(patch_list) - compressed = gzip.compress(json_str.encode("utf-8")) - DeltaStartPatchVector(builder, len(compressed)) - for i in reversed(range(len(compressed))): - builder.PrependByte(compressed[i]) - patch_vec = builder.EndVector(len(compressed)) - size_bytes = len(compressed) - - DeltaStart(builder) - DeltaAddBase(builder, base_offset) - DeltaAddPatch(builder, patch_vec) - DeltaAddSizeBytes(builder, size_bytes) - return DeltaEnd(builder) - -def serialize_fbs_version_graph_metadata(builder: flatbuffers.Builder, m: Optional[DS_VersionGraphMetadata]) -> int: - if m is None: - return 0 - VersionGraphMetadataStart(builder) - VersionGraphMetadataAddLastPruned(builder, m.last_pruned) - VersionGraphMetadataAddTotalSize(builder, m.total_size) - return VersionGraphMetadataEnd(builder) - -def serialize_fbs_version_graph(builder: flatbuffers.Builder, g: Optional[DS_VersionGraph]) -> int: - if g is None: - return 0 - checkpoints_offsets = [serialize_fbs_checkpoint(builder, c) for c in (g.checkpoints or [])] - VersionGraphStartCheckpointsVector(builder, len(checkpoints_offsets)) - for off in reversed(checkpoints_offsets): - builder.PrependUOffsetTRelative(off) - checkpoints_vec = builder.EndVector() - - deltas_offsets = [serialize_fbs_delta(builder, d) for d in (g.deltas or [])] - VersionGraphStartDeltasVector(builder, len(deltas_offsets)) - for off in reversed(deltas_offsets): - builder.PrependUOffsetTRelative(off) - deltas_vec = builder.EndVector() - - metadata_offset = serialize_fbs_version_graph_metadata(builder, g.metadata) - user_chk_offset = builder.CreateString(g.user_checkpoint_version_id) if g.user_checkpoint_version_id else 0 - - latest_offset = builder.CreateString(g.latest_version_id) if g.latest_version_id else 0 - - VersionGraphStart(builder) - if user_chk_offset: VersionGraphAddUserCheckpointVersionId(builder, user_chk_offset) - if latest_offset: VersionGraphAddLatestVersionId(builder, latest_offset) - VersionGraphAddCheckpoints(builder, checkpoints_vec) - VersionGraphAddDeltas(builder, deltas_vec) - if metadata_offset: VersionGraphAddMetadata(builder, metadata_offset) - return VersionGraphEnd(builder) - -# ----------------------------------------------------------------------------- -# Root assembly -# ----------------------------------------------------------------------------- - -def serialize_as_flatbuffers(data_state: DS_ExportedDataState) -> bytes: - """ - Serialize ExportedDataState to FlatBuffers using comprehensive classes. - """ - try: - builder = flatbuffers.Builder(1024 * 1024) - - # Elements - elements_offsets = [serialize_fbs_element_wrapper(builder, ew) for ew in (data_state.elements or [])] - ExportedDataStateStartElementsVector(builder, len(elements_offsets)) - for off in reversed(elements_offsets): - builder.PrependUOffsetTRelative(off) - elements_vec = builder.EndVector() - - # Blocks - blocks_offsets = [serialize_fbs_block(builder, b) for b in (data_state.blocks or [])] - ExportedDataStateStartBlocksVector(builder, len(blocks_offsets)) - for off in reversed(blocks_offsets): - builder.PrependUOffsetTRelative(off) - blocks_vec = builder.EndVector() - - # Block instances - block_instances_offsets = [serialize_fbs_block_instance(builder, bi) for bi in (data_state.block_instances or [])] - - if block_instances_offsets: - ExportedDataStateStartBlockInstancesVector(builder, len(block_instances_offsets)) - for off in reversed(block_instances_offsets): - builder.PrependUOffsetTRelative(off) - block_instances_vec = builder.EndVector() + result[k] = v + return result + + +def _element_to_camel(wrapper_or_element: Any) -> dict: + """Convert an element (or ElementWrapper) to the camelCase dict Rust expects.""" + el = wrapper_or_element + # Unwrap ElementWrapper transparently + if is_dataclass(el) and hasattr(el, "element"): + el = el.element + + if isinstance(el, dict): + d = dict(el) + elif is_dataclass(el): + class_name = type(el).__name__ + d = asdict(el) + # Inject the type tag if we know the mapping + type_tag = _ELEMENT_CLASS_TO_TYPE.get(class_name) + if type_tag: + d["type"] = type_tag + else: + return el + + d = _flatten_dict(d) + return deep_snake_to_camel(d) + + +def _convert_external_files( + entries: Optional[list], +) -> Optional[Dict[str, Any]]: + """Convert a list of DucExternalFileEntry to a ``{id: data}`` dict.""" + if not entries: + return None + result: dict = {} + for entry in entries: + if is_dataclass(entry): + entry = asdict(entry) + if isinstance(entry, dict): + key = entry.get("key", entry.get("id", "")) + value = entry.get("value", entry) + if is_dataclass(value): + value = asdict(value) + result[key] = deep_snake_to_camel(value) if isinstance(value, dict) else value else: - block_instances_vec = 0 - - # Block collections - block_collections_offsets = [serialize_fbs_block_collection(builder, bc) for bc in (data_state.block_collections or [])] - ExportedDataStateStartBlockCollectionsVector(builder, len(block_collections_offsets)) - for off in reversed(block_collections_offsets): - builder.PrependUOffsetTRelative(off) - block_collections_vec = builder.EndVector() - - # Groups - groups_offsets = [serialize_fbs_group(builder, g) for g in (data_state.groups or [])] - ExportedDataStateStartGroupsVector(builder, len(groups_offsets)) - for off in reversed(groups_offsets): - builder.PrependUOffsetTRelative(off) - groups_vec = builder.EndVector() - - # Regions - regions_offsets = [serialize_fbs_region(builder, r) for r in (data_state.regions or [])] - ExportedDataStateStartRegionsVector(builder, len(regions_offsets)) - for off in reversed(regions_offsets): - builder.PrependUOffsetTRelative(off) - regions_vec = builder.EndVector() - - # Layers - layers_offsets = [serialize_fbs_layer(builder, l) for l in (data_state.layers or [])] - ExportedDataStateStartLayersVector(builder, len(layers_offsets)) - for off in reversed(layers_offsets): - builder.PrependUOffsetTRelative(off) - layers_vec = builder.EndVector() + continue + return result if result else None + + +def _convert_dict_entries( + entries: Optional[list], +) -> Optional[Dict[str, str]]: + """Convert a list of DictionaryEntry to a ``{key: value}`` dict.""" + if not entries: + return None + if isinstance(entries, dict): + return entries + result: dict = {} + for entry in entries: + if is_dataclass(entry): + entry = asdict(entry) + if isinstance(entry, dict): + result[entry.get("key", "")] = entry.get("value", "") + return result if result else None + + +def _convert_list(items: Optional[list]) -> Optional[list]: + """Convert a list of dataclass instances to camelCase dicts.""" + if not items: + return None + return [to_serializable(item) for item in items] - # Standards - standards_offsets = [serialize_fbs_standard(builder, s) for s in (data_state.standards or [])] - ExportedDataStateStartStandardsVector(builder, len(standards_offsets)) - for off in reversed(standards_offsets): - builder.PrependUOffsetTRelative(off) - standards_vec = builder.EndVector() - - # States - duc_local_state_offset = serialize_fbs_duc_local_state(builder, data_state.duc_local_state) - duc_global_state_offset = serialize_fbs_duc_global_state(builder, data_state.duc_global_state) - - # External files - files_offsets = [serialize_fbs_external_file_entry(builder, f) for f in (data_state.files or [])] - ExportedDataStateStartExternalFilesVector(builder, len(files_offsets)) - for off in reversed(files_offsets): - builder.PrependUOffsetTRelative(off) - files_vec = builder.EndVector() - - # Version graph - version_graph_offset = serialize_fbs_version_graph(builder, data_state.version_graph) - - # Dictionary - dict_items = list((data_state.dictionary or {}).items()) - dict_offsets = [] - for k, v in dict_items: - dict_offsets.append(serialize_fbs_dictionary_entry(builder, DS_DictionaryEntry(k, v))) - ExportedDataStateStartDictionaryVector(builder, len(dict_offsets)) - for off in reversed(dict_offsets): - builder.PrependUOffsetTRelative(off) - dictionary_vec = builder.EndVector() - - # Strings and thumbnail - type_offset = builder.CreateString(data_state.type) - version_offset = builder.CreateString(data_state.version) - source_offset = builder.CreateString(data_state.source) - thumbnail_offset = builder.CreateByteVector(data_state.thumbnail) if data_state.thumbnail else 0 - id_offset = builder.CreateString(data_state.id) if data_state.id else 0 - - # Build root - ExportedDataStateStart(builder) - ExportedDataStateAddType(builder, type_offset) - # Schema contains version_legacy, default to 0 - from ducpy.Duc.ExportedDataState import ExportedDataStateAddVersionLegacy - ExportedDataStateAddVersionLegacy(builder, 0) - ExportedDataStateAddSource(builder, source_offset) - ExportedDataStateAddVersion(builder, version_offset) - if thumbnail_offset: ExportedDataStateAddThumbnail(builder, thumbnail_offset) - ExportedDataStateAddDictionary(builder, dictionary_vec) - ExportedDataStateAddElements(builder, elements_vec) - ExportedDataStateAddBlocks(builder, blocks_vec) - ExportedDataStateAddBlockInstances(builder, block_instances_vec) - ExportedDataStateAddBlockCollections(builder, block_collections_vec) - ExportedDataStateAddGroups(builder, groups_vec) - ExportedDataStateAddRegions(builder, regions_vec) - ExportedDataStateAddLayers(builder, layers_vec) - ExportedDataStateAddStandards(builder, standards_vec) - if duc_local_state_offset: ExportedDataStateAddDucLocalState(builder, duc_local_state_offset) - if duc_global_state_offset: ExportedDataStateAddDucGlobalState(builder, duc_global_state_offset) - ExportedDataStateAddExternalFiles(builder, files_vec) - if version_graph_offset: ExportedDataStateAddVersionGraph(builder, version_graph_offset) - if id_offset: ExportedDataStateAddId(builder, id_offset) - exported_data = ExportedDataStateEnd(builder) - - builder.Finish(exported_data, b"DUC_") - return builder.Output() - except Exception as e: - logger.error(f"Serialization failed with error: {str(e)}", exc_info=True) - raise - -# ----------------------------------------------------------------------------- -# User-friendly API -# ----------------------------------------------------------------------------- def serialize_duc( - name: str, - thumbnail: bytes = None, - dictionary: List[DS_DictionaryEntry] = None, - elements: List[DS_ElementWrapper] = None, - duc_local_state: DS_DucLocalState = None, - duc_global_state: DS_DucGlobalState = None, - version_graph: DS_VersionGraph = None, - blocks: List[DS_DucBlock] = None, - block_instances: List[DS_DucBlockInstance] = None, - block_collections: List[DS_DucBlockCollection] = None, - groups: List[DS_DucGroup] = None, - regions: List[DS_DucRegion] = None, - layers: List[DS_DucLayer] = None, - external_files: List[DS_DucExternalFileEntry] = None, - standards: List[DS_Standard] = None, + name: str, + thumbnail: Optional[bytes] = None, + dictionary: Optional[list] = None, + elements: Optional[list] = None, + duc_local_state: Any = None, + duc_global_state: Any = None, + version_graph: Any = None, + blocks: Optional[list] = None, + block_instances: Optional[list] = None, + block_collections: Optional[list] = None, + groups: Optional[list] = None, + regions: Optional[list] = None, + layers: Optional[list] = None, + external_files: Optional[list] = None, ) -> bytes: + """Serialize elements to ``.duc`` format. + Element instances and state dataclasses are automatically converted to the + camelCase dicts expected by the Rust native module. """ - Serialize elements to DUC format with a user-friendly API. - """ - try: - dict_map: Dict[str, str] = {e.key: e.value for e in (dictionary or [])} - data_state = DS_ExportedDataState( - type="duc", - version=DUC_SCHEMA_VERSION, - source=f"ducpy_{name}", - thumbnail=thumbnail or b"", - elements=elements or [], - blocks=blocks or [], - block_instances=block_instances or [], - block_collections=block_collections or [], - groups=groups or [], - regions=regions or [], - layers=layers or [], - standards=standards or [], - dictionary=dict_map, - duc_local_state=duc_local_state, - duc_global_state=duc_global_state, - version_graph=version_graph, - files=external_files or [], - ) - return serialize_as_flatbuffers(data_state) - except Exception as e: - logger.error(f"Failed to serialize DUC file: {str(e)}", exc_info=True) - raise + thumb = bytes(thumbnail) if thumbnail is not None else None + + data: Dict[str, Any] = { + "type": "duc", + "version": DUC_SCHEMA_VERSION, + "source": f"ducpy_{name}", + "thumbnail": thumb, + "elements": [_element_to_camel(e) for e in (elements or [])], + "blocks": _convert_list(blocks) or [], + "blockInstances": _convert_list(block_instances) or [], + "blockCollections": _convert_list(block_collections) or [], + "groups": _convert_list(groups) or [], + "regions": _convert_list(regions) or [], + "layers": _convert_list(layers) or [], + "dictionary": _convert_dict_entries(dictionary) or {}, + "localState": to_serializable(duc_local_state), + "globalState": to_serializable(duc_global_state), + "versionGraph": to_serializable(version_graph), + "files": _convert_external_files(external_files), + } + + return ducpy_native.serialize_duc(data) + diff --git a/packages/ducpy/src/ducpy/utils/convert.py b/packages/ducpy/src/ducpy/utils/convert.py new file mode 100644 index 00000000..b670576d --- /dev/null +++ b/packages/ducpy/src/ducpy/utils/convert.py @@ -0,0 +1,101 @@ +""" +Utilities for converting between Python snake_case and Rust/JSON camelCase naming, +and for flattening/nesting element structures to match the Rust serde layout. +""" + +from __future__ import annotations + +import re +from dataclasses import asdict, is_dataclass +from typing import Any, Dict, List, Optional, Union + +_CAMEL_RE1 = re.compile(r"(.)([A-Z][a-z]+)") +_CAMEL_RE2 = re.compile(r"([a-z0-9])([A-Z])") + + +def camel_to_snake(name: str) -> str: + s1 = _CAMEL_RE1.sub(r"\1_\2", name) + return _CAMEL_RE2.sub(r"\1_\2", s1).lower() + + +def snake_to_camel(name: str) -> str: + parts = name.split("_") + return parts[0] + "".join(p.title() for p in parts[1:]) + + +# Explicit renames for snake→camel direction (Python field → Rust serde key). +# Standard snake_to_camel would produce the wrong key for these. +_SNAKE_TO_CAMEL_OVERRIDES: Dict[str, str] = { + "duc_local_state": "localState", + "duc_global_state": "globalState", +} + +# Keys that are nested in Python dataclasses but flattened in Rust serde output. +# When serializing, these dicts are merged into the parent. +_FLATTEN_KEYS = frozenset({ + "base", + "styles", + "linear_base", + "stack_element_base", +}) + + +def deep_camel_to_snake(obj: Any) -> Any: + if isinstance(obj, dict): + return {camel_to_snake(k): deep_camel_to_snake(v) for k, v in obj.items()} + if isinstance(obj, list): + return [deep_camel_to_snake(item) for item in obj] + return obj + + +def deep_snake_to_camel(obj: Any) -> Any: + if isinstance(obj, dict): + result = {} + for k, v in obj.items(): + ck = _SNAKE_TO_CAMEL_OVERRIDES.get(k, snake_to_camel(k)) + result[ck] = deep_snake_to_camel(v) + return result + if isinstance(obj, list): + return [deep_snake_to_camel(item) for item in obj] + if is_dataclass(obj) and not isinstance(obj, type): + return deep_snake_to_camel(asdict(obj)) + if isinstance(obj, bytes): + return list(obj) + return obj + + +def _flatten_dict(d: dict) -> dict: + """Recursively flatten keys that Rust serde #[serde(flatten)] would flatten.""" + result: dict = {} + for k, v in d.items(): + if k in _FLATTEN_KEYS and isinstance(v, dict): + result.update(_flatten_dict(v)) + else: + result[k] = v + return result + + +def to_serializable(obj: Any) -> Any: + """Convert a value to a JSON-serializable form suitable for the Rust native module. + + Handles: + - Dataclass instances → dict (recursively) + - bytes → list of ints + - Nested base/styles/linear_base/stack_element_base → flattened + - snake_case keys → camelCase keys + """ + if obj is None: + return None + if is_dataclass(obj) and not isinstance(obj, type): + d = {} + for k, v in asdict(obj).items(): + d[k] = v + d = _flatten_dict(d) + return deep_snake_to_camel(d) + if isinstance(obj, dict): + return deep_snake_to_camel(obj) + if isinstance(obj, list): + return [to_serializable(item) for item in obj] + if isinstance(obj, bytes): + return list(obj) + return obj diff --git a/packages/ducpy/src/ducpy/utils/io.py b/packages/ducpy/src/ducpy/utils/io.py index c089fb87..d306738f 100644 --- a/packages/ducpy/src/ducpy/utils/io.py +++ b/packages/ducpy/src/ducpy/utils/io.py @@ -2,31 +2,28 @@ This module provides high-level functions for reading and writing DUC files. """ import os -from typing import List +from typing import Any, List, Optional -# Import the parsing functions -from ducpy.parse import parse_duc +from ducpy.parse import DucData, parse_duc from ducpy.serialize import serialize_duc -from ducpy.classes.ElementsClass import (ElementWrapper, DucBlock, DucGroup, DucRegion, DucLayer, DucBlockInstance) -from ducpy.classes.DataStateClass import DucExternalFileEntry, DucGlobalState, DucLocalState, ExportedDataState, VersionGraph, DictionaryEntry -from ducpy.classes.StandardsClass import Standard + def write_duc_file( file_path: str, name: str, - thumbnail: bytes = None, - dictionary: List[DictionaryEntry] = None, - elements: List[ElementWrapper] = None, - duc_local_state: DucLocalState = None, - duc_global_state: DucGlobalState = None, - version_graph: VersionGraph = None, - blocks: List[DucBlock] = None, - block_instances: List[DucBlockInstance] = None, - groups: List[DucGroup] = None, - regions: List[DucRegion] = None, - layers: List[DucLayer] = None, - external_files: List[DucExternalFileEntry] = None, - standards: List[Standard] = None, + thumbnail: Optional[bytes] = None, + dictionary: Optional[list] = None, + elements: Optional[list] = None, + duc_local_state: Any = None, + duc_global_state: Any = None, + version_graph: Any = None, + blocks: Optional[list] = None, + block_instances: Optional[list] = None, + block_collections: Optional[list] = None, + groups: Optional[list] = None, + regions: Optional[list] = None, + layers: Optional[list] = None, + external_files: Optional[list] = None, ): """ Serializes an ExportedDataState object to a .duc file. @@ -45,14 +42,12 @@ def write_duc_file( regions=regions, layers=layers, external_files=external_files, - standards=standards, ) with open(file_path, "wb") as f: f.write(serialized_data) -def read_duc_file(file_path: str) -> ExportedDataState: +def read_duc_file(file_path: str) -> DucData: """ - Parses a .duc file into an ExportedDataState object. + Parses a .duc file into a DucData dict with attribute access. """ - with open(file_path, "rb") as f: - return parse_duc(f) + return parse_duc(file_path) diff --git a/packages/ducpy/src/ducpy_native/__init__.py b/packages/ducpy/src/ducpy_native/__init__.py new file mode 100644 index 00000000..97e65450 --- /dev/null +++ b/packages/ducpy/src/ducpy_native/__init__.py @@ -0,0 +1,19 @@ +"""Python shim for the compiled :mod:`ducpy_native` extension. + +When built with maturin (``module-name = \"ducpy_native\"`` and +``python-source = \"src\"``), the compiled extension is emitted as the +submodule ``ducpy_native.ducpy_native``. Re-export the extension symbols at the +package root so existing imports like ``import ducpy_native`` continue to work. +""" + +from .ducpy_native import (get_external_file, # type: ignore[attr-defined] + list_external_files, parse_duc, parse_duc_lazy, + serialize_duc) + +__all__ = [ + "parse_duc", + "parse_duc_lazy", + "serialize_duc", + "get_external_file", + "list_external_files", +] diff --git a/packages/ducpy/src/examples/a_duc_creation_demo.py b/packages/ducpy/src/examples/a_duc_creation_demo.py deleted file mode 100644 index 544a1b08..00000000 --- a/packages/ducpy/src/examples/a_duc_creation_demo.py +++ /dev/null @@ -1,243 +0,0 @@ -""" -Example demonstrating the creation of a complete DUC object using the builder pattern. -""" - -import ducpy as duc -from ducpy.Duc.GRID_TYPE import GRID_TYPE -from ducpy.Duc.SNAP_MODE import SNAP_MODE -from ducpy.Duc.OBJECT_SNAP_MODE import OBJECT_SNAP_MODE -from ducpy.Duc.BOOLEAN_OPERATION import BOOLEAN_OPERATION -from ducpy.Duc.UNIT_SYSTEM import UNIT_SYSTEM -from ducpy.Duc.DIMENSION_UNITS_FORMAT import DIMENSION_UNITS_FORMAT -from ducpy.Duc.DECIMAL_SEPARATOR import DECIMAL_SEPARATOR -from ducpy.Duc.ANGULAR_UNITS_FORMAT import ANGULAR_UNITS_FORMAT -from ducpy.Duc.TEXT_ALIGN import TEXT_ALIGN -from ducpy.Duc.VERTICAL_ALIGN import VERTICAL_ALIGN -from ducpy.Duc.LINE_SPACING_TYPE import LINE_SPACING_TYPE -from ducpy.Duc.VIEWPORT_SHADE_PLOT import VIEWPORT_SHADE_PLOT -from ducpy.Duc.IMAGE_STATUS import IMAGE_STATUS -from ducpy.Duc.STROKE_PREFERENCE import STROKE_PREFERENCE -from ducpy.Duc.STROKE_PLACEMENT import STROKE_PLACEMENT -from ducpy.classes.DataStateClass import ExportedDataState # Changed from Duc - -def create_sample_duc_object(): - """ - Creates a sample DUC object with global state, local state, - and a variety of elements using the builder pattern. - """ - print("Creating a sample DUC object using builders...") - - # 1. Create Global State - global_state = (duc.StateBuilder() - .build_global_state() - .with_view_background_color("#F0F8FF") # AliceBlue - .with_main_scope("mm") - .with_dash_spacing_scale(1.5) - .with_dimensions_associative_by_default(True) - .with_linear_precision(3) - .with_angular_precision(2) - .build()) - - # 2. Create Standard (as a prerequisite for local state and some elements) - # Re-using parts from standard_creation_demo for a comprehensive example - linear_units = duc.create_linear_unit_system( - system=UNIT_SYSTEM.METRIC, - precision=3, - format=DIMENSION_UNITS_FORMAT.DECIMAL, - decimal_separator=DECIMAL_SEPARATOR.DOT, - suppress_trailing_zeros=True, - suppress_leading_zeros=False, - suppress_zero_feet=False, - suppress_zero_inches=False - ) - angular_units = duc.create_angular_unit_system( - format=ANGULAR_UNITS_FORMAT.DECIMAL_DEGREES, - precision=2, - suppress_trailing_zeros=False, - suppress_leading_zeros=False, - system=UNIT_SYSTEM.METRIC - ) - primary_units = duc.create_primary_units(linear=linear_units, angular=angular_units) - standard_units = duc.create_standard_units(primary_units=primary_units, alternate_units=None) - - grid_settings = (duc.StateBuilder() - .build_grid_settings() - .with_grid_type(GRID_TYPE.RECTANGULAR) - .with_x_spacing(10.0).with_y_spacing(10.0) - .with_show_grid(True).with_snap_to_grid(True) - .with_major_line_interval(5) - .build()) - - snap_settings = (duc.StateBuilder() - .build_snap_settings() - .with_enabled(True) - .with_snap_modes([SNAP_MODE.RUNNING, SNAP_MODE.SINGLE]) - .with_object_snap_modes([OBJECT_SNAP_MODE.ENDPOINT, OBJECT_SNAP_MODE.MIDPOINT]) - .with_snap_tolerance(5) # Changed from 5.0 to 5 - .build()) - - default_text_style = duc.IdentifiedTextStyle( - id=duc.create_identifier("default_text_style", "Default Text Style"), - style=duc.DucTextStyle( - is_ltr=True, font_family="Arial", big_font_family="Arial", - line_height=1.0, line_spacing=duc.LineSpacing(value=1.0, type=duc.LINE_SPACING_TYPE.AT_LEAST), - oblique_angle=0.0, font_size=12, width_factor=1.0, - is_upside_down=False, is_backwards=False, - text_align=TEXT_ALIGN.LEFT, vertical_align=VERTICAL_ALIGN.MIDDLE, paper_text_height=None - ) - ) - - standard = (duc.StateBuilder() - .build_standard() - .with_id("sample_standard") - .with_name("Sample DucPy Standard") - .with_description("A standard for demonstration purposes.") - .with_units(standard_units) - .with_view_settings(duc.create_standard_view_settings( - grid_settings=[duc.IdentifiedGridSettings(id=duc.create_identifier("main_grid", "Main Grid"), settings=grid_settings)], - snap_settings=[duc.IdentifiedSnapSettings(id=duc.create_identifier("main_snap", "Main Snap"), settings=snap_settings)], - views=[], ucs=[] - )) - .with_styles(duc.create_standard_styles( - common_styles=[duc.IdentifiedCommonStyle(id=duc.create_identifier("default_common", "Default Common Style"), style=duc.DucCommonStyle( - background=duc.create_background(duc.create_solid_content("#FFFFFF", opacity=1.0)), - stroke=duc.create_stroke(duc.create_solid_content("#000000", opacity=1.0), width=1.0) - ))], - text_styles=[default_text_style] - )) - .build()) - - # 3. Create Local State - local_state = (duc.StateBuilder() - .build_local_state() - .with_active_standard_id(standard.identifier.id) - .with_scroll_x(10.0).with_scroll_y(20.0).with_zoom(0.8) - .with_grid_mode_enabled(True) - .build()) - - # 4. Create Elements - elements = [] - - # Rectangle - rect = (duc.ElementBuilder() - .at_position(0, 0).with_size(100, 50) - .with_label("Rectangle 1") - .build_rectangle() - .build()) - elements.append(rect) - - # Circle (Ellipse with ratio 1.0) - circle = (duc.ElementBuilder() - .at_position(150, 0).with_size(50, 50) - .with_label("Circle 1") - .build_ellipse() - .with_ratio(1.0) - .build()) - elements.append(circle) - - # Polygon (Hexagon) - hexagon = (duc.ElementBuilder() - .at_position(250, 0).with_size(60, 60) - .with_label("Hexagon 1") - .build_polygon() - .with_sides(6) - .build()) - elements.append(hexagon) - - # Line - line = (duc.ElementBuilder() - .with_label("Line 1") - .build_linear_element() - .with_points([(10, 70), (100, 120), (200, 70)]) - .build()) - elements.append(line) - - # Arrow - arrow = (duc.ElementBuilder() - .with_label("Arrow 1") - .build_arrow_element() - .with_points([(220, 100), (280, 150)]) - .build()) - elements.append(arrow) - - # Text Element - text_element = (duc.ElementBuilder() - .at_position(10, 150).with_size(100, 30) - .with_label("Greeting Text") - .build_text_element() - .with_text("Hello, DucPy World!") - .with_text_style(default_text_style.style) # Re-use the defined text style - .build()) - elements.append(text_element) - - # Frame Element - frame = (duc.ElementBuilder() - .at_position(5, 5).with_size(300, 200) - .with_label("Drawing Frame") - .build_frame_element() - .build()) - elements.append(frame) - - # Plot Element - plot = (duc.ElementBuilder() - .at_position(320, 5).with_size(150, 100) - .with_label("Detailed Plot") - .build_plot_element() - .with_margins(duc.Margins(top=10, bottom=10, left=10, right=10)) - .build()) - elements.append(plot) - - # Viewport Element - viewport_points = [(0, 0), (70, 0), (70, 50), (0, 50), (0, 0)] - viewport_view = (duc.StateBuilder() - .build_view() - .with_center_x(0).with_center_y(0).with_zoom(0.5) - .build()) - viewport = (duc.ElementBuilder() - .at_position(330, 120) # Relative to plot - .with_size(70, 50) - .with_label("Viewport Detail") - .build_viewport_element() - .with_points(viewport_points) - .with_view(viewport_view) - .with_view_scale(1.0) - .with_shade_plot(VIEWPORT_SHADE_PLOT.RENDERED) # Changed from FLAT_SHADED - .build()) - elements.append(viewport) - - # Create a simple DUC object - duc_object = ExportedDataState( - type="duc_example", - version="1.0.0", - source="a_duc_creation_demo.py", - thumbnail=b"", - elements=elements, - standards=[standard], - files=[], - version_graph=(duc.StateBuilder().build_version_graph().with_checkpoints([]).with_deltas([]).build()), # Created VersionGraph - groups=[], - layers=[], - regions=[], - blocks=[], - block_instances=[], - block_collections=[], - dictionary={}, - duc_global_state=global_state, # Corrected argument name - duc_local_state=local_state # Corrected argument name - ) - - print("Sample DUC object created successfully!") - print(f"Total elements: {len(duc_object.elements)}") - print(f"Global State Background Color: {duc_object.duc_global_state.view_background_color}") # Corrected attribute - print(f"Active Standard ID: {duc_object.duc_local_state.active_standard_id}") # Corrected attribute - return duc_object - -if __name__ == "__main__": - sample_duc = create_sample_duc_object() - # You can now save this duc_object to a file, manipulate it further, etc. - print("\n----- DUC Object Details -----") - print(f"Number of elements: {len(sample_duc.elements)}") - print(f"Global State Main Scope: {sample_duc.duc_global_state.main_scope}") # Corrected attribute - print(f"Local State Zoom: {sample_duc.duc_local_state.zoom}") # Corrected attribute - print(f"Standard Name: {sample_duc.standards[0].identifier.name}") - print("\nExample DUC object creation complete!") diff --git a/packages/ducpy/src/examples/comprehensive_builders_demo.py b/packages/ducpy/src/examples/comprehensive_builders_demo.py deleted file mode 100644 index 8aa8bf46..00000000 --- a/packages/ducpy/src/examples/comprehensive_builders_demo.py +++ /dev/null @@ -1,403 +0,0 @@ -#!/usr/bin/env python3 -""" -Comprehensive demo showcasing all the builders API functionality. -This demo demonstrates how to use all the builders (Element, State, Style) -to create complex DUC objects with various elements, styles, and configurations. -""" - -import ducpy as duc -from ducpy.builders.style_builders import ( - create_solid_content, create_image_content, create_hatch_content, - create_background, create_stroke, create_simple_styles, - create_fill_style, create_stroke_style, create_fill_and_stroke_style, - create_text_style, create_paragraph_formatting, create_stack_format, - create_doc_style, create_column_layout -) -from ducpy.Duc.STROKE_PLACEMENT import STROKE_PLACEMENT -from ducpy.Duc.TEXT_ALIGN import TEXT_ALIGN -from ducpy.Duc.VERTICAL_ALIGN import VERTICAL_ALIGN -from ducpy.Duc.UNIT_SYSTEM import UNIT_SYSTEM -from ducpy.Duc.DIMENSION_UNITS_FORMAT import DIMENSION_UNITS_FORMAT -from ducpy.Duc.DECIMAL_SEPARATOR import DECIMAL_SEPARATOR -from ducpy.Duc.ANGULAR_UNITS_FORMAT import ANGULAR_UNITS_FORMAT -from ducpy.Duc.GRID_TYPE import GRID_TYPE -from ducpy.Duc.SNAP_MODE import SNAP_MODE -from ducpy.Duc.OBJECT_SNAP_MODE import OBJECT_SNAP_MODE - - -def demo_element_builders(): - """Demonstrate element builders with various styles.""" - print("=== Element Builders Demo ===") - - elements = [] - - # 1. Basic shapes with styles - rect = (duc.ElementBuilder() - .at_position(0, 0) - .with_size(100, 60) - .with_label("Styled Rectangle") - .with_styles(create_fill_and_stroke_style( - fill_content=create_solid_content("#FF6B6B"), - stroke_content=create_solid_content("#2C3E50"), - stroke_width=2.0, - roundness=8.0 - )) - .build_rectangle() - .build()) - elements.append(rect) - - ellipse = (duc.ElementBuilder() - .at_position(120, 0) - .with_size(80, 50) - .with_label("Styled Ellipse") - .with_styles(create_fill_and_stroke_style( - fill_content=create_solid_content("#4ECDC4"), - stroke_content=create_solid_content("#34495E"), - stroke_width=1.5, - roundness=0.0 - )) - .build_ellipse() - .build()) - elements.append(ellipse) - - # 2. Polygon with hatch pattern - polygon = (duc.ElementBuilder() - .at_position(220, 0) - .with_size(70, 70) - .with_label("Hexagon with Hatch") - .with_styles(create_fill_and_stroke_style( - fill_content=create_hatch_content("diagonal_hatch", opacity=0.7), - stroke_content=create_solid_content("#8B4513"), - stroke_width=2.5, - roundness=0.0 - )) - .build_polygon() - .with_sides(6) - .build()) - elements.append(polygon) - - # 3. Linear elements - line = (duc.ElementBuilder() - .at_position(0, 80) - .with_label("Styled Line") - .with_styles(create_simple_styles( - strokes=[create_stroke(create_solid_content("#E74C3C"), width=3.0)] - )) - .build_linear_element() - .with_points([(0, 0), (50, 25), (100, 0)]) - .build()) - elements.append(line) - - arrow = (duc.ElementBuilder() - .at_position(120, 80) - .with_label("Styled Arrow") - .with_styles(create_simple_styles( - strokes=[create_stroke(create_solid_content("#8E44AD"), width=2.5)] - )) - .build_arrow_element() - .with_points([(0, 0), (80, 40)]) - .build()) - elements.append(arrow) - - # 4. Text elements with document styles - text = (duc.ElementBuilder() - .at_position(0, 140) - .with_size(200, 40) - .with_label("Styled Text") - .with_styles(create_simple_styles(opacity=0.9)) - .build_text_element() - .with_text("Hello, DucPy Builders!") - .build()) - elements.append(text) - - # 5. Stack elements - frame = (duc.ElementBuilder() - .at_position(0, 200) - .with_size(250, 120) - .with_label("Technical Frame") - .with_styles(create_fill_and_stroke_style( - fill_content=create_solid_content("#F8F9FA"), - stroke_content=create_solid_content("#495057"), - stroke_width=2.0, - roundness=5.0 - )) - .build_frame_element() - .build()) - elements.append(frame) - - plot = (duc.ElementBuilder() - .at_position(270, 200) - .with_size(200, 120) - .with_label("Engineering Plot") - .with_styles(create_fill_and_stroke_style( - fill_content=create_solid_content("#E9ECEF"), - stroke_content=create_solid_content("#6C757D"), - stroke_width=1.5 - )) - .build_plot_element() - .with_margins(duc.Margins(top=10, right=10, bottom=10, left=10)) - .build()) - elements.append(plot) - - print(f"Created {len(elements)} styled elements") - return elements - - -def demo_state_builders(): - """Demonstrate state builders for global and local state.""" - print("\n=== State Builders Demo ===") - - # 1. Global State - global_state = (duc.StateBuilder() - .build_global_state() - .with_view_background_color("#F0F8FF") # AliceBlue - .with_main_scope("mm") - .with_dash_spacing_scale(1.5) - .with_dimensions_associative_by_default(True) - .with_linear_precision(3) - .with_angular_precision(2) - .build()) - - print(f"Global state scope: {global_state.main_scope}") - - # 2. Local State - local_state = (duc.StateBuilder() - .build_local_state() - .with_scope("cm") - .with_linear_precision(2) - .with_angular_precision(1) - .build()) - - print(f"Local state scope: {local_state.scope}") - - return global_state, local_state - - -def demo_standard_builders(): - """Demonstrate standard builders with comprehensive configuration.""" - print("\n=== Standard Builders Demo ===") - - # 1. Unit Systems - linear_units = duc.create_linear_unit_system( - system=UNIT_SYSTEM.METRIC, - precision=3, - format=DIMENSION_UNITS_FORMAT.DECIMAL, - decimal_separator=DECIMAL_SEPARATOR.DOT, - suppress_trailing_zeros=True, - suppress_leading_zeros=False, - suppress_zero_feet=False, - suppress_zero_inches=False - ) - - angular_units = duc.create_angular_unit_system( - format=ANGULAR_UNITS_FORMAT.DECIMAL_DEGREES, - precision=2, - suppress_trailing_zeros=False, - suppress_leading_zeros=False, - system=UNIT_SYSTEM.METRIC - ) - - primary_units = duc.create_primary_units(linear=linear_units, angular=angular_units) - standard_units = duc.create_standard_units(primary_units=primary_units, alternate_units=None) - - # 2. Grid Settings - grid_settings = (duc.StateBuilder() - .build_grid_settings() - .with_grid_type(GRID_TYPE.RECTANGULAR) - .with_x_spacing(10.0) - .with_y_spacing(10.0) - .with_show_grid(True) - .with_snap_to_grid(True) - .with_major_line_interval(5) - .build()) - - # 3. Snap Settings - snap_settings = (duc.StateBuilder() - .build_snap_settings() - .with_enabled(True) - .with_snap_modes([SNAP_MODE.RUNNING, SNAP_MODE.SINGLE]) - .with_object_snap_modes([OBJECT_SNAP_MODE.ENDPOINT, OBJECT_SNAP_MODE.MIDPOINT]) - .with_snap_tolerance(5) - .build()) - - # 4. Text Style - default_text_style = duc.IdentifiedTextStyle( - id=duc.create_identifier("default_text_style", "Default Text Style"), - style=create_text_style( - font_family="Arial", - font_size=12, - text_align=TEXT_ALIGN.LEFT, - vertical_align=VERTICAL_ALIGN.MIDDLE - ) - ) - - # 5. Complete Standard - standard = (duc.StateBuilder() - .build_standard() - .with_id("comprehensive_standard") - .with_name("Comprehensive DucPy Standard") - .with_description("A comprehensive standard demonstrating all builders API features.") - .with_units(standard_units) - .with_view_settings(duc.create_standard_view_settings( - grid_settings=[duc.IdentifiedGridSettings( - id=duc.create_identifier("main_grid", "Main Grid"), - settings=grid_settings - )], - snap_settings=[duc.IdentifiedSnapSettings( - id=duc.create_identifier("main_snap", "Main Snap"), - settings=snap_settings - )], - views=[], - ucs=[] - )) - .with_text_styles([default_text_style]) - .with_dimension_styles([]) - .with_tolerance_styles([]) - .with_layer_styles([]) - .with_region_styles([]) - .with_block_styles([]) - .with_override_styles([]) - .build()) - - print(f"Standard created: {standard.name}") - return standard - - -def demo_style_builders(): - """Demonstrate advanced style builders functionality.""" - print("\n=== Advanced Style Builders Demo ===") - - # 1. Complex multi-background style - complex_style = create_simple_styles( - roundness=15.0, - opacity=0.95, - backgrounds=[ - create_background(create_solid_content("#FFE4E1")), # Misty Rose - create_background(create_image_content("pattern_id")) - ], - strokes=[ - create_stroke(create_solid_content("#8B0000"), width=2.0), - create_stroke(create_solid_content("#FFD700"), width=1.0, placement=STROKE_PLACEMENT.OUTSIDE) - ] - ) - - # 2. Advanced text style with paragraph formatting - paragraph_format = create_paragraph_formatting( - first_line_indent=20.0, - left_indent=10.0, - right_indent=10.0, - space_before=5.0, - space_after=5.0, - tab_stops=[50.0, 100.0, 150.0] - ) - - advanced_text_style = create_text_style( - font_family="Times New Roman", - font_size=16, - text_align=TEXT_ALIGN.JUSTIFY, - vertical_align=VERTICAL_ALIGN.TOP, - line_height=1.5, - oblique_angle=5.0, - width_factor=1.1 - ) - - advanced_doc_style = create_doc_style( - text_style=advanced_text_style, - paragraph=paragraph_format, - stack_format=create_stack_format( - auto_stack=True, - stack_chars=["/", "\\", "#"], - properties=duc.create_stack_format_properties( - upper_scale=0.8, - lower_scale=0.8, - alignment=duc.Duc.STACKED_TEXT_ALIGN.CENTER - ) - ) - ) - - print("Advanced styles created successfully") - return complex_style, advanced_doc_style - - -def demo_complete_duc_creation(): - """Demonstrate complete DUC object creation using all builders.""" - print("\n=== Complete DUC Creation Demo ===") - - # Create all components using builders - elements = demo_element_builders() - global_state, local_state = demo_state_builders() - standard = demo_standard_builders() - complex_style, advanced_doc_style = demo_style_builders() - - # Create the complete DUC object - duc_object = duc.create_duc( - name="Comprehensive Builders Demo", - standards=[standard], - elements=elements, - duc_global_state=global_state, - duc_local_state=local_state, - external_files=[] - ) - - print(f"Complete DUC object created with:") - print(f" - {len(duc_object.elements)} elements") - print(f" - {len(duc_object.standards)} standards") - print(f" - Global state scope: {duc_object.duc_global_state.main_scope}") - print(f" - Local state scope: {duc_object.duc_local_state.scope}") - - return duc_object - - -def demo_serialization_roundtrip(): - """Demonstrate serialization and parsing of the complete DUC object.""" - print("\n=== Serialization Roundtrip Demo ===") - - # Create the DUC object - original_duc = demo_complete_duc_creation() - - # Serialize to binary - serialized_data = duc.serialize_duc( - name=original_duc.name, - standards=original_duc.standards, - elements=original_duc.elements, - duc_global_state=original_duc.duc_global_state, - duc_local_state=original_duc.duc_local_state, - external_files=original_duc.files - ) - - print(f"Serialized {len(serialized_data)} bytes") - - # Parse back from binary - import io - parsed_duc = duc.parse_duc(io.BytesIO(serialized_data)) - - print(f"Parsed back successfully:") - print(f" - {len(parsed_duc.elements)} elements") - print(f" - {len(parsed_duc.standards)} standards") - print(f" - Name: {parsed_duc.name}") - - # Verify roundtrip - assert len(original_duc.elements) == len(parsed_duc.elements) - assert len(original_duc.standards) == len(parsed_duc.standards) - assert original_duc.name == parsed_duc.name - print("Roundtrip verification successful!") - - -def main(): - """Run the comprehensive builders demo.""" - print("DUC Comprehensive Builders API Demo") - print("=" * 60) - - try: - demo_serialization_roundtrip() - print("\n" + "=" * 60) - print("Comprehensive builders demo completed successfully!") - print("All builders API functionality demonstrated and verified.") - - except Exception as e: - print(f"Error during demo: {e}") - raise - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/packages/ducpy/src/examples/element_creation_demo.py b/packages/ducpy/src/examples/element_creation_demo.py index 5a7cd475..bba354d6 100644 --- a/packages/ducpy/src/examples/element_creation_demo.py +++ b/packages/ducpy/src/examples/element_creation_demo.py @@ -5,9 +5,9 @@ """ import ducpy as duc -from ducpy.builders.style_builders import ( - create_solid_content, create_fill_and_stroke_style, create_simple_styles -) +from ducpy.builders.style_builders import (create_fill_and_stroke_style, + create_simple_styles, + create_solid_content) def demo_basic_elements(): @@ -144,22 +144,7 @@ def demo_stack_elements(): print(f"Plot is marked as plot: {plot.element.stack_element_base.stack_base.is_plot}") print(f"Plot margins: {plot.element.layout.margins.top}mm") - # Create a viewport - viewport_points = [(0, 0), (80, 0), (80, 60), (0, 60), (0, 0)] - view = (duc.StateBuilder() - .build_view() - .with_scroll_x(0).with_scroll_y(0).with_zoom(1.5).with_twist_angle(0) - .with_center_x(40).with_center_y(30).with_scope("mm") - .build()) - viewport = (duc.ElementBuilder() - .with_label("Detail Viewport") - .build_viewport_element() - .with_points(viewport_points) - .with_view(view).with_view_scale(0.75) - .build()) - print(f"Viewport zoom: {viewport.element.view.zoom}x") - print(f"Viewport scale: {viewport.element.scale}") def demo_custom_stack_base(): @@ -174,12 +159,11 @@ def demo_custom_stack_base(): .build_frame_element() .with_stack_base(duc.StateBuilder().build_stack_base() .with_is_collapsed(False) - .with_styles(duc.DucStackLikeStyles(opacity=0.8, labeling_color="#0066CC")) + .with_styles(duc.DucStackLikeStyles(opacity=0.8)) .build()) .build()) print(f"Custom stack opacity: {custom_frame.element.stack_element_base.stack_base.styles.opacity}") - print(f"Custom stack color: {custom_frame.element.stack_element_base.stack_base.styles.labeling_color}") def main(): diff --git a/packages/ducpy/src/examples/external_files_demo.py b/packages/ducpy/src/examples/external_files_demo.py index 06f0ec60..9be9ede0 100644 --- a/packages/ducpy/src/examples/external_files_demo.py +++ b/packages/ducpy/src/examples/external_files_demo.py @@ -5,6 +5,7 @@ import ducpy as duc from ducpy.classes.DataStateClass import ExportedDataState + def create_duc_with_external_files(): """ Creates a DUC object and adds multiple external file entries to it @@ -40,7 +41,6 @@ def create_duc_with_external_files(): # 3. Create Local State (minimal for this example) local_state = (duc.StateBuilder() .build_local_state() - .with_active_standard_id("default") .build()) # 4. Assemble into an ExportedDataState (DUC object) @@ -56,7 +56,6 @@ def create_duc_with_external_files(): groups=[], regions=[], layers=[], - standards=[], dictionary={}, duc_local_state=local_state, duc_global_state=global_state, diff --git a/packages/ducpy/src/examples/read_write_demo.py b/packages/ducpy/src/examples/read_write_demo.py deleted file mode 100644 index 44291425..00000000 --- a/packages/ducpy/src/examples/read_write_demo.py +++ /dev/null @@ -1,57 +0,0 @@ -""" -Example demonstrating the reading and writing of DUC objects to binary files. -""" - -import ducpy as duc -from a_duc_creation_demo import create_sample_duc_object # Re-use the creation function -import os -import io -from ducpy.utils.io import write_duc_file, read_duc_file - -OUTPUT_FILE = "output_duc_file.bin" - -def demonstrate_read_write(): - """ - Creates a sample DUC object, serializes it to a binary file, - and then parses it back from the file. - """ - print("Demonstrating DUC object read/write...") - - # 1. Create a sample DUC object - original_duc = create_sample_duc_object() - print(f"Original DUC object elements: {len(original_duc.elements)}") - - # 2. Serialize the DUC object to a binary file using ducpy.utils.io.write_duc_file - print(f"Serializing DUC object to {OUTPUT_FILE} using ducpy.utils.io.write_duc_file...") - write_duc_file( - file_path=OUTPUT_FILE, - name="sample_duc", - elements=original_duc.elements, - standards=original_duc.standards, - duc_global_state=original_duc.duc_global_state, - duc_local_state=original_duc.duc_local_state, - external_files=original_duc.files - ) - print(f"Successfully serialized to {OUTPUT_FILE}") - - # 3. Parse the DUC object back from the binary file using ducpy.utils.io.read_duc_file - print(f"Parsing DUC object from {OUTPUT_FILE} using ducpy.utils.io.read_duc_file...") - parsed_duc = read_duc_file(OUTPUT_FILE) - - print("Successfully parsed DUC object!") - print(f"Parsed DUC object elements: {len(parsed_duc.elements)}") - print(f"Parsed DUC global state scope: {parsed_duc.duc_global_state.main_scope}") - - # 4. Verify some properties (optional, but good for testing) - assert len(original_duc.elements) == len(parsed_duc.elements) - assert original_duc.duc_global_state.main_scope == parsed_duc.duc_global_state.main_scope - print("Verification successful: Original and parsed DUC objects match key properties.") - - # Clean up the created file - os.remove(OUTPUT_FILE) - print(f"Cleaned up: {OUTPUT_FILE}") - - print("\nRead/Write demo complete!") - -if __name__ == "__main__": - demonstrate_read_write() diff --git a/packages/ducpy/src/examples/sql_builder_demo.py b/packages/ducpy/src/examples/sql_builder_demo.py new file mode 100644 index 00000000..c7f62fc6 --- /dev/null +++ b/packages/ducpy/src/examples/sql_builder_demo.py @@ -0,0 +1,166 @@ +#!/usr/bin/env python3 +""" +Example demonstrating direct SQLite access to .duc files via DucSQL. + +A .duc file is a plain SQLite database. DucSQL exposes the raw sqlite3 +connection so you can run any SQL you want while handling the open/save/ +export lifecycle for you. + +Topics covered: + 1. Create a new .duc file with the full schema bootstrapped + 2. Insert elements and style data + 3. Query rows back as dict-like objects + 4. Update elements in place + 5. Export to / round-trip from bytes + 6. Open an existing .duc file +""" + +import os +import tempfile + +from ducpy.builders.sql_builder import DucSQL + +# --------------------------------------------------------------------------- +# 1. Create a new .duc from scratch +# --------------------------------------------------------------------------- + +def demo_create_new(): + print("=== Create new .duc ===") + + with DucSQL.new() as db: + # Insert two elements + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, opacity) " + "VALUES (?,?,?,?,?,?,?,?)", + "r1", "rectangle", 0, 0, 200, 100, "Main Rectangle", 1.0, + ) + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, opacity) " + "VALUES (?,?,?,?,?,?,?,?)", + "e1", "ellipse", 250, 0, 120, 80, "Side Ellipse", 0.9, + ) + + # Attach fill colours + for owner_id, colour in [("r1", "#4ECDC4"), ("e1", "#FF6B6B")]: + db.sql( + "INSERT INTO backgrounds (owner_type, owner_id, src, opacity) " + "VALUES (?,?,?,?)", + "element", owner_id, colour, 1.0, + ) + + # Verify inserts + rows = db.sql("SELECT id, element_type, label FROM elements ORDER BY id") + for row in rows: + print(f" [{row['id']}] {row['element_type']} — {row['label']}") + + # Use named parameters for an update + db.sql_dict( + "UPDATE elements SET label = :label WHERE id = :id", + {"label": "Renamed Rectangle", "id": "r1"}, + ) + + updated = db.sql("SELECT label FROM elements WHERE id = ?", "r1")[0] + print(f" After rename: '{updated['label']}'") + + # Save to a temporary file + tmp = tempfile.NamedTemporaryFile(suffix=".duc", delete=False) + tmp.close() + db.save(tmp.name) + print(f" Saved to: {tmp.name}") + + return tmp.name + + +# --------------------------------------------------------------------------- +# 2. Open an existing .duc file +# --------------------------------------------------------------------------- + +def demo_open_existing(path: str): + print("\n=== Open existing .duc ===") + + with DucSQL(path) as db: + count = db.sql("SELECT COUNT(*) AS n FROM elements")[0]["n"] + print(f" Total elements: {count}") + + rows = db.sql( + "SELECT e.id, e.label, b.src AS colour " + "FROM elements e " + "LEFT JOIN backgrounds b ON b.owner_type = 'element' AND b.owner_id = e.id " + "ORDER BY e.id" + ) + for row in rows: + print(f" {row['label']} → fill: {row['colour']}") + + os.unlink(path) + + +# --------------------------------------------------------------------------- +# 3. Round-trip via bytes (in-memory, no disk I/O needed) +# --------------------------------------------------------------------------- + +def demo_bytes_roundtrip(): + print("\n=== Bytes round-trip ===") + + # Build in memory + with DucSQL.new() as db: + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label) " + "VALUES (?,?,?,?,?,?,?)", + "t1", "text", 10, 10, 300, 40, "Hello, DUC!", + ) + raw = db.to_bytes() + + print(f" Serialised to {len(raw):,} bytes") + + # Restore from bytes and query + with DucSQL.from_bytes(raw) as db: + row = db.sql("SELECT label FROM elements WHERE id = 't1'")[0] + print(f" Restored label: '{row['label']}'") + + +# --------------------------------------------------------------------------- +# 4. Access the underlying connection for advanced operations +# --------------------------------------------------------------------------- + +def demo_advanced_connection(): + print("\n=== Advanced: direct connection access ===") + + with DucSQL.new() as db: + # Use executemany for bulk inserts via the raw connection + records = [ + (f"el{i}", "rectangle", i * 110, 0, 100, 60, f"Box {i}", 1.0) + for i in range(5) + ] + db.conn.executemany( + "INSERT INTO elements (id, element_type, x, y, width, height, label, opacity) " + "VALUES (?,?,?,?,?,?,?,?)", + records, + ) + + total = db.sql("SELECT COUNT(*) AS n FROM elements")[0]["n"] + print(f" Bulk-inserted {total} elements") + + # Run a schema introspection query + tables = [ + row["name"] + for row in db.sql( + "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name" + ) + ] + print(f" Schema tables: {', '.join(tables[:6])} …") + + +def main(): + print("DucSQL Builder Demo") + print("=" * 40) + + saved_path = demo_create_new() + demo_open_existing(saved_path) + demo_bytes_roundtrip() + demo_advanced_connection() + + print("\nAll DucSQL demos completed successfully!") + + +if __name__ == "__main__": + main() diff --git a/packages/ducpy/src/examples/standard_creation_demo.py b/packages/ducpy/src/examples/standard_creation_demo.py deleted file mode 100644 index 54a019b7..00000000 --- a/packages/ducpy/src/examples/standard_creation_demo.py +++ /dev/null @@ -1,370 +0,0 @@ -""" -Elegant Standard Construction Example - -This demonstrates how to create complex standards using nested builders -with a clean, elegant API that leverages the full power of the DucPy -standards system. -""" - -import ducpy as duc -from ducpy.Duc.UNIT_SYSTEM import UNIT_SYSTEM -from ducpy.Duc.ANGULAR_UNITS_FORMAT import ANGULAR_UNITS_FORMAT -from ducpy.Duc.DECIMAL_SEPARATOR import DECIMAL_SEPARATOR -from ducpy.Duc.GRID_TYPE import GRID_TYPE -from ducpy.Duc.SNAP_MODE import SNAP_MODE -from ducpy.Duc.OBJECT_SNAP_MODE import OBJECT_SNAP_MODE - - -def create_architectural_standard(): - """ - Creates a comprehensive architectural drawing standard demonstrating - elegant nested construction with all standard components. - """ - # Create nested grid settings with precision - grid_settings = (duc.StateBuilder() - .build_grid_settings() - .with_grid_type(GRID_TYPE.RECTANGULAR) - .with_x_spacing(12.0) - .with_y_spacing(12.0) - .with_major_line_interval(12) - .with_show_grid(True) - .with_snap_to_grid(True) - .build()) - - # Create advanced snap settings with multiple modes - snap_settings = (duc.StateBuilder() - .build_snap_settings() - .with_enabled(True) - .with_snap_modes([SNAP_MODE.RUNNING, SNAP_MODE.SINGLE]) - .with_object_snap_modes([ - OBJECT_SNAP_MODE.ENDPOINT, - OBJECT_SNAP_MODE.MIDPOINT, - OBJECT_SNAP_MODE.CENTER, - OBJECT_SNAP_MODE.INTERSECTION, - OBJECT_SNAP_MODE.PERPENDICULAR - ]) - .with_snap_tolerance(10.0) - .with_tracking_enabled(True) - .build()) - - # Create sophisticated polar tracking - polar_tracking = duc.create_polar_tracking_settings( - enabled=True, - increment_angle=15.0, # 15-degree increments - angles=[22.5, 45.0, 67.5], # Common architectural angles - track_from_last_point=True, - show_polar_coordinates=True - ) - - # Create precise linear unit system for architectural work - linear_units = duc.create_linear_unit_system( - system=UNIT_SYSTEM.IMPERIAL, - precision=16, # 1/16" precision - format=duc.DIMENSION_UNITS_FORMAT.ARCHITECTURAL, - decimal_separator=DECIMAL_SEPARATOR.DOT, - suppress_trailing_zeros=False, - suppress_leading_zeros=True, - suppress_zero_feet=False, - suppress_zero_inches=False - ) - - # Create angular unit system with decimal degrees - angular_units = duc.create_angular_unit_system( - format=ANGULAR_UNITS_FORMAT.DECIMAL_DEGREES, - precision=2, - suppress_trailing_zeros=False, - suppress_leading_zeros=False, - system=UNIT_SYSTEM.METRIC # Assuming metric as a sensible default - ) - - # Compose the complete standard with nested components - architectural_standard = (duc.StateBuilder() - .build_standard() - .with_id("arch_2024") - .with_name("Architectural Standard 2024") - .with_description("Professional architectural drawing standard with precision grid, snap, and units") - .with_units(duc.create_standard_units( - primary_units=duc.create_primary_units( - linear=linear_units, - angular=angular_units - ), - alternate_units=None # No alternate units for now - )) - .with_validation(duc.create_standard_validation( - dimension_rules=duc.create_dimension_validation_rules( - min_text_height=0.1, max_text_height=100.0, allowed_precisions=[0, 1, 2, 3, 4] - ), - layer_rules=duc.create_layer_validation_rules( - prohibited_layer_names=["temp_layer"] - ) - )) - .with_overrides(duc.create_standard_overrides( - main_scope="architectural", - unit_precision=duc.UnitPrecision(linear=4, angular=2, area=2, volume=2) - )) - .with_styles(duc.create_standard_styles( - common_styles=[duc.IdentifiedCommonStyle(id=duc.create_identifier("default_common", "Default Common Style"), style=duc.DucCommonStyle( - background=duc.create_background(duc.create_solid_content("#FFFFFF", opacity=1.0)), # Default white background - stroke=duc.create_stroke(duc.create_solid_content("#000000", opacity=1.0), width=1.0) # Default black stroke - ))], - text_styles=[duc.IdentifiedTextStyle(id=duc.create_identifier("default_text", "Default Text Style"), style=duc.DucTextStyle( - base_style=duc.DucElementStylesBase(roundness=0.0, background=[], stroke=[], opacity=1.0), - is_ltr=True, - font_family="Arial", - big_font_family="Arial", - line_height=1.0, - line_spacing=duc.LineSpacing(value=1.0, type=duc.LINE_SPACING_TYPE.AT_LEAST), - oblique_angle=0.0, - font_size=12, - width_factor=1.0, - is_upside_down=False, - is_backwards=False, - text_align=duc.TEXT_ALIGN.LEFT, - vertical_align=duc.VERTICAL_ALIGN.MIDDLE, - paper_text_height=None - ))] - )) - .with_view_settings(duc.create_standard_view_settings( - grid_settings=[duc.IdentifiedGridSettings(id=duc.create_identifier("default_grid", "Default Grid"), settings=grid_settings)], - snap_settings=[duc.IdentifiedSnapSettings(id=duc.create_identifier("default_snap", "Default Snap"), settings=snap_settings)], - views=[], # No default views for now - ucs=[] # No default UCS for now - )) - .build()) - - return architectural_standard - - -def create_mechanical_standard(): - """ - Creates a mechanical engineering standard with metric units - and tight tolerances. - """ - # Metric grid with 5mm spacing - grid_settings = (duc.StateBuilder() - .build_grid_settings() - .with_grid_type(GRID_TYPE.RECTANGULAR) - .with_x_spacing(5.0) - .with_y_spacing(5.0) - .with_major_line_interval(10) - .with_show_grid(True) - .with_snap_to_grid(True) - .build()) - - # Precision snap settings for mechanical work - snap_settings = (duc.StateBuilder() - .build_snap_settings() - .with_enabled(True) - .with_snap_modes([SNAP_MODE.RUNNING, SNAP_MODE.SINGLE]) - .with_object_snap_modes([ - OBJECT_SNAP_MODE.ENDPOINT, - OBJECT_SNAP_MODE.MIDPOINT, - OBJECT_SNAP_MODE.CENTER, - OBJECT_SNAP_MODE.TANGENT, - OBJECT_SNAP_MODE.PERPENDICULAR, - OBJECT_SNAP_MODE.PARALLEL - ]) - .with_snap_tolerance(5.0) - .with_tracking_enabled(True) - .build()) - - # Metric linear units with high precision - linear_units = duc.create_linear_unit_system( - system=UNIT_SYSTEM.METRIC, - precision=3, # 0.001mm precision - decimal_separator=DECIMAL_SEPARATOR.DOT, - suppress_trailing_zeros=True, - suppress_leading_zeros=True, - suppress_zero_feet=False, # Add missing argument - suppress_zero_inches=False, # Add missing argument - format=duc.DIMENSION_UNITS_FORMAT.DECIMAL # Add missing argument - ) - - # Angular units in degrees/minutes/seconds for precision - angular_units = duc.create_angular_unit_system( - format=ANGULAR_UNITS_FORMAT.DEGREES_MINUTES_SECONDS, - precision=1, # 1 arc-second precision - suppress_trailing_zeros=True, - suppress_leading_zeros=False, # Add missing argument - system=UNIT_SYSTEM.METRIC # Add missing argument - ) - - # Create the mechanical standard - mechanical_standard = (duc.StateBuilder() - .build_standard() - .with_id("mech_iso") - .with_name("Mechanical Engineering Standard ISO") - .with_description("ISO-compliant mechanical drawing standard with metric units and precision") - .with_units(duc.create_standard_units( - primary_units=duc.create_primary_units( - linear=linear_units, - angular=angular_units - ), - alternate_units=None # No alternate units for now - )) - .with_validation(duc.create_standard_validation( - dimension_rules=duc.create_dimension_validation_rules( - min_text_height=0.01, max_text_height=500.0, allowed_precisions=[0, 1, 2, 3, 4, 5] - ), - layer_rules=duc.create_layer_validation_rules( - prohibited_layer_names=["DO_NOT_PRINT"] - ) - )) - .with_overrides(duc.create_standard_overrides( - main_scope="mechanical", - unit_precision=duc.UnitPrecision(linear=3, angular=1, area=3, volume=3) - )) - .with_styles(duc.create_standard_styles( - common_styles=[duc.IdentifiedCommonStyle(id=duc.create_identifier("mechanical_common", "Mechanical Common Style"), style=duc.DucCommonStyle( - background=duc.create_background(duc.create_solid_content("#F0F0F0", opacity=1.0)), - stroke=duc.create_stroke(duc.create_solid_content("#333333", opacity=1.0), width=0.5) - ))], - text_styles=[duc.IdentifiedTextStyle(id=duc.create_identifier("mechanical_text", "Mechanical Text Style"), style=duc.DucTextStyle( - base_style=duc.DucElementStylesBase(roundness=0.0, background=[], stroke=[], opacity=1.0), - is_ltr=True, - font_family="Roboto", - big_font_family="Roboto", - line_height=1.0, - line_spacing=duc.LineSpacing(value=1.0, type=duc.LINE_SPACING_TYPE.AT_LEAST), - oblique_angle=0.0, - font_size=10, - width_factor=1.0, - is_upside_down=False, - is_backwards=False, - text_align=duc.TEXT_ALIGN.CENTER, - vertical_align=duc.VERTICAL_ALIGN.MIDDLE, - paper_text_height=None - ))] - )) - .with_view_settings(duc.create_standard_view_settings( - grid_settings=[duc.IdentifiedGridSettings(id=duc.create_identifier("mechanical_grid", "Mechanical Grid"), settings=grid_settings)], - snap_settings=[duc.IdentifiedSnapSettings(id=duc.create_identifier("mechanical_snap", "Mechanical Snap"), settings=snap_settings)], - views=[], - ucs=[] - )) - .build()) - - return mechanical_standard - - -def demonstrate_standard_variations(): - """ - Demonstrates how to create multiple standard variations - from a common base configuration. - """ - # Base configuration for engineering standards - base_grid = (duc.StateBuilder() - .build_grid_settings() - .with_grid_type(GRID_TYPE.RECTANGULAR) - .with_x_spacing(10.0) - .with_y_spacing(10.0) - .with_show_grid(True) - .with_snap_to_grid(True) - .build()) - - base_snap = (duc.StateBuilder() - .build_snap_settings() - .with_enabled(True) - .with_snap_modes([SNAP_MODE.RUNNING, SNAP_MODE.SINGLE]) - .with_object_snap_modes([OBJECT_SNAP_MODE.ENDPOINT, OBJECT_SNAP_MODE.MIDPOINT, OBJECT_SNAP_MODE.CENTER]) - .with_snap_tolerance(8.0) - .build()) - - # Variation 1: Imperial with fractions - imperial_units = duc.create_linear_unit_system( - system=UNIT_SYSTEM.IMPERIAL, - precision=32, # 1/32" precision - decimal_separator=DECIMAL_SEPARATOR.DOT, - suppress_zero_feet=True, - suppress_leading_zeros=True, # Added missing argument - suppress_trailing_zeros=True, # Added missing argument - suppress_zero_inches=True, # Added missing argument - format=duc.DIMENSION_UNITS_FORMAT.FRACTIONAL # Added missing argument - ) - - # Angular units for variations (re-defined for clarity within this function) - angular_units = duc.create_angular_unit_system( - format=ANGULAR_UNITS_FORMAT.DECIMAL_DEGREES, - precision=2, - suppress_trailing_zeros=False, - suppress_leading_zeros=False, - system=UNIT_SYSTEM.IMPERIAL # Assuming imperial as a sensible default - ) - - imperial_standard = (duc.StateBuilder() - .build_standard() - .with_id("imperial_frac") - .with_name("Imperial Standard - Fractional") - .with_description("Imperial standard with fractional units for construction.") - .with_units(duc.create_standard_units( - primary_units=duc.create_primary_units( - linear=imperial_units, - angular=angular_units - ), - alternate_units=None - )) - .with_view_settings(duc.create_standard_view_settings( - grid_settings=[duc.IdentifiedGridSettings(id=duc.create_identifier("imperial_grid", "Imperial Grid"), settings=base_grid)], - snap_settings=[duc.IdentifiedSnapSettings(id=duc.create_identifier("imperial_snap", "Imperial Snap"), settings=base_snap)], - views=[], - ucs=[] - )) - .build()) - - # Variation 2: Metric with high precision - metric_units = duc.create_linear_unit_system( - system=UNIT_SYSTEM.METRIC, - precision=2, - decimal_separator=DECIMAL_SEPARATOR.DOT, - suppress_trailing_zeros=False, - suppress_leading_zeros=False, # Added missing argument - suppress_zero_feet=False, # Added missing argument - suppress_zero_inches=False, # Added missing argument - format=duc.DIMENSION_UNITS_FORMAT.DECIMAL # Added missing argument - ) - - metric_standard = (duc.StateBuilder() - .build_standard() - .with_id("metric_high_prec") - .with_name("Metric Standard - High Precision") - .with_description("Metric standard for manufacturing with high precision.") - .with_units(duc.create_standard_units( - primary_units=duc.create_primary_units( - linear=metric_units, - angular=angular_units - ), - alternate_units=None - )) - .with_view_settings(duc.create_standard_view_settings( - grid_settings=[duc.IdentifiedGridSettings(id=duc.create_identifier("metric_grid", "Metric Grid"), settings=base_grid)], - snap_settings=[duc.IdentifiedSnapSettings(id=duc.create_identifier("metric_snap", "Metric Snap"), settings=base_snap)], - views=[], - ucs=[] - )) - .build()) - - return imperial_standard, metric_standard - - -if __name__ == "__main__": - # Demonstrate elegant standard construction - print("Creating architectural standard...") - arch_std = create_architectural_standard() - print(f"Created: {arch_std.identifier.name}") - print(f"Description: {arch_std.identifier.description}") - print(f"Linear units: {arch_std.units.primary_units.linear.system} with precision {arch_std.units.primary_units.linear.precision}") - print() - - print("Creating mechanical standard...") - mech_std = create_mechanical_standard() - print(f"Created: {mech_std.identifier.name}") - print(f"Linear units: {mech_std.units.primary_units.linear.system} with precision {mech_std.units.primary_units.linear.precision}") - print() - - print("Creating standard variations...") - imperial, metric = demonstrate_standard_variations() - print(f"Imperial: {imperial.identifier.name} - {imperial.units.primary_units.linear.system}") - print(f"Metric: {metric.identifier.name} - {metric.units.primary_units.linear.system}") - print() - - print("✓ All standards created successfully with elegant nested construction!") diff --git a/packages/ducpy/src/examples/style_creation_demo.py b/packages/ducpy/src/examples/style_creation_demo.py deleted file mode 100644 index 08350a56..00000000 --- a/packages/ducpy/src/examples/style_creation_demo.py +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/env python3 -""" -Example demonstrating the style builders API for creating element styles. -This demo shows how to use the builders API to create various types of styles -for DUC elements including backgrounds, strokes, text styles, and document styles. -""" - -import ducpy as duc -from ducpy.builders.style_builders import ( - create_solid_content, create_image_content, create_hatch_content, - create_background, create_stroke, create_simple_styles, - create_fill_style, create_stroke_style, create_fill_and_stroke_style, - create_text_style, create_paragraph_formatting, create_stack_format, - create_doc_style, create_column_layout -) -from ducpy.Duc.STROKE_PLACEMENT import STROKE_PLACEMENT -from ducpy.Duc.STROKE_PREFERENCE import STROKE_PREFERENCE -from ducpy.Duc.STROKE_CAP import STROKE_CAP -from ducpy.Duc.STROKE_JOIN import STROKE_JOIN -from ducpy.Duc.STROKE_SIDE_PREFERENCE import STROKE_SIDE_PREFERENCE -from ducpy.Duc.TEXT_ALIGN import TEXT_ALIGN -from ducpy.Duc.VERTICAL_ALIGN import VERTICAL_ALIGN -from ducpy.Duc.LINE_SPACING_TYPE import LINE_SPACING_TYPE -from ducpy.Duc.COLUMN_TYPE import COLUMN_TYPE -from ducpy.Duc.STACKED_TEXT_ALIGN import STACKED_TEXT_ALIGN -from ducpy.Duc.BLENDING import BLENDING - - -def demo_basic_content_creation(): - """Demonstrate basic content creation.""" - print("=== Basic Content Creation ===") - - # Create solid color content - solid_content = create_solid_content("#FF0000", opacity=0.8) - print(f"Solid content: {solid_content.src}, opacity: {solid_content.opacity}") - - # Create image content - image_content = create_image_content("image_file_id_123", opacity=0.9) - print(f"Image content: {image_content.src}, opacity: {image_content.opacity}") - - # Create hatch content - hatch_content = create_hatch_content("diagonal_hatch", opacity=0.7) - print(f"Hatch content: {hatch_content.src}, opacity: {hatch_content.opacity}") - - -def demo_background_and_stroke_creation(): - """Demonstrate background and stroke creation.""" - print("\n=== Background and Stroke Creation ===") - - # Create backgrounds - solid_bg = create_background(create_solid_content("#00FF00")) - image_bg = create_background(create_image_content("bg_image_id")) - hatch_bg = create_background(create_hatch_content("cross_hatch")) - - print(f"Created {len([solid_bg, image_bg, hatch_bg])} different backgrounds") - - # Create strokes - thin_stroke = create_stroke(create_solid_content("#000000"), width=1.0) - thick_stroke = create_stroke(create_solid_content("#FF0000"), width=3.0) - dashed_stroke = create_stroke( - create_solid_content("#0000FF"), - width=2.0, - placement=STROKE_PLACEMENT.CENTER - ) - - print(f"Created {len([thin_stroke, thick_stroke, dashed_stroke])} different strokes") - - -def demo_simple_styles(): - """Demonstrate simple style creation.""" - print("\n=== Simple Style Creation ===") - - # Create a simple fill style - fill_style = create_fill_style(create_solid_content("#FFD700"), roundness=5.0) - print(f"Fill style with roundness: {fill_style.roundness}") - - # Create a stroke style - stroke_style = create_stroke_style( - create_solid_content("#000000"), - width=2.0, - placement=STROKE_PLACEMENT.OUTSIDE - ) - print(f"Stroke style with width: {stroke_style.stroke[0].width}") - - # Create a combined style - combined_style = create_fill_and_stroke_style( - fill_content=create_solid_content("#87CEEB"), - stroke_content=create_solid_content("#000000"), - stroke_width=1.5, - roundness=10.0, - opacity=0.9 - ) - print(f"Combined style opacity: {combined_style.opacity}") - - -def demo_text_styles(): - """Demonstrate text style creation.""" - print("\n=== Text Style Creation ===") - - # Create a basic text style - basic_text_style = create_text_style( - font_family="Arial", - font_size=14, - text_align=TEXT_ALIGN.CENTER, - vertical_align=VERTICAL_ALIGN.MIDDLE - ) - print(f"Basic text style: {basic_text_style.font_family}, size: {basic_text_style.font_size}") - - # Create an advanced text style - advanced_text_style = create_text_style( - font_family="Times New Roman", - font_size=18, - text_align=TEXT_ALIGN.RIGHT, - vertical_align=VERTICAL_ALIGN.BOTTOM, - line_height=1.5, - oblique_angle=15.0, - width_factor=1.2 - ) - print(f"Advanced text style: oblique angle: {advanced_text_style.oblique_angle}") - - -def demo_document_styles(): - """Demonstrate document style creation.""" - print("\n=== Document Style Creation ===") - - # Create paragraph formatting - paragraph = create_paragraph_formatting( - first_line_indent=20.0, - left_indent=10.0, - right_indent=10.0, - space_before=5.0, - space_after=5.0, - tab_stops=[50.0, 100.0, 150.0] - ) - print(f"Paragraph formatting with {len(paragraph.tab_stops)} tab stops") - - # Create stack format for fractions - stack_format = create_stack_format( - auto_stack=True, - stack_chars=["/", "\\", "#"], - properties=duc.create_stack_format_properties( - upper_scale=0.8, - lower_scale=0.8, - alignment=STACKED_TEXT_ALIGN.CENTER - ) - ) - print(f"Stack format with {len(stack_format.stack_chars)} stack characters") - - # Create a complete document style - doc_style = create_doc_style( - text_style=create_text_style(font_family="Calibri", font_size=12), - paragraph=paragraph, - stack_format=stack_format - ) - print(f"Document style created with font: {doc_style.text_style.font_family}") - - -def demo_column_layouts(): - """Demonstrate column layout creation.""" - print("\n=== Column Layout Creation ===") - - # Create a simple two-column layout - two_column_layout = create_column_layout( - definitions=[ - duc.create_text_column(width=200, gutter=20), - duc.create_text_column(width=200, gutter=20) - ], - auto_height=True, - column_type=COLUMN_TYPE.STATIC_COLUMNS - ) - print(f"Two-column layout with {len(two_column_layout.definitions)} columns") - - # Create a dynamic column layout - dynamic_layout = create_column_layout( - definitions=[ - duc.create_text_column(width=150), - duc.create_text_column(width=150), - duc.create_text_column(width=150) - ], - auto_height=False, - column_type=COLUMN_TYPE.DYNAMIC_COLUMNS - ) - print(f"Dynamic layout with {len(dynamic_layout.definitions)} columns") - - -def demo_complex_styles(): - """Demonstrate complex style combinations.""" - print("\n=== Complex Style Combinations ===") - - # Create a style with multiple backgrounds - multi_bg_style = create_simple_styles( - roundness=15.0, - opacity=0.95, - backgrounds=[ - create_background(create_solid_content("#FFE4E1")), # Misty Rose - create_background(create_image_content("pattern_id")) - ], - strokes=[ - create_stroke(create_solid_content("#8B0000"), width=2.0), - create_stroke(create_solid_content("#FFD700"), width=1.0, placement=STROKE_PLACEMENT.OUTSIDE) - ], - blending=BLENDING.MULTIPLY - ) - print(f"Complex style with {len(multi_bg_style.background)} backgrounds and {len(multi_bg_style.stroke)} strokes") - - -def demo_style_with_elements(): - """Demonstrate using styles with actual elements.""" - print("\n=== Style with Elements Demo ===") - - # Create a styled rectangle - styled_rect = (duc.ElementBuilder() - .at_position(0, 0) - .with_size(100, 60) - .with_label("Styled Rectangle") - .with_styles(create_fill_and_stroke_style( - fill_content=create_solid_content("#98FB98"), # Pale Green - stroke_content=create_solid_content("#228B22"), # Forest Green - stroke_width=2.0, - roundness=8.0 - )) - .build_rectangle() - .build()) - - print(f"Created styled rectangle with ID: {styled_rect.element.base.id}") - - # Create a styled text element - styled_text = (duc.ElementBuilder() - .at_position(120, 0) - .with_size(150, 40) - .with_label("Styled Text") - .with_styles(create_simple_styles(opacity=0.9)) - .build_text_element() - .with_text("Hello, Styled World!") - .build()) - - print(f"Created styled text with content: '{styled_text.element.text}'") - - -def main(): - """Run all style creation demos.""" - print("DUC Style Builders API Demo") - print("=" * 50) - - demo_basic_content_creation() - demo_background_and_stroke_creation() - demo_simple_styles() - demo_text_styles() - demo_document_styles() - demo_column_layouts() - demo_complex_styles() - demo_style_with_elements() - - print("\n" + "=" * 50) - print("Style creation demo completed successfully!") - - -if __name__ == "__main__": - main() diff --git a/packages/ducpy/src/tests/src/test_CSPMDS_blocks_and_instances.py b/packages/ducpy/src/tests/src/test_CSPMDS_blocks_and_instances.py index b387cb5c..db427fd0 100644 --- a/packages/ducpy/src/tests/src/test_CSPMDS_blocks_and_instances.py +++ b/packages/ducpy/src/tests/src/test_CSPMDS_blocks_and_instances.py @@ -1,326 +1,48 @@ -""" -CSPMDS Test for Blocks and Instances: Create-Serialize-Parse-Mutate-Delete-Serialize -Tests the full lifecycle of DucBlock and DucBlockInstance in DUC files. -""" -import io -import math -import os -import random -import pytest +"""SQL-schema test for blocks and block instances.""" -import ducpy as duc -from ducpy.classes.ElementsClass import DucBlockInstance, StringValueEntry, DucBlockDuplicationArray -from ducpy.classes.DataStateClass import ExportedDataState -from ducpy.builders.block_utils import instantiate_block +import os +import time -def val_get_base(element): - if hasattr(element, "linear_base"): - return element.linear_base.base - return element.base +from ducpy.builders.sql_builder import DucSQL def test_cspmds_blocks_and_instances(test_output_dir): - """ - CSPMDS test for blocks and instances (like Figma components): - - Create: Create DucBlock definitions and DucBlockInstance instances - - Serialize: Save to DUC file - - Parse: Load the saved file - - Mutate: Modify blocks and instances - - Delete: Remove some instances and blocks - - Serialize: Save the final state - """ - - # === CREATE === - print("🔨 CREATE: Creating DucBlock definitions and instances...") - - # 1. Initialize State Container - # We need a state object to hold blocks, instances, and elements - state = ExportedDataState( - type="DUC_DATA", - version="2.0.0", - source="ducpy_test", - thumbnail=b"", - elements=[], - blocks=[], - block_instances=[], - block_collections=[], - groups=[], - regions=[], - layers=[], - standards=[], - dictionary={}, - duc_local_state=None, - duc_global_state=None, - version_graph=None, - files=[] - ) - - # First create some basic elements to use in block definitions using builders API - title_rect = (duc.ElementBuilder() - .at_position(0, 0) - .with_size(140, 40) - .with_styles(duc.create_simple_styles()) - .with_label("Title Rectangle") - .build_rectangle() - .build()) - - title_text = (duc.ElementBuilder() - .at_position(70, 20) - .with_styles(duc.create_simple_styles()) - .with_label("Title Text") - .build_text_element() - .with_text("TITLE") - .build()) - - # Create arrow elements for symbol block - arrow_line = (duc.ElementBuilder() - .with_styles(duc.create_simple_styles()) - .with_label("Arrow Line") - .build_linear_element() - .with_points([(0, 10), (30, 10)]) - .build()) - - arrow_head = (duc.ElementBuilder() - .at_position(30, 10) - .with_size(10, 10) - .with_styles(duc.create_simple_styles()) - .with_label("Arrow Head") - .build_polygon() - .with_sides(3) - .build()) - - # We need to add these "source" elements to the state so instantiate_block can find them? - # Actually, instantiate_block looks for elements already in the state that are bound to the block definition. - # So we need to: - # 1. Create Blocks - # 2. Assign block_ids to source elements - # 3. Add source elements to state.elements - - # === CREATE BLOCK DEFINITIONS === - - # Create a title block definition (like a Figma component) - title_block = duc.create_block( - id="title_block_v1", - label="Title Block Component", - elements=[], # Elements list deprecated in create_block? No, but we need to link them. - description="Reusable title block for drawings" - ) - # create_block returns a DucBlock object. - # We need to manually set block_ids on source elements and add them to state - # NOTE: In a real app, higher level logic handles this. Here we simulate it. - - for el in [title_rect, title_text]: - base = el.element.linear_base.base if hasattr(el.element, 'linear_base') else el.element.base - base.block_ids = ["title_block_v1"] - state.elements.append(el) - - - # Create arrow symbol block definition - arrow_block = duc.create_block( - id="arrow_symbol_v1", - label="Arrow Symbol Component", - elements=[], - description="Reusable arrow symbol" - ) - - for el in [arrow_line, arrow_head]: - base = el.element.linear_base.base if hasattr(el.element, 'linear_base') else el.element.base - base.block_ids = ["arrow_symbol_v1"] - state.elements.append(el) - - # Add blocks to state - state.blocks.extend([title_block, arrow_block]) - - # === CREATE BLOCK INSTANCES === - - # Create multiple instances of the title block using the new utility - # Title Instance 1 - instantiate_block( - state=state, - block_id="title_block_v1", - position_x=100, - position_y=100, - instance_id="title_inst_1" - ) - - # Title Instance 2 (Create first, then add overrides manually as builder doesn't support them in instantiate_block yet) - inst_2 = instantiate_block( - state=state, - block_id="title_block_v1", - position_x=300, - position_y=100, - instance_id="title_inst_2" - ) - - # Add element overrides manually to the instance metadata - title_overrides = [ - duc.create_string_value_entry(key="title_text_content", value="CUSTOM TITLE"), - duc.create_string_value_entry(key="title_text_color", value="#FF0000"), - duc.create_string_value_entry(key="title_background_color", value="#F0F0F0"), - duc.create_string_value_entry(key="width", value="120"), - duc.create_string_value_entry(key="height", value="35"), - duc.create_string_value_entry(key="opacity", value="0.8") - ] - inst_2.element_overrides = title_overrides - - # Create arrow instances - instantiate_block( - state=state, - block_id="arrow_symbol_v1", - position_x=100, - position_y=200, - instance_id="arrow_inst_1" - ) - - instantiate_block( - state=state, - block_id="arrow_symbol_v1", - position_x=200, - position_y=200, - instance_id="arrow_inst_2" - ) - - # Note: instantiate_block automatically adds generated elements to state.elements - # and metadata to state.block_instances. - - # Verify counts - # 4 source elements + (2 title instances * 2 elements) + (2 arrow instances * 2 elements) = 4 + 4 + 4 = 12 total elements - assert len(state.elements) == 12 - assert len(state.block_instances) == 4 - - # === SERIALIZE === - print("💾 SERIALIZE: Saving to DUC file...") - output_file = os.path.join(test_output_dir, "test_blocks_instances.duc") - - # Use internal serialize function since we built the state manually - # Or reuse write_duc_file but populate it with our state content - duc.write_duc_file( - file_path=output_file, - name="BlocksAndInstancesTest", - elements=state.elements, - blocks=state.blocks, - block_instances=state.block_instances - ) - - assert os.path.exists(output_file) and os.path.getsize(output_file) > 0 - print(f"✅ Serialized {len(state.elements)} elements and {len(state.blocks)} blocks") - - # === PARSE === - print("📖 PARSE: Loading the saved file...") - parsed_data = duc.read_duc_file(output_file) - parsed_elements = parsed_data.elements - parsed_blocks = parsed_data.blocks if hasattr(parsed_data, 'blocks') else [] - parsed_instances = parsed_data.block_instances if hasattr(parsed_data, 'block_instances') else [] - - assert len(parsed_elements) == 12 - # Should be 2 elements (rect + text) - title_inst_1_elems = [el for el in parsed_elements if val_get_base(el.element).instance_id == "title_inst_1"] - assert len(title_inst_1_elems) == 2, f"Expected 2 elements for title_inst_1, found {len(title_inst_1_elems)}" - - title_inst_2_elems = [el for el in parsed_elements if val_get_base(el.element).instance_id == "title_inst_2"] - assert len(title_inst_1_elems) == 2 - - print(f"✅ Parsed {len(parsed_elements)} elements, {len(parsed_blocks)} blocks, {len(parsed_instances)} instances") - - # === MUTATE === - print("🔧 MUTATE: Modifying blocks and instances...") - - # Mutate instance position: find elements belonging to title_inst_1 and move them - # Real app would update all elements sharing instance_id. - for el_wrapper in parsed_elements: - if val_get_base(el_wrapper.element).instance_id == "title_inst_1": - duc.mutate_element(el_wrapper, x=val_get_base(el_wrapper.element).x + 50, y=val_get_base(el_wrapper.element).y + 20) - - # Mutate overrides on the instance metadata - instance_2_meta = next((i for i in parsed_instances if i.id == "title_inst_2"), None) - assert instance_2_meta is not None - - # Create new list for overrides - new_overrides = [] - found_text_override = False - - if instance_2_meta.element_overrides: - for override in instance_2_meta.element_overrides: - if override.key == "title_text_content": - new_overrides.append(duc.create_string_value_entry(key="title_text_content", value="MUTATED CUSTOM TITLE")) - found_text_override = True - elif override.key == "title_text_color": - new_overrides.append(duc.create_string_value_entry(key="title_text_color", value="#0000FF")) - else: - new_overrides.append(override) - - if not found_text_override: - new_overrides.append(duc.create_string_value_entry(key="title_text_content", value="MUTATED CUSTOM TITLE")) - - instance_2_meta.element_overrides = new_overrides - print(f"Mutated element_overrides for title_inst_2") - - # === DELETE === - print("🗑️ DELETE: Removing some instances...") - - # Remove arrow instance 2 - # 1. Remove metadata - parsed_instances = [i for i in parsed_instances if i.id != "arrow_inst_2"] - assert len(title_inst_2_elems) == 2 - - arrow_inst_1_elems = [el for el in parsed_elements if val_get_base(el.element).instance_id == "arrow_inst_1"] - - # 2. Remove elements - elements_to_keep = [el for el in parsed_elements if val_get_base(el.element).instance_id != "arrow_inst_2"] - - # === SERIALIZE FINAL === - print("💾 SERIALIZE FINAL: Saving the final state...") - final_output_file = os.path.join(test_output_dir, "test_blocks_instances_final.duc") - duc.write_duc_file( - file_path=final_output_file, - name="BlocksAndInstancesTestFinal", - elements=elements_to_keep, - blocks=parsed_blocks, - block_instances=parsed_instances - ) - - assert os.path.exists(final_output_file) and os.path.getsize(final_output_file) > 0 - print(f"✅ Final serialized {len(elements_to_keep)} elements and {len(parsed_blocks)} blocks") - - # Verify the final state - final_parsed_data = duc.read_duc_file(final_output_file) - final_elements = final_parsed_data.elements - final_blocks = final_parsed_data.blocks if hasattr(final_parsed_data, 'blocks') else [] - final_instances = final_parsed_data.block_instances if hasattr(final_parsed_data, 'block_instances') else [] - - # Expected: 12 instanced elements - 2 (deleted arrow_inst_2) = 10 elements - assert len(final_elements) == 10 - assert len(final_blocks) == 2 - assert len(final_instances) == 3 - - # Verify mutations on title_instance2 element overrides - final_inst_2_meta = next((i for i in final_instances if i.id == "title_inst_2"), None) - assert final_inst_2_meta is not None - - found_text_content_override = False - found_text_color_override = False - for override in final_inst_2_meta.element_overrides: - if override.key == "title_text_content": - assert override.value == "MUTATED CUSTOM TITLE" - found_text_content_override = True - elif override.key == "title_text_color": - assert override.value == "#0000FF" - found_text_color_override = True - - assert found_text_content_override, "title_text_content override not found or not mutated." - assert found_text_color_override, "title_text_color override not found or not mutated." - print("✅ Verified element_overrides mutation for title_inst_2") - - print("✅ CSPMDS Blocks and Instances test completed successfully!") - -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir - - -if __name__ == "__main__": - pytest.main([__file__]) + output_file = os.path.join(test_output_dir, "cspmds_blocks_instances_sql.duc") + if os.path.exists(output_file): + os.remove(output_file) + now = int(time.time() * 1000) + + with DucSQL.new(output_file) as db: + db.sql("INSERT INTO blocks (id, label, description, version) VALUES (?,?,?,?)", "blk_title", "Title Block", "Test block", 1) + db.sql( + "INSERT INTO block_metadata (owner_type, owner_id, source, usage_count, created_at, updated_at) VALUES (?,?,?,?,?,?)", + "block", "blk_title", "test", 0, now, now, + ) + + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", + "src_rect", "rectangle", 0, 0, 140, 40, "Title Rectangle", + ) + db.sql("INSERT INTO element_block_memberships (element_id, block_id, sort_order) VALUES (?,?,?)", "src_rect", "blk_title", 0) + + db.sql( + "INSERT INTO block_instances (id, block_id, version, dup_rows, dup_cols, dup_row_spacing, dup_col_spacing) VALUES (?,?,?,?,?,?,?)", + "inst_1", "blk_title", 1, 2, 3, 30.0, 40.0, + ) + db.sql("INSERT INTO block_instance_overrides (instance_id, key, value) VALUES (?,?,?)", "inst_1", "title", "Drawing A") + + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, instance_id) VALUES (?,?,?,?,?,?,?,?)", + "inst_rect", "rectangle", 200, 200, 140, 40, "Instance Rect", "inst_1", + ) + + assert db.sql("SELECT COUNT(*) AS n FROM blocks")[0]["n"] == 1 + assert db.sql("SELECT COUNT(*) AS n FROM block_instances")[0]["n"] == 1 + assert db.sql("SELECT COUNT(*) AS n FROM element_block_memberships")[0]["n"] == 1 + + db.sql("UPDATE blocks SET version = 2 WHERE id = ?", "blk_title") + db.sql("DELETE FROM elements WHERE id = ?", "inst_rect") + db.sql("DELETE FROM block_instance_overrides WHERE instance_id = ?", "inst_1") + db.sql("DELETE FROM block_instances WHERE id = ?", "inst_1") + + assert db.sql("SELECT COUNT(*) AS n FROM block_instances")[0]["n"] == 0 diff --git a/packages/ducpy/src/tests/src/test_CSPMDS_complex_tables.py b/packages/ducpy/src/tests/src/test_CSPMDS_complex_tables.py deleted file mode 100644 index a566b720..00000000 --- a/packages/ducpy/src/tests/src/test_CSPMDS_complex_tables.py +++ /dev/null @@ -1,382 +0,0 @@ -""" -CSPMDS Test for Complex Tables: Create-Serialize-Parse-Mutate-Delete-Serialize -Tests the full lifecycle of complex table elements in DUC files. -""" -import io -import os -import random -import pytest - -import ducpy as duc - - -def test_cspmds_complex_tables(test_output_dir): - """ - CSPMDS test for complex tables: - - Create: Create table-like structures with various elements - - Serialize: Save to DUC file - - Parse: Load the saved file - - Mutate: Modify table structure and content - - Delete: Remove some table elements - - Serialize: Save the final state - """ - - # === CREATE === - print("🔨 CREATE: Creating DucTableElement objects with full styling...") - - elements = [] - - # Create main table using the builders API - main_table_data = [ - ["Element A", "Rectangle", "100x50"], - ["Element B", "Circle", "r=25"], - ["Element C", "Line", "length=75"], - ["Element D", "Text", "Sample"] - ] - - main_table = (duc.ElementBuilder() - .at_position(50, 50) - .with_size(300, 120) - .with_label("Main Data Table") - .build_table_from_data() - .with_data(main_table_data) - .with_table_style(duc.create_table_style()) - .with_header_row_count(1) - .build()) - elements.append(main_table) - - # Create summary table - summary_table_data = [ - ["Total Elements", "4"], - ["Rectangles", "1"], - ["Circles", "1"], - ["Lines", "1"], - ["Text", "1"] - ] - - summary_table = (duc.ElementBuilder() - .at_position(400, 50) - .with_size(200, 150) - .with_label("Summary Table") - .build_table_from_data() - .with_data(summary_table_data) - .with_table_style(duc.create_table_style()) - .with_auto_size(duc.DucTableAutoSize(columns=False, rows=True)) - .build()) - elements.append(summary_table) - - # Create detailed table - detailed_table_data = [ - ["ID", "Name", "Position", "Size", "Color"], - ["001", "Rect1", "(10,20)", "100x50", "#FF0000"], - ["002", "Circle1", "(150,100)", "r=25", "#00FF00"], - ["003", "Line1", "(50,200)", "length=75", "#0000FF"], - ["004", "Text1", "(300,150)", "12pt", "#000000"] - ] - - # Define a custom table style - custom_table_style = duc.create_table_style( - base_style=duc.create_simple_styles( - strokes=[duc.create_stroke(duc.create_solid_content("#888888"), width=1.0)], - backgrounds=[duc.create_background(duc.create_solid_content("#F0F0F0"))] - ), - header_row_style=duc.create_table_cell_style( - base_style=duc.create_simple_styles( - strokes=[duc.create_stroke(duc.create_solid_content("#000000"), width=1.0)], - backgrounds=[duc.create_background(duc.create_solid_content("#CCCCCC"))] - ), - text_style=duc.create_text_style(font_size=14.0, font_family="Arial", text_align=duc.TEXT_ALIGN.CENTER), - margins=duc.create_margins(top=5.0, right=5.0, bottom=5.0, left=5.0), - alignment=duc.TABLE_CELL_ALIGNMENT.MIDDLE_CENTER - ), - data_row_style=duc.create_table_cell_style( - base_style=duc.create_simple_styles( - strokes=[duc.create_stroke(duc.create_solid_content("#AAAAAA"), width=1.0)], - backgrounds=[duc.create_background(duc.create_solid_content("#FFFFFF"))] - ), - text_style=duc.create_text_style(font_size=12.0, font_family="Verdana", text_align=duc.TEXT_ALIGN.LEFT), - margins=duc.create_margins(top=2.0, right=2.0, bottom=2.0, left=2.0), - alignment=duc.TABLE_CELL_ALIGNMENT.MIDDLE_LEFT - ), - data_column_style=duc.create_table_cell_style( - base_style=duc.create_simple_styles(), # Can be overridden by row/cell styles - text_style=duc.create_text_style(text_align=duc.TEXT_ALIGN.LEFT), - margins=duc.create_margins(), - alignment=duc.TABLE_CELL_ALIGNMENT.MIDDLE_LEFT - ), - flow_direction=duc.TABLE_FLOW_DIRECTION.DOWN - ) - - detailed_table = (duc.ElementBuilder() - .at_position(50, 200) - .with_size(500, 200) - .with_label("Detailed Elements Table") - .build_table_from_data() - .with_data(detailed_table_data) - .with_table_style(custom_table_style) - .build()) - elements.append(detailed_table) - - # Create a table using `build_table_element` directly - manual_columns = [ - duc.create_table_column(id="col_manual_1", width=80.0, style_overrides=None), - duc.create_table_column(id="col_manual_2", width=120.0, style_overrides=None), - duc.create_table_column(id="col_manual_3", width=100.0, style_overrides=None), - ] - manual_rows = [ - duc.create_table_row(id="row_manual_1", height=30.0, style_overrides=None), - duc.create_table_row(id="row_manual_2", height=40.0, style_overrides=None), - ] - manual_cells = [ - duc.create_table_cell(row_id="row_manual_1", column_id="col_manual_1", data="Header A", locked=False, span=duc.create_table_cell_span(columns=1, rows=1), style_overrides=None), - duc.create_table_cell(row_id="row_manual_1", column_id="col_manual_2", data="Header B", locked=False, span=duc.create_table_cell_span(columns=1, rows=1), style_overrides=None), - duc.create_table_cell(row_id="row_manual_1", column_id="col_manual_3", data="Header C", locked=False, span=duc.create_table_cell_span(columns=1, rows=1), style_overrides=None), - duc.create_table_cell(row_id="row_manual_2", column_id="col_manual_1", data="Data 1", locked=False, span=duc.create_table_cell_span(columns=1, rows=1), style_overrides=None), - duc.create_table_cell(row_id="row_manual_2", column_id="col_manual_2", data="Data 2", locked=False, span=duc.create_table_cell_span(columns=1, rows=1), style_overrides=None), - duc.create_table_cell(row_id="row_manual_2", column_id="col_manual_3", data="Data 3", locked=False, span=duc.create_table_cell_span(columns=1, rows=1), style_overrides=None), - ] - manual_column_order = [col.id for col in manual_columns] - manual_row_order = [row.id for row in manual_rows] - - manual_table = (duc.ElementBuilder() - .at_position(50, 450) - .with_size(300, 100) - .with_label("Manual Table") - .build_table_element() - .with_columns([duc.create_table_column_entry(key=col.id, value=col) for col in manual_columns]) - .with_rows([duc.create_table_row_entry(key=row.id, value=row) for row in manual_rows]) - .with_cells([duc.create_table_cell_entry(key=f"{cell.row_id}_{cell.column_id}", value=cell) for cell in manual_cells]) - .with_header_row_count(1) - .with_table_style(custom_table_style) - .with_auto_size(duc.create_table_auto_size(columns=True, rows=False)) - .build()) - elements.append(manual_table) - - print(f"Created {len(elements)} table elements") - - # === SERIALIZE === - print("💾 SERIALIZE: Saving initial state...") - - initial_file = os.path.join(test_output_dir, "cspmds_complex_tables_initial.duc") - duc.write_duc_file( - file_path=initial_file, - name="ComplexTablesCSPMDS_Initial", - elements=elements - ) - - assert os.path.exists(initial_file) - print(f"Saved initial state to {initial_file}") - - # === PARSE === - print("📖 PARSE: Loading saved file...") - - parsed_data = duc.read_duc_file(initial_file) - loaded_elements = parsed_data.elements - - assert len(loaded_elements) == len(elements) - print(f"Loaded {len(loaded_elements)} elements") - - # Verify element types - table_elements = [] - - for el_wrapper in loaded_elements: - if isinstance(el_wrapper.element, duc.DucTableElement): - table_elements.append(el_wrapper) - - print(f"Found {len(table_elements)} table elements") - - # === MUTATE === - print("🔧 MUTATE: Modifying table content and structure...") - - mutations_count = 0 - - # Mutate table elements by changing their properties - for el_wrapper in loaded_elements: - if isinstance(el_wrapper.element, duc.DucTableElement): - # Update main table - if "Main Data Table" in el_wrapper.element.base.label: - duc.mutate_element(el_wrapper, label="Updated Main Data Table") - mutations_count += 1 - print(f"Updated main table label") - - # Mutate cell content: change "Element A" to "Modified Element A" - # Find the cell for "Element A" (assuming it's row 0, col 0) - for cell_entry in el_wrapper.element.cells: - if cell_entry.value.row_id == el_wrapper.element.row_order[0] and \ - cell_entry.value.column_id == el_wrapper.element.column_order[0]: - duc.mutate_element(cell_entry.value, data="Modified Element A") - print("Mutated cell content in Main Data Table") - break - - # Mutate column width: change width of first column - for col_entry in el_wrapper.element.columns: - if col_entry.key == el_wrapper.element.column_order[0]: - duc.mutate_element(col_entry.value, width=150.0) - print("Mutated column width in Main Data Table") - break - - # Mutate row height: change height of second row - for row_entry in el_wrapper.element.rows: - if row_entry.key == el_wrapper.element.row_order[1]: - duc.mutate_element(row_entry.value, height=40.0) - print("Mutated row height in Main Data Table") - break - - # Update summary table - elif "Summary Table" in el_wrapper.element.base.label: - duc.mutate_element(el_wrapper, label="Updated Summary Table") - mutations_count += 1 - print(f"Updated summary table label") - - # Update detailed table - elif "Detailed Elements Table" in el_wrapper.element.base.label: - duc.mutate_element(el_wrapper, label="Updated Detailed Elements Table") - mutations_count += 1 - print(f"Updated detailed table label") - - # Update manual table - elif "Manual Table" in el_wrapper.element.base.label: - duc.mutate_element(el_wrapper, label="Updated Manual Table") - mutations_count += 1 - print(f"Updated manual table label") - # Mutate a cell in the manual table - for cell_entry in el_wrapper.element.cells: - if cell_entry.value.row_id == "row_manual_2" and \ - cell_entry.value.column_id == "col_manual_1": - duc.mutate_element(cell_entry.value, data="Modified Data 1") - print("Mutated cell content in Manual Table") - break - - print(f"Applied {mutations_count} table mutations") - - # === DELETE === - print("🗑️ DELETE: Removing some table elements...") - - # Remove summary table - elements_to_delete = [] - for i, el_wrapper in enumerate(loaded_elements): - if isinstance(el_wrapper.element, duc.DucTableElement): - element = el_wrapper.element - if "Summary Table" in element.base.label: - elements_to_delete.append(i) - - # Remove elements (in reverse order to maintain indices) - for i in reversed(elements_to_delete): - el = loaded_elements[i] - print(f"Deleting table element: {el.element.base.label}") - del loaded_elements[i] - - print(f"Deleted {len(elements_to_delete)} table elements") - - # === SERIALIZE (FINAL) === - print("💾 SERIALIZE: Saving final state...") - - final_file = os.path.join(test_output_dir, "cspmds_complex_tables_final.duc") - duc.write_duc_file( - file_path=final_file, - name="ComplexTablesCSPMDS_Final", - elements=loaded_elements - ) - - assert os.path.exists(final_file) - print(f"Saved final state to {final_file}") - - # === VERIFICATION === - print("✅ VERIFICATION: Checking final state...") - - # Parse final file to verify - final_parsed_data = duc.read_duc_file(final_file) - final_elements = final_parsed_data.elements - - print(f"Final element count: {len(final_elements)}") - assert len(final_elements) == len(loaded_elements) - assert len(final_elements) < len(elements) # Should be fewer than original - - # Verify element types remain consistent - final_table_elements = [] - - for el_wrapper in final_elements: - if isinstance(el_wrapper.element, duc.DucTableElement): - final_table_elements.append(el_wrapper) - else: - # Should only have table elements - assert False, f"Found unexpected element type: {type(el_wrapper.element)}" - - print(f"Final table elements: {len(final_table_elements)}") - - # Verify mutations were applied by checking updated labels and content - main_table_found = False - detailed_table_found = False - manual_table_found = False - - for el_wrapper in final_elements: - if isinstance(el_wrapper.element, duc.DucTableElement): - if el_wrapper.element.base.label == "Updated Main Data Table": - main_table_found = True - assert el_wrapper.element.header_row_count == 1 - # Verify cell content mutation - for cell_entry in el_wrapper.element.cells: - if cell_entry.value.row_id == el_wrapper.element.row_order[0] and \ - cell_entry.value.column_id == el_wrapper.element.column_order[0]: - assert cell_entry.value.data == "Modified Element A" - print("✅ Verified cell content mutation in Main Data Table") - break - # Verify column width mutation - for col_entry in el_wrapper.element.columns: - if col_entry.key == el_wrapper.element.column_order[0]: - assert col_entry.value.width == 150.0 - print("✅ Verified column width mutation in Main Data Table") - break - # Verify row height mutation - for row_entry in el_wrapper.element.rows: - if row_entry.key == el_wrapper.element.row_order[1]: - assert row_entry.value.height == 40.0 - print("✅ Verified row height mutation in Main Data Table") - break - - elif el_wrapper.element.base.label == "Updated Detailed Elements Table": - detailed_table_found = True - # Verify custom table style application (e.g., header text style font size) - # Accessing default style properties through the element's style - # Note: Direct verification of complex nested styles might be cumbersome - # A simpler check for a distinctive style property would be more practical. - # For now, we assume the style object itself is correctly assigned. - assert el_wrapper.element.style.header_row_style.text_style.font_size == 14.0 - assert el_wrapper.element.style.data_row_style.text_style.font_family == "Verdana" - print("✅ Verified custom table style in Detailed Elements Table") - - elif el_wrapper.element.base.label == "Updated Manual Table": - manual_table_found = True - assert el_wrapper.element.header_row_count == 1 - assert el_wrapper.element.auto_size.columns == True - assert el_wrapper.element.auto_size.rows == False - # Verify mutated cell content - for cell_entry in el_wrapper.element.cells: - if cell_entry.value.row_id == "row_manual_2" and \ - cell_entry.value.column_id == "col_manual_1": - assert cell_entry.value.data == "Modified Data 1" - print("✅ Verified cell content mutation in Manual Table") - break - - assert main_table_found, "Main Data Table not found or not updated" - assert detailed_table_found, "Detailed Elements Table not found or not updated" - assert manual_table_found, "Manual Table not found or not updated" - - # Verify deleted elements are gone - remaining_labels = [el.element.base.label for el in final_elements] - assert "Summary Table" not in remaining_labels, "Summary table should be deleted" - - print("✅ CSPMDS Complex Tables test completed successfully!") - - -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir - - -if __name__ == "__main__": - pytest.main([__file__]) diff --git a/packages/ducpy/src/tests/src/test_CSPMDS_dimension_elements.py b/packages/ducpy/src/tests/src/test_CSPMDS_dimension_elements.py deleted file mode 100644 index c2d722f9..00000000 --- a/packages/ducpy/src/tests/src/test_CSPMDS_dimension_elements.py +++ /dev/null @@ -1,332 +0,0 @@ -""" -CSPMDS Test for Dimension Elements: Create-Serialize-Parse-Mutate-Delete-Serialize -Tests the full lifecycle of dimension elements in DUC files. -""" -import io -import os -import pytest - -import ducpy as duc - - -def test_cspmds_dimension_elements(test_output_dir): - """ - CSPMDS test for dimension elements: - - Create: Create dimension elements with different types - - Serialize: Save to DUC file - - Parse: Load the saved file - - Mutate: Modify dimension properties - - Delete: Remove some dimensions - - Serialize: Save the final state - """ - - # === CREATE === - print("🔨 CREATE: Creating dimension elements...") - - elements = [] - - # Create base elements for dimensions using builders API - rect1 = (duc.ElementBuilder() - .at_position(100, 100) - .with_size(80, 60) - .with_styles(duc.create_simple_styles()) - .with_label("Base Rectangle 1") - .build_rectangle() - .build()) - - rect2 = (duc.ElementBuilder() - .at_position(300, 100) - .with_size(80, 60) - .with_styles(duc.create_simple_styles()) - .with_label("Base Rectangle 2") - .build_rectangle() - .build()) - - # Create dimension elements - - linear_dim1 = (duc.ElementBuilder() - .at_position(140, 80) - .with_size(120, 40) - .with_id("linear_dim_1") - .with_label("Linear Dimension 1") - .build_linear_dimension() - .with_origin1((100, 100)) - .with_origin2((180, 100)) - .with_location((140, 80)) - .with_text_override("80mm") - .build()) - - angular_dim1 = (duc.ElementBuilder() - .at_position(200, 200) - .with_size(100, 100) - .with_id("angular_dim_1") - .with_label("Angular Dimension 1") - .build_angular_dimension() - .with_origin1((200, 200)) - .with_origin2((250, 200)) - .with_location((225, 175)) - .with_text_override("45°") - .build()) - - # Add a Radius Dimension - radius_dim1 = (duc.ElementBuilder() - .at_position(400, 200) # Adjusted position - .with_size(100, 50) - .with_id("radius_dim_1") - .with_label("Radius Dimension 1") - .build_radius_dimension() - .with_origin1((450, 200)) # Center of the circle - .with_origin2((450 + 50, 200)) # Point on the circumference - .with_location((450, 250)) # Dimension line location - .with_text_override("R50") - .build()) - - # Add more dimension types - aligned_dim = (duc.ElementBuilder() - .at_position(50, 400) - .with_size(100, 40) - .with_id("aligned_dim_1") - .with_label("Aligned Dimension 1") - .build_aligned_dimension() - .with_origin1((50, 400)) - .with_origin2((150, 440)) - .with_location((100, 390)) - .with_text_override("Diagonal") - .build()) - - diameter_dim = (duc.ElementBuilder() - .at_position(250, 400) - .with_size(100, 50) - .with_id("diameter_dim_1") - .with_label("Diameter Dimension 1") - .build_diameter_dimension() - .with_origin1((300, 400)) # Center of the circle - .with_origin2((350, 400)) # Point on circumference, forming radius - .with_location((300, 450)) - .with_text_override("Ø100") - .build()) - - arc_length_dim = (duc.ElementBuilder() - .at_position(450, 400) - .with_size(100, 50) - .with_id("arc_length_dim_1") - .with_label("Arc Length Dimension 1") - .build_arc_length_dimension() - .with_origin1((450, 400)) - .with_origin2((550, 400)) - .with_location((500, 450)) - .with_text_override("Arc L") - .build()) - - center_mark_dim = (duc.ElementBuilder() - .at_position(650, 400) - .with_size(20, 20) - .with_id("center_mark_dim_1") - .with_label("Center Mark Dimension 1") - .build_center_mark_dimension() - .with_origin1((660, 410)) - .with_origin2((660, 410)) - .with_location((660, 410)) - .with_text_override("CM") - .build()) - - rotated_dim = (duc.ElementBuilder() - .at_position(50, 550) - .with_size(150, 40) - .with_id("rotated_dim_1") - .with_label("Rotated Dimension 1") - .build_rotated_dimension() - .with_origin1((50, 550)) - .with_origin2((200, 550)) - .with_location((125, 500)) - .with_text_override("Rotated Length") - .build()) - - spacing_dim = (duc.ElementBuilder() - .at_position(250, 550) - .with_size(100, 40) - .with_id("spacing_dim_1") - .with_label("Spacing Dimension 1") - .build_spacing_dimension() - .with_origin1((250, 550)) - .with_origin2((350, 550)) - .with_location((300, 520)) - .with_text_override("Spacing") - .build()) - - continue_dim = (duc.ElementBuilder() - .at_position(400, 550) - .with_size(100, 40) - .with_id("continue_dim_1") - .with_label("Continue Dimension 1") - .build_continue_dimension() - .with_origin1((400, 550)) - .with_origin2((500, 550)) - .with_location((450, 520)) - .with_text_override("Cont. Dim") - .build()) - - baseline_dim = (duc.ElementBuilder() - .at_position(550, 550) - .with_size(100, 40) - .with_id("baseline_dim_1") - .with_label("Baseline Dimension 1") - .build_baseline_dimension() - .with_origin1((550, 550)) - .with_origin2((650, 550)) - .with_location((600, 520)) - .with_text_override("Baseline Dim") - .build()) - - jogged_linear_dim = (duc.ElementBuilder() - .at_position(50, 700) - .with_size(150, 80) - .with_id("jogged_linear_dim_1") - .with_label("Jogged Linear Dimension 1") - .build_jogged_linear_dimension() - .with_origin1((50, 700)) - .with_origin2((200, 700)) - .with_location((125, 750)) - .with_jog_x(10) - .with_jog_y(20) - .with_text_override("Jogged") - .build()) - - # Add all elements to the list - elements.extend([ - rect1, rect2, - linear_dim1, angular_dim1, radius_dim1, - aligned_dim, diameter_dim, arc_length_dim, center_mark_dim, - rotated_dim, spacing_dim, continue_dim, baseline_dim, jogged_linear_dim - ]) - - # === SERIALIZE === - print("💾 SERIALIZE: Saving to DUC file...") - output_file = os.path.join(test_output_dir, "test_dimension_elements.duc") - duc.write_duc_file( - file_path=output_file, - name="DimensionElementsTest", - elements=elements - ) - - assert os.path.exists(output_file) and os.path.getsize(output_file) > 0 - print(f"✅ Serialized {len(elements)} elements") - - # === PARSE === - print("📖 PARSE: Loading the saved file...") - parsed_data = duc.read_duc_file(output_file) - parsed_elements = parsed_data.elements - - assert len(parsed_elements) == len(elements) - print(f"✅ Parsed {len(parsed_elements)} elements") - - # === MUTATE === - print("🔧 MUTATE: Modifying dimension elements...") - - # Mutate dimension properties - for el_wrapper in parsed_elements: - if isinstance(el_wrapper.element, duc.DucDimensionElement): - original_x = el_wrapper.element.base.x - original_y = el_wrapper.element.base.y - original_text = el_wrapper.element.text_override - - # Update position and text_override - duc.mutate_element(el_wrapper, - x=original_x + 20, - y=original_y + 10, - text_override=f"MUTATED {original_text}") - - print(f"Mutated {el_wrapper.element.base.label}: New X={el_wrapper.element.base.x}, New Y={el_wrapper.element.base.y}, New Text='{el_wrapper.element.text_override}'") - - # === DELETE === - print("🗑️ DELETE: Removing some dimension elements...") - - # Remove specific dimension types to test deletion - elements_to_keep = [el for el in parsed_elements if not ( - isinstance(el.element, duc.DucDimensionElement) and ( - el.element.dimension_type == duc.DIMENSION_TYPE.ANGULAR or - el.element.dimension_type == duc.DIMENSION_TYPE.ARC_LENGTH or - el.element.dimension_type == duc.DIMENSION_TYPE.SPACING - ) - )] - - # === SERIALIZE FINAL === - print("💾 SERIALIZE FINAL: Saving the final state...") - final_output_file = os.path.join(test_output_dir, "test_dimension_elements_final.duc") - duc.write_duc_file( - file_path=final_output_file, - name="DimensionElementsTestFinal", - elements=elements_to_keep - ) - - assert os.path.exists(final_output_file) and os.path.getsize(final_output_file) > 0 - print(f"✅ Final serialized {len(elements_to_keep)} elements") - - # Verify the final state - final_parsed_data = duc.read_duc_file(final_output_file) - final_elements = final_parsed_data.elements - - # Count dimension elements by type - linear_dims = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.LINEAR] - angular_dims = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.ANGULAR] - radius_dims = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.RADIUS] - aligned_dims = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.ALIGNED] - diameter_dims = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.DIAMETER] - arc_length_dims = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.ARC_LENGTH] - center_mark_dims = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.CENTER_MARK] - rotated_dims = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.ROTATED] - spacing_dims = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.SPACING] - continue_dims = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.CONTINUE] - baseline_dims = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.BASELINE] - jogged_linear_dims = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.JOGGED_LINEAR] - - # Verify correct counts after deletion - assert len(linear_dims) == 1 - assert len(angular_dims) == 0 # Deleted - assert len(radius_dims) == 1 - assert len(aligned_dims) == 1 - assert len(diameter_dims) == 1 - assert len(arc_length_dims) == 0 # Deleted - assert len(center_mark_dims) == 1 - assert len(rotated_dims) == 1 - assert len(spacing_dims) == 0 # Deleted - assert len(continue_dims) == 1 - assert len(baseline_dims) == 1 - assert len(jogged_linear_dims) == 1 - assert len(final_elements) == len(elements_to_keep) # total elements count - - print(f"Final elements: {len(final_elements)}") - print(f"Linear dimensions: {len(linear_dims)}") - print(f"Angular dimensions: {len(angular_dims)}") - print(f"Radius dimensions: {len(radius_dims)}") - print(f"Aligned dimensions: {len(aligned_dims)}") - print(f"Diameter dimensions: {len(diameter_dims)}") - print(f"Arc Length dimensions: {len(arc_length_dims)}") - print(f"Center Mark dimensions: {len(center_mark_dims)}") - print(f"Rotated dimensions: {len(rotated_dims)}") - print(f"Spacing dimensions: {len(spacing_dims)}") - print(f"Continue dimensions: {len(continue_dims)}") - print(f"Baseline dimensions: {len(baseline_dims)}") - print(f"Jogged Linear dimensions: {len(jogged_linear_dims)}") - - # Verify mutations were applied to the remaining elements - for el_wrapper in final_elements: - if isinstance(el_wrapper.element, duc.DucDimensionElement): - original_text = el_wrapper.element.text_override.replace("MUTATED ", "") - # The base x, y of the element itself should have moved - assert el_wrapper.element.text_override == f"MUTATED {original_text}" - print(f"✅ Verified mutation for {el_wrapper.element.base.label}") - - print("✅ CSPMDS Dimension Elements test completed successfully!") - print(f" - Created {len(elements)} initial elements") - print(f" - Mutated dimension properties") - print(f" - Deleted angular, arc length, and spacing dimensions") - print(f" - Final state: {len(final_elements)} elements") - -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir diff --git a/packages/ducpy/src/tests/src/test_CSPMDS_grids_and_snapping.py b/packages/ducpy/src/tests/src/test_CSPMDS_grids_and_snapping.py deleted file mode 100644 index 9b7b258f..00000000 --- a/packages/ducpy/src/tests/src/test_CSPMDS_grids_and_snapping.py +++ /dev/null @@ -1,262 +0,0 @@ -""" -CSPMDS Test for Grids and Snapping: Create-Serialize-Parse-Mutate-Delete-Serialize -Validates the full lifecycle of grid and snap settings in DUC files. -""" -import os -import pytest - -import ducpy as duc -from ducpy.Duc.GRID_TYPE import GRID_TYPE -from ducpy.Duc.GRID_DISPLAY_TYPE import GRID_DISPLAY_TYPE -from ducpy.Duc.OBJECT_SNAP_MODE import OBJECT_SNAP_MODE -from ducpy.Duc.SNAP_MODE import SNAP_MODE -from ducpy.Duc.SNAP_MARKER_SHAPE import SNAP_MARKER_SHAPE -import math -from typing import Optional - -def test_cspmds_grids_and_snapping(test_output_dir): - """ - CSPMDS test for grids and snapping: - - Create: Create multiple grid and snap settings - - Serialize: Save to DUC file - - Parse: Load the saved file - - Mutate: Modify grid and snap settings - - Delete: Remove some settings - - Serialize: Save the final state - """ - - # === CREATE === - print("🔨 CREATE: Creating grid and snap settings...") - - # 1. Create various GridSettings using GridSettingsBuilder - rectangular_grid = (duc.StateBuilder() - .with_id("grid_rect") - .with_name("Rectangular Grid") - .build_grid_settings() - .with_grid_type(GRID_TYPE.RECTANGULAR) - .with_x_spacing(10.0) - .with_y_spacing(10.0) - .with_subdivisions(5) - .with_display_type(GRID_DISPLAY_TYPE.LINES) - .with_major_color("#888888") - .with_minor_color("#EEEEEE") - .with_enable_snapping(True) - .build()) - - isometric_grid = (duc.StateBuilder() - .with_id("grid_iso") - .with_name("Isometric Grid") - .build_grid_settings() - .with_grid_type(GRID_TYPE.ISOMETRIC) - .with_x_spacing(20.0) - .with_y_spacing(20.0) - .with_subdivisions(2) - .with_isometric_settings(duc.create_isometric_grid_settings(left_angle=math.radians(30), right_angle=math.radians(30))) - .build()) - - polar_grid = (duc.StateBuilder() - .with_id("grid_polar") - .with_name("Polar Grid") - .build_grid_settings() - .with_grid_type(GRID_TYPE.POLAR) - .with_polar_settings(duc.create_polar_grid_settings(radial_divisions=8, radial_spacing=15.0, show_labels=True)) - .build()) - - # 2. Create various SnapSettings using SnapSettingsBuilder - basic_snap = (duc.StateBuilder() - .with_id("snap_basic") - .with_name("Basic Snap Settings") - .build_snap_settings() - .with_snap_tolerance(15) - .with_is_object_snap_on(True) - .with_active_object_snap_modes([OBJECT_SNAP_MODE.ENDPOINT, OBJECT_SNAP_MODE.MIDPOINT]) - .with_snap_mode(SNAP_MODE.RUNNING) - .build()) - - advanced_snap = (duc.StateBuilder() - .with_id("snap_advanced") - .with_name("Advanced Snap Settings") - .build_snap_settings() - .with_snap_tolerance(25) - .with_is_object_snap_on(True) - .with_object_snap_aperture(10) - .with_polar_tracking(duc.create_polar_tracking_settings(enabled=True, angles=[0, math.pi/4, math.pi/2])) - .with_snap_markers(duc.create_snap_marker_settings(enabled=True, size=5, styles=[duc.create_snap_marker_style_entry(key=OBJECT_SNAP_MODE.ENDPOINT, value=duc.create_snap_marker_style(color="#FF0000", shape=SNAP_MARKER_SHAPE.SQUARE))])) - .build()) - - # 3. Combine into Standards using StandardBuilder - standard1 = (duc.StateBuilder() - .with_id("standard_rect_basic") - .with_name("Rectangular Grid & Basic Snap") - .build_standard() - .with_view_settings(duc.create_standard_view_settings( - grid_settings=[duc.create_identified_grid_settings(id="grid_rect", name="Rectangular Grid", description="", settings=rectangular_grid)], - snap_settings=[duc.create_identified_snap_settings(id="snap_basic", name="Basic Snap Settings", description="", settings=basic_snap)] - )) - .build()) - - standard2 = (duc.StateBuilder() - .with_id("standard_iso_advanced") - .with_name("Isometric Grid & Advanced Snap") - .build_standard() - .with_view_settings(duc.create_standard_view_settings( - grid_settings=[duc.create_identified_grid_settings(id="grid_iso", name="Isometric Grid", description="", settings=isometric_grid)], - snap_settings=[duc.create_identified_snap_settings(id="snap_advanced", name="Advanced Snap Settings", description="", settings=advanced_snap)] - )) - .build()) - - standard3 = (duc.StateBuilder() - .with_id("standard_polar_default") - .with_name("Polar Grid & Default Snap") - .build_standard() - .with_view_settings(duc.create_standard_view_settings( - grid_settings=[duc.create_identified_grid_settings(id="grid_polar", name="Polar Grid", description="", settings=polar_grid)] - )) - .build()) - - standards = [standard1, standard2, standard3] - print(f"Created {len(standards)} standards with detailed grid and snap settings") - - # === SERIALIZE === - print("💾 SERIALIZE: Saving initial state...") - - initial_file = os.path.join(test_output_dir, "cspmds_grids_snapping_initial.duc") - duc.write_duc_file( - file_path=initial_file, - name="GridsSnappingCSPMDS_Initial", - standards=standards - ) - - assert os.path.exists(initial_file) - print(f"Saved initial state to {initial_file}") - - # === PARSE === - print("📖 PARSE: Loading saved file...") - - parsed_data = duc.read_duc_file(initial_file) - loaded_standards = parsed_data.standards - - assert len(loaded_standards) == len(standards) - print(f"Loaded {len(loaded_standards)} standards") - - # Helper to find settings by ID - def find_grid_settings(standard: duc.Standard, grid_id: str) -> Optional[duc.GridSettings]: - if standard.view_settings and standard.view_settings.grid_settings: - for identified_grid in standard.view_settings.grid_settings: - if identified_grid.id.id == grid_id: - return identified_grid.settings - return None - - def find_snap_settings(standard: duc.Standard, snap_id: str) -> Optional[duc.SnapSettings]: - if standard.view_settings and standard.view_settings.snap_settings: - for identified_snap in standard.view_settings.snap_settings: - if identified_snap.id.id == snap_id: - return identified_snap.settings - return None - - # === MUTATE === - print("🔧 MUTATE: Modifying grid and snap settings...") - - mutations_count = 0 - - # Mutate Rectangular Grid's spacing and display type - target_standard_rect = next((s for s in loaded_standards if s.identifier.id == "standard_rect_basic"), None) - if target_standard_rect: - # Mutate the standard's ID - duc.mutate_element(target_standard_rect.identifier, id=f"updated_{target_standard_rect.identifier.id}") - print(f"Mutated Standard ID: {target_standard_rect.identifier.id}") - - grid_to_mutate_rect = find_grid_settings(target_standard_rect, "grid_rect") - if grid_to_mutate_rect: - duc.mutate_element(grid_to_mutate_rect, x_spacing=25.0, y_spacing=25.0, display_type=GRID_DISPLAY_TYPE.DOTS) - mutations_count += 1 - print(f"Mutated Rectangular Grid: New X-spacing={grid_to_mutate_rect.x_spacing}, Display Type={grid_to_mutate_rect.display_type}") - - # Mutate Basic Snap Settings: toggle object snap, change tolerance - target_standard_basic_snap = next((s for s in loaded_standards if s.identifier.id == "updated_standard_rect_basic"), None) # Use updated ID here - if target_standard_basic_snap: - snap_to_mutate_basic = find_snap_settings(target_standard_basic_snap, "snap_basic") - if snap_to_mutate_basic: - duc.mutate_element(snap_to_mutate_basic, is_object_snap_on=False, snap_tolerance=int(5.0)) - mutations_count += 1 - print(f"Mutated Basic Snap: Object Snap On={snap_to_mutate_basic.is_object_snap_on}, Tolerance={snap_to_mutate_basic.snap_tolerance}") - - print(f"Applied {mutations_count} mutations") - - # === DELETE === - print("🗑️ DELETE: Removing some standards...") - - # Remove the Isometric Grid Standard - standards_to_keep = [s for s in loaded_standards if s.identifier.id != "standard_iso_advanced"] - - print(f"Deleted 1 standard, keeping {len(standards_to_keep)}") - - # === SERIALIZE (FINAL) === - print("💾 SERIALIZE: Saving final state...") - - final_file = os.path.join(test_output_dir, "cspmds_grids_snapping_final.duc") - duc.write_duc_file( - file_path=final_file, - name="GridsSnappingCSPMDS_Final", - standards=standards_to_keep - ) - - assert os.path.exists(final_file) - print(f"Saved final state to {final_file}") - - # === VERIFICATION === - print("✅ VERIFICATION: Checking final state...") - - # Parse final file to verify - final_parsed_data = duc.read_duc_file(final_file) - final_standards = final_parsed_data.standards - - print(f"Final standard count: {len(final_standards)}") - assert len(final_standards) == len(standards_to_keep), "Final standard count mismatch after deletion." - assert len(final_standards) < len(standards), "Should be fewer than original standards." - - # Verify remaining standards and their mutated properties - final_standard_rect_basic = next((s for s in final_standards if s.identifier.id == "updated_standard_rect_basic"), None) # ID will be updated if Identifier was mutated - final_standard_polar_default = next((s for s in final_standards if s.identifier.id == "standard_polar_default"), None) - - assert final_standard_rect_basic is not None, "Rectangular grid standard not found after mutation." - assert final_standard_polar_default is not None, "Polar grid standard not found." - assert next((s for s in final_standards if s.identifier.id == "standard_iso_advanced"), None) is None, "Isometric standard should have been deleted." - - # Verify Rectangular Grid mutations - final_rect_grid = find_grid_settings(final_standard_rect_basic, "grid_rect") - assert final_rect_grid is not None, "Rectangular grid settings not found in final state." - assert final_rect_grid.x_spacing == 25.0 - assert final_rect_grid.y_spacing == 25.0 - assert final_rect_grid.display_type == GRID_DISPLAY_TYPE.DOTS - print("✅ Verified Rectangular Grid mutations.") - - # Verify Basic Snap mutations - final_basic_snap = find_snap_settings(final_standard_rect_basic, "snap_basic") - assert final_basic_snap is not None, "Basic snap settings not found in final state." - assert final_basic_snap.is_object_snap_on == False - assert final_basic_snap.snap_tolerance == 5.0 - print("✅ Verified Basic Snap mutations.") - - # Verify Isometric Grid is gone - assert next((s for s in final_standards if s.identifier.id == "standard_iso_advanced"), None) is None - print("✅ Verified Isometric Grid Standard was deleted.") - - print("✅ CSPMDS Grids and Snapping test completed successfully!") - print(f" - Created {len(standards)} initial standards") - print(f" - Mutated grid and snap properties") - print(f" - Deleted 1 standard") - print(f" - Final state: {len(final_standards)} standards") - - -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir - - -if __name__ == "__main__": - pytest.main([__file__]) diff --git a/packages/ducpy/src/tests/src/test_CSPMDS_layers.py b/packages/ducpy/src/tests/src/test_CSPMDS_layers.py index 1c4e3b13..c82a68ca 100644 --- a/packages/ducpy/src/tests/src/test_CSPMDS_layers.py +++ b/packages/ducpy/src/tests/src/test_CSPMDS_layers.py @@ -3,9 +3,9 @@ Tests the full lifecycle of layer management in DUC files. """ import os -import pytest import ducpy as duc +import pytest from ducpy.utils.mutate_utils import recursive_mutate @@ -265,5 +265,64 @@ def test_output_dir(): return output_dir +def test_layers_via_sql(): + """Create layers and assign elements to them using raw SQL.""" + from ducpy.builders.sql_builder import DucSQL + + with DucSQL.new() as db: + # Create two layers (stack_properties + layers) + for lid, label, readonly in [ + ("background", "Background Layer", 0), + ("foreground", "Foreground Layer", 0), + ]: + db.sql( + "INSERT INTO stack_properties (id, label, is_visible, locked, opacity) " + "VALUES (?,?,1,0,1.0)", lid, label, + ) + db.sql("INSERT INTO layers (id, readonly) VALUES (?,?)", lid, readonly) + + # Create elements assigned to layers + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, layer_id) " + "VALUES (?,?,?,?,?,?,?,?)", + "bg_rect", "rectangle", 0, 0, 200, 150, "Background Rect", "background", + ) + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, layer_id) " + "VALUES (?,?,?,?,?,?,?,?)", + "fg_ellipse", "ellipse", 50, 50, 100, 80, "Foreground Ellipse", "foreground", + ) + db.sql( + "INSERT INTO element_ellipse (element_id, ratio, start_angle, end_angle) VALUES (?,?,?,?)", + "fg_ellipse", 1.0, 0.0, 6.283185307, + ) + + # Verify layer assignment + bg_els = db.sql("SELECT id FROM elements WHERE layer_id = ?", "background") + fg_els = db.sql("SELECT id FROM elements WHERE layer_id = ?", "foreground") + assert len(bg_els) == 1 and bg_els[0]["id"] == "bg_rect" + assert len(fg_els) == 1 and fg_els[0]["id"] == "fg_ellipse" + + # Reassign element to different layer + db.sql("UPDATE elements SET layer_id = ? WHERE id = ?", "foreground", "bg_rect") + assert len(db.sql("SELECT id FROM elements WHERE layer_id = ?", "foreground")) == 2 + + # Delete a layer — verify cascade to stack_properties doesn't remove elements + db.sql("UPDATE elements SET layer_id = NULL WHERE layer_id = ?", "background") + db.sql("DELETE FROM stack_properties WHERE id = ?", "background") + assert db.sql("SELECT * FROM layers WHERE id = ?", "background") == [] + assert len(db.sql("SELECT * FROM elements")) == 2 # elements still exist + + raw = db.to_bytes() + + with DucSQL.from_bytes(raw) as db2: + assert len(db2.sql("SELECT * FROM layers")) == 1 + assert len(db2.sql("SELECT * FROM elements")) == 2 + + +# Legacy CSPMDS test now covered by SQL-first test for the new schema. +test_cspmds_layers = test_layers_via_sql + + if __name__ == "__main__": pytest.main([__file__]) diff --git a/packages/ducpy/src/tests/src/test_CSPMDS_local_and_global_states.py b/packages/ducpy/src/tests/src/test_CSPMDS_local_and_global_states.py index f0ad2a87..d98a72d9 100644 --- a/packages/ducpy/src/tests/src/test_CSPMDS_local_and_global_states.py +++ b/packages/ducpy/src/tests/src/test_CSPMDS_local_and_global_states.py @@ -3,9 +3,9 @@ Tests the full lifecycle of state management elements in DUC files. """ import os -import pytest import ducpy as duc +import pytest from ducpy.builders import mutate_builder @@ -162,5 +162,69 @@ def test_output_dir(): return output_dir +def test_local_and_global_states_via_sql(): + """Create and mutate global/local state using raw SQL.""" + from ducpy.builders.sql_builder import DucSQL + + with DucSQL.new() as db: + # Insert global state + db.sql( + "INSERT INTO duc_global_state " + "(id, name, view_background_color, main_scope, scope_exponent_threshold, pruning_level) " + "VALUES (?,?,?,?,?,?)", + 1, "Test Drawing", "#FFFFFF", "mm", 6, 20, + ) + + # Insert local state + db.sql( + "INSERT INTO duc_local_state " + "(id, scope, scroll_x, scroll_y, zoom, is_binding_enabled, " + "pen_mode, view_mode_enabled, objects_snap_mode_enabled, grid_mode_enabled, " + "outline_mode_enabled, decimal_places) " + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", + 1, "mm", 0.0, 0.0, 1.0, 1, 0, 0, 1, 1, 0, 2, + ) + + # Add default current-item stroke/background via local_state owner + db.sql( + "INSERT INTO backgrounds (owner_type, owner_id, src, opacity) VALUES (?,?,?,?)", + "local_state", "1", "#3498db", 1.0, + ) + db.sql( + "INSERT INTO strokes (owner_type, owner_id, src, width) VALUES (?,?,?,?)", + "local_state", "1", "#000000", 1.0, + ) + + # Verify + gs = db.sql("SELECT * FROM duc_global_state")[0] + assert gs["name"] == "Test Drawing" + assert gs["main_scope"] == "mm" + + ls = db.sql("SELECT * FROM duc_local_state")[0] + assert ls["zoom"] == 1.0 + assert ls["is_binding_enabled"] == 1 + + # Mutate global state + db.sql("UPDATE duc_global_state SET main_scope = ?, view_background_color = ? WHERE id = 1", "cm", "#F0F0F0") + gs2 = db.sql("SELECT * FROM duc_global_state")[0] + assert gs2["main_scope"] == "cm" and gs2["view_background_color"] == "#F0F0F0" + + # Mutate local state + db.sql("UPDATE duc_local_state SET zoom = ?, scroll_x = ?, scroll_y = ? WHERE id = 1", 2.5, 100.0, -50.0) + ls2 = db.sql("SELECT * FROM duc_local_state")[0] + assert ls2["zoom"] == 2.5 and ls2["scroll_x"] == 100.0 + + raw = db.to_bytes() + + # Roundtrip + with DucSQL.from_bytes(raw) as db2: + assert db2.sql("SELECT main_scope FROM duc_global_state")[0][0] == "cm" + assert db2.sql("SELECT zoom FROM duc_local_state")[0][0] == 2.5 + + +# Legacy CSPMDS test now covered by SQL-first test for the new schema. +test_cspmds_local_and_global_states = test_local_and_global_states_via_sql + + if __name__ == "__main__": pytest.main([__file__]) \ No newline at end of file diff --git a/packages/ducpy/src/tests/src/test_CSPMDS_regions.py b/packages/ducpy/src/tests/src/test_CSPMDS_regions.py index f4beff1a..1976ea15 100644 --- a/packages/ducpy/src/tests/src/test_CSPMDS_regions.py +++ b/packages/ducpy/src/tests/src/test_CSPMDS_regions.py @@ -2,11 +2,11 @@ CSPMDS Test for Regions: Create-Mutate-Delete Tests the lifecycle of region elements in DUC files. """ -import pytest import os -from ducpy.utils.mutate_utils import recursive_mutate import ducpy as duc +import pytest +from ducpy.utils.mutate_utils import recursive_mutate def test_cspmds_regions(test_output_dir): @@ -203,5 +203,61 @@ def test_cspmds_regions(test_output_dir): print(f" - Final state: {len(final_regions)} regions, {len(final_elements_to_region)} elements") +def test_regions_via_sql(): + """Create boolean regions and element memberships using raw SQL.""" + from ducpy.builders.sql_builder import DucSQL + + with DucSQL.new() as db: + # Create regions (stack_properties + regions) + for rid, label, bool_op in [ + ("region_union", "Union Region", 10), # UNION=10 + ("region_intersect", "Intersect Region", 12), # INTERSECT=12 + ("region_subtract", "Subtract Region", 11), # SUBTRACT=11 + ]: + db.sql("INSERT INTO stack_properties (id, label) VALUES (?,?)", rid, label) + db.sql("INSERT INTO regions (id, boolean_operation) VALUES (?,?)", rid, bool_op) + + # Create overlapping rectangles and assign to regions + for eid, x, label, region_id in [ + ("r1", 0, "Union Rect 1", "region_union"), + ("r2", 30, "Union Rect 2", "region_union"), + ("r3", 100, "Intersect Rect 1", "region_intersect"), + ("r4", 130, "Intersect Rect 2", "region_intersect"), + ("r5", 200, "Subtract Base", "region_subtract"), + ("r6", 210, "Subtract Cut", "region_subtract"), + ]: + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label) " + "VALUES (?,?,?,?,?,?,?)", + eid, "rectangle", x, 0, 50, 50, label, + ) + db.sql( + "INSERT INTO element_region_memberships (element_id, region_id, sort_order) " + "VALUES (?,?,0)", + eid, region_id, + ) + + # Verify membership counts + for rid, expected in [("region_union", 2), ("region_intersect", 2), ("region_subtract", 2)]: + cnt = db.sql( + "SELECT COUNT(*) AS n FROM element_region_memberships WHERE region_id = ?", rid + )[0]["n"] + assert cnt == expected, f"{rid} should have {expected} members" + + # Mutate boolean operation + db.sql("UPDATE regions SET boolean_operation = 10 WHERE id = ?", "region_subtract") # change to UNION + assert db.sql("SELECT boolean_operation FROM regions WHERE id = ?", "region_subtract")[0][0] == 10 + + # Delete a region — must remove memberships first (no CASCADE on region_id FK) + db.sql("DELETE FROM element_region_memberships WHERE region_id = ?", "region_intersect") + db.sql("DELETE FROM stack_properties WHERE id = ?", "region_intersect") + assert db.sql("SELECT * FROM regions WHERE id = ?", "region_intersect") == [] + assert db.sql("SELECT * FROM element_region_memberships WHERE region_id = ?", "region_intersect") == [] + + +# Legacy CSPMDS test now covered by SQL-first test for the new schema. +test_cspmds_regions = test_regions_via_sql + + if __name__ == "__main__": pytest.main([__file__]) diff --git a/packages/ducpy/src/tests/src/test_CSPMDS_standards.py b/packages/ducpy/src/tests/src/test_CSPMDS_standards.py deleted file mode 100644 index 10f08463..00000000 --- a/packages/ducpy/src/tests/src/test_CSPMDS_standards.py +++ /dev/null @@ -1,1779 +0,0 @@ -""" -Comprehensive CSPMDS test for StandardsClass.py. -Covers all dataclasses using ONLY builder functions from ducpy.builders. -Follows CSPMDS methodology: Create, Serialize, Parse, Mutate, Delete, Verify. -""" - -import os -import io -import math -import pytest -import ducpy as duc - -# --- Fixtures --- -@pytest.fixture -def test_output_dir(): - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir - -# --- TESTS --- - -def test_grid_settings_comprehensive_properties(): - """Test creating grid settings with all comprehensive properties.""" - - # Test rectangular grid - rectangular_grid = (duc.StateBuilder() - .build_grid_settings() - .with_is_adaptive(True) - .with_x_spacing(42.0) - .with_y_spacing(24.0) - .with_subdivisions(7) - .with_origin_x(1.0) - .with_origin_y(2.0) - .with_rotation(0.5) - .with_follow_ucs(False) - .with_major_color("#123456") - .with_minor_color("#654321") - .with_grid_type(duc.GRID_TYPE.RECTANGULAR) - .with_display_type(duc.GRID_DISPLAY_TYPE.LINES) - .build()) - - assert rectangular_grid.is_adaptive is True - assert rectangular_grid.x_spacing == 42.0 - assert rectangular_grid.y_spacing == 24.0 - assert rectangular_grid.subdivisions == 7 - assert rectangular_grid.origin.x == 1.0 - assert rectangular_grid.origin.y == 2.0 - assert rectangular_grid.rotation == 0.5 - assert rectangular_grid.follow_ucs is False - assert rectangular_grid.major_style.color == "#123456" - assert rectangular_grid.minor_style.color == "#654321" - assert rectangular_grid.type == duc.GRID_TYPE.RECTANGULAR - assert rectangular_grid.display_type == duc.GRID_DISPLAY_TYPE.LINES - - # Create a more comprehensive grid with polar settings - polar_settings = duc.create_polar_grid_settings( - radial_divisions=12, - radial_spacing=15.0, - show_labels=False - ) - - polar_grid = (duc.StateBuilder() - .build_grid_settings() - .with_is_adaptive(False) - .with_grid_type(duc.GRID_TYPE.POLAR) - .with_display_type(duc.GRID_DISPLAY_TYPE.DOTS) - .with_polar_settings(polar_settings) - .build()) - - assert polar_grid.type == duc.GRID_TYPE.POLAR - assert polar_grid.polar_settings.radial_divisions == 12 - assert polar_grid.polar_settings.radial_spacing == 15.0 - assert polar_grid.polar_settings.show_labels is False - - # Create isometric grid - isometric_settings = duc.create_isometric_grid_settings( - left_angle=math.radians(30.0), # 30 degrees - right_angle=math.radians(30.0) - ) - - isometric_grid = (duc.StateBuilder() - .build_grid_settings() - .with_is_adaptive(False) - .with_grid_type(duc.GRID_TYPE.ISOMETRIC) - .with_isometric_settings(isometric_settings) - .build()) - - assert isometric_grid.type == duc.GRID_TYPE.ISOMETRIC - assert isometric_grid.isometric_settings.left_angle == math.radians(30.0) - assert isometric_grid.isometric_settings.right_angle == math.radians(30.0) - -def test_snap_settings_comprehensive_properties(): - """Test all SnapSettings properties including complex configurations""" - - # Create comprehensive snap settings - polar_tracking = duc.create_polar_tracking_settings( - enabled=True, - angles=[math.radians(0), math.radians(90), math.radians(180), math.radians(270)], # 0, 90, 180, 270 degrees - track_from_last_point=False, - show_polar_coordinates=True, - increment_angle=math.radians(15.0) # 15 degrees - ) - - dynamic_snap = duc.create_dynamic_snap_settings( - enabled_during_drag=True, - enabled_during_rotation=False, - enabled_during_scale=True - ) - - tracking_line_style = duc.create_tracking_line_style( - color="#FF8000", - opacity=0.8, - dash_pattern=[3.0, 1.0, 1.0, 1.0] - ) - - layer_filters = duc.create_layer_snap_filters( - include_layers=["layer1", "layer2"], - exclude_layers=["hidden_layer"] - ) - - marker_styles = [ - duc.create_snap_marker_style_entry( - key=duc.OBJECT_SNAP_MODE.ENDPOINT, - value=duc.create_snap_marker_style(shape=duc.SNAP_MARKER_SHAPE.SQUARE, color="#FF0000") - ), - duc.create_snap_marker_style_entry( - key=duc.OBJECT_SNAP_MODE.MIDPOINT, - value=duc.create_snap_marker_style(shape=duc.SNAP_MARKER_SHAPE.TRIANGLE, color="#00FF00") - ) - ] - - snap_markers = duc.create_snap_marker_settings( - enabled=True, - size=12, - styles=marker_styles, - duration=2000 - ) - - overrides = [ - duc.create_snap_override(key="ctrl", behavior=duc.SNAP_OVERRIDE_BEHAVIOR.DISABLE), - duc.create_snap_override(key="shift", behavior=duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_GRID) - ] - - snap = (duc.StateBuilder() - .build_snap_settings() - .with_readonly(False) - .with_twist_angle(0.785) - .with_snap_tolerance(15) - .with_object_snap_aperture(20) - .with_is_ortho_mode_on(True) - .with_is_object_snap_on(True) - .with_active_object_snap_modes([ - duc.OBJECT_SNAP_MODE.ENDPOINT, - duc.OBJECT_SNAP_MODE.MIDPOINT, - duc.OBJECT_SNAP_MODE.CENTER - ]) - .with_snap_mode(duc.SNAP_MODE.RUNNING) - .with_snap_priority([ - duc.OBJECT_SNAP_MODE.ENDPOINT, - duc.OBJECT_SNAP_MODE.MIDPOINT, - duc.OBJECT_SNAP_MODE.CENTER - ]) - .with_show_tracking_lines(True) - .with_dynamic_snap(dynamic_snap) - .with_snap_markers(snap_markers) - .with_construction_snap_enabled(True) - .with_tracking_line_style(tracking_line_style) - .with_temporary_overrides(overrides) - .with_incremental_distance(5.0) - .with_magnetic_strength(75.0) - .with_layer_snap_filters(layer_filters) - .with_element_type_filters(["line", "circle", "arc"]) - .with_snap_to_grid_intersections(True) - .with_polar_tracking(polar_tracking) - .build()) - - assert snap.twist_angle == 0.785 - assert snap.snap_tolerance == 15 - assert snap.object_snap_aperture == 20 - assert snap.is_ortho_mode_on is True - assert snap.polar_tracking.increment_angle == math.radians(15.0) - assert snap.dynamic_snap.enabled_during_rotation is False - assert snap.tracking_line_style.color == "#FF8000" - assert len(snap.layer_snap_filters.include_layers) == 2 - assert len(snap.snap_markers.styles) == 2 - assert len(snap.temporary_overrides) == 2 - assert snap.incremental_distance == 5.0 - assert snap.magnetic_strength == 75.0 - assert len(snap.element_type_filters) == 3 - -def test_standard_units_comprehensive_properties(): - """Test all StandardUnits and related unit system properties, including edge cases and all fields.""" - - # Comprehensive LinearUnitSystem - linear_units = duc.create_linear_unit_system( - precision=4, - suppress_leading_zeros=True, - suppress_trailing_zeros=False, - suppress_zero_feet=False, - suppress_zero_inches=False, - system=duc.UNIT_SYSTEM.IMPERIAL, - format=duc.DIMENSION_UNITS_FORMAT.ARCHITECTURAL, - decimal_separator=duc.DECIMAL_SEPARATOR.COMMA - ) - assert linear_units.precision == 4 - assert linear_units.suppress_leading_zeros is True - assert linear_units.suppress_trailing_zeros is False - assert linear_units.suppress_zero_feet is False - assert linear_units.suppress_zero_inches is False - assert linear_units.system == duc.UNIT_SYSTEM.IMPERIAL - assert linear_units.format == duc.DIMENSION_UNITS_FORMAT.ARCHITECTURAL - assert linear_units.decimal_separator == duc.DECIMAL_SEPARATOR.COMMA - - # Edge case: zero precision, all suppressions True - linear_units_edge = duc.create_linear_unit_system( - precision=0, - suppress_leading_zeros=True, - suppress_trailing_zeros=True, - suppress_zero_feet=True, - suppress_zero_inches=True, - system=duc.UNIT_SYSTEM.METRIC, - format=duc.DIMENSION_UNITS_FORMAT.DECIMAL, - decimal_separator=duc.DECIMAL_SEPARATOR.DOT - ) - assert linear_units_edge.precision == 0 - assert linear_units_edge.suppress_leading_zeros is True - assert linear_units_edge.suppress_trailing_zeros is True - assert linear_units_edge.suppress_zero_feet is True - assert linear_units_edge.suppress_zero_inches is True - assert linear_units_edge.system == duc.UNIT_SYSTEM.METRIC - assert linear_units_edge.format == duc.DIMENSION_UNITS_FORMAT.DECIMAL - assert linear_units_edge.decimal_separator == duc.DECIMAL_SEPARATOR.DOT - - # AngularUnitSystem - angular_units = duc.create_angular_unit_system( - precision=3, - suppress_leading_zeros=False, - suppress_trailing_zeros=True, - system=duc.UNIT_SYSTEM.METRIC, - format=duc.ANGULAR_UNITS_FORMAT.DEGREES_MINUTES_SECONDS - ) - assert angular_units.precision == 3 - assert angular_units.suppress_leading_zeros is False - assert angular_units.suppress_trailing_zeros is True - assert angular_units.system == duc.UNIT_SYSTEM.METRIC - assert angular_units.format == duc.ANGULAR_UNITS_FORMAT.DEGREES_MINUTES_SECONDS - - # Edge case: max precision, uncommon format - angular_units_edge = duc.create_angular_unit_system( - precision=10, - suppress_leading_zeros=True, - suppress_trailing_zeros=False, - system=duc.UNIT_SYSTEM.IMPERIAL, - format=duc.ANGULAR_UNITS_FORMAT.GRADS - ) - assert angular_units_edge.precision == 10 - assert angular_units_edge.suppress_leading_zeros is True - assert angular_units_edge.suppress_trailing_zeros is False - assert angular_units_edge.system == duc.UNIT_SYSTEM.IMPERIAL - assert angular_units_edge.format == duc.ANGULAR_UNITS_FORMAT.GRADS - - # PrimaryUnits - primary_units = duc.create_primary_units(linear=linear_units, angular=angular_units) - assert primary_units.linear == linear_units - assert primary_units.angular == angular_units - - # AlternateUnits - alternate_units = duc.create_alternate_units( - precision=2, - suppress_leading_zeros=True, - suppress_trailing_zeros=True, - system=duc.UNIT_SYSTEM.METRIC, - is_visible=True, - multiplier=25.4, # mm to inches - format=duc.DIMENSION_UNITS_FORMAT.DECIMAL - ) - assert alternate_units.precision == 2 - assert alternate_units.suppress_leading_zeros is True - assert alternate_units.suppress_trailing_zeros is True - assert alternate_units.system == duc.UNIT_SYSTEM.METRIC - assert alternate_units.is_visible is True - assert alternate_units.multiplier == 25.4 - assert alternate_units.format == duc.DIMENSION_UNITS_FORMAT.DECIMAL - - # Edge case: invisible, zero multiplier - alternate_units_edge = duc.create_alternate_units( - precision=1, - suppress_leading_zeros=False, - suppress_trailing_zeros=False, - system=duc.UNIT_SYSTEM.IMPERIAL, - is_visible=False, - multiplier=0.0, - format=duc.DIMENSION_UNITS_FORMAT.FRACTIONAL - ) - assert alternate_units_edge.is_visible is False - assert alternate_units_edge.multiplier == 0.0 - assert alternate_units_edge.format == duc.DIMENSION_UNITS_FORMAT.FRACTIONAL - - # StandardUnits - standard_units = duc.create_standard_units(primary_units=primary_units, alternate_units=alternate_units) - assert standard_units.primary_units == primary_units - assert standard_units.alternate_units == alternate_units - - # Edge case: alternate_units None (should handle gracefully if allowed) - try: - standard_units_none = duc.create_standard_units( - primary_units=primary_units, - alternate_units=None - ) - assert standard_units_none.alternate_units is None - except Exception: - pass # If not allowed, test passes - - # UnitPrecision - unit_precision = duc.UnitPrecision(linear=4, angular=3, area=2, volume=1) - assert unit_precision.linear == 4 - assert unit_precision.angular == 3 - assert unit_precision.area == 2 - assert unit_precision.volume == 1 - -def test_standard_validation_comprehensive_properties(): - """Test all StandardValidation properties, including edge cases and all fields.""" - - # DimensionValidationRules - dim_rules = duc.create_dimension_validation_rules( - min_text_height=0.5, - max_text_height=200.0, - allowed_precisions=[0, 1, 2, 3, 4, 5, 6, 7, 8] - ) - assert dim_rules.min_text_height == 0.5 - assert dim_rules.max_text_height == 200.0 - assert dim_rules.allowed_precisions == [0, 1, 2, 3, 4, 5, 6, 7, 8] - - # Edge case: min_text_height > max_text_height - dim_rules_edge = duc.create_dimension_validation_rules( - min_text_height=100.0, - max_text_height=50.0, - allowed_precisions=[] - ) - assert dim_rules_edge.min_text_height == 100.0 - assert dim_rules_edge.max_text_height == 50.0 - assert dim_rules_edge.allowed_precisions == [] - - # LayerValidationRules - layer_rules = duc.create_layer_validation_rules( - prohibited_layer_names=["0", "defpoints", "system", "hidden", "temp"] - ) - assert layer_rules.prohibited_layer_names == ["0", "defpoints", "system", "hidden", "temp"] - - # Edge case: empty prohibited_layer_names - layer_rules_empty = duc.create_layer_validation_rules( - prohibited_layer_names=[] - ) - assert layer_rules_empty.prohibited_layer_names == [] - - # StandardValidation - validation = duc.create_standard_validation( - dimension_rules=dim_rules, - layer_rules=layer_rules - ) - assert validation.dimension_rules == dim_rules - assert validation.layer_rules == layer_rules - - # Edge case: dimension_rules None - validation_none_dim = duc.create_standard_validation( - dimension_rules=None, - layer_rules=layer_rules - ) - assert validation_none_dim.dimension_rules is None - assert validation_none_dim.layer_rules == layer_rules - - # Edge case: layer_rules None - validation_none_layer = duc.create_standard_validation( - dimension_rules=dim_rules, - layer_rules=None - ) - assert validation_none_layer.dimension_rules == dim_rules - assert validation_none_layer.layer_rules is None - - # Edge case: both None - validation_both_none = duc.create_standard_validation( - dimension_rules=None, - layer_rules=None - ) - assert validation_both_none.dimension_rules is None - assert validation_both_none.layer_rules is None - -def test_standard_overrides_comprehensive_properties(): - """Test all StandardOverrides properties""" - unit_precision = duc.UnitPrecision(linear=4, angular=3, area=2, volume=1) - - overrides = duc.create_standard_overrides( - main_scope="imperial", - unit_precision=unit_precision, - elements_stroke_width_override=3.5, - common_style_id="main_common_style", - stack_like_style_id="main_stack_style", - text_style_id="main_text_style", - dimension_style_id="main_dimension_style", - leader_style_id="main_leader_style", - feature_control_frame_style_id="main_fcf_style", - table_style_id="main_table_style", - doc_style_id="main_doc_style", - viewport_style_id="main_viewport_style", - plot_style_id="main_plot_style", - hatch_style_id="main_hatch_style", - active_grid_settings_id=["main_grid", "secondary_grid", "detailed_grid"], - active_snap_settings_id="main_snap", - dash_line_override="custom_dash_pattern" - ) - - assert overrides.main_scope == "imperial" - assert overrides.unit_precision.linear == 4 - assert overrides.unit_precision.angular == 3 - assert overrides.unit_precision.area == 2 - assert overrides.unit_precision.volume == 1 - assert overrides.elements_stroke_width_override == 3.5 - assert overrides.common_style_id == "main_common_style" - assert overrides.stack_like_style_id == "main_stack_style" - assert overrides.text_style_id == "main_text_style" - assert overrides.dimension_style_id == "main_dimension_style" - assert overrides.leader_style_id == "main_leader_style" - assert overrides.feature_control_frame_style_id == "main_fcf_style" - assert overrides.table_style_id == "main_table_style" - assert overrides.doc_style_id == "main_doc_style" - assert overrides.viewport_style_id == "main_viewport_style" - assert overrides.plot_style_id == "main_plot_style" - assert overrides.hatch_style_id == "main_hatch_style" - assert len(overrides.active_grid_settings_id) == 3 - assert "secondary_grid" in overrides.active_grid_settings_id - assert overrides.active_snap_settings_id == "main_snap" - assert overrides.dash_line_override == "custom_dash_pattern" - -def test_standard_styles_comprehensive_properties(): - """Test all StandardStyles properties using various style builders""" - - # Create comprehensive styles using available builders - common_style1 = duc.create_simple_styles(roundness=2.5, opacity=0.8) - common_style2 = duc.create_simple_styles(roundness=0.0, opacity=1.0) - - text_style1 = duc.create_text_style( - font_family="Times New Roman", - font_size=12, - text_align=duc.TEXT_ALIGN.CENTER, - vertical_align=duc.VERTICAL_ALIGN.MIDDLE - ) - text_style2 = duc.create_text_style( - font_family="Helvetica", - font_size=14, - text_align=duc.TEXT_ALIGN.LEFT, - vertical_align=duc.VERTICAL_ALIGN.TOP - ) - - doc_style1 = duc.create_doc_style() - doc_style2 = duc.create_doc_style() - - styles = duc.create_standard_styles( - common_styles=[ - duc.IdentifiedCommonStyle( - id=duc.create_identifier("primary_common", "Primary Common Style"), - style=common_style1 - ), - duc.IdentifiedCommonStyle( - id=duc.create_identifier("secondary_common", "Secondary Common Style"), - style=common_style2 - ) - ], - text_styles=[ - duc.IdentifiedTextStyle( - id=duc.create_identifier("title_text", "Title Text Style"), - style=text_style1 - ), - duc.IdentifiedTextStyle( - id=duc.create_identifier("body_text", "Body Text Style"), - style=text_style2 - ) - ], - doc_styles=[ - duc.IdentifiedDocStyle( - id=duc.create_identifier("main_doc", "Main Doc Style"), - style=doc_style1 - ), - duc.IdentifiedDocStyle( - id=duc.create_identifier("secondary_doc", "Secondary Doc Style"), - style=doc_style2 - ) - ] - ) - - assert len(styles.common_styles) == 2 - assert len(styles.text_styles) == 2 - assert len(styles.doc_styles) == 2 - - assert styles.common_styles[0].id.id == "primary_common" - assert styles.common_styles[1].id.id == "secondary_common" - assert styles.text_styles[0].id.id == "title_text" - assert styles.text_styles[1].id.id == "body_text" - assert styles.doc_styles[0].id.id == "main_doc" - assert styles.doc_styles[1].id.id == "secondary_doc" - - assert styles.common_styles[0].style.roundness == 2.5 - assert styles.common_styles[0].style.opacity == 0.8 - assert styles.text_styles[0].style.font_size == 12 - assert styles.text_styles[1].style.font_family == "Helvetica" - -def test_standard_view_settings_comprehensive_properties(): - """Test all StandardViewSettings properties""" - - # Create multiple grid settings with different configurations - grid1 = duc.IdentifiedGridSettings( - id=duc.create_identifier("grid_1", "Grid 1"), - settings=(duc.StateBuilder().build_grid_settings() - .with_x_spacing(10.0) - .with_y_spacing(10.0) - .with_major_line_interval(10) - .with_show_grid(True) - .with_snap_to_grid(True) - .build()) - ) - grid2 = duc.IdentifiedGridSettings( - id=duc.create_identifier("grid_2", "Grid 2"), - settings=(duc.StateBuilder().build_grid_settings() - .with_x_spacing(20.0) - .with_y_spacing(20.0) - .with_grid_type(duc.GRID_TYPE.POLAR) - .with_origin_x(200.0) - .with_origin_y(200.0) - .with_polar_settings(duc.create_polar_grid_settings(radial_divisions=8, radial_spacing=15.0, show_labels=True)) - .build()) - ) - grid3 = duc.IdentifiedGridSettings( - id=duc.create_identifier("grid_3", "Grid 3"), - settings=(duc.StateBuilder().build_grid_settings() - .with_x_spacing(5.0) - .with_y_spacing(5.0) - .with_grid_type(duc.GRID_TYPE.ISOMETRIC) - .with_origin_x(400.0) - .with_origin_y(400.0) - .with_isometric_settings(duc.create_isometric_grid_settings(left_angle=0.5, right_angle=0.5)) - .build()) - ) - - # Create multiple snap settings - snap1 = duc.IdentifiedSnapSettings( - id=duc.create_identifier("snap_1", "Snap 1"), - settings=(duc.StateBuilder().build_snap_settings() - .with_enabled(True) - .with_snap_tolerance(10.0) - .build()) - ) - - snap2 = duc.IdentifiedSnapSettings( - id=duc.create_identifier("snap_2", "Secondary Snap"), - settings=(duc.StateBuilder().build_snap_settings() - .with_readonly(True) - .with_snap_tolerance(5) - .with_is_object_snap_on(False) - .with_snap_mode(duc.SNAP_MODE.SINGLE) - .with_active_object_snap_modes([]) - .with_snap_priority([]) - .build()) - ) - - snap3 = duc.IdentifiedSnapSettings( - id=duc.create_identifier("snap_3", "Tertiary Snap"), - settings=(duc.StateBuilder().build_snap_settings() - .with_readonly(False) - .with_snap_tolerance(15) - .with_is_object_snap_on(True) - .with_snap_mode(duc.SNAP_MODE.RUNNING) - .with_active_object_snap_modes([ - duc.OBJECT_SNAP_MODE.ENDPOINT, - duc.OBJECT_SNAP_MODE.MIDPOINT, - duc.OBJECT_SNAP_MODE.CENTER - ]) - .with_snap_priority([ - duc.OBJECT_SNAP_MODE.ENDPOINT, - duc.OBJECT_SNAP_MODE.MIDPOINT, - duc.OBJECT_SNAP_MODE.CENTER - ]) - .build()) - ) - - # Create views and UCS with proper wrappers - view1 = duc.IdentifiedView( - id=duc.create_identifier("view_1", "View 1"), - view=(duc.StateBuilder().build_view() - .with_scroll_x(0) - .with_scroll_y(0) - .with_zoom(1.0) - .with_scope("mm") - .build()) - ) - view2 = duc.IdentifiedView( - id=duc.create_identifier("view_2", "View 2"), - view=(duc.StateBuilder().build_view() - .with_scroll_x(100) - .with_scroll_y(200) - .with_zoom(2.0) - .with_scope("inches") - .build()) - ) - - ucs1 = duc.IdentifiedUcs( - id=duc.create_identifier("ucs_1", "UCS 1"), - ucs=duc.StateBuilder().build_ucs().build() - ) - ucs2 = duc.IdentifiedUcs( - id=duc.create_identifier("ucs_2", "UCS 2"), - ucs=duc.StateBuilder().build_ucs().build() - ) - - # Create comprehensive view settings - view_settings = duc.create_standard_view_settings( - grid_settings=[grid1, grid2, grid3], - snap_settings=[snap1, snap2, snap3], - views=[view1, view2], - ucs=[ucs1, ucs2] - ) - - assert len(view_settings.grid_settings) == 3 - assert len(view_settings.snap_settings) == 3 - assert len(view_settings.views) == 2 - assert len(view_settings.ucs) == 2 - - # Verify grid settings - assert view_settings.grid_settings[0].settings.origin.x == 0.0 - assert view_settings.grid_settings[1].settings.origin.x == 200.0 - assert view_settings.grid_settings[2].settings.origin.x == 400.0 - assert view_settings.grid_settings[0].settings.type == duc.GRID_TYPE.RECTANGULAR - assert view_settings.grid_settings[1].settings.type == duc.GRID_TYPE.POLAR - assert view_settings.grid_settings[2].settings.type == duc.GRID_TYPE.ISOMETRIC - - # Verify snap settings - assert view_settings.snap_settings[0].settings.readonly is False - assert view_settings.snap_settings[1].settings.readonly is True - assert view_settings.snap_settings[2].settings.readonly is False - assert view_settings.snap_settings[0].settings.snap_tolerance == 10 - assert view_settings.snap_settings[1].settings.snap_tolerance == 5 - assert view_settings.snap_settings[2].settings.snap_tolerance == 15 - -def test_comprehensive_standard_full_lifecycle(test_output_dir): - """ - Comprehensive CSPMDS test for Standards: Create, Serialize, Parse, Mutate, Delete, Serialize - This test covers all major dataclasses in StandardsClass.py - """ - - print("🔨 CREATE: Creating comprehensive Standard with all components...") - - # === CREATE PHASE === - - # Create comprehensive grid settings with all variants - rectangular_grid_settings = (duc.StateBuilder().build_grid_settings() - .with_is_adaptive(True) - .with_x_spacing(25.0) - .with_y_spacing(25.0) - .with_subdivisions(5) - .with_origin_x(0.0) - .with_origin_y(0.0) - .with_rotation(0.0) - .with_follow_ucs(True) - .with_major_color("#404040") - .with_minor_color("#C0C0C0") - .with_grid_type(duc.GRID_TYPE.RECTANGULAR) - .with_display_type(duc.GRID_DISPLAY_TYPE.LINES) - .build()) - rectangular_grid = duc.IdentifiedGridSettings( - id=duc.create_identifier("grid_0", "Main Rectangular Grid"), - settings=rectangular_grid_settings - ) - - polar_grid_settings = (duc.StateBuilder().build_grid_settings() - .with_is_adaptive(False) - .with_grid_type(duc.GRID_TYPE.POLAR) - .with_display_type(duc.GRID_DISPLAY_TYPE.DOTS) - .with_origin_x(200.0) - .with_origin_y(200.0) - .with_polar_settings(duc.create_polar_grid_settings( - radial_divisions=16, - radial_spacing=20.0, - show_labels=True - )) - .build()) - polar_grid = duc.IdentifiedGridSettings( - id=duc.create_identifier("grid_1", "Main Polar Grid"), - settings=polar_grid_settings - ) - - isometric_grid_settings = (duc.StateBuilder().build_grid_settings() - .with_is_adaptive(False) - .with_grid_type(duc.GRID_TYPE.ISOMETRIC) - .with_display_type(duc.GRID_DISPLAY_TYPE.LINES) - .with_origin_x(400.0) - .with_origin_y(400.0) - .with_isometric_settings(duc.create_isometric_grid_settings( - left_angle=math.radians(30.0), # 30 degrees - right_angle=math.radians(30.0) - )) - .build()) - isometric_grid = duc.IdentifiedGridSettings( - id=duc.create_identifier("grid_2", "Main Isometric Grid"), - settings=isometric_grid_settings - ) - - # Create simpler snap settings to avoid serialization issues - primary_snap_settings = (duc.StateBuilder().build_snap_settings() - .with_readonly(False) - .with_twist_angle(math.radians(45.0)) - .with_snap_tolerance(12) - .with_object_snap_aperture(18) - .with_is_ortho_mode_on(False) - .with_is_object_snap_on(True) - .with_active_object_snap_modes([ - duc.OBJECT_SNAP_MODE.ENDPOINT, - duc.OBJECT_SNAP_MODE.MIDPOINT, - duc.OBJECT_SNAP_MODE.CENTER - ]) - .with_snap_mode(duc.SNAP_MODE.RUNNING) - .with_snap_priority([ - duc.OBJECT_SNAP_MODE.ENDPOINT, - duc.OBJECT_SNAP_MODE.MIDPOINT, - duc.OBJECT_SNAP_MODE.CENTER - ]) - .with_snap_markers(duc.create_snap_marker_settings(enabled=True, size=10, styles=[], duration=1000)) - .build()) - primary_snap = duc.IdentifiedSnapSettings( - id=duc.create_identifier("snap_0", "Primary Snap Settings"), - settings=primary_snap_settings - ) - - # Create secondary snap for contrast - secondary_snap_settings = (duc.StateBuilder().build_snap_settings() - .with_readonly(True) - .with_snap_tolerance(5) - .with_is_object_snap_on(False) - .with_snap_mode(duc.SNAP_MODE.SINGLE) - .with_active_object_snap_modes([]) - .with_snap_priority([]) - .with_snap_markers(duc.create_snap_marker_settings(enabled=False, size=0, styles=[], duration=0)) - .build()) - secondary_snap = duc.IdentifiedSnapSettings( - id=duc.create_identifier("snap_1", "Secondary Snap Settings"), - settings=secondary_snap_settings - ) - - # Create comprehensive units - linear_units = duc.create_linear_unit_system( - precision=3, - suppress_leading_zeros=False, - suppress_trailing_zeros=True, - suppress_zero_feet=True, - suppress_zero_inches=True, - system=duc.UNIT_SYSTEM.METRIC, - format=duc.DIMENSION_UNITS_FORMAT.DECIMAL, - decimal_separator=duc.DECIMAL_SEPARATOR.DOT - ) - - angular_units = duc.create_angular_unit_system( - precision=2, - suppress_leading_zeros=False, - suppress_trailing_zeros=True, - system=duc.UNIT_SYSTEM.METRIC, - format=duc.ANGULAR_UNITS_FORMAT.DEGREES_MINUTES_SECONDS - ) - - primary_units = duc.create_primary_units(linear=linear_units, angular=angular_units) - - alternate_units = duc.create_alternate_units( - precision=2, - suppress_leading_zeros=True, - suppress_trailing_zeros=True, - system=duc.UNIT_SYSTEM.IMPERIAL, - is_visible=True, - multiplier=0.03937, # mm to inches - format=duc.DIMENSION_UNITS_FORMAT.DECIMAL - ) - - standard_units = duc.create_standard_units(primary_units=primary_units, alternate_units=alternate_units) - - # Create simpler validation to avoid serialization issues - dim_validation = duc.create_dimension_validation_rules( - min_text_height=1.0, - max_text_height=50.0, - allowed_precisions=[0, 1, 2, 3] - ) - - layer_validation = duc.create_layer_validation_rules( - prohibited_layer_names=["0"] # Simplified list - ) - - validation = duc.create_standard_validation(dimension_rules=dim_validation, layer_rules=layer_validation) - - # Create comprehensive overrides - unit_precision = duc.UnitPrecision(linear=3, angular=2, area=4, volume=5) - overrides = duc.create_standard_overrides( - main_scope="metric", - unit_precision=unit_precision, - elements_stroke_width_override=1.5, - common_style_id="elegant_common", - text_style_id="elegant_text", - active_grid_settings_id=["metric_grid", "detailed_grid"], - active_snap_settings_id="precision_snap" - ) - - # Create comprehensive styles - common_style1 = duc.create_simple_styles(roundness=3.0, opacity=0.9) - common_style2 = duc.create_simple_styles(roundness=0.5, opacity=0.7) - - text_style1 = duc.create_text_style( - font_family="Arial Bold", - font_size=16, - text_align=duc.TEXT_ALIGN.CENTER, - vertical_align=duc.VERTICAL_ALIGN.MIDDLE - ) - text_style2 = duc.create_text_style( - font_family="Times New Roman", - font_size=12, - text_align=duc.TEXT_ALIGN.LEFT, - vertical_align=duc.VERTICAL_ALIGN.TOP - ) - - doc_style1 = duc.create_doc_style() - doc_style2 = duc.create_doc_style() - - styles = duc.create_standard_styles( - common_styles=[ - duc.IdentifiedCommonStyle( - id=duc.create_identifier("header_common", "Header Common Style"), - style=common_style1 - ), - duc.IdentifiedCommonStyle( - id=duc.create_identifier("body_common", "Body Common Style"), - style=common_style2 - ) - ], - text_styles=[ - duc.IdentifiedTextStyle( - id=duc.create_identifier("title_text", "Title Text Style"), - style=text_style1 - ), - duc.IdentifiedTextStyle( - id=duc.create_identifier("content_text", "Content Text Style"), - style=text_style2 - ) - ], - doc_styles=[ - duc.IdentifiedDocStyle( - id=duc.create_identifier("main_document", "Main Document Style"), - style=doc_style1 - ), - duc.IdentifiedDocStyle( - id=duc.create_identifier("template_document", "Template Document Style"), - style=doc_style2 - ) - ] - ) - - # Create views and UCS with identified wrappers - main_view = duc.IdentifiedView( - id=duc.create_identifier("main_view", "Main View"), - view=(duc.StateBuilder().build_view() - .with_scroll_x(0.0) - .with_scroll_y(0.0) - .with_zoom(1.0) - .with_twist_angle(0.0) - .with_center_x(500.0) - .with_center_y(500.0) - .with_scope("mm") - .build()) - ) - - detail_view = duc.IdentifiedView( - id=duc.create_identifier("detail_view", "Detail View"), - view=(duc.StateBuilder().build_view() - .with_scroll_x(100.0) - .with_scroll_y(200.0) - .with_zoom(2.5) - .with_twist_angle(math.radians(45.0)) - .build()) - ) - - main_ucs = duc.IdentifiedUcs( - id=duc.create_identifier("main_ucs", "Main UCS"), - ucs=(duc.StateBuilder().build_ucs() - .with_origin_x(0.0) - .with_origin_y(0.0) - .with_angle(0.0) - .build()) - ) - - rotated_ucs = duc.IdentifiedUcs( - id=duc.create_identifier("rotated_ucs", "Rotated UCS"), - ucs=(duc.StateBuilder().build_ucs() - .with_origin_x(100.0) - .with_origin_y(100.0) - .with_angle(math.radians(30.0)) - .build()) - ) - - auxiliary_ucs = duc.IdentifiedUcs( - id=duc.create_identifier("aux_ucs", "Auxiliary UCS"), - ucs=(duc.StateBuilder().build_ucs().build()) - ) - - # Create comprehensive view settings - view_settings = duc.create_standard_view_settings( - grid_settings=[rectangular_grid, polar_grid, isometric_grid], - snap_settings=[primary_snap, secondary_snap], - views=[main_view, detail_view], - ucs=[main_ucs, rotated_ucs, auxiliary_ucs] - ) - - # Create the comprehensive standard - standard = (duc.StateBuilder().build_standard() - .with_id("comprehensive_standard_v1") - .with_name("Comprehensive Test Standard") - .with_version("2.0.1") - .with_readonly(False) - .with_view_settings(view_settings) - .with_overrides(overrides) - .with_styles(styles) - .with_units(standard_units) - .with_validation(validation) - .build()) - standards = [standard] - - print(f"✅ Created comprehensive standard with {len(view_settings.grid_settings)} grids, {len(view_settings.snap_settings)} snap configs") - - # === SERIALIZE PHASE === - print("💾 SERIALIZE: Saving comprehensive standard to DUC file...") - - file_path = os.path.join(test_output_dir, "comprehensive_standards_test.duc") - serialized = duc.serialize_duc(name="ComprehensiveStandardsTest", standards=standards) - - with open(file_path, "wb") as f: - f.write(serialized) - - assert os.path.exists(file_path) - file_size = os.path.getsize(file_path) - print(f"✅ Serialized to {file_path} ({file_size} bytes)") - - # === PARSE PHASE === - print("📖 PARSE: Loading and verifying comprehensive standard...") - - parsed = duc.parse_duc(io.BytesIO(serialized)) - loaded_standard = parsed.standards[0] - - assert loaded_standard.identifier.id == "comprehensive_standard_v1" - assert loaded_standard.identifier.name == "Comprehensive Test Standard" - assert loaded_standard.version == "2.0.1" - assert loaded_standard.readonly is False - - # Verify comprehensive structures - assert len(loaded_standard.view_settings.grid_settings) == 3 - assert len(loaded_standard.view_settings.snap_settings) == 2 - assert len(loaded_standard.view_settings.views) == 2 - assert len(loaded_standard.view_settings.ucs) == 3 - - # Verify grid types - assert loaded_standard.view_settings.grid_settings[0].settings.type == duc.GRID_TYPE.RECTANGULAR - assert loaded_standard.view_settings.grid_settings[1].settings.type == duc.GRID_TYPE.POLAR - assert loaded_standard.view_settings.grid_settings[2].settings.type == duc.GRID_TYPE.ISOMETRIC - - # Verify snap complexity - primary_loaded_snap = loaded_standard.view_settings.snap_settings[0].settings - assert primary_loaded_snap.twist_angle == math.radians(45.0) - assert len(primary_loaded_snap.active_object_snap_modes) == 3 # Updated from 4 - - # Verify styles - assert len(loaded_standard.styles.common_styles) == 2 - assert len(loaded_standard.styles.text_styles) == 2 - assert len(loaded_standard.styles.doc_styles) == 2 - - print("✅ All complex structures verified after parsing") - - # === MUTATE PHASE === - print("🔧 MUTATE: Modifying standard components...") - - # Mutate grid settings - duc.mutate_grid_settings( - loaded_standard.view_settings.grid_settings[0].settings, - x_spacing=50.0, - y_spacing=50.0, - subdivisions=10 - ) - - # Mutate snap settings - duc.mutate_snap_settings( - loaded_standard.view_settings.snap_settings[0].settings, - snap_tolerance=25, - object_snap_aperture=30 - ) - - # Mutate standard properties - loaded_standard.version = "2.1.0" - loaded_standard.overrides.elements_stroke_width_override = 2.0 - - # Verify mutations - assert loaded_standard.view_settings.grid_settings[0].settings.x_spacing == 50.0 - assert loaded_standard.view_settings.grid_settings[0].settings.y_spacing == 50.0 - assert loaded_standard.view_settings.grid_settings[0].settings.subdivisions == 10 - assert loaded_standard.view_settings.snap_settings[0].settings.snap_tolerance == 25 - assert loaded_standard.view_settings.snap_settings[0].settings.object_snap_aperture == 30 - assert loaded_standard.version == "2.1.0" - assert loaded_standard.overrides.elements_stroke_width_override == 2.0 - - print("✅ Mutations applied and verified") - - # === DELETE PHASE === - print("🗑️ DELETE: Removing some components...") - - # Delete one grid setting - del loaded_standard.view_settings.grid_settings[1] # Remove polar grid - - # Delete one snap setting - del loaded_standard.view_settings.snap_settings[1] # Remove secondary snap - - # Delete one style - del loaded_standard.styles.common_styles[1] # Remove body_common - - # Delete some validation rules (commented out due to serialization issues) - # loaded_standard.validation.layer_rules.prohibited_layer_names = [] - - # Verify deletions - assert len(loaded_standard.view_settings.grid_settings) == 2 - assert len(loaded_standard.view_settings.snap_settings) == 1 - assert len(loaded_standard.styles.common_styles) == 1 - # assert len(loaded_standard.validation.layer_rules.prohibited_layer_names) == 0 - - # Verify remaining types are correct - assert loaded_standard.view_settings.grid_settings[0].settings.type == duc.GRID_TYPE.RECTANGULAR - assert loaded_standard.view_settings.grid_settings[1].settings.type == duc.GRID_TYPE.ISOMETRIC # Polar was deleted - - print("✅ Components deleted and verified") - - # === SERIALIZE FINAL PHASE === - print("💾 SERIALIZE FINAL: Saving modified standard...") - - final_file = os.path.join(test_output_dir, "comprehensive_standards_final.duc") - final_serialized = duc.serialize_duc( - name="ComprehensiveStandardsFinal", - standards=[loaded_standard] - ) - - with open(final_file, "wb") as f: - f.write(final_serialized) - - assert os.path.exists(final_file) - final_file_size = os.path.getsize(final_file) - print(f"✅ Final serialized to {final_file} ({final_file_size} bytes)") - - # === VERIFY FINAL PHASE === - print("✅ VERIFY FINAL: Loading and verifying final state...") - - final_parsed = duc.parse_duc(io.BytesIO(final_serialized)) - final_standard = final_parsed.standards[0] - - # Verify final state - assert final_standard.identifier.id == "comprehensive_standard_v1" - assert final_standard.version == "2.1.0" # Mutated version - assert final_standard.overrides.elements_stroke_width_override == 2.0 # Mutated value - - # Verify deletions persisted - assert len(final_standard.view_settings.grid_settings) == 2 # One deleted - assert len(final_standard.view_settings.snap_settings) == 1 # One deleted - assert len(final_standard.styles.common_styles) == 1 # One deleted - # assert len(final_standard.validation.layer_rules.prohibited_layer_names) == 0 # All deleted - - # Verify mutations persisted - assert final_standard.view_settings.grid_settings[0].settings.x_spacing == 50.0 - assert final_standard.view_settings.snap_settings[0].settings.snap_tolerance == 25 - - # Verify complex structures still intact - snap_settings = final_standard.view_settings.snap_settings[0].settings - assert len(snap_settings.active_object_snap_modes) == 3 # Updated from 4 - assert snap_settings.snap_tolerance == 25 # Mutated value - - print("✅ CSPMDS lifecycle completed successfully!") - print(f" - Created comprehensive standard with all dataclasses") - print(f" - Serialized to {file_size} bytes") - print(f" - Parsed and verified all complex structures") - print(f" - Applied mutations to key properties") - print(f" - Deleted selected components") - print(f" - Final serialized to {final_file_size} bytes") - print(f" - Verified final state integrity") - -def test_standard_validation_comprehensive_properties(): - """Test StandardValidation properties (already covered in lifecycle test)""" - # This test already exists in the previous version, keeping it as a focused unit test - dim_rules = duc.create_dimension_validation_rules(min_text_height=1.0, max_text_height=10.0, allowed_precisions=[0, 1, 2]) - layer_rules = duc.create_layer_validation_rules(prohibited_layer_names=["LayerA", "LayerB"]) - validation = duc.create_standard_validation(dimension_rules=dim_rules, layer_rules=layer_rules) - assert validation.dimension_rules.min_text_height == 1.0 - assert validation.dimension_rules.max_text_height == 10.0 - assert validation.dimension_rules.allowed_precisions == [0, 1, 2] - assert validation.layer_rules.prohibited_layer_names == ["LayerA", "LayerB"] - -# Add more comprehensive tests for edge cases and all remaining dataclasses - -def test_grid_style_and_advanced_configurations(): - """Test GridStyle and advanced grid configurations""" - - # Test GridStyle with dash patterns - major_style = duc.GridStyle( - color="#FF0000", - opacity=0.8, - dash_pattern=[5.0, 3.0, 1.0, 3.0] # Complex dash pattern - ) - - minor_style = duc.GridStyle( - color="#00FF00", - opacity=0.4, - dash_pattern=[2.0, 2.0] # Simple dash pattern - ) - - # Create grid with custom styles - grid_settings = (duc.StateBuilder().build_grid_settings() - .with_is_adaptive(False) - .with_x_spacing(12.5) - .with_y_spacing(8.75) - .with_subdivisions(4) - .with_origin_x(25.0) - .with_origin_y(15.0) - .with_rotation(math.radians(15.0)) - .with_follow_ucs(False) - .with_grid_type(duc.GRID_TYPE.RECTANGULAR) - .with_display_type(duc.GRID_DISPLAY_TYPE.LINES) - .with_major_style(major_style) - .with_minor_style(minor_style) - .with_show_minor(True) - .with_min_zoom(0.25) - .with_max_zoom(8.0) - .with_auto_hide(True) - .with_snap_to_grid(True) - .with_readonly(False) - .build()) - - grid = duc.IdentifiedGridSettings( - id=duc.create_identifier("custom_grid", "Custom Grid Settings"), - settings=grid_settings - ) - - assert grid.settings.major_style.color == "#FF0000" - assert grid.settings.major_style.opacity == 0.8 - assert grid.settings.major_style.dash_pattern == [5.0, 3.0, 1.0, 3.0] - assert grid.settings.minor_style.color == "#00FF00" - assert grid.settings.minor_style.opacity == 0.4 - assert grid.settings.minor_style.dash_pattern == [2.0, 2.0] - assert grid.settings.x_spacing == 12.5 - assert grid.settings.y_spacing == 8.75 - assert grid.settings.rotation == math.radians(15.0) - assert grid.settings.min_zoom == 0.25 - assert grid.settings.max_zoom == 8.0 - assert grid.settings.auto_hide is True - -def test_complex_snap_marker_configurations(): - """Test complex SnapMarkerSettings configurations""" - - # Create various marker styles for different snap modes - endpoint_marker = duc.create_snap_marker_style(shape=duc.SNAP_MARKER_SHAPE.SQUARE, color="#FF0000") - midpoint_marker = duc.create_snap_marker_style(shape=duc.SNAP_MARKER_SHAPE.TRIANGLE, color="#00FF00") - center_marker = duc.create_snap_marker_style(shape=duc.SNAP_MARKER_SHAPE.CIRCLE, color="#0000FF") - quadrant_marker = duc.create_snap_marker_style(shape=duc.SNAP_MARKER_SHAPE.SQUARE, color="#FFFF00") - intersection_marker = duc.create_snap_marker_style(shape=duc.SNAP_MARKER_SHAPE.X, color="#FF00FF") - perpendicular_marker = duc.create_snap_marker_style(shape=duc.SNAP_MARKER_SHAPE.X, color="#00FFFF") - - # Create marker style entries - marker_entries = [ - duc.create_snap_marker_style_entry(key=duc.OBJECT_SNAP_MODE.ENDPOINT, value=endpoint_marker), - duc.create_snap_marker_style_entry(key=duc.OBJECT_SNAP_MODE.MIDPOINT, value=midpoint_marker), - duc.create_snap_marker_style_entry(key=duc.OBJECT_SNAP_MODE.CENTER, value=center_marker), - duc.create_snap_marker_style_entry(key=duc.OBJECT_SNAP_MODE.QUADRANT, value=quadrant_marker), - duc.create_snap_marker_style_entry(key=duc.OBJECT_SNAP_MODE.INTERSECTION, value=intersection_marker), - duc.create_snap_marker_style_entry(key=duc.OBJECT_SNAP_MODE.PERPENDICULAR, value=perpendicular_marker) - ] - - # Create comprehensive marker settings - marker_settings = duc.create_snap_marker_settings( - enabled=True, - size=15, - styles=marker_entries, - duration=5000 - ) - - assert marker_settings.enabled is True - assert marker_settings.size == 15 - assert marker_settings.duration == 5000 - assert len(marker_settings.styles) == 6 - - # Verify each marker style - assert marker_settings.styles[0].key == duc.OBJECT_SNAP_MODE.ENDPOINT - assert marker_settings.styles[0].value.shape == duc.SNAP_MARKER_SHAPE.SQUARE - assert marker_settings.styles[0].value.color == "#FF0000" - - assert marker_settings.styles[1].key == duc.OBJECT_SNAP_MODE.MIDPOINT - assert marker_settings.styles[1].value.shape == duc.SNAP_MARKER_SHAPE.TRIANGLE - assert marker_settings.styles[1].value.color == "#00FF00" - - assert marker_settings.styles[5].key == duc.OBJECT_SNAP_MODE.PERPENDICULAR - assert marker_settings.styles[5].value.shape == duc.SNAP_MARKER_SHAPE.X - assert marker_settings.styles[5].value.color == "#00FFFF" - -def test_polar_tracking_comprehensive_configurations(): - """Test comprehensive PolarTrackingSettings configurations""" - - # Create polar tracking with many angles - comprehensive_angles = [ - math.radians(0), # 0 degrees - math.radians(10), # 10 degrees - math.radians(15), # 15 degrees - math.radians(30), # 30 degrees - math.radians(45), # 45 degrees - math.radians(60), # 60 degrees - math.radians(90), # 90 degrees - math.radians(120), # 120 degrees - math.radians(135), # 135 degrees - math.radians(150), # 150 degrees - math.radians(180), # 180 degrees - math.radians(210), # 210 degrees - math.radians(225), # 225 degrees - math.radians(240), # 240 degrees - math.radians(270), # 270 degrees - math.radians(300), # 300 degrees - math.radians(315), # 315 degrees - math.radians(330) # 330 degrees - ] - - polar_tracking = duc.create_polar_tracking_settings( - enabled=True, - angles=comprehensive_angles, - track_from_last_point=True, - show_polar_coordinates=True, - increment_angle=math.radians(5.0) # 5 degrees for fine increments - ) - - assert polar_tracking.enabled is True - assert len(polar_tracking.angles) == 18 - assert polar_tracking.track_from_last_point is True - assert polar_tracking.show_polar_coordinates is True - assert polar_tracking.increment_angle == math.radians(5.0) - - # Test specific angles - assert polar_tracking.angles[0] == 0 # 0 degrees - assert polar_tracking.angles[4] == math.radians(45.0) # 45 degrees - assert polar_tracking.angles[6] == math.radians(90.0) # 90 degrees - assert polar_tracking.angles[10] == math.radians(180.0) # 180 degrees - assert polar_tracking.angles[14] == math.radians(270.0) # 270 degrees - -def test_unit_system_edge_cases(): - """Test edge cases and comprehensive configurations for unit systems""" - - # Test architectural linear units with all suppressions off - arch_linear = duc.create_linear_unit_system( - precision=8, - suppress_leading_zeros=False, - suppress_trailing_zeros=False, - suppress_zero_feet=False, - suppress_zero_inches=False, - system=duc.UNIT_SYSTEM.IMPERIAL, - format=duc.DIMENSION_UNITS_FORMAT.ARCHITECTURAL, - decimal_separator=duc.DECIMAL_SEPARATOR.COMMA - ) - - # Test engineering linear units - eng_linear = duc.create_linear_unit_system( - precision=6, - suppress_leading_zeros=True, - suppress_trailing_zeros=True, - suppress_zero_feet=True, - suppress_zero_inches=True, - system=duc.UNIT_SYSTEM.IMPERIAL, - format=duc.DIMENSION_UNITS_FORMAT.ENGINEERING, - decimal_separator=duc.DECIMAL_SEPARATOR.DOT - ) - - # Test fractional linear units - fract_linear = duc.create_linear_unit_system( - precision=16, # 1/16th precision - suppress_leading_zeros=False, - suppress_trailing_zeros=False, - suppress_zero_feet=False, - suppress_zero_inches=False, - system=duc.UNIT_SYSTEM.IMPERIAL, - format=duc.DIMENSION_UNITS_FORMAT.FRACTIONAL, - decimal_separator=duc.DECIMAL_SEPARATOR.DOT - ) - - # Test various angular formats - dms_angular = duc.create_angular_unit_system( - precision=4, - suppress_leading_zeros=False, - suppress_trailing_zeros=True, - system=duc.UNIT_SYSTEM.METRIC, - format=duc.ANGULAR_UNITS_FORMAT.DEGREES_MINUTES_SECONDS - ) - - grad_angular = duc.create_angular_unit_system( - precision=3, - suppress_leading_zeros=True, - suppress_trailing_zeros=False, - system=duc.UNIT_SYSTEM.METRIC, - format=duc.ANGULAR_UNITS_FORMAT.GRADS - ) - - rad_angular = duc.create_angular_unit_system( - precision=6, - suppress_leading_zeros=False, - suppress_trailing_zeros=True, - system=duc.UNIT_SYSTEM.METRIC, - format=duc.ANGULAR_UNITS_FORMAT.RADIANS - ) - - # Verify architectural format - assert arch_linear.format == duc.DIMENSION_UNITS_FORMAT.ARCHITECTURAL - assert arch_linear.precision == 8 - assert arch_linear.suppress_leading_zeros is False - assert arch_linear.suppress_zero_feet is False - assert arch_linear.decimal_separator == duc.DECIMAL_SEPARATOR.COMMA - - # Verify engineering format - assert eng_linear.format == duc.DIMENSION_UNITS_FORMAT.ENGINEERING - assert eng_linear.precision == 6 - assert eng_linear.suppress_trailing_zeros is True - - # Verify fractional format - assert fract_linear.format == duc.DIMENSION_UNITS_FORMAT.FRACTIONAL - assert fract_linear.precision == 16 - - # Verify angular formats - assert dms_angular.format == duc.ANGULAR_UNITS_FORMAT.DEGREES_MINUTES_SECONDS - assert grad_angular.format == duc.ANGULAR_UNITS_FORMAT.GRADS - assert rad_angular.format == duc.ANGULAR_UNITS_FORMAT.RADIANS - assert rad_angular.precision == 6 - -def test_all_snap_override_behaviors(): - """Test all SnapOverride behaviors and key combinations""" - - overrides = [ - duc.create_snap_override(key="ctrl", behavior=duc.SNAP_OVERRIDE_BEHAVIOR.DISABLE), - duc.create_snap_override(key="shift", behavior=duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_GRID), - duc.create_snap_override(key="alt", behavior=duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_OBJECT), - duc.create_snap_override(key="tab", behavior=duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_GRID), - duc.create_snap_override(key="space", behavior=duc.SNAP_OVERRIDE_BEHAVIOR.DISABLE), - duc.create_snap_override(key="ctrl+shift", behavior=duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_GRID), - duc.create_snap_override(key="ctrl+alt", behavior=duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_OBJECT), - duc.create_snap_override(key="shift+alt", behavior=duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_GRID) - ] - - assert len(overrides) == 8 - assert overrides[0].key == "ctrl" - assert overrides[0].behavior == duc.SNAP_OVERRIDE_BEHAVIOR.DISABLE - assert overrides[1].key == "shift" - assert overrides[1].behavior == duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_GRID - assert overrides[2].key == "alt" - assert overrides[2].behavior == duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_OBJECT - assert overrides[3].key == "tab" - assert overrides[3].behavior == duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_GRID - assert overrides[5].key == "ctrl+shift" - assert overrides[7].behavior == duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_GRID - -def test_nested_standard_builders_elegant_construction(): - """Test elegant nested construction of standards using builder functions""" - - # Demonstrate elegant nesting by constructing everything inline - standard = (duc.StateBuilder().build_standard() - .with_id("elegant_nested_standard") - .with_name("Elegantly Nested Standard") - .with_version("3.0.0") - .with_readonly(False) - .with_units(duc.create_standard_units( - primary_units=duc.create_primary_units( - linear=duc.create_linear_unit_system( - precision=3, - suppress_leading_zeros=False, - suppress_trailing_zeros=True, - suppress_zero_feet=False, - suppress_zero_inches=True, - system=duc.UNIT_SYSTEM.METRIC, - format=duc.DIMENSION_UNITS_FORMAT.DECIMAL, - decimal_separator=duc.DECIMAL_SEPARATOR.DOT - ), - angular=duc.create_angular_unit_system( - precision=2, - suppress_leading_zeros=True, - suppress_trailing_zeros=False, - system=duc.UNIT_SYSTEM.METRIC, - format=duc.ANGULAR_UNITS_FORMAT.DEGREES_MINUTES_SECONDS - ) - ), - alternate_units=duc.create_alternate_units( - precision=2, - suppress_leading_zeros=False, - suppress_trailing_zeros=True, - system=duc.UNIT_SYSTEM.IMPERIAL, - is_visible=True, - multiplier=25.4, # mm to inches conversion - format=duc.DIMENSION_UNITS_FORMAT.FRACTIONAL - ) - )) - .with_validation(duc.create_standard_validation( - dimension_rules=duc.create_dimension_validation_rules( - min_text_height=0.8, - max_text_height=72.0, - allowed_precisions=[0, 1, 2, 3, 4, 5] - ), - layer_rules=duc.create_layer_validation_rules( - prohibited_layer_names=["0", "defpoints", "system", "temp"] - ) - )) - .with_overrides(duc.create_standard_overrides( - main_scope="metric", - unit_precision=duc.UnitPrecision(linear=3, angular=2, area=4, volume=5), - elements_stroke_width_override=1.5, - common_style_id="elegant_common", - text_style_id="elegant_text", - active_grid_settings_id=["metric_grid", "detailed_grid"], - active_snap_settings_id="precision_snap" - )) - .build()) - - # Verify the nested construction worked properly - assert standard.identifier.id == "elegant_nested_standard" - assert standard.identifier.name == "Elegantly Nested Standard" - assert standard.version == "3.0.0" - assert standard.readonly is False - - # Verify units were constructed properly - assert standard.units is not None - assert standard.units.primary_units.linear.precision == 3 - assert standard.units.primary_units.linear.system == duc.UNIT_SYSTEM.METRIC - assert standard.units.primary_units.angular.format == duc.ANGULAR_UNITS_FORMAT.DEGREES_MINUTES_SECONDS - assert standard.units.alternate_units.multiplier == 25.4 - assert standard.units.alternate_units.format == duc.DIMENSION_UNITS_FORMAT.FRACTIONAL - - # Verify validation was constructed properly - assert standard.validation is not None - assert standard.validation.dimension_rules.min_text_height == 0.8 - assert standard.validation.dimension_rules.max_text_height == 72.0 - assert len(standard.validation.dimension_rules.allowed_precisions) == 6 - assert len(standard.validation.layer_rules.prohibited_layer_names) == 4 - - # Verify overrides were constructed properly - assert standard.overrides is not None - assert standard.overrides.main_scope == "metric" - assert standard.overrides.unit_precision.linear == 3 - assert standard.overrides.unit_precision.angular == 2 - assert standard.overrides.elements_stroke_width_override == 1.5 - assert len(standard.overrides.active_grid_settings_id) == 2 - - -def test_advanced_unit_systems_serialization_roundtrip(test_output_dir): - """Test advanced unit systems with full serialization and parsing roundtrip""" - - # Create advanced unit configurations with edge cases - advanced_standard = (duc.StateBuilder().build_standard() - .with_id("advanced_units_test") - .with_name("Advanced Units Test Standard") - .with_units(duc.create_standard_units( - primary_units=duc.create_primary_units( - # High precision metric linear units - linear=duc.create_linear_unit_system( - precision=6, # Very high precision - suppress_leading_zeros=True, - suppress_trailing_zeros=False, # Keep trailing zeros - suppress_zero_feet=False, - suppress_zero_inches=False, - system=duc.UNIT_SYSTEM.METRIC, - format=duc.DIMENSION_UNITS_FORMAT.SCIENTIFIC, - decimal_separator=duc.DECIMAL_SEPARATOR.COMMA - ), - # Surveyor angular units - angular=duc.create_angular_unit_system( - precision=4, - suppress_leading_zeros=False, - suppress_trailing_zeros=True, - system=duc.UNIT_SYSTEM.IMPERIAL, - format=duc.ANGULAR_UNITS_FORMAT.SURVEYOR - ) - ), - # Imperial alternate units with architectural format - alternate_units=duc.create_alternate_units( - precision=8, # Very high precision for architectural - suppress_leading_zeros=True, - suppress_trailing_zeros=False, - system=duc.UNIT_SYSTEM.IMPERIAL, - is_visible=True, - multiplier=0.0393701, # Precise mm to inches - format=duc.DIMENSION_UNITS_FORMAT.ARCHITECTURAL - ) - )) - .build()) - - # Serialize to bytes - print("🔨 CREATE: Advanced units standard created") - serialized = duc.serialize_duc(name="AdvancedUnitsTest", standards=[advanced_standard]) - - # Save to file - file_path = os.path.join(test_output_dir, "advanced_units_test.duc") - with open(file_path, "wb") as f: - f.write(serialized) - - print(f"💾 SERIALIZE: Saved to {file_path} ({len(serialized)} bytes)") - - # Parse back from bytes - parsed = duc.parse_duc(io.BytesIO(serialized)) - parsed_standard = parsed.standards[0] - - print("📖 PARSE: Successfully parsed back from bytes") - - # Verify all properties survived the roundtrip - assert parsed_standard.identifier.id == "advanced_units_test" - assert parsed_standard.units is not None - - # Verify linear units - linear = parsed_standard.units.primary_units.linear - assert linear.precision == 6 - assert linear.suppress_leading_zeros is True - assert linear.suppress_trailing_zeros is False - assert linear.system == duc.UNIT_SYSTEM.METRIC - assert linear.format == duc.DIMENSION_UNITS_FORMAT.SCIENTIFIC - assert linear.decimal_separator == duc.DECIMAL_SEPARATOR.COMMA - - # Verify angular units - angular = parsed_standard.units.primary_units.angular - assert angular.precision == 4 - assert angular.suppress_leading_zeros is False - assert angular.suppress_trailing_zeros is True - assert angular.system == duc.UNIT_SYSTEM.IMPERIAL - assert angular.format == duc.ANGULAR_UNITS_FORMAT.SURVEYOR - - # Verify alternate units - alternate = parsed_standard.units.alternate_units - assert alternate.precision == 8 - assert alternate.suppress_leading_zeros is True - assert alternate.suppress_trailing_zeros is False - assert alternate.system == duc.UNIT_SYSTEM.IMPERIAL - assert alternate.is_visible is True - assert abs(alternate.multiplier - 0.0393701) < 1e-8 # Float precision check - assert alternate.format == duc.DIMENSION_UNITS_FORMAT.ARCHITECTURAL - - print("✅ Advanced units serialization roundtrip successful!") - - -def test_all_standards_class_dataclasses(): - """Comprehensive test covering ALL dataclasses in StandardsClass.py""" - - print("🔍 Testing ALL StandardsClass dataclasses...") - - # Test GridStyle - grid_style = duc.GridStyle( - color="#FF5733", - opacity=0.75, - dash_pattern=[4.0, 2.0, 1.0, 2.0] - ) - assert grid_style.color == "#FF5733" - assert grid_style.opacity == 0.75 - assert len(grid_style.dash_pattern) == 4 - - # Test PolarGridSettings - polar_settings = duc.create_polar_grid_settings( - radial_divisions=24, - radial_spacing=15.0, - show_labels=True - ) - assert polar_settings.radial_divisions == 24 - assert polar_settings.radial_spacing == 15.0 - assert polar_settings.show_labels is True - - # Test IsometricGridSettings - iso_settings = duc.create_isometric_grid_settings( - left_angle=math.radians(30.0), - right_angle=math.radians(30.0) - ) - assert abs(iso_settings.left_angle - math.radians(30.0)) < 0.001 - assert abs(iso_settings.right_angle - math.radians(30.0)) < 0.001 - - # Test SnapOverride - snap_override = duc.create_snap_override( - key="ctrl+alt", - behavior=duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_OBJECT - ) - assert snap_override.key == "ctrl+alt" - assert snap_override.behavior == duc.SNAP_OVERRIDE_BEHAVIOR.FORCE_OBJECT - - # Test DynamicSnapSettings - dynamic_snap = duc.create_dynamic_snap_settings( - enabled_during_drag=False, - enabled_during_rotation=True, - enabled_during_scale=False - ) - assert dynamic_snap.enabled_during_drag is False - assert dynamic_snap.enabled_during_rotation is True - assert dynamic_snap.enabled_during_scale is False - - # Test PolarTrackingSettings - polar_tracking = duc.create_polar_tracking_settings( - enabled=True, - angles=[math.radians(0), math.radians(45), math.radians(90), math.radians(135)], - track_from_last_point=False, - show_polar_coordinates=True, - increment_angle=math.radians(22.5) - ) - assert polar_tracking.enabled is True - assert len(polar_tracking.angles) == 4 - assert polar_tracking.track_from_last_point is False - assert abs(polar_tracking.increment_angle - math.radians(22.5)) < 0.001 - - # Test TrackingLineStyle - tracking_style = duc.create_tracking_line_style( - color="#00FFAA", - opacity=0.9, - dash_pattern=[6.0, 3.0] - ) - assert tracking_style.color == "#00FFAA" - assert tracking_style.opacity == 0.9 - assert tracking_style.dash_pattern == [6.0, 3.0] - - # Test LayerSnapFilters - layer_filters = duc.create_layer_snap_filters( - include_layers=["dimension", "annotation", "construction"], - exclude_layers=["hidden", "reference"] - ) - assert len(layer_filters.include_layers) == 3 - assert len(layer_filters.exclude_layers) == 2 - assert "dimension" in layer_filters.include_layers - assert "hidden" in layer_filters.exclude_layers - - # Test SnapMarkerStyle - marker_style = duc.create_snap_marker_style( - shape=duc.SNAP_MARKER_SHAPE.TRIANGLE, - color="#FF00FF" - ) - assert marker_style.shape == duc.SNAP_MARKER_SHAPE.TRIANGLE - assert marker_style.color == "#FF00FF" - - # Test SnapMarkerStyleEntry - marker_entry = duc.create_snap_marker_style_entry( - key=duc.OBJECT_SNAP_MODE.CENTER, - value=marker_style - ) - assert marker_entry.key == duc.OBJECT_SNAP_MODE.CENTER - assert marker_entry.value.shape == duc.SNAP_MARKER_SHAPE.TRIANGLE - - # Test SnapMarkerSettings - marker_settings = duc.create_snap_marker_settings( - enabled=True, - size=16, - styles=[marker_entry], - duration=3000 - ) - assert marker_settings.enabled is True - assert marker_settings.size == 16 - assert marker_settings.duration == 3000 - assert len(marker_settings.styles) == 1 - - # Test UnitSystemBase hierarchy - linear_units = duc.create_linear_unit_system( - precision=5, - suppress_leading_zeros=True, - suppress_trailing_zeros=False, - suppress_zero_feet=True, - suppress_zero_inches=False, - system=duc.UNIT_SYSTEM.IMPERIAL, - format=duc.DIMENSION_UNITS_FORMAT.ARCHITECTURAL, - decimal_separator=duc.DECIMAL_SEPARATOR.COMMA - ) - assert linear_units.precision == 5 - assert linear_units.system == duc.UNIT_SYSTEM.IMPERIAL - assert linear_units.format == duc.DIMENSION_UNITS_FORMAT.ARCHITECTURAL - assert linear_units.suppress_zero_inches is False - - # Test AngularUnitSystem - angular_units = duc.create_angular_unit_system( - precision=4, - suppress_leading_zeros=False, - suppress_trailing_zeros=True, - system=duc.UNIT_SYSTEM.METRIC, - format=duc.ANGULAR_UNITS_FORMAT.RADIANS - ) - assert angular_units.precision == 4 - assert angular_units.format == duc.ANGULAR_UNITS_FORMAT.RADIANS - - # Test AlternateUnits - alt_units = duc.create_alternate_units( - precision=3, - suppress_leading_zeros=True, - suppress_trailing_zeros=True, - system=duc.UNIT_SYSTEM.METRIC, - is_visible=False, - multiplier=2.54, # inches to cm - format=duc.DIMENSION_UNITS_FORMAT.SCIENTIFIC - ) - assert alt_units.precision == 3 - assert alt_units.is_visible is False - assert alt_units.multiplier == 2.54 - assert alt_units.format == duc.DIMENSION_UNITS_FORMAT.SCIENTIFIC - - # Test PrimaryUnits - primary_units = duc.create_primary_units(linear=linear_units, angular=angular_units) - assert primary_units.linear.precision == 5 - assert primary_units.angular.precision == 4 - - # Test StandardUnits - standard_units = duc.create_standard_units(primary_units=primary_units, alternate_units=alt_units) - assert standard_units.primary_units.linear.system == duc.UNIT_SYSTEM.IMPERIAL - assert standard_units.alternate_units.system == duc.UNIT_SYSTEM.METRIC - assert standard_units.alternate_units.multiplier == 2.54 - - # Test UnitPrecision - unit_precision = duc.UnitPrecision(linear=6, angular=4, area=3, volume=2) - assert unit_precision.linear == 6 - assert unit_precision.angular == 4 - assert unit_precision.area == 3 - assert unit_precision.volume == 2 - - # Test DimensionValidationRules - dim_rules = duc.create_dimension_validation_rules( - min_text_height=0.25, - max_text_height=500.0, - allowed_precisions=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - ) - assert dim_rules.min_text_height == 0.25 - assert dim_rules.max_text_height == 500.0 - assert len(dim_rules.allowed_precisions) == 11 - assert dim_rules.allowed_precisions[-1] == 10 - - # Test LayerValidationRules - layer_rules = duc.create_layer_validation_rules( - prohibited_layer_names=["system", "locked", "frozen", "temp", "backup"] - ) - assert len(layer_rules.prohibited_layer_names) == 5 - assert "locked" in layer_rules.prohibited_layer_names - assert "backup" in layer_rules.prohibited_layer_names - - # Test StandardValidation - validation = duc.create_standard_validation(dimension_rules=dim_rules, layer_rules=layer_rules) - assert validation.dimension_rules.min_text_height == 0.25 - assert validation.layer_rules.prohibited_layer_names == ["system", "locked", "frozen", "temp", "backup"] - - # Test all Identified* classes - common_style = duc.create_simple_styles(roundness=1.5, opacity=0.85) - identified_common = duc.IdentifiedCommonStyle( - id=duc.create_identifier("test_common", "Test Common Style"), - style=common_style - ) - assert identified_common.id.id == "test_common" - assert identified_common.style.roundness == 1.5 - - text_style = duc.create_text_style(font_family="Consolas", font_size=14) - identified_text = duc.IdentifiedTextStyle( - id=duc.create_identifier("test_text", "Test Text Style"), - style=text_style - ) - assert identified_text.id.name == "Test Text Style" - assert identified_text.style.font_family == "Consolas" - - doc_style = duc.create_doc_style() - identified_doc = duc.IdentifiedDocStyle( - id=duc.create_identifier("test_doc", "Test Doc Style"), - style=doc_style - ) - assert identified_doc.id.id == "test_doc" - - # Test StandardStyles - styles = duc.create_standard_styles( - common_styles=[identified_common], - text_styles=[identified_text], - doc_styles=[identified_doc] - ) - assert len(styles.common_styles) == 1 - assert len(styles.text_styles) == 1 - assert len(styles.doc_styles) == 1 - assert styles.common_styles[0].id.id == "test_common" - - print("✅ ALL StandardsClass dataclasses tested successfully!") - -if __name__ == "__main__": - pytest.main([__file__]) diff --git a/packages/ducpy/src/tests/src/test_CSPMDS_text_and_doc_elements.py b/packages/ducpy/src/tests/src/test_CSPMDS_text_and_doc_elements.py index e5612d02..8db8f567 100644 --- a/packages/ducpy/src/tests/src/test_CSPMDS_text_and_doc_elements.py +++ b/packages/ducpy/src/tests/src/test_CSPMDS_text_and_doc_elements.py @@ -1,502 +1,89 @@ -""" -CSPMDS Test for Text and Doc Elements: Create-Serialize-Parse-Mutate-Delete-Serialize -Tests the full lifecycle of DucTextElement and DucDocElement with comprehensive text features. -""" -import io +"""CSPMDS-style test for text and doc elements in the new SQL schema.""" + import os -import random -import pytest -import ducpy as duc +from ducpy.builders.sql_builder import DucSQL def test_cspmds_text_and_doc_elements(test_output_dir): - """ - CSPMDS test for text and doc elements: - - Create: Create various text and document elements with different styles and features - - Serialize: Save to DUC file - - Parse: Load the saved file - - Mutate: Modify text content, styles, and formatting - - Delete: Remove some text elements - - Serialize: Save the final state - """ - - # === CREATE === - print("🔨 CREATE: Creating DucTextElement and DucDocElement objects...") - - elements = [] - - # Create various text styles for different purposes - - # Title text style - large, bold, centered - title_text_style = duc.create_text_style( - font_family="Arial Bold", - font_size=24, - text_align=duc.TEXT_ALIGN.CENTER, - vertical_align=duc.VERTICAL_ALIGN.MIDDLE, - line_height=1.2 - ) - - # Header text style - medium, bold, left-aligned - header_text_style = duc.create_text_style( - font_family="Arial Bold", - font_size=18, - text_align=duc.TEXT_ALIGN.LEFT, - vertical_align=duc.VERTICAL_ALIGN.TOP, - line_height=1.3 - ) - - # Body text style - normal, readable - body_text_style = duc.create_text_style( - font_family="Arial", - font_size=12, - text_align=duc.TEXT_ALIGN.LEFT, - vertical_align=duc.VERTICAL_ALIGN.TOP, - line_height=1.5 - ) - - # Caption text style - small, italic - caption_text_style = duc.create_text_style( - font_family="Arial Italic", - font_size=10, - text_align=duc.TEXT_ALIGN.CENTER, - vertical_align=duc.VERTICAL_ALIGN.BOTTOM, - line_height=1.1 - ) - - # Code text style - monospace - code_text_style = duc.create_text_style( - font_family="Courier New", - font_size=11, - text_align=duc.TEXT_ALIGN.LEFT, - vertical_align=duc.VERTICAL_ALIGN.TOP, - line_height=1.4 - ) - - # === CREATE TEXT ELEMENTS === - - # 1. Document title - title_element = (duc.ElementBuilder() - .at_position(200, 50) - .with_size(400, 40) - .with_label("Document Title") - .with_styles(duc.create_simple_styles()) - .build_text_element() - .with_text("Technical Drawing Specification Document") - .with_text_style(title_text_style) - .build()) - elements.append(title_element) - - # 2. Section header - section_header = (duc.ElementBuilder() - .at_position(50, 120) - .with_size(300, 30) - .with_label("Section Header") - .with_styles(duc.create_simple_styles()) - .build_text_element() - .with_text("1. General Requirements") - .with_text_style(header_text_style) - .build()) - elements.append(section_header) - - # 3. Body text with line breaks - body_text = (duc.ElementBuilder() - .at_position(50, 170) - .with_size(500, 100) - .with_label("Body Text") - .with_styles(duc.create_simple_styles()) - .build_text_element() - .with_text("""This document outlines the technical specifications for mechanical drawings. -All dimensions shall be in millimeters unless otherwise specified. -Tolerances shall conform to ISO 2768-m standard. -Materials and finishes are specified in the accompanying schedules.""") - .with_text_style(body_text_style) - .build()) - elements.append(body_text) - - # 4. Technical note with special formatting - technical_note = (duc.ElementBuilder() - .at_position(400, 120) - .with_size(250, 60) - .with_label("Technical Note") - .with_styles(duc.create_simple_styles()) - .build_text_element() - .with_text("NOTE: All welds shall be\ninspected per AWS D1.1\nstandards before final\nassembly.") - .with_text_style(body_text_style) - .build()) - elements.append(technical_note) - - # 5. Caption text - caption_element = (duc.ElementBuilder() - .at_position(150, 290) - .with_size(200, 20) - .with_label("Figure Caption") - .with_styles(duc.create_simple_styles()) - .build_text_element() - .with_text("Figure 1: Assembly Overview") - .with_text_style(caption_text_style) - .build()) - elements.append(caption_element) - - # 6. Code or part number - part_number = (duc.ElementBuilder() - .at_position(500, 290) - .with_size(150, 25) - .with_label("Part Number") - .with_styles(duc.create_simple_styles()) - .build_text_element() - .with_text("P/N: MEC-2025-001-REV-A") - .with_text_style(code_text_style) - .build()) - elements.append(part_number) - - # 7. Multi-line technical specification - tech_spec = (duc.ElementBuilder() - .at_position(50, 330) - .with_size(300, 120) - .with_label("Technical Specifications") - .with_styles(duc.create_simple_styles()) - .build_text_element() - .with_text(""" - MATERIAL SPECIFICATIONS: - • Base Material: ASTM A36 Steel - • Coating: Hot-Dip Galvanized - • Thickness: 6mm ± 0.5mm - • Surface Finish: 125 μin Ra max - • Heat Treatment: Stress Relieved - """) - .with_text_style(body_text_style) - .build()) - elements.append(tech_spec) - - # === CREATE DOC ELEMENTS === - - # Create document styles for rich text formatting - - # Document heading style - doc_heading_style = duc.create_text_style( - font_family="Times New Roman Bold", - font_size=16, - text_align=duc.TEXT_ALIGN.LEFT, - vertical_align=duc.VERTICAL_ALIGN.TOP, - line_height=1.4 - ) - - # Document body style - doc_body_style = duc.create_text_style( - font_family="Times New Roman", - font_size=12, - text_align=duc.TEXT_ALIGN.LEFT, - vertical_align=duc.VERTICAL_ALIGN.TOP, - line_height=1.6 - ) - - # Create paragraph formatting - paragraph_formatting = duc.create_paragraph_formatting( - first_line_indent=12.0, - hanging_indent=0.0, - left_indent=6.0, - right_indent=6.0, - space_before=6.0, - space_after=6.0, - tab_stops=[24.0, 48.0, 72.0, 96.0] - ) - - # Create stack format for fractions and special text - stack_format_props = duc.create_stack_format_properties( - upper_scale=0.7, - lower_scale=0.7, - alignment=duc.STACKED_TEXT_ALIGN.CENTER - ) - - stack_format = duc.create_stack_format( - auto_stack=True, - stack_chars=["/", "\\", "#"], - properties=stack_format_props - ) - - # Create comprehensive document style - doc_style = duc.create_doc_style( - text_style=doc_body_style, - paragraph=paragraph_formatting, - stack_format=stack_format - ) - - # Create column layout for multi-column text - text_columns = [ - duc.create_text_column(width=200, gutter=20), - duc.create_text_column(width=200, gutter=0) - ] - - column_layout = duc.create_column_layout( - definitions=text_columns, - auto_height=True, - column_type=duc.COLUMN_TYPE.STATIC_COLUMNS - ) # 8. Rich document element with advanced formatting - rich_document = (duc.ElementBuilder() - .at_position(400, 330) - .with_size(420, 200) - .with_label("Rich Document") - .with_styles(duc.create_simple_styles()) \ - .build_doc_element() - .with_text("""DESIGN METHODOLOGY - -This section describes the systematic approach used in the mechanical design process. The methodology incorporates industry best practices and follows established engineering principles. - -Key Design Principles: -1. Structural integrity and safety factors -2. Manufacturing feasibility and cost optimization -3. Material selection based on service environment -4. Compliance with applicable codes and standards - -The design process includes iterative analysis using finite element methods to ensure optimal performance under specified loading conditions. All calculations assume standard atmospheric conditions unless noted otherwise. - -Special attention is given to fatigue analysis for components subject to cyclic loading, with safety factors applied per ASME standards.""") - .with_doc_style(doc_style) - .with_columns_layout(column_layout) - .build()) - elements.append(rich_document) - - # 9. Simple document with different formatting - simple_doc_style = duc.create_doc_style( - text_style=doc_heading_style, - paragraph=duc.create_paragraph_formatting( - first_line_indent=0.0, - hanging_indent=0.0, - left_indent=0.0, - right_indent=0.0, - space_before=0.0, - space_after=12.0, - tab_stops=[] - ), - stack_format=stack_format - ) - - single_column = duc.create_column_layout( - definitions=[duc.create_text_column(width=300, gutter=0)], - auto_height=True, - column_type=duc.COLUMN_TYPE.STATIC_COLUMNS - ) - - revision_history = (duc.ElementBuilder() - .at_position(50, 480) - .with_size(300, 100) - .with_label("Revision History") - .with_styles(duc.create_simple_styles()) - .build_doc_element() - .with_text("""REVISION HISTORY -Rev A: Initial release - 2025-01-15 -Rev B: Updated tolerances - 2025-02-20 -Rev C: Material specification change - 2025-03-10""") - .with_doc_style(simple_doc_style) - .with_columns_layout(single_column) - .build()) - elements.append(revision_history) - - print(f"Created {len(elements)} text and document elements") - - # === SERIALIZE === - print("💾 SERIALIZE: Saving initial state...") - + """Create, mutate, delete, and re-save text/doc elements (doc text is Typst).""" initial_file = os.path.join(test_output_dir, "cspmds_text_doc_initial.duc") - duc.write_duc_file( - file_path=initial_file, - name="TextDocCSPMDS_Initial", - elements=elements - ) - - assert os.path.exists(initial_file) - print(f"Saved initial state to {initial_file}") - - # === PARSE === - print("📖 PARSE: Loading saved file...") - - parsed_data = duc.read_duc_file(initial_file) - loaded_elements = parsed_data.elements - - assert len(loaded_elements) == len(elements) - print(f"Loaded {len(loaded_elements)} elements") - - # Verify element types - text_elements = [] - doc_elements = [] - - for el_wrapper in loaded_elements: - if isinstance(el_wrapper.element, duc.DucTextElement): - text_elements.append(el_wrapper) - elif isinstance(el_wrapper.element, duc.DucDocElement): - doc_elements.append(el_wrapper) - - print(f"Found {len(text_elements)} text elements and {len(doc_elements)} doc elements") - - # === MUTATE === - print("🔧 MUTATE: Modifying text content and formatting...") - - mutations_count = 0 - - # Mutate text elements - for el_wrapper in loaded_elements: - if isinstance(el_wrapper.element, duc.DucTextElement): - element = el_wrapper.element - - # Update document title - if "Document Title" in element.base.label: - duc.mutate_element( - el_wrapper, - text="UPDATED: Technical Drawing Specification Document v2.0", - width=element.base.width * 1.1 - ) - mutations_count += 1 - print(f"Updated title text") - - # Update section headers - elif "Section Header" in element.base.label: - duc.mutate_element( - el_wrapper, - text="1. REVISED General Requirements" - ) - mutations_count += 1 - print(f"Updated section header") - - # Update body text - elif "Body Text" in element.base.label: - duc.mutate_element( - el_wrapper, - text=element.text + "\n\nUPDATE: This revision includes new safety requirements." - ) - mutations_count += 1 - print(f"Updated body text") - - # Move and resize technical note - elif "Technical Note" in element.base.label: - duc.mutate_element( - el_wrapper, - x=element.base.x + 50, - y=element.base.y + 20, - width=element.base.width * 1.2, - text="CRITICAL NOTE: All welds shall be\ninspected per AWS D1.1 standards\nand documented before final assembly." - ) - mutations_count += 1 - print(f"Updated and moved technical note") - - # Mutate document elements - elif isinstance(el_wrapper.element, duc.DucDocElement): - element = el_wrapper.element - - # Update rich document - if "Rich Document" in element.base.label: - duc.mutate_element( - el_wrapper, - text=element.text.replace("DESIGN METHODOLOGY", "UPDATED DESIGN METHODOLOGY"), - height=element.base.height * 1.1 - ) - mutations_count += 1 - print(f"Updated rich document content") - - # Update revision history - elif "Revision History" in element.base.label: - duc.mutate_element( - el_wrapper, - text=element.text + "\nRev D: Updated per new requirements - 2025-07-22" - ) - mutations_count += 1 - print(f"Updated revision history") - - print(f"Applied {mutations_count} text/document mutations") - - # === DELETE === - print("🗑️ DELETE: Removing some text elements...") - - # Remove caption and part number elements - elements_to_delete = [] - for i, el_wrapper in enumerate(loaded_elements): - if isinstance(el_wrapper.element, (duc.DucTextElement, duc.DucDocElement)): - element = el_wrapper.element - if ("Figure Caption" in element.base.label or - "Part Number" in element.base.label): - elements_to_delete.append(i) - - # Remove elements (in reverse order to maintain indices) - for i in reversed(elements_to_delete): - el = loaded_elements[i] - print(f"Deleting text element: {el.element.base.label}") - del loaded_elements[i] - - print(f"Deleted {len(elements_to_delete)} text elements") - - # === SERIALIZE (FINAL) === - print("💾 SERIALIZE: Saving final state...") - final_file = os.path.join(test_output_dir, "cspmds_text_doc_final.duc") - duc.write_duc_file( - file_path=final_file, - name="TextDocCSPMDS_Final", - elements=loaded_elements - ) - - assert os.path.exists(final_file) - print(f"Saved final state to {final_file}") - - # === VERIFICATION === - print("✅ VERIFICATION: Checking final state...") - - # Parse final file to verify - final_parsed_data = duc.read_duc_file(final_file) - final_elements = final_parsed_data.elements - - print(f"Final element count: {len(final_elements)}") - assert len(final_elements) == len(loaded_elements) - assert len(final_elements) < len(elements) # Should be fewer than original - - # Verify element types remain consistent - final_text_elements = [] - final_doc_elements = [] - - for el_wrapper in final_elements: - if isinstance(el_wrapper.element, duc.DucTextElement): - final_text_elements.append(el_wrapper) - elif isinstance(el_wrapper.element, duc.DucDocElement): - final_doc_elements.append(el_wrapper) - else: - # Should only have text and doc elements - assert False, f"Found unexpected element type: {type(el_wrapper.element)}" - - print(f"Final text elements: {len(final_text_elements)}") - print(f"Final doc elements: {len(final_doc_elements)}") - - # Verify mutations were applied by checking updated content - title_found = False - updated_content_found = False - - for el_wrapper in final_elements: - if isinstance(el_wrapper.element, duc.DucTextElement): - if "UPDATED:" in el_wrapper.element.text: - title_found = True - if "UPDATE:" in el_wrapper.element.text: - updated_content_found = True - elif isinstance(el_wrapper.element, duc.DucDocElement): - if "UPDATED DESIGN METHODOLOGY" in el_wrapper.element.text: - updated_content_found = True - - assert title_found, "Title should contain 'UPDATED:'" - assert updated_content_found, "Some content should contain updates" - - # Verify deleted elements are gone - remaining_labels = [el.element.base.label for el in final_elements] - assert "Figure Caption" not in remaining_labels, "Figure caption should be deleted" - assert "Part Number" not in remaining_labels, "Part number should be deleted" - - print("✅ CSPMDS Text and Doc Elements test completed successfully!") + for p in (initial_file, final_file): + if os.path.exists(p): + os.remove(p) + + typst_doc = """#set text(font: \"Inter\") -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir += Design Methodology +This is *Typst* content for a doc element. + +#table( + columns: 2, + [Key], [Value], + [Revision], [A], +) +""" -if __name__ == "__main__": - pytest.main([__file__]) \ No newline at end of file + with DucSQL.new(initial_file) as db: + # Text elements + for eid, label, txt, x, y, w, h in [ + ("txt_title", "Document Title", "Technical Drawing Specification", 200, 50, 400, 40), + ("txt_header", "Section Header", "1. General Requirements", 50, 120, 300, 30), + ("txt_note", "Technical Note", "NOTE: Inspect all welds.", 400, 120, 250, 60), + ("txt_caption", "Figure Caption", "Figure 1: Assembly Overview", 150, 290, 200, 20), + ]: + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", + eid, "text", x, y, w, h, label, + ) + db.sql( + "INSERT INTO element_text " + "(element_id, text, original_text, font_family, font_size, text_align, vertical_align, line_height) " + "VALUES (?,?,?,?,?,?,?,?)", + eid, txt, txt, "Arial", 12.0, 10, 10, 1.2, + ) + + # Doc element (Typst code in element_doc.text) + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", + "doc_rich", "doc", 400, 330, 420, 200, "Rich Document", + ) + db.sql( + "INSERT INTO document_grid_config (element_id, file_id, grid_columns, grid_gap_x, grid_gap_y, grid_scale) VALUES (?,?,?,?,?,?)", + "doc_rich", None, 2, 20.0, 20.0, 1.0, + ) + db.sql("INSERT INTO element_doc (element_id, text) VALUES (?,?)", "doc_rich", typst_doc) + + # Verify initial counts + assert db.sql("SELECT COUNT(*) AS n FROM elements WHERE element_type = 'text'")[0]["n"] == 4 + assert db.sql("SELECT COUNT(*) AS n FROM elements WHERE element_type = 'doc'")[0]["n"] == 1 + + with DucSQL(initial_file) as db: + # Mutate title text + db.sql("UPDATE element_text SET text = ? WHERE element_id = ?", "UPDATED: Technical Drawing Specification v2", "txt_title") + + # Mutate doc Typst content + db.sql( + "UPDATE element_doc SET text = text || ? WHERE element_id = ?", + "\n\n== Update\n- Added safety constraints", "doc_rich", + ) + + # Delete caption + db.sql("DELETE FROM element_text WHERE element_id = ?", "txt_caption") + db.sql("DELETE FROM elements WHERE id = ?", "txt_caption") + + db.save(final_file) + + with DucSQL(final_file) as db: + assert db.sql("SELECT COUNT(*) AS n FROM elements WHERE element_type = 'text'")[0]["n"] == 3 + assert db.sql("SELECT COUNT(*) AS n FROM elements WHERE element_type = 'doc'")[0]["n"] == 1 + + title = db.sql("SELECT text FROM element_text WHERE element_id = ?", "txt_title")[0]["text"] + assert title.startswith("UPDATED:") + + doc_text = db.sql("SELECT text FROM element_doc WHERE element_id = ?", "doc_rich")[0]["text"] + assert "#table(" in doc_text + assert "== Update" in doc_text diff --git a/packages/ducpy/src/tests/src/test_CSPMDS_tolerances.py b/packages/ducpy/src/tests/src/test_CSPMDS_tolerances.py deleted file mode 100644 index 5a631ca6..00000000 --- a/packages/ducpy/src/tests/src/test_CSPMDS_tolerances.py +++ /dev/null @@ -1,232 +0,0 @@ -""" -CSPMDS Test for Tolerances: Create-Serialize-Parse-Mutate-Delete-Serialize -Tests the full lifecycle of tolerance elements in DUC files. -""" -import io -import os -import pytest - -import ducpy as duc - - -def test_cspmds_tolerances(test_output_dir): - """ - CSPMDS test for tolerance elements: - - Create: Create tolerance elements with different types - - Serialize: Save to DUC file - - Parse: Load the saved file - - Mutate: Modify tolerance properties - - Delete: Remove some tolerances - - Serialize: Save the final state - """ - - # === CREATE === - print("🔨 CREATE: Creating tolerance elements...") - - elements = [] - - # Create base elements for tolerances using builders API - rect1 = (duc.ElementBuilder() - .at_position(100, 100) - .with_size(80, 60) - .with_styles(duc.create_simple_styles()) - .with_label("Base Rectangle 1") - .build_rectangle() - .build()) - - rect2 = (duc.ElementBuilder() - .at_position(300, 100) - .with_size(80, 60) - .with_styles(duc.create_simple_styles()) - .with_label("Base Rectangle 2") - .build_rectangle() - .build()) - - # Create tolerance elements - from ducpy.classes.ElementsClass import GeometricPoint - - linear_tolerance1 = (duc.ElementBuilder() - .at_position(140, 80) - .with_size(120, 40) - .with_id("linear_tolerance_1") - .with_label("Linear Tolerance 1") - .build_linear_dimension() - .with_origin1((100, 100)) - .with_origin2((180, 100)) - .with_location((140, 80)) - .with_text_override("80±0.1mm") - .build()) - - angular_tolerance1 = (duc.ElementBuilder() - .at_position(200, 200) - .with_size(100, 100) - .with_id("angular_tolerance_1") - .with_label("Angular Tolerance 1") - .build_angular_dimension() - .with_origin1((200, 200)) - .with_origin2((250, 200)) - .with_location((225, 175)) - .with_text_override("45°±0.5°") - .build()) - - # Add a Feature Control Frame (FCF) element - # This is a complex tolerance type often used in GD&T - fcf_element = (duc.ElementBuilder() - .at_position(450, 150) # Adjusted position - .with_size(150, 50) # Approximate size for visualization - .with_id("fcf_tolerance_1") - .with_label("FCF Tolerance 1") - .build_feature_control_frame_element() - .with_segments([ - duc.create_fcf_segment_row( # First row, one segment - segments=[ - duc.create_fcf_segment( - symbol=duc.GDT_SYMBOL.POSITION, - tolerance=duc.create_tolerance_clause( - value="0.05", - zone_type=duc.TOLERANCE_ZONE_TYPE.CYLINDRICAL, - feature_modifiers=[duc.FEATURE_MODIFIER.DIAMETER], - material_condition=duc.MATERIAL_CONDITION.MAXIMUM - ), - datums=[ - duc.create_datum_reference("A"), - duc.create_datum_reference("B", modifier=duc.MATERIAL_CONDITION.LEAST), - duc.create_datum_reference("C") - ] - ) - ] - ) - ]) - .build()) - - # Add all elements to the list - elements.extend([ - rect1, rect2, - linear_tolerance1, angular_tolerance1, fcf_element - ]) - - # === SERIALIZE === - print("💾 SERIALIZE: Saving to DUC file...") - output_file = os.path.join(test_output_dir, "test_tolerance_elements.duc") - serialized_data = duc.serialize_duc( - name="ToleranceElementsTest", - elements=elements - ) - - with open(output_file, 'wb') as f: - f.write(serialized_data) - - assert os.path.exists(output_file) and os.path.getsize(output_file) > 0 - print(f"✅ Serialized {len(elements)} elements") - - # === PARSE === - print("📖 PARSE: Loading the saved file...") - parsed_data = duc.parse_duc(io.BytesIO(serialized_data)) - parsed_elements = parsed_data.elements - - assert len(parsed_elements) == len(elements) - print(f"✅ Parsed {len(parsed_elements)} elements") - - # === MUTATE === - print("🔧 MUTATE: Modifying tolerance elements...") - - # Mutate tolerance properties - for el_wrapper in parsed_elements: - if isinstance(el_wrapper.element, duc.DucDimensionElement): - original_x = el_wrapper.element.base.x - original_y = el_wrapper.element.base.y - original_text = el_wrapper.element.text_override - - # Update position and text_override for dimension elements - duc.mutate_element(el_wrapper, - x=original_x + 20, - y=original_y + 10, - text_override=f"MUTATED {original_text}") - print(f"Mutated {el_wrapper.element.base.label}: New X={el_wrapper.element.base.x}, New Y={el_wrapper.element.base.y}, New Text='{el_wrapper.element.text_override}'") - - elif isinstance(el_wrapper.element, duc.DucFeatureControlFrameElement): - # Mutate the label of the FCF element - original_label = el_wrapper.element.base.label - duc.mutate_element(el_wrapper, label=f"MUTATED {original_label}") - print(f"Mutated {el_wrapper.element.base.label}") - - # === DELETE === - print("🗑️ DELETE: Removing some tolerance elements...") - - # Remove angular tolerance and one base rectangle - elements_to_keep = [ - el for el in parsed_elements - if not ( - (isinstance(el.element, duc.DucDimensionElement) and "Angular" in el.element.base.label) or - (isinstance(el.element, duc.DucRectangleElement) and "Base Rectangle 2" in el.element.base.label) - ) - ] - - # === SERIALIZE FINAL === - print("💾 SERIALIZE FINAL: Saving the final state...") - final_output_file = os.path.join(test_output_dir, "test_tolerance_elements_final.duc") - final_serialized_data = duc.serialize_duc( - name="ToleranceElementsTestFinal", - elements=elements_to_keep - ) - - with open(final_output_file, 'wb') as f: - f.write(final_serialized_data) - - assert os.path.exists(final_output_file) and os.path.getsize(final_output_file) > 0 - print(f"✅ Final serialized {len(elements_to_keep)} elements") - - # Verify the final state - final_parsed_data = duc.parse_duc(io.BytesIO(final_serialized_data)) - final_elements = final_parsed_data.elements - - assert len(final_elements) == len(elements_to_keep), "Final element count mismatch after deletion." - - # Count element types in the final state - linear_tolerances = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.LINEAR] - angular_tolerances = [el for el in final_elements if isinstance(el.element, duc.DucDimensionElement) and el.element.dimension_type == duc.DIMENSION_TYPE.ANGULAR] - fcf_elements = [el for el in final_elements if isinstance(el.element, duc.DucFeatureControlFrameElement)] - rectangles = [el for el in final_elements if isinstance(el.element, duc.DucRectangleElement)] - - # Verify correct counts after deletion - assert len(linear_tolerances) == 1, "Expected 1 linear tolerance to remain." - assert len(angular_tolerances) == 0, "Expected 0 angular tolerances after deletion." - assert len(fcf_elements) == 1, "Expected 1 FCF element to remain." - assert len(rectangles) == 1, "Expected 1 rectangle to remain after deleting Base Rectangle 2." - - print(f"Final elements: {len(final_elements)}") - print(f"Linear tolerances: {len(linear_tolerances)}") - print(f"Angular tolerances: {len(angular_tolerances)}") - print(f"FCF elements: {len(fcf_elements)}") - print(f"Rectangles: {len(rectangles)}") - - # Verify mutations were applied to the remaining elements - for el_wrapper in final_elements: - if isinstance(el_wrapper.element, duc.DucDimensionElement): - # Check for linear tolerance mutation - if el_wrapper.element.base.id == "linear_tolerance_1": - assert el_wrapper.element.base.x == 140 + 20 # Original x from at_position + 20 - assert el_wrapper.element.base.y == 80 + 10 # Original y from at_position + 10 - assert el_wrapper.element.text_override == "MUTATED 80±0.1mm" - print("✅ Verified mutation for Linear Tolerance 1") - - elif isinstance(el_wrapper.element, duc.DucFeatureControlFrameElement): - # Check for FCF element mutation - if el_wrapper.element.base.id == "fcf_tolerance_1": - assert el_wrapper.element.base.label == "MUTATED FCF Tolerance 1" - print("✅ Verified mutation for FCF Tolerance 1") - - - print("✅ CSPMDS Tolerances test completed successfully!") - print(f" - Created {len(elements)} initial elements") - print(f" - Mutated tolerance properties and FCF label") - print(f" - Deleted 1 angular tolerance and 1 base rectangle") - print(f" - Final state: {len(final_elements)} elements") - -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir \ No newline at end of file diff --git a/packages/ducpy/src/tests/src/test_CSPMDS_version_graph.py b/packages/ducpy/src/tests/src/test_CSPMDS_version_graph.py index 12498716..ea1c62b8 100644 --- a/packages/ducpy/src/tests/src/test_CSPMDS_version_graph.py +++ b/packages/ducpy/src/tests/src/test_CSPMDS_version_graph.py @@ -1,184 +1,84 @@ -""" -CSPMDS Test for Version Graph: Create-Serialize-Parse-Mutate-Delete-Serialize -Tests the full lifecycle of version control elements in DUC files. -""" -import io +"""Version graph lifecycle test against the new SQL schema.""" + import os -import pytest import time -import ducpy as duc +from ducpy.builders.sql_builder import DucSQL def test_cspmds_version_graph(test_output_dir): - """ - CSPMDS test for version graph elements: - - Create: Create version control elements with checkpoints and deltas - - Serialize: Save to DUC file - - Parse: Load the saved file - - Mutate: Modify version properties - - Delete: Remove some version elements - - Serialize: Save the final state - """ - - # === CREATE === - print("🔨 CREATE: Creating version graph elements...") - - elements = [] - - # Create base elements for version control using builders API - rect1 = (duc.ElementBuilder() - .at_position(100, 100) - .with_size(80, 60) - .with_styles(duc.create_simple_styles()) - .with_label("Base Rectangle 1") - .build_rectangle() - .build()) - - rect2 = (duc.ElementBuilder() - .at_position(300, 100) - .with_size(80, 60) - .with_styles(duc.create_simple_styles()) - .with_label("Base Rectangle 2") - .build_rectangle() - .build()) - - # Create version graph elements - from ducpy.classes.DataStateClass import Checkpoint, Delta, JSONPatchOperation - - # Create checkpoints - checkpoint1 = (duc.StateBuilder().build_checkpoint() - .with_id("checkpoint_1") - .with_description("Initial state checkpoint") - .with_data(b"initial_state_data") - .build()) - - checkpoint2 = (duc.StateBuilder().build_checkpoint() - .with_id("checkpoint_2") - .with_description("Modified state checkpoint") - .with_data(b"modified_state_data") - .build()) - - # Create deltas - patch_operation1 = duc.create_json_patch_operation( - op="replace", - path="/elements/0/base/x", - value=150.0 - ) - - delta1 = (duc.StateBuilder() - .build_delta() - .with_id("delta_1") - .with_description("Move rectangle 1") - .with_patch([patch_operation1]) - .build()) - - patch_operation2 = duc.create_json_patch_operation( - op="replace", - path="/elements/1/base/y", - value=150.0 - ) - - delta2 = (duc.StateBuilder() - .build_delta() - .with_id("delta_2") - .with_description("Move rectangle 2") - .with_patch([patch_operation2]) - .build()) - - # Create version graph - version_graph = (duc.StateBuilder() - .build_version_graph() - .with_checkpoints([checkpoint1, checkpoint2]) - .with_deltas([delta1, delta2]) - .with_user_checkpoint_version_id("checkpoint_1") - .with_latest_version_id("delta_2") - .build()) - - # Add all elements to the list - elements.extend([rect1, rect2]) - - # === SERIALIZE === - print("💾 SERIALIZE: Saving to DUC file...") - output_file = os.path.join(test_output_dir, "test_version_graph.duc") - serialized_data = duc.serialize_duc( - name="VersionGraphTest", - elements=elements, - version_graph=version_graph - ) - - with open(output_file, 'wb') as f: - f.write(serialized_data) - - assert os.path.exists(output_file) and os.path.getsize(output_file) > 0 - print(f"✅ Serialized {len(elements)} elements and version graph") - - # === PARSE === - print("📖 PARSE: Loading the saved file...") - parsed_data = duc.parse_duc(io.BytesIO(serialized_data)) - parsed_elements = parsed_data.elements - parsed_version_graph = parsed_data.version_graph if hasattr(parsed_data, 'version_graph') else None - - assert len(parsed_elements) == len(elements) - print(f"✅ Parsed {len(parsed_elements)} elements") - - # === MUTATE === - print("🔧 MUTATE: Modifying version graph elements...") - - # Mutate element properties - for el_wrapper in parsed_elements: - duc.mutate_element(el_wrapper, - x=el_wrapper.element.base.x + 20, - y=el_wrapper.element.base.y + 10) - - # === DELETE === - print("🗑️ DELETE: Removing some version elements...") - - # Remove one rectangle - elements_to_keep = [el for el in parsed_elements if not (hasattr(el.element, 'label') and "Rectangle 2" in el.element.label)] - - # === SERIALIZE FINAL === - print("💾 SERIALIZE FINAL: Saving the final state...") - final_output_file = os.path.join(test_output_dir, "test_version_graph_final.duc") - final_serialized_data = duc.serialize_duc( - name="VersionGraphTestFinal", - elements=elements_to_keep, - version_graph=parsed_version_graph - ) - - with open(final_output_file, 'wb') as f: - f.write(final_serialized_data) - - assert os.path.exists(final_output_file) and os.path.getsize(final_output_file) > 0 - print(f"✅ Final serialized {len(elements_to_keep)} elements") - - # Verify the final state - final_parsed_data = duc.parse_duc(io.BytesIO(final_serialized_data)) - final_elements = final_parsed_data.elements - final_version_graph = final_parsed_data.version_graph if hasattr(final_parsed_data, 'version_graph') else None - - assert len(final_elements) == len(elements_to_keep) - - # Count elements by type - rectangles = [el for el in final_elements if hasattr(el.element, 'label') and "Rectangle" in el.element.label] - - print(f"Final elements: {len(final_elements)}") - print(f"Rectangles: {len(rectangles)}") - - # More lenient assertion - just check that we have the right total count - assert len(final_elements) >= 1 # Should have at least 1 rectangle - - print("✅ CSPMDS Version Graph test completed successfully!") - print(f" - Created {len(elements)} initial elements") - print(f" - Created version graph with checkpoints and deltas") - print(f" - Mutated element properties") - print(f" - Deleted 1 rectangle") - print(f" - Final state: {len(final_elements)} elements") + output_file = os.path.join(test_output_dir, "cspmds_version_graph_sql.duc") + now = int(time.time() * 1000) + + if os.path.exists(output_file): + os.remove(output_file) + + with DucSQL.new(output_file) as db: + db.sql( + "INSERT INTO version_chains (id, schema_version, start_version, root_checkpoint_id) " + "VALUES (?,?,?,?)", + "chain_1", 1, 0, "cp_1", + ) + + db.sql( + "INSERT INTO checkpoints " + "(id, parent_id, chain_id, version_number, schema_version, timestamp, description, data, size_bytes) " + "VALUES (?,?,?,?,?,?,?,?,?)", + "cp_1", None, "chain_1", 1, 1, now, "Initial snapshot", b"state_v1", 8, + ) + db.sql( + "INSERT INTO checkpoints " + "(id, parent_id, chain_id, version_number, schema_version, timestamp, description, data, size_bytes) " + "VALUES (?,?,?,?,?,?,?,?,?)", + "cp_2", "cp_1", "chain_1", 2, 1, now + 1, "Second snapshot", b"state_v2", 8, + ) + + db.sql( + "INSERT INTO deltas " + "(id, parent_id, base_checkpoint_id, chain_id, delta_sequence, version_number, schema_version, timestamp, description, changeset, size_bytes) " + "VALUES (?,?,?,?,?,?,?,?,?,?,?)", + "d_1", None, "cp_2", "chain_1", 1, 3, 1, now + 2, "move element", b"delta_1", 7, + ) + db.sql( + "INSERT INTO deltas " + "(id, parent_id, base_checkpoint_id, chain_id, delta_sequence, version_number, schema_version, timestamp, description, changeset, size_bytes) " + "VALUES (?,?,?,?,?,?,?,?,?,?,?)", + "d_2", "d_1", "cp_2", "chain_1", 2, 4, 1, now + 3, "scale element", b"delta_2", 7, + ) + + db.sql( + "UPDATE version_graph " + "SET current_version = ?, current_schema_version = ?, user_checkpoint_version_id = ?, latest_version_id = ?, total_size = ? " + "WHERE id = 1", + 4, 1, "cp_2", "d_2", 30, + ) + + db.sql( + "INSERT INTO schema_migrations " + "(from_schema_version, to_schema_version, migration_name, migration_sql, applied_at, boundary_checkpoint_id) " + "VALUES (?,?,?,?,?,?)", + 1, 2, "v1_to_v2", "ALTER TABLE elements ADD COLUMN test_col TEXT;", now + 4, "cp_3", + ) + db.sql( + "INSERT INTO version_chains (id, schema_version, start_version, root_checkpoint_id) " + "VALUES (?,?,?,?)", + "chain_2", 2, 5, "cp_3", + ) + db.sql( + "INSERT INTO checkpoints " + "(id, parent_id, chain_id, version_number, schema_version, timestamp, description, is_schema_boundary, data, size_bytes) " + "VALUES (?,?,?,?,?,?,?,?,?,?)", + "cp_3", None, "chain_2", 5, 2, now + 5, "Schema boundary", 1, b"state_v3", 8, + ) + + db.sql("UPDATE deltas SET description = ? WHERE id = ?", "move element updated", "d_1") + db.sql("DELETE FROM deltas WHERE id = ?", "d_1") + + assert db.sql("SELECT COUNT(*) AS n FROM checkpoints")[0]["n"] == 3 + assert db.sql("SELECT COUNT(*) AS n FROM deltas")[0]["n"] == 1 + assert db.sql("SELECT current_schema_version FROM version_graph")[0]["current_schema_version"] == 1 + assert db.sql("SELECT COUNT(*) AS n FROM schema_migrations")[0]["n"] == 1 -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir \ No newline at end of file + with DucSQL(output_file) as db2: + assert db2.sql("SELECT latest_version_id FROM version_graph")[0]["latest_version_id"] == "d_2" + assert db2.sql("SELECT COUNT(*) AS n FROM version_chains")[0]["n"] == 2 \ No newline at end of file diff --git a/packages/ducpy/src/tests/src/test_a_duc_with_everything.py b/packages/ducpy/src/tests/src/test_a_duc_with_everything.py index ea8eb512..d15db053 100644 --- a/packages/ducpy/src/tests/src/test_a_duc_with_everything.py +++ b/packages/ducpy/src/tests/src/test_a_duc_with_everything.py @@ -1,630 +1,392 @@ -# The goal of this test is to create a Duc file with every single property possible to test coverage -# The test will consist of creating the Duc file first with the builders api, and then serializing it to the outputs -# Then in the end will parse the file and check if most properties are present and valid in the python state - -# This duc test file must include: -# - All possible element types -# - All possible properties for each element type -# - All possible styles and settings -# - Diverse Layers, Regions, Blocks, Groups -# - Diverse Dictionary key values -# - Thumbnail image from assets (thumbnail.png) -# - On external files at least three files related to elements (test.pdf, test.step and test.jpg) -# - Respectively these files will be necessary to link to the DucPdfElement, DucParametricElement and DucImageElement -# - Some VersionGraph history -# - Diverse Standards - -""" -Comprehensive DUC file test: creates a file with every element type, property, style, layer, region, block, group, dictionary, thumbnail, external files, version graph, and standards. -Uses only the builders API. -""" +"""Broad integration test for the new SQL-backed DUC schema.""" + import os -import pytest +import time + import ducpy as duc +from ducpy.builders.sql_builder import DucSQL -def load_asset_bytes(filename): - """Load asset bytes using file extension to determine subdirectory.""" - _, ext = os.path.splitext(filename.lower()) - ext = ext[1:] # Remove the dot - # Map extensions to subdirectories +def _load_asset_bytes(base_dir: str, filename: str) -> bytes: + _, ext = os.path.splitext(filename.lower()) + ext = ext[1:] if ext == "pdf": sub_dir = "pdf-files" - elif ext == "svg": - sub_dir = "svg-files" - elif ext in ["png", "jpg", "jpeg", "gif"]: + elif ext in {"png", "jpg", "jpeg", "gif"}: sub_dir = "image-files" elif ext == "step": sub_dir = "step-files" - elif ext == "duc": - sub_dir = "duc-files" else: - sub_dir = "image-files" # default + sub_dir = "image-files" + with open(os.path.join(base_dir, sub_dir, filename), "rb") as f: + return f.read() - asset_dir = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "..", "..", "..", "assets", "testing")) - with open(os.path.join(asset_dir, sub_dir, filename), "rb") as f: - return f.read() +def test_a_duc_with_everything(test_output_dir, test_assets_dir): + output_file = os.path.join(test_output_dir, "test_a_duc_with_everything.duc") + now = int(time.time() * 1000) + + if os.path.exists(output_file): + os.remove(output_file) -@pytest.fixture -def test_output_dir(): - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir - -def test_a_duc_with_everything(test_output_dir): - # --- Load assets --- - thumbnail_bytes = load_asset_bytes("thumbnail.png") - pdf_bytes = load_asset_bytes("test.pdf") - step_bytes = load_asset_bytes("test.step") - jpg_bytes = load_asset_bytes("test.jpg") - - # --- External files --- - external_files = [ - (duc.StateBuilder().build_external_file() - .with_key("pdf_file") - .with_mime_type("application/pdf") - .with_data(pdf_bytes) - .build()), - (duc.StateBuilder().build_external_file() - .with_key("step_file") - .with_mime_type("application/step") - .with_data(step_bytes) - .build()), - (duc.StateBuilder().build_external_file() - .with_key("jpg_file") - .with_mime_type("image/jpeg") - .with_data(jpg_bytes) - .build()), - ] - - # --- Dictionary entries --- - dictionary = [ - duc.DictionaryEntry(key="ProjectName", value="Everything Test"), - duc.DictionaryEntry(key="Author", value="TestBot"), - duc.DictionaryEntry(key="Revision", value="42"), - duc.DictionaryEntry(key="SpecialKey", value="SpecialValue"), - ] - - # --- Layers --- - layers = [ - duc.StateBuilder().build_layer().with_id("layer1").with_label("Main Layer").build(), - duc.StateBuilder().build_layer().with_id("layer2").with_label("Secondary Layer").with_readonly(True).build(), - ] - - # --- Regions --- - from ducpy.Duc.BOOLEAN_OPERATION import BOOLEAN_OPERATION - regions = [ - (duc.StateBuilder().build_region() - .with_id("region1") - .with_label("UnionRegion") - .with_boolean_operation(BOOLEAN_OPERATION.UNION) - .build()), - (duc.StateBuilder().build_region() - .with_id("region2") - .with_label("SubtractRegion") - .with_boolean_operation(BOOLEAN_OPERATION.SUBTRACT) - .build()), - ] - - # --- Groups --- - groups = [ - (duc.StateBuilder().build_group() - .with_id("group1") - .with_label("Group1") - .build()), - (duc.StateBuilder().build_group() - .with_id("group2") - .with_label("Group2") - .with_is_collapsed(True) - .build()), - ] - - # --- Standards --- - standards = [ - duc.create_standard_complete(id="std1", name="Metric Standard"), - duc.create_standard_complete(id="std2", name="Imperial Standard") - ] - - # --- Version graph --- - checkpoint = (duc.StateBuilder().build_checkpoint() - .with_description("Initial checkpoint") - .with_is_manual_save(True) - .with_data(b"checkpoint") - .build()) - delta = (duc.StateBuilder().build_delta() - .with_patch([duc.create_json_patch_operation(op="replace", path="/elements/0/x", value="123.45")]) - .with_description("Moved element") - .build()) - version_graph = (duc.StateBuilder().build_version_graph() - .with_checkpoints([checkpoint]) - .with_deltas([delta]) - .with_user_checkpoint_version_id(checkpoint.id) - .with_latest_version_id(delta.id) - .build()) - - # --- Global State --- - global_state = (duc.StateBuilder().build_global_state() - .with_view_background_color("#F0F0F0") - .with_main_scope("m") - .with_dash_spacing_scale(2.0) - .with_is_dash_spacing_affected_by_viewport_scale(True) - .with_scope_exponent_threshold(3) - .with_dimensions_associative_by_default(False) - .with_use_annotative_scaling(True) - .with_linear_precision(4) - .with_angular_precision(3) - .with_pruning_level(duc.PRUNING_LEVEL.AGGRESSIVE) # Explicitly set pruning level - .build()) - - # --- Local State --- - local_state = (duc.StateBuilder().build_local_state() - .with_scope("cm") - .with_active_standard_id("std1") - .with_scroll_x(50.0) - .with_scroll_y(75.0) - .with_zoom(2.0) - .with_is_binding_enabled(False) - .with_pen_mode(True) - .with_view_mode_enabled(True) - .with_objects_snap_mode_enabled(False) - .with_grid_mode_enabled(False) - .with_outline_mode_enabled(True) - .build()) - - # --- Elements --- - elements = [] - - # Rectangle - elements.append(duc.ElementBuilder() + thumbnail = _load_asset_bytes(test_assets_dir, "thumbnail.png") + pdf_bytes = _load_asset_bytes(test_assets_dir, "test.pdf") + step_bytes = _load_asset_bytes(test_assets_dir, "test.step") + jpg_bytes = _load_asset_bytes(test_assets_dir, "test.jpg") + + # Builder stream: elements + rect_from_builder = ( + duc.ElementBuilder() .at_position(10, 20) .with_size(100, 50) .with_label("Rectangle") - .with_styles(duc.create_fill_and_stroke_style( - duc.create_solid_content("#FF0000", opacity=0.8), - duc.create_solid_content("#000000"), - stroke_width=2.0 - )) + .with_layer_id("layer1") .with_z_index(1.0) - .with_locked(True) + .with_styles( + duc.create_fill_and_stroke_style( + duc.create_solid_content("#4E79A7", opacity=0.85), + duc.create_solid_content("#1F2937", opacity=1.0), + stroke_width=2.0, + ) + ) + .build_rectangle() + .build() + ) + rect_sql_style_target = ( + duc.ElementBuilder() + .at_position(130, 20) + .with_size(100, 50) + .with_label("Rectangle from Builder (SQL style)") .with_layer_id("layer1") - .with_region_ids(["region1"]) + .with_z_index(1.5) .build_rectangle() - .build()) - - # Ellipse - import math - elements.append(duc.ElementBuilder() - .at_position(200, 100) - .with_size(80, 40) - .with_label("Ellipse") - .with_styles(duc.create_fill_and_stroke_style( - duc.create_solid_content("#00FF00", opacity=0.6), - duc.create_solid_content("#000000"), - stroke_width=1.5 - )) - .with_z_index(2.0) - .with_locked(False) - .with_layer_id("layer2") - .with_region_ids(["region2"]) - .build_ellipse() - .with_ratio(0.5) - .with_start_angle(0.0) - .with_end_angle(math.pi) - .build()) - - # Polygon - elements.append(duc.ElementBuilder() - .at_position(300, 200) - .with_size(60, 60) - .with_label("Pentagon") - .with_styles(duc.create_fill_and_stroke_style( - duc.create_solid_content("#0000FF", opacity=0.5), - duc.create_solid_content("#FFFFFF"), - stroke_width=1.0 - )) - .with_z_index(3.0) - .build_polygon() - .with_sides(5) - .build()) - - # Linear element (polyline) - elements.append(duc.ElementBuilder() + .build() + ) + line_from_builder = ( + duc.ElementBuilder() .with_label("Polyline") - .with_styles(duc.create_stroke_style( - duc.create_solid_content("#FF00FF"), - width=2.5 - )) .with_z_index(4.0) .build_linear_element() - .with_points([(0,0), (50,50), (100,0)]) - .build()) - - # Arrow element - elements.append(duc.ElementBuilder() - .with_label("Arrow") - .with_styles(duc.create_stroke_style( - duc.create_solid_content("#FFA500"), - width=3.0 - )) - .with_z_index(5.0) - .build_arrow_element() - .with_points([(150,150), (200,200)]) - .build()) - - # Image element (linked to external jpg) - elements.append(duc.ElementBuilder() - .at_position(400, 50) - .with_size(120, 80) - .with_label("Image") - .with_styles(duc.create_simple_styles()) - .with_z_index(6.0) - .build_image_element() - .with_file_id("jpg_file") - .build()) - - # PDF element (linked to external pdf) - elements.append(duc.ElementBuilder() - .at_position(500, 100) - .with_size(100, 140) - .with_label("PDF") - .with_styles(duc.create_simple_styles()) - .with_z_index(7.0) - .build_pdf_element() - .with_file_id("pdf_file") - .build()) - - # Parametric element (linked to external step) - elements.append(duc.ElementBuilder() - .at_position(600, 200) - .with_size(80, 80) - .with_label("STEP") - .with_styles(duc.create_simple_styles()) - .with_z_index(8.0) - .build_parametric_element() - .with_file_id("step_file") - .with_source_type(duc.PARAMETRIC_SOURCE_TYPE.FILE) - .with_code("import_file('test.step')") - .build()) - - # Text element - elements.append(duc.ElementBuilder() + .with_points([(0, 0), (50, 50)]) + .build() + ) + line_sql_style_target = ( + duc.ElementBuilder() + .with_label("Polyline from Builder (SQL style)") + .with_z_index(4.5) + .build_linear_element() + .with_points([(10, 10), (60, 30), (110, 10)]) + .build() + ) + text_from_builder = ( + duc.ElementBuilder() .at_position(50, 300) .with_size(200, 40) .with_label("Text") - .with_styles(duc.create_simple_styles()) - .with_z_index(9.0) + .with_z_index(8.0) .build_text_element() .with_text("Hello, DUC!") .with_text_style(duc.create_text_style(font_family="Arial", font_size=18)) - .build()) - - # Table element - table_data = [ - ["Header1", "Header2", "Header3"], - ["Row1A", "Row1B", "Row1C"], - ["Row2A", "Row2B", "Row2C"] - ] - elements.append(duc.ElementBuilder() - .at_position(100, 400) - .with_size(300, 120) - .with_label("Table") - .with_styles(duc.create_simple_styles()) - .with_z_index(10.0) - .build_table_from_data() - .with_data(table_data) - .build()) - - # Frame element - elements.append(duc.ElementBuilder() - .at_position(700, 50) - .with_size(150, 100) - .with_label("Frame") - .with_styles(duc.create_simple_styles()) - .with_z_index(11.0) - .build_frame_element() - .build()) - - # Plot element - elements.append(duc.ElementBuilder() - .at_position(700, 200) - .with_size(200, 150) - .with_label("Plot") - .with_styles(duc.create_simple_styles()) - .with_z_index(12.0) - .build_plot_element() - .build()) - - # Viewport element - view = (duc.StateBuilder().build_view() - .with_center_x(800) - .with_center_y(300) - .with_zoom(1.5) - .build()) - elements.append(duc.ElementBuilder() - .with_label("Viewport") - .with_styles(duc.create_simple_styles()) - .with_z_index(13.0) - .build_viewport_element() - .with_points([(800,300), (900,300), (900,400), (800,400)]) - .with_view(view) - .build()) - - # FreeDraw element - freedraw_points = [(i*10, 500 + (i%2)*10) for i in range(20)] - freedraw_pressures = [0.5 + 0.02*i for i in range(20)] - duc_freedraw_points = [duc.DucPoint(x=float(p[0]), y=float(p[1]), mirroring=None) for p in freedraw_points] - elements.append(duc.ElementBuilder() - .at_position(50, 500) - .with_size(200, 50) - .with_label("FreeDraw") - .with_styles(duc.create_simple_styles()) - .with_z_index(14.0) - .build_freedraw_element() - .with_points(duc_freedraw_points) - .with_pressures(freedraw_pressures) - .with_size_thickness(5.0) - .with_thinning(0.2) - .with_smoothing(0.3) - .with_streamline(0.4) - .with_easing("linear") - .build()) - - # Doc element - elements.append(duc.ElementBuilder() + .build() + ) + text_sql_style_target = ( + duc.ElementBuilder() + .at_position(270, 300) + .with_size(200, 40) + .with_label("Text from Builder (SQL style)") + .with_z_index(8.5) + .build_text_element() + .with_text("Builder text with SQL-applied style") + .with_text_style(duc.create_text_style(font_family="Arial", font_size=14)) + .build() + ) + doc_from_builder = ( + duc.ElementBuilder() .at_position(400, 500) .with_size(300, 100) .with_label("Doc") - .with_styles(duc.create_simple_styles()) - .with_z_index(15.0) + .with_z_index(7.0) .build_doc_element() - .with_text("This is a rich text document with {{Author}} and {{Revision}}.") - .build()) - - # Dimension element (linear) - elements.append(duc.ElementBuilder() - .with_label("Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(16.0) - .build_linear_dimension() - .with_origin1(duc.DucPoint(x=100, y=600, mirroring=None)) - .with_origin2(duc.DucPoint(x=300, y=600, mirroring=None)) - .with_location(duc.DucPoint(x=200, y=580, mirroring=None)) - .build()) - - # Leader element - leader_content = duc.create_leader_text_content("Leader annotation") - elements.append(duc.ElementBuilder() - .at_position(350, 650) - .with_size(50, 50) - .with_label("Leader") - .with_styles(duc.create_simple_styles()) - .with_z_index(17.0) - .build_leader_element() - .with_content_anchor_x(410) - .with_content_anchor_y(710) - .with_content(duc.create_leader_content(leader_content)) - .build()) - - # Feature Control Frame element - from ducpy.Duc.GDT_SYMBOL import GDT_SYMBOL - tolerance = duc.create_tolerance_clause(value="0.05") - datums = [duc.create_datum_reference("A"), duc.create_datum_reference("B")] - segment = duc.create_feature_control_frame_segment(symbol=GDT_SYMBOL.POSITION, tolerance=tolerance, datums=datums) - fcf_row = duc.FCFSegmentRow(segments=[segment]) - elements.append(duc.ElementBuilder() - .at_position(500, 650) - .with_size(120, 40) - .with_label("FCF") - .with_styles(duc.create_simple_styles()) - .with_z_index(18.0) - .build_feature_control_frame_element() - .with_segments([fcf_row]) - .build()) - - - # Mermaid element - elements.append(duc.ElementBuilder() - .at_position(50, 750) - .with_size(300, 200) - .with_label("Mermaid Diagram") - .with_styles(duc.create_simple_styles()) - .with_z_index(20.0) - .build_mermaid_element() - .with_source("graph TD; A[Christmas] -->|Get money| B(Go shopping); B --> C{Let me think}; C -->|One| D[Laptop]; C -->|Two| E[iPhone]; C -->|Three] F[Car];") - .with_theme("dark") - .build()) - - # Embeddable element - elements.append(duc.ElementBuilder() - .at_position(400, 750) - .with_size(400, 250) - .with_label("YouTube Video") - .with_styles(duc.create_simple_styles()) - .with_z_index(21.0) - .build_embeddable_element() - .with_link("https://www.youtube.com/embed/dQw4w9WgXcQ") - .build()) - - # XRay element - elements.append(duc.ElementBuilder() - .at_position(50, 960) - .with_size(10, 10) - .with_label("XRay") - .with_styles(duc.create_simple_styles()) - .with_z_index(22.0) - .build_xray_element() - .with_origin_x(50) - .with_origin_y(960) - .with_direction_x(1) - .with_direction_y(0) - .with_color("#FF0000") - .with_start_from_origin(True) - .build()) - - # Aligned Dimension element - elements.append(duc.ElementBuilder() - .with_label("Aligned Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(23.0) - .build_aligned_dimension() - .with_origin1(duc.DucPoint(x=100, y=800, mirroring=None)) - .with_origin2(duc.DucPoint(x=300, y=850, mirroring=None)) - .with_location(duc.DucPoint(x=200, y=780, mirroring=None)) - .build()) - - # Angular Dimension element - elements.append(duc.ElementBuilder() - .with_label("Angular Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(24.0) - .build_angular_dimension() - .with_origin1(duc.DucPoint(x=400, y=800, mirroring=None)) - .with_origin2(duc.DucPoint(x=500, y=800, mirroring=None)) - .with_location(duc.DucPoint(x=450, y=750, mirroring=None)) - .build()) - - # Radius Dimension element - elements.append(duc.ElementBuilder() - .with_label("Radius Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(25.0) - .build_radius_dimension() - .with_origin1(duc.DucPoint(x=600, y=800, mirroring=None)) - .with_location(duc.DucPoint(x=650, y=850, mirroring=None)) - .build()) - - # Diameter Dimension element - elements.append(duc.ElementBuilder() - .with_label("Diameter Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(26.0) - .build_diameter_dimension() - .with_origin1(duc.DucPoint(x=700, y=800, mirroring=None)) - .with_location(duc.DucPoint(x=750, y=850, mirroring=None)) - .build()) - - # Arc Length Dimension element - elements.append(duc.ElementBuilder() - .with_label("Arc Length Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(27.0) - .build_arc_length_dimension() - .with_origin1(duc.DucPoint(x=800, y=800, mirroring=None)) - .with_origin2(duc.DucPoint(x=900, y=800, mirroring=None)) - .with_location(duc.DucPoint(x=850, y=750, mirroring=None)) - .build()) - - # Center Mark Dimension element - elements.append(duc.ElementBuilder() - .with_label("Center Mark Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(28.0) - .build_center_mark_dimension() - .with_origin1(duc.DucPoint(x=100, y=900, mirroring=None)) - .with_location(duc.DucPoint(x=100, y=920, mirroring=None)) - .build()) - - # Rotated Dimension element - elements.append(duc.ElementBuilder() - .with_label("Rotated Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(29.0) - .build_rotated_dimension() - .with_origin1(duc.DucPoint(x=200, y=900, mirroring=None)) - .with_origin2(duc.DucPoint(x=300, y=900, mirroring=None)) - .with_location(duc.DucPoint(x=250, y=880, mirroring=None)) - .build()) - - # Spacing Dimension element - elements.append(duc.ElementBuilder() - .with_label("Spacing Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(30.0) - .build_spacing_dimension() - .with_origin1(duc.DucPoint(x=400, y=900, mirroring=None)) - .with_origin2(duc.DucPoint(x=500, y=900, mirroring=None)) - .with_location(duc.DucPoint(x=450, y=880, mirroring=None)) - .build()) - - # Continue Dimension element - elements.append(duc.ElementBuilder() - .with_label("Continue Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(31.0) - .build_continue_dimension() - .with_origin1(duc.DucPoint(x=600, y=900, mirroring=None)) - .with_origin2(duc.DucPoint(x=700, y=900, mirroring=None)) - .with_location(duc.DucPoint(x=650, y=880, mirroring=None)) - .build()) - - # Baseline Dimension element - elements.append(duc.ElementBuilder() - .with_label("Baseline Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(32.0) - .build_baseline_dimension() - .with_origin1(duc.DucPoint(x=800, y=900, mirroring=None)) - .with_origin2(duc.DucPoint(x=900, y=900, mirroring=None)) - .with_location(duc.DucPoint(x=850, y=880, mirroring=None)) - .build()) - - # Jogged Linear Dimension element - elements.append(duc.ElementBuilder() - .with_label("Jogged Linear Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(33.0) - .build_jogged_linear_dimension() - .with_origin1(duc.DucPoint(x=100, y=1000, mirroring=None)) - .with_origin2(duc.DucPoint(x=300, y=1050, mirroring=None)) - .with_location(duc.DucPoint(x=200, y=980, mirroring=None)) - .with_jog_x(250) - .with_jog_y(1020) - .build()) - - # --- Serialize --- - output_file = os.path.join(test_output_dir, "test_a_duc_with_everything.duc") - - duc.write_duc_file( - file_path=output_file, - name="EverythingTest", - elements=elements, - - blocks=[], - groups=groups, - regions=regions, - layers=layers, - standards=standards, - dictionary=dictionary, - thumbnail=thumbnail_bytes, - external_files=external_files, - version_graph=version_graph, - duc_global_state=global_state, - duc_local_state=local_state + .with_text("= Typst Doc\nThis is *Typst* content with {{Author}}.") + .build() + ) + doc_sql_style_target = ( + duc.ElementBuilder() + .at_position(730, 500) + .with_size(300, 100) + .with_label("Doc from Builder (SQL style)") + .with_z_index(7.5) + .build_doc_element() + .with_text("= Typst Companion\nThis doc is builder-created and SQL-styled.") + .build() + ) + + # Builder stream: styles and stack-like state objects. + builder_style = duc.create_fill_and_stroke_style( + duc.create_solid_content("#A0D468", opacity=0.75), + duc.create_solid_content("#2D3436", opacity=1.0), + stroke_width=2.5, + ) + builder_layer = ( + duc.StateBuilder() + .with_id("layer1") + .with_readonly(False) + .build_layer() + .with_label("Main Layer (builder)") + .build() + ) + builder_group = ( + duc.StateBuilder() + .with_id("group1") + .build_group() + .with_label("Group1 (builder)") + .build() + ) + builder_region = ( + duc.StateBuilder() + .with_id("region1") + .build_region() + .with_label("UnionRegion (builder)") + .with_boolean_operation(duc.BOOLEAN_OPERATION.UNION) + .build() ) - assert os.path.exists(output_file), f"Output file was not created: {output_file}" - assert os.path.getsize(output_file) > 0, "Output file is empty" - - # --- Parse and validate --- - # Use read_ducfile from ducpy.io - parsed = duc.read_duc_file(output_file) - assert parsed is not None, "Parsed state is None" - assert parsed.elements is not None, "Parsed state missing elements" - element_count = len(parsed.elements) - if element_count < 32: # Updated from 33 to 32 elements - pytest.fail(f"Not all elements present: found {element_count}, expected at least 32") - assert parsed.blocks is not None, "Parsed state missing blocks" - assert parsed.layers is not None, "Parsed state missing layers" - assert parsed.regions is not None, "Parsed state missing regions" - assert parsed.standards is not None, "Parsed state missing standards" - assert parsed.dictionary is not None, "Parsed state missing dictionary" - assert parsed.thumbnail is not None, "Parsed state missing thumbnail" - assert parsed.files is not None, "Parsed state missing files" - assert parsed.version_graph is not None, "Parsed state missing version graph" - assert parsed.duc_global_state is not None, "Parsed state missing global state" - assert parsed.duc_local_state is not None, "Parsed state missing local state" - assert parsed.version_graph.metadata is not None, "Parsed state missing version graph metadata" - - print("✅ Everything test passed and file created:", output_file) \ No newline at end of file + # SQL stream: style constants applied to builder-created elements. + sql_style_fill_src = "#F6C85F" + sql_style_stroke_src = "#6F4E7C" + sql_style_stroke_width = 1.75 + + with DucSQL.new(output_file) as db: + # Document metadata + dictionary + db.sql( + "INSERT INTO duc_document (id, version, source, data_type, thumbnail) VALUES (?,?,?,?,?)", + "everything_doc", "3.0.0", "ducpy_test", "DUC_DATA", thumbnail, + ) + for k, v in [("ProjectName", "Everything Test"), ("Author", "TestBot"), ("Revision", "42")]: + db.sql("INSERT INTO document_dictionary (key, value) VALUES (?,?)", k, v) + + # Global + local state + db.sql( + "INSERT INTO duc_global_state (id, name, view_background_color, main_scope, scope_exponent_threshold, pruning_level) " + "VALUES (?,?,?,?,?,?)", + 1, "Everything", "#F0F0F0", "m", 3, 30, + ) + db.sql( + "INSERT INTO duc_local_state (id, scope, scroll_x, scroll_y, zoom, is_binding_enabled, pen_mode, view_mode_enabled, objects_snap_mode_enabled, grid_mode_enabled, outline_mode_enabled) " + "VALUES (?,?,?,?,?,?,?,?,?,?,?)", + 1, "cm", 50.0, 75.0, 2.0, 0, 1, 1, 0, 0, 1, + ) + + # Layers / groups / regions: one from builders, one from SQL (mashup within same families). + db.sql("INSERT INTO stack_properties (id, label) VALUES (?,?)", builder_layer.id, builder_layer.stack_base.label) + db.sql("INSERT INTO layers (id, readonly) VALUES (?,?)", builder_layer.id, 1 if builder_layer.readonly else 0) + db.sql("INSERT INTO stack_properties (id, label) VALUES (?,?)", "layer2", "Secondary Layer (sql)") + db.sql("INSERT INTO layers (id, readonly) VALUES (?,?)", "layer2", 1) + + db.sql("INSERT INTO stack_properties (id, label) VALUES (?,?)", builder_group.id, builder_group.stack_base.label) + db.sql("INSERT INTO groups (id) VALUES (?)", builder_group.id) + db.sql("INSERT INTO stack_properties (id, label) VALUES (?,?)", "group2", "Group2 (sql)") + db.sql("INSERT INTO groups (id) VALUES (?)", "group2") + + db.sql("INSERT INTO stack_properties (id, label) VALUES (?,?)", builder_region.id, builder_region.stack_base.label) + db.sql("INSERT INTO regions (id, boolean_operation) VALUES (?,?)", builder_region.id, 10) + db.sql("INSERT INTO stack_properties (id, label) VALUES (?,?)", "region2", "SubtractRegion (sql)") + db.sql("INSERT INTO regions (id, boolean_operation) VALUES (?,?)", "region2", 11) + + # External files + db.sql("INSERT INTO external_files (id, mime_type, data, created, last_retrieved) VALUES (?,?,?,?,?)", "pdf_file", "application/pdf", pdf_bytes, now, now) + db.sql("INSERT INTO external_files (id, mime_type, data, created, last_retrieved) VALUES (?,?,?,?,?)", "step_file", "model/step", step_bytes, now, now) + db.sql("INSERT INTO external_files (id, mime_type, data, created, last_retrieved) VALUES (?,?,?,?,?)", "jpg_file", "image/jpeg", jpg_bytes, now, now) + + # Core elements (broad type coverage in new schema): each family has builder+SQL-created members. + rect_base = rect_from_builder.element.base + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, layer_id, z_index) VALUES (?,?,?,?,?,?,?,?,?)", + "rect1", "rectangle", rect_base.x, rect_base.y, rect_base.width, rect_base.height, rect_base.label, rect_base.layer_id, rect_base.z_index, + ) + # Apply SQL-created style onto builder-created rectangle. + db.sql("INSERT INTO backgrounds (owner_type, owner_id, src, opacity) VALUES (?,?,?,?)", "element", "rect1", sql_style_fill_src, 0.80) + db.sql("INSERT INTO strokes (owner_type, owner_id, src, width, opacity) VALUES (?,?,?,?,?)", "element", "rect1", sql_style_stroke_src, sql_style_stroke_width, 1.0) + + # Builder-created rectangle + SQL style (same family, second item). + rect2_base = rect_sql_style_target.element.base + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, layer_id, z_index) VALUES (?,?,?,?,?,?,?,?,?)", + "rect2", "rectangle", rect2_base.x, rect2_base.y, rect2_base.width, rect2_base.height, rect2_base.label, rect2_base.layer_id, rect2_base.z_index, + ) + db.sql("INSERT INTO backgrounds (owner_type, owner_id, src, opacity) VALUES (?,?,?,?)", "element", "rect2", "#FF9DA7", 0.70) + db.sql("INSERT INTO strokes (owner_type, owner_id, src, width, opacity) VALUES (?,?,?,?,?)", "element", "rect2", "#1F2937", 2.20, 1.0) + + # SQL-created rectangle + builder-created style (same family, third item). + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, layer_id, z_index) VALUES (?,?,?,?,?,?,?,?,?)", + "rect3", "rectangle", 260, 20, 100, 50, "Rectangle from SQL (builder style)", "layer2", 2.0, + ) + bkg = builder_style.background[0].content + stk = builder_style.stroke[0] + db.sql("INSERT INTO backgrounds (owner_type, owner_id, src, opacity) VALUES (?,?,?,?)", "element", "rect3", bkg.src, bkg.opacity) + db.sql("INSERT INTO strokes (owner_type, owner_id, src, width, opacity) VALUES (?,?,?,?,?)", "element", "rect3", stk.content.src, stk.width, stk.content.opacity) + + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label, layer_id, z_index) VALUES (?,?,?,?,?,?,?,?,?)", "ell1", "ellipse", 200, 100, 80, 40, "Ellipse", "layer2", 2.0) + db.sql("INSERT INTO element_ellipse (element_id, ratio, start_angle, end_angle) VALUES (?,?,?,?)", "ell1", 0.5, 0.0, 3.1415926535) + + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", "poly1", "polygon", 300, 200, 60, 60, "Pentagon", 3.0) + db.sql("INSERT INTO element_polygon (element_id, sides) VALUES (?,?)", "poly1", 5) + + line_base = line_from_builder.element.linear_base.base + line_points = line_from_builder.element.linear_base.points + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", + "line1", "line", line_base.x, line_base.y, line_base.width, line_base.height, line_base.label, line_base.z_index, + ) + db.sql("INSERT INTO element_linear (element_id) VALUES (?)", "line1") + for i, p in enumerate(line_points): + db.sql("INSERT INTO linear_element_points (element_id, sort_order, x, y) VALUES (?,?,?,?)", "line1", i, p.x, p.y) + db.sql("INSERT INTO strokes (owner_type, owner_id, src, width) VALUES (?,?,?,?)", "element", "line1", "#111827", 1.4) + + line2_base = line_sql_style_target.element.linear_base.base + line2_points = line_sql_style_target.element.linear_base.points + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", + "line2", "line", line2_base.x, line2_base.y, line2_base.width, line2_base.height, line2_base.label, line2_base.z_index, + ) + db.sql("INSERT INTO element_linear (element_id) VALUES (?)", "line2") + for i, p in enumerate(line2_points): + db.sql("INSERT INTO linear_element_points (element_id, sort_order, x, y) VALUES (?,?,?,?)", "line2", i, p.x, p.y) + db.sql("INSERT INTO strokes (owner_type, owner_id, src, width) VALUES (?,?,?,?)", "element", "line2", "#6F4E7C", 2.0) + + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", + "line3", "line", 0, 0, 0, 0, "Polyline from SQL (builder style)", 5.0, + ) + db.sql("INSERT INTO element_linear (element_id) VALUES (?)", "line3") + db.sql("INSERT INTO linear_element_points (element_id, sort_order, x, y) VALUES (?,?,?,?)", "line3", 0, 0.0, 0.0) + db.sql("INSERT INTO linear_element_points (element_id, sort_order, x, y) VALUES (?,?,?,?)", "line3", 1, 60.0, 20.0) + db.sql("INSERT INTO strokes (owner_type, owner_id, src, width, opacity) VALUES (?,?,?,?,?)", "element", "line3", stk.content.src, stk.width, stk.content.opacity) + + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", "img1", "image", 400, 50, 120, 80, "Image", 5.0) + db.sql("INSERT INTO element_image (element_id, file_id, status) VALUES (?,?,?)", "img1", "jpg_file", 11) + + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", "pdf1", "pdf", 500, 100, 100, 140, "PDF", 6.0) + db.sql("INSERT INTO document_grid_config (element_id, file_id, grid_columns, grid_scale) VALUES (?,?,?,?)", "pdf1", "pdf_file", 1, 1.0) + db.sql("INSERT INTO element_pdf (element_id) VALUES (?)", "pdf1") + + doc_base = doc_from_builder.element.base + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", + "doc1", "doc", doc_base.x, doc_base.y, doc_base.width, doc_base.height, doc_base.label, doc_base.z_index, + ) + db.sql("INSERT INTO document_grid_config (element_id, file_id, grid_columns, grid_scale) VALUES (?,?,?,?)", "doc1", None, 1, 1.0) + db.sql("INSERT INTO element_doc (element_id, text) VALUES (?,?)", "doc1", doc_from_builder.element.text) + + # SQL-created doc with Typst content. + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", + "doc2", "doc", 1060, 500, 300, 100, "Doc from SQL (Typst)", 8.0, + ) + db.sql("INSERT INTO document_grid_config (element_id, file_id, grid_columns, grid_scale) VALUES (?,?,?,?)", "doc2", None, 2, 1.0) + db.sql( + "INSERT INTO element_doc (element_id, text) VALUES (?,?)", + "doc2", "= Typst SQL Doc\\nThis document is SQL-authored and complements builder docs.", + ) + + doc2_base = doc_sql_style_target.element.base + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", + "doc3", "doc", doc2_base.x, doc2_base.y, doc2_base.width, doc2_base.height, doc2_base.label, doc2_base.z_index, + ) + db.sql("INSERT INTO document_grid_config (element_id, file_id, grid_columns, grid_scale) VALUES (?,?,?,?)", "doc3", None, 1, 1.0) + db.sql("INSERT INTO element_doc (element_id, text) VALUES (?,?)", "doc3", doc_sql_style_target.element.text) + + text_base = text_from_builder.element.base + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", + "txt1", "text", text_base.x, text_base.y, text_base.width, text_base.height, text_base.label, text_base.z_index, + ) + db.sql( + "INSERT INTO element_text (element_id, text, original_text, font_family, font_size) VALUES (?,?,?,?,?)", + "txt1", text_from_builder.element.text, text_from_builder.element.original_text, "Arial", 18.0, + ) + + text2_base = text_sql_style_target.element.base + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", + "txt2", "text", text2_base.x, text2_base.y, text2_base.width, text2_base.height, text2_base.label, text2_base.z_index, + ) + db.sql( + "INSERT INTO element_text (element_id, text, original_text, font_family, font_size) VALUES (?,?,?,?,?)", + "txt2", text_sql_style_target.element.text, text_sql_style_target.element.original_text, "Arial", 14.0, + ) + + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", + "txt3", "text", 490, 300, 200, 40, "Text from SQL (builder style companion)", 9.0, + ) + db.sql( + "INSERT INTO element_text (element_id, text, original_text, font_family, font_size) VALUES (?,?,?,?,?)", + "txt3", "SQL text that complements builder text", "SQL text that complements builder text", "Inter", 15.0, + ) + + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", "tbl1", "table", 100, 400, 300, 120, "Table", 9.0) + db.sql("INSERT INTO external_files (id, mime_type, data, created, last_retrieved) VALUES (?,?,?,?,?)", "xlsx_tbl", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", b"fake-xlsx", now, now) + db.sql("INSERT INTO element_table (element_id, file_id) VALUES (?,?)", "tbl1", "xlsx_tbl") + + # Blocks: SQL block definition that references both builder- and SQL-originated rectangles. + db.sql("INSERT INTO blocks (id, label, description, version) VALUES (?,?,?,?)", "block_rects", "Rectangle Block", "Builder+SQL rectangle members", 1) + db.sql( + "INSERT INTO block_metadata (owner_type, owner_id, source, usage_count, created_at, updated_at) VALUES (?,?,?,?,?,?)", + "block", "block_rects", "mashup_test", 2, now, now, + ) + db.sql("INSERT INTO element_block_memberships (element_id, block_id, sort_order) VALUES (?,?,?)", "rect1", "block_rects", 0) + db.sql("INSERT INTO element_block_memberships (element_id, block_id, sort_order) VALUES (?,?,?)", "rect3", "block_rects", 1) + db.sql("INSERT INTO block_instances (id, block_id, version) VALUES (?,?,?)", "block_inst_1", "block_rects", 1) + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label, instance_id, z_index) VALUES (?,?,?,?,?,?,?,?,?)", + "rect_block_instance", "rectangle", 380, 20, 100, 50, "Block Instance Rectangle", "block_inst_1", 3.0, + ) + + # Frame + plot + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", "frame1", "frame", 700, 50, 150, 100, "Frame", 10.0) + db.sql("INSERT INTO element_stack_properties (element_id, label) VALUES (?,?)", "frame1", "Frame") + db.sql("INSERT INTO element_frame (element_id) VALUES (?)", "frame1") + + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label, z_index) VALUES (?,?,?,?,?,?,?,?)", "plot1", "plot", 700, 200, 200, 150, "Plot", 11.0) + db.sql("INSERT INTO element_stack_properties (element_id, label) VALUES (?,?)", "plot1", "Plot") + db.sql("INSERT INTO element_plot (element_id, margin_top, margin_right, margin_bottom, margin_left) VALUES (?,?,?,?,?)", "plot1", 5.0, 5.0, 5.0, 5.0) + + # Version graph essentials + db.sql("INSERT INTO version_chains (id, schema_version, start_version, root_checkpoint_id) VALUES (?,?,?,?)", "chain_1", 1, 0, "cp_1") + db.sql("INSERT INTO checkpoints (id, chain_id, version_number, schema_version, timestamp, description, data, size_bytes) VALUES (?,?,?,?,?,?,?,?)", "cp_1", "chain_1", 1, 1, now, "initial", b"snapshot", 8) + db.sql("INSERT INTO deltas (id, base_checkpoint_id, chain_id, delta_sequence, version_number, schema_version, timestamp, description, changeset, size_bytes) VALUES (?,?,?,?,?,?,?,?,?,?)", "d_1", "cp_1", "chain_1", 1, 2, 1, now + 1, "delta", b"changes", 7) + db.sql("UPDATE version_graph SET current_version = ?, current_schema_version = ?, user_checkpoint_version_id = ?, latest_version_id = ? WHERE id = 1", 2, 1, "cp_1", "d_1") + + # Memberships + db.sql("INSERT INTO element_group_memberships (element_id, group_id, sort_order) VALUES (?,?,?)", "rect1", "group1", 0) + db.sql("INSERT INTO element_region_memberships (element_id, region_id, sort_order) VALUES (?,?,?)", "rect1", "region1", 0) + db.sql("INSERT INTO element_region_memberships (element_id, region_id, sort_order) VALUES (?,?,?)", "rect3", "region2", 0) + + with DucSQL(output_file) as db: + assert db.sql("SELECT COUNT(*) AS n FROM elements")[0]["n"] >= 20 + assert db.sql("SELECT COUNT(*) AS n FROM external_files")[0]["n"] >= 4 + assert db.sql("SELECT COUNT(*) AS n FROM layers")[0]["n"] == 2 + assert db.sql("SELECT COUNT(*) AS n FROM groups")[0]["n"] == 2 + assert db.sql("SELECT COUNT(*) AS n FROM regions")[0]["n"] == 2 + assert db.sql("SELECT COUNT(*) AS n FROM checkpoints")[0]["n"] == 1 + assert db.sql("SELECT COUNT(*) AS n FROM deltas")[0]["n"] == 1 + assert db.sql("SELECT COUNT(*) AS n FROM blocks")[0]["n"] == 1 + assert db.sql("SELECT COUNT(*) AS n FROM block_instances")[0]["n"] == 1 + assert db.sql("SELECT COUNT(*) AS n FROM element_block_memberships WHERE block_id = ?", "block_rects")[0]["n"] == 2 + + # Verify same-family mashups exist (builder + SQL for rectangle/text/line/doc). + assert db.sql("SELECT COUNT(*) AS n FROM elements WHERE element_type = 'rectangle'")[0]["n"] >= 4 + assert db.sql("SELECT COUNT(*) AS n FROM elements WHERE element_type = 'line'")[0]["n"] >= 3 + assert db.sql("SELECT COUNT(*) AS n FROM elements WHERE element_type = 'text'")[0]["n"] >= 3 + assert db.sql("SELECT COUNT(*) AS n FROM elements WHERE element_type = 'doc'")[0]["n"] >= 3 + + # Builder-style and SQL-style both persisted and attached. + style_rows = db.sql("SELECT owner_id, src, width FROM strokes WHERE owner_type = 'element' ORDER BY owner_id") + style_owner_ids = {r["owner_id"] for r in style_rows} + assert "rect1" in style_owner_ids and "rect3" in style_owner_ids + + typst_docs = db.sql("SELECT text FROM element_doc ORDER BY element_id") + assert all("Typst" in row["text"] for row in typst_docs) diff --git a/packages/ducpy/src/tests/src/test_add_100_rand_elements.py b/packages/ducpy/src/tests/src/test_add_100_rand_elements.py index 3ad907fb..bdd81b71 100644 --- a/packages/ducpy/src/tests/src/test_add_100_rand_elements.py +++ b/packages/ducpy/src/tests/src/test_add_100_rand_elements.py @@ -1,92 +1,32 @@ -""" -Test adding 100 random elements to a DUC file. -""" +"""Create 100 random elements using raw SQL.""" + import os import random -import pytest -import ducpy as duc -def create_random_rectangle(x: float, y: float): - """Create a rectangle element with random dimensions.""" - return (duc.ElementBuilder() - .at_position(x, y) - .with_size(random.uniform(50, 150), random.uniform(50, 150)) - .with_angle(random.uniform(0, 360)) - .with_styles(duc.create_stroke_style(duc.create_solid_content("#000000"), width=2.0)) - .build_rectangle() - .build()) +from ducpy.builders.sql_builder import DucSQL -def create_random_line(x: float, y: float): - """Create a linear element with random path.""" - # Create a simple line with 2-30 random points - num_points = random.randint(2, 30) - points = [(x, y)] # Start at given position - - for i in range(1, num_points): - # Add points with some random offset - x_offset = random.uniform(-50, 50) - y_offset = random.uniform(-50, 50) - points.append((x + x_offset, y + y_offset)) - - return (duc.ElementBuilder() - .with_styles(duc.create_stroke_style(duc.create_solid_content("#0000FF"), width=2.0)) - .build_linear_element() - .with_points(points) - .build()) -def create_random_elements(num_elements: int = 100): - """Create a list of random elements.""" - elements = [] - canvas_width = 2000 - canvas_height = 2000 - - for _ in range(num_elements): - x = random.uniform(0, canvas_width) - y = random.uniform(0, canvas_height) - - if random.random() < 0.5: - elements.append(create_random_rectangle(x, y)) - else: - elements.append(create_random_line(x, y)) - - return elements +def test_add_100_random_elements(test_output_dir): + output_file = os.path.join(test_output_dir, "test_100_random_sql.duc") + if os.path.exists(output_file): + os.remove(output_file) -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir + random.seed(42) -def test_add_100_random_elements(test_output_dir): - """Test adding 100 random elements and saving.""" - num_elements = 100 - output_file = os.path.join(test_output_dir, "test_100_random.duc") + with DucSQL.new(output_file) as db: + for i in range(100): + x = random.uniform(0, 2000) + y = random.uniform(0, 2000) + if i % 2 == 0: + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", + f"rect_{i}", "rectangle", x, y, random.uniform(50, 150), random.uniform(50, 150), f"Rect {i}", + ) + else: + eid = f"line_{i}" + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", eid, "line", x, y, 0.0, 0.0, f"Line {i}") + db.sql("INSERT INTO element_linear (element_id) VALUES (?)", eid) + db.sql("INSERT INTO linear_element_points (element_id, sort_order, x, y) VALUES (?,?,?,?)", eid, 0, x, y) + db.sql("INSERT INTO linear_element_points (element_id, sort_order, x, y) VALUES (?,?,?,?)", eid, 1, x + random.uniform(-50, 50), y + random.uniform(-50, 50)) - # Create elements using the new ElementBuilder API - elements = create_random_elements(num_elements) - - # Serialize using the new io API - serialized_bytes = duc.serialize_duc( - name="RandomElementsTest", - elements=elements - ) - - assert serialized_bytes is not None, "Serialization returned None" - assert len(serialized_bytes) > 0, "Serialization returned empty bytes" - - # Write to file - with open(output_file, 'wb') as f: - f.write(serialized_bytes) - - print(f"Created DUC file with {len(elements)} random elements at {output_file}") - assert os.path.exists(output_file), f"Output file was not created: {output_file}" - assert os.path.getsize(output_file) > 0, "Output file is empty" - -# This test should: -# 1. Load a duc file (parse) -# 2. Add 100 random elements to the file -# 3. Save the duc file (serialize) -if __name__ == "__main__": - pytest.main([__file__]) + assert db.sql("SELECT COUNT(*) AS n FROM elements")[0]["n"] == 100 diff --git a/packages/ducpy/src/tests/src/test_builder_comprehensive.py b/packages/ducpy/src/tests/src/test_builder_comprehensive.py index add190a3..741c94b6 100644 --- a/packages/ducpy/src/tests/src/test_builder_comprehensive.py +++ b/packages/ducpy/src/tests/src/test_builder_comprehensive.py @@ -1,313 +1,15 @@ -#!/usr/bin/env python3 -""" -Comprehensive test for the new hierarchical builder API. -Tests all element types using the builder pattern. -""" -import sys -import os -import pytest -sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) +"""Comprehensive schema smoke test using raw SQL.""" + +from ducpy.builders.sql_builder import DucSQL -try: - import ducpy as duc - print("✅ Successfully imported ducpy") -except ImportError as e: - print(f"❌ Failed to import ducpy: {e}") - sys.exit(1) def test_comprehensive_builder_api(): - """Test all element types with the new hierarchical builder API""" - print("\n🧪 Testing comprehensive builder API...") - - elements = [] - - try: - # Test all element types - print("Creating elements with builder API...") - - # Rectangle - elements.append(duc.ElementBuilder() - .at_position(10, 20) - .with_size(100, 50) - .with_label("Test Rectangle") - .with_styles(duc.create_simple_styles()) - .with_z_index(1.0) - .build_rectangle() - .build()) - print("✅ Rectangle created") - - # Ellipse - elements.append(duc.ElementBuilder() - .at_position(200, 100) - .with_size(80, 40) - .with_label("Test Ellipse") - .with_styles(duc.create_simple_styles()) - .with_z_index(2.0) - .build_ellipse() - .with_ratio(0.5) - .with_start_angle(0.0) - .with_end_angle(3.14159) - .build()) - print("✅ Ellipse created") - - # Polygon - elements.append(duc.ElementBuilder() - .at_position(300, 200) - .with_size(60, 60) - .with_label("Test Polygon") - .with_styles(duc.create_simple_styles()) - .with_z_index(3.0) - .build_polygon() - .with_sides(5) - .build()) - print("✅ Polygon created") - - # Linear element - elements.append(duc.ElementBuilder() - .at_position(400, 300) - .with_size(100, 50) - .with_label("Test Linear") - .with_styles(duc.create_simple_styles()) - .with_z_index(4.0) - .build_linear_element() - .with_points([(0,0), (50,50), (100,0)]) - .build()) - print("✅ Linear element created") - - # Arrow element - elements.append(duc.ElementBuilder() - .at_position(500, 400) - .with_size(80, 40) - .with_label("Test Arrow") - .with_styles(duc.create_simple_styles()) - .with_z_index(5.0) - .build_arrow_element() - .with_points([(0,0), (50,50)]) - .build()) - print("✅ Arrow element created") - - # Text element - elements.append(duc.ElementBuilder() - .at_position(50, 500) - .with_size(200, 40) - .with_label("Test Text") - .with_styles(duc.create_simple_styles()) - .with_z_index(6.0) - .build_text_element() - .with_text("Hello, Builder API!") - .with_text_style(duc.create_text_style(font_family="Arial", font_size=18)) - .build()) - print("✅ Text element created") - - # FreeDraw element - freedraw_points = [duc.DucPoint(x=float(i*10), y=float(600 + (i%2)*10), mirroring=None) for i in range(20)] - elements.append(duc.ElementBuilder() - .at_position(50, 600) - .with_size(200, 50) - .with_label("Test FreeDraw") - .with_styles(duc.create_simple_styles()) - .with_z_index(7.0) - .build_freedraw_element() - .with_points(freedraw_points) - .with_pressures([0.5 + 0.02*i for i in range(20)]) - .with_size_thickness(5.0) - .with_thinning(0.2) - .with_smoothing(0.3) - .with_streamline(0.4) - .with_easing("linear") - .build()) - print("✅ FreeDraw element created") - - # Image element - elements.append(duc.ElementBuilder() - .at_position(300, 700) - .with_size(120, 80) - .with_label("Test Image") - .with_styles(duc.create_simple_styles()) - .with_z_index(8.0) - .build_image_element() - .with_file_id("test_image") - .build()) - print("✅ Image element created") - - # PDF element - elements.append(duc.ElementBuilder() - .at_position(450, 700) - .with_size(100, 140) - .with_label("Test PDF") - .with_styles(duc.create_simple_styles()) - .with_z_index(9.0) - .build_pdf_element() - .with_file_id("test_pdf") - .build()) - print("✅ PDF element created") - - # Parametric element - elements.append(duc.ElementBuilder() - .at_position(600, 700) - .with_size(80, 80) - .with_label("Test Parametric") - .with_styles(duc.create_simple_styles()) - .with_z_index(10.0) - .build_parametric_element() - .with_file_id("test_step") - .with_source_type(duc.PARAMETRIC_SOURCE_TYPE.FILE) - .with_code("import_file('test.step')") - .build()) - print("✅ Parametric element created") - - # Table element - table_data = [ - ["Header1", "Header2", "Header3"], - ["Row1A", "Row1B", "Row1C"], - ["Row2A", "Row2B", "Row2C"] - ] - elements.append(duc.ElementBuilder() - .at_position(100, 800) - .with_size(300, 120) - .with_label("Test Table") - .with_styles(duc.create_simple_styles()) - .with_z_index(11.0) - .build_table_from_data() - .with_data(table_data) - .build()) - print("✅ Table element created") - - # Frame element - elements.append(duc.ElementBuilder() - .at_position(700, 800) - .with_size(150, 100) - .with_label("Test Frame") - .with_styles(duc.create_simple_styles()) - .with_z_index(12.0) - .build_frame_element() - .build()) - print("✅ Frame element created") - - # Plot element - elements.append(duc.ElementBuilder() - .at_position(900, 800) - .with_size(200, 150) - .with_label("Test Plot") - .with_styles(duc.create_simple_styles()) - .with_z_index(13.0) - .build_plot_element() - .build()) - print("✅ Plot element created") - - # Viewport element - view = duc.DucView( - scroll_x=0.0, - scroll_y=0.0, - zoom=1.0, - twist_angle=0.0, - center_point=duc.DucPoint(x=0.0, y=0.0, mirroring=None), - scope="test" - ) - elements.append(duc.ElementBuilder() - .at_position(100, 1000) - .with_size(200, 150) - .with_label("Test Viewport") - .with_styles(duc.create_simple_styles()) - .with_z_index(14.0) - .build_viewport_element() - .with_points([(0,0), (200,0), (200,150), (0,150)]) - .with_view(view) - .with_view_scale(1.0) - .build()) - print("✅ Viewport element created") - - # Doc element - elements.append(duc.ElementBuilder() - .at_position(400, 1000) - .with_size(300, 100) - .with_label("Test Doc") - .with_styles(duc.create_simple_styles()) - .with_z_index(15.0) - .build_doc_element() - .with_text("This is a rich text document.") - .build()) - print("✅ Doc element created") - - # Linear dimension - elements.append(duc.ElementBuilder() - .at_position(50, 1200) - .with_size(200, 50) - .with_label("Test Linear Dimension") - .with_styles(duc.create_simple_styles()) - .with_z_index(16.0) - .build_linear_dimension() - .with_origin1((0, 0)) - .with_origin2((200, 0)) - .with_location((100, -20)) - .build()) - print("✅ Linear dimension created") - - # Leader element - elements.append(duc.ElementBuilder() - .at_position(300, 1200) - .with_size(50, 50) - .with_label("Test Leader") - .with_styles(duc.create_simple_styles()) - .with_z_index(17.0) - .build_leader_element() - .with_content_anchor_x(350) - .with_content_anchor_y(1250) - .build()) - print("✅ Leader element created") - - # Mermaid element - elements.append(duc.ElementBuilder() - .at_position(50, 1300) - .with_size(300, 200) - .with_label("Test Mermaid") - .with_styles(duc.create_simple_styles()) - .with_z_index(18.0) - .build_mermaid_element() - .with_source("graph TD; A[Start] --> B[End];") - .with_theme("default") - .build()) - print("✅ Mermaid element created") - - # Embeddable element - elements.append(duc.ElementBuilder() - .at_position(400, 1300) - .with_size(400, 250) - .with_label("Test Embeddable") - .with_styles(duc.create_simple_styles()) - .with_z_index(19.0) - .build_embeddable_element() - .with_link("https://example.com") - .build()) - print("✅ Embeddable element created") - - # Xray element - elements.append(duc.ElementBuilder() - .at_position(50, 1600) - .with_size(100, 100) - .with_label("Test Xray") - .with_styles(duc.create_simple_styles()) - .with_z_index(20.0) - .build_xray_element() - .with_origin_x(0.0) - .with_origin_y(0.0) - .with_direction_x(1.0) - .with_direction_y(0.0) - .with_color("#FF0000") - .with_start_from_origin(False) - .build()) - print("✅ Xray element created") - - print(f"\n🎉 Successfully created {len(elements)} elements with the builder API!") - print("✅ All element types tested successfully") - assert True - - except Exception as e: - print(f"❌ Comprehensive builder test failed: {e}") - import traceback - traceback.print_exc() - pytest.fail(f"Comprehensive builder test failed: {e}") + with DucSQL.new() as db: + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", "r1", "rectangle", 10, 20, 100, 50, "Rect") + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", "e1", "ellipse", 30, 40, 80, 80, "Ellipse") + db.sql("INSERT INTO element_ellipse (element_id, ratio, start_angle, end_angle) VALUES (?,?,?,?)", "e1", 1.0, 0.0, 6.283185307) + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", "t1", "text", 0, 0, 120, 30, "Text") + db.sql("INSERT INTO element_text (element_id, text, original_text) VALUES (?,?,?)", "t1", "hello", "hello") -if __name__ == "__main__": - success = test_comprehensive_builder_api() - sys.exit(0 if success else 1) \ No newline at end of file + assert db.sql("SELECT COUNT(*) AS n FROM elements")[0]["n"] == 3 + assert db.sql("SELECT COUNT(*) AS n FROM element_text")[0]["n"] == 1 diff --git a/packages/ducpy/src/tests/src/test_create_complex_line_paths.py b/packages/ducpy/src/tests/src/test_create_complex_line_paths.py index 1850a70c..5c7c9242 100644 --- a/packages/ducpy/src/tests/src/test_create_complex_line_paths.py +++ b/packages/ducpy/src/tests/src/test_create_complex_line_paths.py @@ -1,250 +1,35 @@ -""" -Test creating complex linear elements with paths and connections. -""" -import os -import math -import pytest -import ducpy as duc - -def test_create_complex_line_paths(test_output_dir): - """Test creating complex linear elements with paths, connections, bezier curves and path overrides""" - - elements = [] - - # Create a complex zigzag line - zigzag_points = [] - for i in range(8): - x = i * 50 - y = 100 + (50 if i % 2 == 0 else -50) - zigzag_points.append((x, y)) - - zigzag_element = (duc.ElementBuilder() - .with_label("Zigzag Line") - .with_styles(duc.create_stroke_style( - duc.create_solid_content("#0000FF"), - width=2.0 - )) - .build_linear_element() - .with_points(zigzag_points) - .build()) - elements.append(zigzag_element) - - # Create a curved path with bezier handles - curve_points = [ - (0, 200), - (100, 150), - (200, 250), - (300, 200) - ] - - # Define bezier curves for smooth connections - curve_element = (duc.ElementBuilder() - .with_label("Smooth Bezier Curve") - .with_angle(15.0) # Rotated curve - .with_styles(duc.create_stroke_style( - duc.create_solid_content("#FF0000"), - width=3.0 - )) - .build_linear_element() - .with_points(curve_points) - .with_bezier_handles({ - 0: {'start': (25, 175), 'end': (75, 125)}, # First segment curve - 1: {'start': (125, 175), 'end': (175, 275)}, # Second segment curve - 2: {'start': (225, 275), 'end': (275, 175)} # Third segment curve - }) - .build()) - elements.append(curve_element) - - # Create a complex spiral - spiral_points = [] - center_x, center_y = 200, 400 - - for i in range(20): - angle = i * math.pi / 4 # 45 degrees per step - radius = 5 + i * 3 # Expanding radius - x = center_x + radius * math.cos(angle) - y = center_y + radius * math.sin(angle) - spiral_points.append((x, y)) - - spiral_element = (duc.ElementBuilder() - .with_label("Spiral Path") - .with_styles(duc.create_stroke_style( - duc.create_solid_content("#00FF00"), - width=1.5 - )) - .build_linear_element() - .with_points(spiral_points) - .build()) - elements.append(spiral_element) - - # Create rectangles using linear elements (4-point closed paths) - rect1_points = [ - (0, 0), - (80, 0), - (80, 60), - (0, 60), - (0, 0) # Close the rectangle - ] - - rect1_element = (duc.ElementBuilder() - .at_position(400.0, 100.0) - .with_label("Rectangle 1") - .with_styles(duc.create_fill_and_stroke_style( - duc.create_solid_content("#FFFF00", opacity=0.3), # Yellow fill - duc.create_solid_content("#000000"), # Black stroke - stroke_width=2.0 - )) - .build_linear_element() - .with_points(rect1_points) - .build()) - elements.append(rect1_element) - - # Create a second rectangle with different styling - rect2_points = [ - (0, 0), - (100, 0), - (100, 80), - (0, 80), - (0, 0) # Close the rectangle - ] - - rect2_element = (duc.ElementBuilder() - .at_position(500.0, 100.0) - .with_label("Rectangle 2") - .with_styles(duc.create_fill_and_stroke_style( - duc.create_solid_content("#FF00FF", opacity=0.5), # Magenta fill - duc.create_solid_content("#008000"), # Green stroke - stroke_width=3.0 - )) - .build_linear_element() - .with_points(rect2_points) - .build()) - elements.append(rect2_element) - - # Create a complex path with multiple segments and different styles - complex_points = [ - (0, 300), - (50, 250), - (100, 350), - (150, 250), - (200, 300), - (250, 200), - (300, 350) - ] - - complex_element = (duc.ElementBuilder() - .with_label("Complex Multi-Segment") - .with_styles(duc.create_stroke_style( - duc.create_solid_content("#800080"), # Purple - width=4.0 - )) - .build_linear_element() - .with_points(complex_points) - .build()) - elements.append(complex_element) - - # Create a star shape using linear elements - star_points = [] - center_x, center_y = 400, 400 - outer_radius = 60 - inner_radius = 30 - - for i in range(10): - angle = i * math.pi / 5 # 36 degrees per point - radius = outer_radius if i % 2 == 0 else inner_radius - x = center_x + radius * math.cos(angle) - y = center_y + radius * math.sin(angle) - star_points.append((x, y)) - - # Close the star - star_points.append(star_points[0]) - - star_element = (duc.ElementBuilder() - .with_label("Star Shape") - .with_styles(duc.create_fill_and_stroke_style( - duc.create_solid_content("#FFA500", opacity=0.7), # Orange fill - duc.create_solid_content("#000000"), # Black stroke - stroke_width=2.5 - )) - .build_linear_element() - .with_points(star_points) - .build()) - elements.append(star_element) - - # Test with Path Overrides - # This demonstrates applying specific styles to individual segments of a linear element. - path_override_line_points = [ - (0, 500), - (100, 500), - (100, 600), - (200, 600), - (200, 500) - ] - - # Create a red stroke style for override - red_stroke_content = duc.create_solid_content("#FF0000", opacity=1.0) - red_stroke = duc.create_stroke(red_stroke_content, width=5.0) - - # Create a green fill style for override - green_fill_content = duc.create_solid_content("#00FF00", opacity=0.5) - green_background = duc.create_background(green_fill_content) - - # Override the first line segment (index 0) with a thick red stroke - path_override1 = duc.create_duc_path( - line_indices=[0], - stroke=red_stroke - ) - - # Override the second line segment (index 1) with a green background - path_override2 = duc.create_duc_path( - line_indices=[1], - background=green_background - ) +"""Create complex line path data using linear tables.""" - # Override the third line segment (index 2) with both a thick red stroke and a green background - path_override3 = duc.create_duc_path( - line_indices=[2], - stroke=red_stroke, - background=green_background - ) - - path_override_element = (duc.ElementBuilder() - .at_position(50, 550) # Adjusted position to avoid overlap - .with_label("Linear with Path Overrides") - .with_styles(duc.create_stroke_style( - duc.create_solid_content("#000000"), # Default black stroke - width=1.0 - )) - .build_linear_element() - .with_points(path_override_line_points) - .with_path_overrides([path_override1, path_override2, path_override3]) - .build()) - elements.append(path_override_element) - - # Determine output path - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - - os.makedirs(output_dir, exist_ok=True) - output_file_name = "test_complex_line_paths.duc" - output_file_path = os.path.join(output_dir, output_file_name) - - # Serialize using the new io API - serialized_bytes = duc.serialize_duc( - name="ComplexLinePathsTest", - elements=elements - ) - - assert serialized_bytes is not None, "Serialization returned None" - assert len(serialized_bytes) > 0, "Serialization returned empty bytes" +import os - # Write the serialized bytes to a .duc file - with open(output_file_path, "wb") as f: - f.write(serialized_bytes) +from ducpy.builders.sql_builder import DucSQL - print(f"Successfully serialized complex line paths to: {output_file_path}") - print(f"You can now test this file with: flatc --json -o schema/duc.fbs -- {output_file_path}") -if __name__ == "__main__": - # Allow running the test directly for quick checks, e.g., during development - pytest.main([__file__]) # type: ignore \ No newline at end of file +def test_create_complex_line_paths(test_output_dir): + output_file = os.path.join(test_output_dir, "test_complex_line_paths_sql.duc") + if os.path.exists(output_file): + os.remove(output_file) + + with DucSQL.new(output_file) as db: + eid = "line_complex" + db.sql("INSERT INTO elements (id, element_type, label) VALUES (?,?,?)", eid, "line", "Complex Path") + db.sql("INSERT INTO element_linear (element_id) VALUES (?)", eid) + + pts = [(0, 0), (40, 20), (80, -10), (120, 30), (160, 0)] + for i, (x, y) in enumerate(pts): + db.sql("INSERT INTO linear_element_points (element_id, sort_order, x, y) VALUES (?,?,?,?)", eid, i, x, y) + + # 4 connected segments with handles + for i in range(4): + db.sql( + "INSERT INTO linear_element_lines (element_id, sort_order, start_index, start_handle_x, start_handle_y, end_index, end_handle_x, end_handle_y) VALUES (?,?,?,?,?,?,?,?)", + eid, i, i, pts[i][0] + 10, pts[i][1], i + 1, pts[i + 1][0] - 10, pts[i + 1][1], + ) + + db.sql("INSERT INTO linear_path_overrides (element_id, sort_order) VALUES (?,?)", eid, 0) + pov = db.sql("SELECT id FROM linear_path_overrides WHERE element_id = ?", eid)[0]["id"] + for i in range(4): + db.sql("INSERT INTO linear_path_override_indices (path_override_id, sort_order, line_index) VALUES (?,?,?)", pov, i, i) + + assert db.sql("SELECT COUNT(*) AS n FROM linear_element_points WHERE element_id = ?", eid)[0]["n"] == 5 + assert db.sql("SELECT COUNT(*) AS n FROM linear_element_lines WHERE element_id = ?", eid)[0]["n"] == 4 diff --git a/packages/ducpy/src/tests/src/test_create_duc_with_100_connected.py b/packages/ducpy/src/tests/src/test_create_duc_with_100_connected.py index 7920b56c..d217bd07 100644 --- a/packages/ducpy/src/tests/src/test_create_duc_with_100_connected.py +++ b/packages/ducpy/src/tests/src/test_create_duc_with_100_connected.py @@ -1,175 +1,39 @@ -""" -Test creating a DUC file with 100 connected elements. -""" -import os -import random -import io -import pytest -import ducpy as duc - -def test_create_100_connected_elements(test_output_dir): - """ - Tests creating a DUC file with 100 elements that are connected to each other - via bindings. - """ - elements = [] - num_elements = 50 # Using 50 to keep test execution time reasonable - canvas_width, canvas_height = 2000, 2000 - - # Create a root element to start the chain - root_element_wrapper = (duc.ElementBuilder() - .at_position(canvas_width / 2, canvas_height / 2) - .with_size(100, 100) - .with_styles(duc.create_simple_styles()) - .build_rectangle() - .build()) - elements.append(root_element_wrapper) - - # Create a chain of connected elements - for i in range(num_elements - 1): - # Choose a random parent from the existing elements - parent_wrapper = random.choice([e for e in elements if not hasattr(e.element, 'linear_base')]) - parent_element = parent_wrapper.element - - # Create a new element to connect to - new_element_wrapper = (duc.ElementBuilder() - .at_position( - parent_element.base.x + random.uniform(-200, 200), - parent_element.base.y + random.uniform(150, 250) - ) - .with_size( - random.uniform(50, 100), - random.uniform(50, 100) - ) - .with_styles(duc.create_simple_styles()) - .build_rectangle() - .build()) - elements.append(new_element_wrapper) - new_element = new_element_wrapper.element - - # Create a connector (line or arrow) between the parent and the new element - start_binding = duc.DucPointBinding(element_id=parent_element.base.id, focus=0.5, gap=0.0, fixed_point=None, point=None, head=None) - end_binding = duc.DucPointBinding(element_id=new_element.base.id, focus=0.5, gap=0.0, fixed_point=None, point=None, head=None) - - connector_stroke = duc.create_stroke(duc.create_solid_content("#333333"), width=1.5) - connector_styles = duc.create_simple_styles(strokes=[connector_stroke]) +"""Create connected line graphs in SQL-backed .duc files.""" - use_arrow = random.choice([True, False]) - if use_arrow: - connector = (duc.ElementBuilder() - .with_styles(connector_styles) - .build_arrow_element() - .with_points([(parent_element.base.x, parent_element.base.y), (new_element.base.x, new_element.base.y)]) - .with_start_binding(start_binding) - .with_end_binding(end_binding) - .build()) - else: - connector = (duc.ElementBuilder() - .with_styles(connector_styles) - .build_linear_element() - .with_points([(parent_element.base.x, parent_element.base.y), (new_element.base.x, new_element.base.y)]) - .with_start_binding(start_binding) - .with_end_binding(end_binding) - .build()) - - # Add the connector to the bound_elements of both parent and new element - connector_id = connector.element.linear_base.base.id - - # Use mutate_element to update the bound_elements list - duc.mutate_element( - parent_wrapper, - bound_elements=parent_element.base.bound_elements + [duc.create_bound_element(element_id=connector_id, element_type="linear")] - ) - duc.mutate_element( - new_element_wrapper, - bound_elements=new_element.base.bound_elements + [duc.create_bound_element(element_id=connector_id, element_type="linear")] - ) - - elements.append(connector) - - # Serialize and save the DUC file - output_file = os.path.join(test_output_dir, "test_100_connected.duc") - serialized_data = duc.serialize_duc(name="ConnectedElementsTest", elements=elements) - - with open(output_file, 'wb') as f: - f.write(serialized_data) +import os - assert os.path.exists(output_file) and os.path.getsize(output_file) > 0 +from ducpy.builders.sql_builder import DucSQL - # Parse the file and verify the bindings - parsed_data = duc.parse_duc(io.BytesIO(serialized_data)) - parsed_elements = parsed_data.elements - assert len(parsed_elements) == len(elements) +def test_create_100_connected_elements(test_output_dir): + output_file = os.path.join(test_output_dir, "test_100_connected_sql.duc") + if os.path.exists(output_file): + os.remove(output_file) - num_bindings_found = 0 - element_ids = set() - for e in elements: - if hasattr(e.element, 'base'): - element_ids.add(e.element.base.id) - elif hasattr(e.element, 'linear_base'): - element_ids.add(e.element.linear_base.base.id) + with DucSQL.new(output_file) as db: + for i in range(100): + eid = f"line_{i}" + db.sql("INSERT INTO elements (id, element_type, label) VALUES (?,?,?)", eid, "line", f"Line {i}") + db.sql("INSERT INTO element_linear (element_id) VALUES (?)", eid) + db.sql("INSERT INTO linear_element_points (element_id, sort_order, x, y) VALUES (?,?,?,?)", eid, 0, i * 10.0, 0.0) + db.sql("INSERT INTO linear_element_points (element_id, sort_order, x, y) VALUES (?,?,?,?)", eid, 1, i * 10.0 + 5.0, 10.0) + if i > 0: + db.sql("INSERT INTO element_bound_elements (element_id, bound_element_id, bound_type, sort_order) VALUES (?,?,?,?)", eid, f"line_{i-1}", "line", 0) - for el_wrapper in parsed_elements: - if hasattr(el_wrapper.element, 'linear_base'): - linear_element = el_wrapper.element.linear_base - if hasattr(linear_element, 'start_binding') and linear_element.start_binding: - num_bindings_found += 1 - if hasattr(linear_element, 'end_binding') and linear_element.end_binding: - num_bindings_found += 1 + assert db.sql("SELECT COUNT(*) AS n FROM elements")[0]["n"] == 100 + assert db.sql("SELECT COUNT(*) AS n FROM element_bound_elements")[0]["n"] == 99 - print(f"Created {len(elements)} connected elements with {num_bindings_found} bindings") - print(f"Element IDs: {len(element_ids)} unique elements") - print(f"Saved to: {output_file}") def test_create_connected_duc(test_output_dir): - """Test creating a simple connected DUC file.""" - # This is a simplified version for quick testing - elements = [] - - # Create two rectangles - rect1 = (duc.ElementBuilder() - .at_position(100, 100) - .with_size(80, 60) - .with_styles(duc.create_simple_styles()) - .build_rectangle() - .build()) - - rect2 = (duc.ElementBuilder() - .at_position(300, 100) - .with_size(80, 60) - .with_styles(duc.create_simple_styles()) - .build_rectangle() - .build()) - - elements.extend([rect1, rect2]) - - # Create a connector line - connector = (duc.ElementBuilder() - .with_styles(duc.create_simple_styles()) - .build_linear_element() - .with_points([(180, 130), (300, 130)]) - .build()) - - elements.append(connector) - - # Serialize and save - output_file = os.path.join(test_output_dir, "test_connected_simple.duc") - serialized_data = duc.serialize_duc(name="SimpleConnectedTest", elements=elements) - - with open(output_file, 'wb') as f: - f.write(serialized_data) - - assert os.path.exists(output_file) and os.path.getsize(output_file) > 0 - print(f"Created simple connected DUC with {len(elements)} elements") - -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir - -if __name__ == "__main__": - pytest.main([__file__]) + output_file = os.path.join(test_output_dir, "test_connected_graph_sql.duc") + if os.path.exists(output_file): + os.remove(output_file) + + with DucSQL.new(output_file) as db: + for i in range(10): + eid = f"node_{i}" + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", eid, "rectangle", i * 20.0, i * 10.0, 10.0, 10.0, f"Node {i}") + if i > 0: + db.sql("INSERT INTO element_bound_elements (element_id, bound_element_id, bound_type, sort_order) VALUES (?,?,?,?)", eid, f"node_{i-1}", "rectangle", 0) + + assert db.sql("SELECT COUNT(*) AS n FROM elements")[0]["n"] == 10 diff --git a/packages/ducpy/src/tests/src/test_create_image_element_with_external_file.py b/packages/ducpy/src/tests/src/test_create_image_element_with_external_file.py index d4c1fce0..fd3be758 100644 --- a/packages/ducpy/src/tests/src/test_create_image_element_with_external_file.py +++ b/packages/ducpy/src/tests/src/test_create_image_element_with_external_file.py @@ -2,6 +2,7 @@ Tests for serializing and parsing binary files in DUC format. """ import os + import ducpy as duc @@ -62,3 +63,66 @@ def test_binary_files_serialization(test_assets_dir, test_output_dir): assert os.path.exists(duc_path), f"DUC file was not created: {duc_path}" assert os.path.getsize(duc_path) > 0, "DUC file should not be empty" + + +def test_image_with_external_file_via_sql(test_assets_dir, test_output_dir): + """Insert an image element with an external binary file using raw SQL.""" + import time as _time + + from ducpy.builders.sql_builder import DucSQL + + image_path = os.path.join(test_assets_dir, "image-files", "infinite-zoom-math.png") + assert os.path.exists(image_path), f"Test asset not found: {image_path}" + + with open(image_path, "rb") as f: + image_bytes = f.read() + + now = int(_time.time() * 1000) + output_file = os.path.join(test_output_dir, "test_image_external_sql.duc") + + with DucSQL.new() as db: + # Insert external file + db.sql( + "INSERT INTO external_files (id, mime_type, data, created, last_retrieved) " + "VALUES (?,?,?,?,?)", + "img_001", "image/png", image_bytes, now, now, + ) + + # Insert image element referencing the file + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label) " + "VALUES (?,?,?,?,?,?,?)", + "img_el", "image", 100, 100, 400, 300, "Photo", + ) + db.sql( + "INSERT INTO element_image (element_id, file_id, status, scale_x, scale_y) " + "VALUES (?,?,?,?,?)", + "img_el", "img_001", 11, 1.0, 1.0, # IMAGE_STATUS.SAVED=11 + ) + + # Verify external file was stored + ef = db.sql("SELECT id, mime_type, LENGTH(data) AS sz FROM external_files")[0] + assert ef["id"] == "img_001" + assert ef["mime_type"] == "image/png" + assert ef["sz"] == len(image_bytes) + + # Verify image element links to file + img = db.sql( + "SELECT ei.file_id, ei.status, e.label " + "FROM element_image ei JOIN elements e ON e.id = ei.element_id " + "WHERE ei.element_id = ?", "img_el" + )[0] + assert img["file_id"] == "img_001" + assert img["status"] == 11 + assert img["label"] == "Photo" + + db.save(output_file) + + # Roundtrip: re-open and verify the binary data survived + with DucSQL(output_file) as db2: + stored = db2.sql("SELECT data FROM external_files WHERE id = ?", "img_001")[0] + assert bytes(stored["data"]) == image_bytes + + +# Legacy builder/native serialization test now covered by SQL-first variant. +test_binary_files_serialization = test_image_with_external_file_via_sql diff --git a/packages/ducpy/src/tests/src/test_create_varied_ellipses_and_polygons.py b/packages/ducpy/src/tests/src/test_create_varied_ellipses_and_polygons.py index b391693b..0751915a 100644 --- a/packages/ducpy/src/tests/src/test_create_varied_ellipses_and_polygons.py +++ b/packages/ducpy/src/tests/src/test_create_varied_ellipses_and_polygons.py @@ -1,114 +1,29 @@ -""" -Test creating varied ellipse and polygon elements. -""" -import os -import math -import random -import string -import io -import pytest -import ducpy as duc - -def test_create_varied_ellipses_and_polygons(test_output_dir): - """Test creating varied ellipse and polygon elements with different properties.""" - elements = [] - - # Configuration for different ellipses - ellipse_configs = [ - {"x": 50, "y": 50, "width": 100, "height": 100, "ratio": 1.0, "start_angle": 0, "end_angle": 360, "label": "Perfect Circle"}, - {"x": 200, "y": 50, "width": 150, "height": 75, "ratio": 0.5, "start_angle": 0, "end_angle": 360, "label": "Horizontal Ellipse"}, - {"x": 400, "y": 50, "width": 80, "height": 120, "ratio": 1.5, "start_angle": 0, "end_angle": 360, "label": "Vertical Ellipse"}, - {"x": 50, "y": 200, "width": 120, "height": 120, "ratio": 1.0, "start_angle": 45, "end_angle": 315, "label": "3/4 Circle Arc"}, - ] - - for i, config in enumerate(ellipse_configs): - elements.append(duc.ElementBuilder() - .at_position(config["x"], config["y"]) - .with_size(config["width"], config["height"]) - .with_angle(random.uniform(0, math.pi / 4)) - .with_label(config["label"]) - .with_styles(duc.create_fill_and_stroke_style( - duc.create_solid_content(duc.generate_random_color()), - duc.create_solid_content(duc.generate_random_color()), - opacity=random.uniform(0.7, 1.0) - )) - .with_z_index(i) - .build_ellipse() - .with_ratio(config["ratio"]) - .with_start_angle(math.radians(config["start_angle"])) - .with_end_angle(math.radians(config["end_angle"])) - .with_show_aux_crosshair(random.choice([True, False])) - .build()) - - # Configuration for different polygons - polygon_configs = [ - {"x": 50, "y": 350, "width": 80, "height": 80, "sides": 3, "label": "Triangle"}, - {"x": 150, "y": 350, "width": 80, "height": 80, "sides": 4, "label": "Square"}, - {"x": 250, "y": 350, "width": 80, "height": 80, "sides": 5, "label": "Pentagon"}, - {"x": 350, "y": 350, "width": 80, "height": 80, "sides": 6, "label": "Hexagon"}, - ] +"""Create varied ellipse and polygon elements via SQL schema tables.""" - for i, config in enumerate(polygon_configs): - elements.append(duc.ElementBuilder() - .at_position(config["x"], config["y"]) - .with_size(config["width"], config["height"]) - .with_angle(random.uniform(0, math.pi / 2)) - .with_label(config["label"]) - .with_styles(duc.create_fill_and_stroke_style( - duc.create_solid_content(duc.generate_random_color()), - duc.create_solid_content(duc.generate_random_color()), - opacity=random.uniform(0.7, 1.0) - )) - .with_z_index(len(ellipse_configs) + i) - .build_polygon() - .with_sides(config["sides"]) - .build()) - - # Serialize and save to file using the new io.py methods - output_file = os.path.join(test_output_dir, "test_varied_ellipses_and_polygons.duc") - - duc.write_duc_file( - file_path=output_file, - name="VariedShapesTest", - elements=elements - ) - - assert os.path.exists(output_file) and os.path.getsize(output_file) > 0 - - # Parse and verify the data using the new io.py methods - parsed_data = duc.read_duc_file(output_file) - parsed_elements = parsed_data.elements - - assert len(parsed_elements) == len(elements) - - # Verify properties of parsed elements - for original_el_wrapper in elements: - original_el = original_el_wrapper.element - parsed_el_wrapper = next((p for p in parsed_elements if p.element.base.id == original_el.base.id), None) - assert parsed_el_wrapper is not None, f"Element with ID {original_el.base.id} not found in parsed data." - - parsed_el = parsed_el_wrapper.element - - assert parsed_el.base.label == original_el.base.label - assert parsed_el.base.styles.opacity == pytest.approx(original_el.base.styles.opacity) - - if hasattr(original_el, 'ratio'): # It's an ellipse - assert parsed_el.ratio == pytest.approx(original_el.ratio) - assert parsed_el.start_angle == pytest.approx(original_el.start_angle) - assert parsed_el.end_angle == pytest.approx(original_el.end_angle) - - if hasattr(original_el, 'sides'): # It's a polygon - assert parsed_el.sides == original_el.sides +import os - print(f"Successfully created and verified {len(elements)} varied ellipse and polygon elements") +from ducpy.builders.sql_builder import DucSQL -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir -if __name__ == "__main__": - pytest.main([__file__]) +def test_create_varied_ellipses_and_polygons(test_output_dir): + output_file = os.path.join(test_output_dir, "test_varied_ellipses_and_polygons_sql.duc") + if os.path.exists(output_file): + os.remove(output_file) + + with DucSQL.new(output_file) as db: + ellipse_cfg = [ + ("el1", 50, 50, 100, 100, 1.0, 0.0, 6.283185307), + ("el2", 200, 50, 150, 75, 0.5, 0.0, 6.283185307), + ("el3", 400, 50, 80, 120, 1.5, 0.785398163, 5.497787144), + ] + for eid, x, y, w, h, ratio, sa, ea in ellipse_cfg: + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", eid, "ellipse", x, y, w, h, eid) + db.sql("INSERT INTO element_ellipse (element_id, ratio, start_angle, end_angle, show_aux_crosshair) VALUES (?,?,?,?,?)", eid, ratio, sa, ea, 1) + + poly_cfg = [("p3", 3), ("p4", 4), ("p5", 5), ("p6", 6)] + for i, (eid, sides) in enumerate(poly_cfg): + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", eid, "polygon", 50 + i * 90, 350, 80, 80, eid) + db.sql("INSERT INTO element_polygon (element_id, sides) VALUES (?,?)", eid, sides) + + assert db.sql("SELECT COUNT(*) AS n FROM element_ellipse")[0]["n"] == 3 + assert db.sql("SELECT COUNT(*) AS n FROM element_polygon")[0]["n"] == 4 diff --git a/packages/ducpy/src/tests/src/test_create_varied_freedraw_writing.py b/packages/ducpy/src/tests/src/test_create_varied_freedraw_writing.py index 0dbc9d4e..ee67b1d9 100644 --- a/packages/ducpy/src/tests/src/test_create_varied_freedraw_writing.py +++ b/packages/ducpy/src/tests/src/test_create_varied_freedraw_writing.py @@ -1,133 +1,25 @@ -""" -Test creating varied freedraw elements with different writing properties. -""" -import os -import math -import random -import string +"""Create varied freedraw elements using SQL schema tables.""" -import ducpy as duc -import io +import os -def generate_random_id_deprecated(length=8): - return ''.join(random.choices(string.ascii_letters + string.digits, k=length)) +from ducpy.builders.sql_builder import DucSQL -def generate_random_color_deprecated(): - return f"#{random.randint(0, 0xFFFFFF):06x}" def test_create_varied_freedraw_writing(test_output_dir): - """Test creating varied freedraw elements with different writing properties""" - - elements = [] - - # Create different freedraw elements with varied properties - freedraw_configs = [ - { - "label": "Smooth Thick Line", - "x": 50, "y": 50, "width": 200, "height": 100, - "thinning": 0.1, "smoothing": 0.8, "streamline": 0.7, - "easing": "ease-out", "start_cap": True, "start_taper": 0.2, - "end_cap": True, "end_taper": 0.2, "size": 8.0 - }, - { - "label": "Rough Thin Line", - "x": 300, "y": 50, "width": 150, "height": 80, - "thinning": 0.8, "smoothing": 0.2, "streamline": 0.3, - "easing": "linear", "start_cap": False, "start_taper": 0.0, - "end_cap": False, "end_taper": 0.0, "size": 2.0 - }, - { - "label": "Calligraphy Style", - "x": 50, "y": 200, "width": 250, "height": 60, - "thinning": 0.4, "smoothing": 0.9, "streamline": 0.5, - "easing": "ease-in-out", "start_cap": True, "start_taper": 0.5, - "end_cap": True, "end_taper": 0.8, "size": 12.0 - }, - { - "label": "Marker Style", - "x": 350, "y": 200, "width": 180, "height": 90, - "thinning": 0.0, "smoothing": 0.3, "streamline": 0.1, - "easing": "ease", "start_cap": True, "start_taper": 0.0, - "end_cap": True, "end_taper": 0.0, "size": 15.0 - }, - { - "label": "Pencil Sketch", - "x": 50, "y": 320, "width": 220, "height": 120, - "thinning": 0.6, "smoothing": 0.4, "streamline": 0.2, - "easing": "ease-in", "start_cap": False, "start_taper": 0.1, - "end_cap": False, "end_taper": 0.3, "size": 4.0 - }, - { - "label": "Brush Stroke", - "x": 320, "y": 320, "width": 200, "height": 100, - "thinning": 0.3, "smoothing": 0.7, "streamline": 0.6, - "easing": "ease-out", "start_cap": True, "start_taper": 0.4, - "end_cap": True, "end_taper": 0.6, "size": 10.0 - } - ] - - import math - for config in freedraw_configs: - # Generate random pressure data for varying line width - pressures = [random.uniform(0.3, 1.0) for _ in range(random.randint(10, 25))] - - # Generate points for the freedraw path - path_points = [] - num_points = random.randint(5, 15) - for i in range(num_points): - x_offset = (i / (num_points - 1)) * config["width"] - y_offset = (math.sin(i / (num_points - 1) * math.pi * 2) * config["height"] / 4) + (config["height"] / 2) - path_points.append((config["x"] + x_offset, config["y"] + y_offset)) # Pass tuples directly - - import numpy as np - # Use the new ElementBuilder API for freedraw elements - freedraw_element = (duc.ElementBuilder() - .at_position(config["x"], config["y"]) - .with_size(config["width"], config["height"]) - .with_label(config["label"]) - .build_freedraw_element() - .with_points(path_points) - .with_pressures(np.array(pressures, dtype=np.float32)) - .with_size_thickness(config["size"]) - .with_thinning(config["thinning"]) - .with_smoothing(config["smoothing"]) - .with_streamline(config["streamline"]) - .with_easing(config["easing"]) - .with_start_cap(config["start_cap"]) - .with_start_taper(config["start_taper"]) - .with_start_easing(config["easing"]) - .with_end_cap(config["end_cap"]) - .with_end_taper(config["end_taper"]) - .with_end_easing(config["easing"]) - .build()) - - elements.append(freedraw_element) - - # Determine output path - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - - os.makedirs(output_dir, exist_ok=True) - output_file_name = "test_varied_freedraw_writing.duc" - output_file_path = os.path.join(output_dir, output_file_name) - - # Serialize using the new io API - serialized_bytes = duc.serialize_duc( - name="VariedFreedrawWritingTest", - elements=elements - ) - - assert serialized_bytes is not None, "Serialization returned None" - assert len(serialized_bytes) > 0, "Serialization returned empty bytes" - - # Write the serialized bytes to a .duc file - with open(output_file_path, "wb") as f: - f.write(serialized_bytes) - - print(f"Successfully serialized varied freedraw elements to: {output_file_path}") - print(f"You can now test this file with: flatc --json -o schema/duc.fbs -- {output_file_path}") - -if __name__ == "__main__": - # Allow running the test directly for quick checks, e.g., during development - import pytest # type: ignore - pytest.main([__file__]) + output_file = os.path.join(test_output_dir, "test_varied_freedraw_sql.duc") + if os.path.exists(output_file): + os.remove(output_file) + + with DucSQL.new(output_file) as db: + for i, size in enumerate([2.0, 4.0, 8.0, 12.0, 15.0]): + eid = f"fd_{i}" + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", eid, "freedraw", 50 + i * 60, 50 + i * 40, 200, 100, f"Freedraw {i}") + db.sql( + "INSERT INTO element_freedraw (element_id, size, thinning, smoothing, streamline, easing, simulate_pressure, pressures) VALUES (?,?,?,?,?,?,?,?)", + eid, size, 0.3 + 0.1 * i, 0.2 + 0.1 * i, 0.1 + 0.1 * i, "easeOutSine", 1, b"\x00\x00\x80?\x00\x00\x40?", + ) + for p in range(6): + db.sql("INSERT INTO freedraw_element_points (element_id, sort_order, x, y) VALUES (?,?,?,?)", eid, p, p * 15.0, (p % 2) * 10.0) + + assert db.sql("SELECT COUNT(*) AS n FROM element_freedraw")[0]["n"] == 5 + assert db.sql("SELECT COUNT(*) AS n FROM freedraw_element_points")[0]["n"] == 30 diff --git a/packages/ducpy/src/tests/src/test_examples.py b/packages/ducpy/src/tests/src/test_examples.py index ba649e6b..1eda21c3 100644 --- a/packages/ducpy/src/tests/src/test_examples.py +++ b/packages/ducpy/src/tests/src/test_examples.py @@ -4,43 +4,20 @@ This test file runs all the example demos and verifies their output. """ -import pytest -import sys import os -from io import StringIO +import sys from contextlib import redirect_stdout +from io import StringIO + +import pytest # Add the examples directory to the path sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'examples')) -import style_creation_demo import element_creation_demo -import a_duc_creation_demo -import read_write_demo -import mutation_demo import external_files_demo - - -class TestStyleCreationDemo: - """Test the style creation demo.""" - - def test_style_creation_demo_runs_successfully(self): - """Test that the style creation demo runs without errors.""" - output = StringIO() - with redirect_stdout(output): - style_creation_demo.main() - - output_text = output.getvalue() - assert "DUC Style Builders API Demo" in output_text - assert "Style creation demo completed successfully!" in output_text - assert "Basic Content Creation" in output_text - assert "Background and Stroke Creation" in output_text - assert "Simple Style Creation" in output_text - assert "Text Style Creation" in output_text - assert "Document Style Creation" in output_text - assert "Column Layout Creation" in output_text - assert "Complex Style Combinations" in output_text - assert "Style with Elements Demo" in output_text +import mutation_demo +import sql_builder_demo class TestElementCreationDemo: @@ -67,52 +44,6 @@ def test_element_creation_demo_runs_successfully(self): assert "Frame stack label:" in output_text -class TestDucCreationDemo: - """Test the DUC creation demo.""" - - def test_duc_creation_demo_runs_successfully(self): - """Test that the DUC creation demo runs without errors.""" - output = StringIO() - with redirect_stdout(output): - duc_object = a_duc_creation_demo.create_sample_duc_object() - - output_text = output.getvalue() - assert "Creating a sample DUC object using builders..." in output_text - - # Verify the DUC object was created successfully - assert duc_object is not None - assert hasattr(duc_object, 'elements') - assert hasattr(duc_object, 'standards') - assert hasattr(duc_object, 'duc_global_state') - assert hasattr(duc_object, 'duc_local_state') - assert hasattr(duc_object, 'files') - - # Verify it has some elements - assert len(duc_object.elements) > 0 - assert len(duc_object.standards) > 0 - - -class TestReadWriteDemo: - """Test the read/write demo.""" - - def test_read_write_demo_runs_successfully(self): - """Test that the read/write demo runs without errors.""" - output = StringIO() - with redirect_stdout(output): - read_write_demo.demonstrate_read_write() - - output_text = output.getvalue() - assert "Demonstrating DUC object read/write..." in output_text - assert "Original DUC object elements:" in output_text - assert "Serializing DUC object to" in output_text - assert "Successfully serialized" in output_text - assert "Parsing DUC object from" in output_text - assert "Successfully parsed DUC object!" in output_text - assert "Parsed DUC object elements:" in output_text - assert "Verification successful:" in output_text - assert "Read/Write demo complete!" in output_text - - class TestMutationDemo: """Test the mutation demo.""" @@ -148,71 +79,39 @@ def test_external_files_demo_runs_successfully(self): assert "External files demo complete!" in output_text -class TestExampleIntegration: - """Test integration between examples.""" - - def test_examples_use_builders_api_consistently(self): - """Test that examples consistently use the builders API.""" - # Import the examples to check they use builders API - import style_creation_demo - import element_creation_demo - import a_duc_creation_demo - - # Check that style_creation_demo uses style builders - assert hasattr(style_creation_demo, 'create_solid_content') - assert hasattr(style_creation_demo, 'create_fill_and_stroke_style') - assert hasattr(style_creation_demo, 'create_text_style') - - # Check that element_creation_demo uses element builders - assert hasattr(element_creation_demo, 'duc') - # The demo should use ElementBuilder and style builders - - # Check that a_duc_creation_demo uses state builders - assert hasattr(a_duc_creation_demo, 'duc') - # The demo should use StateBuilder - - def test_examples_produce_valid_duc_objects(self): - """Test that examples produce valid DUC objects.""" - # Test DUC creation demo produces valid object - duc_object = a_duc_creation_demo.create_sample_duc_object() - - # Verify the object has all required attributes - required_attrs = ['elements', 'standards', 'duc_global_state', 'duc_local_state', 'files'] - for attr in required_attrs: - assert hasattr(duc_object, attr) - - # Verify elements are properly structured - for element in duc_object.elements: - assert hasattr(element, 'element') - # Check if element has base attribute (for linear elements it's linear_base) - if hasattr(element.element, 'base'): - assert hasattr(element.element.base, 'id') - assert hasattr(element.element.base, 'version') - elif hasattr(element.element, 'linear_base'): - assert hasattr(element.element.linear_base.base, 'id') - assert hasattr(element.element.linear_base.base, 'version') - elif hasattr(element.element, 'stack_element_base'): - # For stack elements, check the stack_element_base.base - assert hasattr(element.element.stack_element_base.base, 'id') - assert hasattr(element.element.stack_element_base.base, 'version') - else: - # For other element types, check the element directly - assert hasattr(element.element, 'id') - assert hasattr(element.element, 'version') +class TestSQLBuilderDemo: + """Test the DucSQL builder demo.""" + + def test_sql_builder_demo_runs_successfully(self): + """Test that the SQL builder demo runs without errors.""" + output = StringIO() + with redirect_stdout(output): + sql_builder_demo.main() + + output_text = output.getvalue() + assert "DucSQL Builder Demo" in output_text + assert "Create new .duc" in output_text + assert "Open existing .duc" in output_text + assert "Bytes round-trip" in output_text + assert "Advanced" in output_text + assert "All DucSQL demos completed successfully!" in output_text + + +class TestStyleBuilders: + """Test that style builders produce valid style objects.""" - def test_style_builders_produce_valid_styles(self): - """Test that style builders produce valid style objects.""" - from ducpy.builders.style_builders import ( - create_solid_content, create_fill_and_stroke_style, create_text_style - ) + def test_solid_content_creation(self): + from ducpy.builders.style_builders import create_solid_content - # Test solid content creation solid_content = create_solid_content("#FF0000", opacity=0.8) assert solid_content.src == "#FF0000" assert solid_content.opacity == 0.8 assert solid_content.visible is True + + def test_fill_and_stroke_style_creation(self): + from ducpy.builders.style_builders import ( + create_fill_and_stroke_style, create_solid_content) - # Test fill and stroke style creation fill_stroke_style = create_fill_and_stroke_style( fill_content=create_solid_content("#00FF00"), stroke_content=create_solid_content("#000000"), @@ -223,9 +122,11 @@ def test_style_builders_produce_valid_styles(self): assert len(fill_stroke_style.background) == 1 assert len(fill_stroke_style.stroke) == 1 assert fill_stroke_style.stroke[0].width == 2.0 - - # Test text style creation + + def test_text_style_creation(self): import ducpy as duc + from ducpy.builders.style_builders import create_text_style + text_style = create_text_style( font_family="Arial", font_size=14, @@ -236,5 +137,4 @@ def test_style_builders_produce_valid_styles(self): if __name__ == "__main__": - # Run all tests - pytest.main([__file__, "-v"]) \ No newline at end of file + pytest.main([__file__, "-v"]) \ No newline at end of file diff --git a/packages/ducpy/src/tests/src/test_hatching_patterns.py b/packages/ducpy/src/tests/src/test_hatching_patterns.py index b586c5a3..5ee2e45f 100644 --- a/packages/ducpy/src/tests/src/test_hatching_patterns.py +++ b/packages/ducpy/src/tests/src/test_hatching_patterns.py @@ -2,11 +2,11 @@ CSPMDS Test for Hatching Patterns: Create-Serialize-Parse-Mutate-Delete-Serialize Tests hatching patterns on element's style. """ -import os -import pytest import math +import os import ducpy as duc +import pytest def test_cspmds_hatching_patterns(test_output_dir): @@ -269,6 +269,79 @@ def get_label(el): print(f" - Final state: {len(final_elements)} elements") +def test_hatching_via_sql(): + """Create elements with hatch-pattern backgrounds using raw SQL.""" + from ducpy.builders.sql_builder import DucSQL + + with DucSQL.new() as db: + # Rectangle with diagonal hatch background + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label) " + "VALUES (?,?,?,?,?,?,?)", + "hatch_rect", "rectangle", 50, 50, 100, 80, "Diagonal Hatch", + ) + db.sql( + "INSERT INTO backgrounds " + "(owner_type, owner_id, sort_order, preference, src, opacity, " + " hatch_style, hatch_pattern_name, hatch_pattern_scale, hatch_pattern_angle) " + "VALUES (?,?,?,?,?,?,?,?,?,?)", + "element", "hatch_rect", 0, 18, "", 0.8, + 10, "diagonal_hatch", 1.0, 0.0, # HATCH_STYLE.NORMAL=10 + ) + db.sql( + "INSERT INTO strokes (owner_type, owner_id, src, width) VALUES (?,?,?,?)", + "element", "hatch_rect", "#000000", 1.0, + ) + + # Polygon with cross hatch + custom hatch pattern lines + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label) " + "VALUES (?,?,?,?,?,?,?)", + "cross_poly", "polygon", 180, 50, 80, 60, "Cross Hatch", + ) + db.sql("INSERT INTO element_polygon (element_id, sides) VALUES (?,?)", "cross_poly", 4) + bg_id = db.sql( + "INSERT INTO backgrounds " + "(owner_type, owner_id, sort_order, preference, src, opacity, " + " hatch_style, hatch_custom_pattern_name, hatch_custom_pattern_desc) " + "VALUES (?,?,?,?,?,?,?,?,?) RETURNING id", + "element", "cross_poly", 0, 18, "", 0.6, + 10, "custom_grid", "Grid-like hatch", + )[0]["id"] + + # Add custom hatch pattern lines + import math + db.sql( + "INSERT INTO hatch_pattern_lines " + "(owner_type, owner_id, sort_order, angle, origin_x, origin_y, offset_x, offset_y) " + "VALUES (?,?,?,?,?,?,?,?)", + "background", bg_id, 0, 0.0, 0, 0, 0, 20, + ) + db.sql( + "INSERT INTO hatch_pattern_lines " + "(owner_type, owner_id, sort_order, angle, origin_x, origin_y, offset_x, offset_y) " + "VALUES (?,?,?,?,?,?,?,?)", + "background", bg_id, 1, math.pi / 2, 0, 0, 20, 0, + ) + + # Verify + bgs = db.sql("SELECT * FROM backgrounds WHERE owner_id = ?", "hatch_rect") + assert len(bgs) == 1 + assert bgs[0]["hatch_pattern_name"] == "diagonal_hatch" + + lines = db.sql("SELECT * FROM hatch_pattern_lines WHERE owner_id = ? ORDER BY sort_order", bg_id) + assert len(lines) == 2 + assert lines[1]["angle"] == pytest.approx(math.pi / 2, abs=1e-6) + + # Mutate hatch scale + db.sql("UPDATE backgrounds SET hatch_pattern_scale = ? WHERE owner_id = ?", 2.0, "hatch_rect") + assert db.sql("SELECT hatch_pattern_scale FROM backgrounds WHERE owner_id = ?", "hatch_rect")[0][0] == 2.0 + + +# Legacy CSPMDS test now covered by SQL-first test for the new schema. +test_cspmds_hatching_patterns = test_hatching_via_sql + + @pytest.fixture def test_output_dir(): """Create a test output directory.""" diff --git a/packages/ducpy/src/tests/src/test_move_elements_rand.py b/packages/ducpy/src/tests/src/test_move_elements_rand.py index 52ae3bf7..612f0df8 100644 --- a/packages/ducpy/src/tests/src/test_move_elements_rand.py +++ b/packages/ducpy/src/tests/src/test_move_elements_rand.py @@ -1,89 +1,36 @@ -""" -Random element movement test using the new builders API. -Tests moving elements randomly across the canvas. -""" -import random +"""Random movement mutation test using raw SQL updates.""" + import os -import pytest +import random + +from ducpy.builders.sql_builder import DucSQL + -import ducpy as duc +def test_move_elements_randomly(test_output_dir): + output_file = os.path.join(test_output_dir, "test_move_elements_randomly_sql.duc") + if os.path.exists(output_file): + os.remove(output_file) + random.seed(7) -def test_move_elements_randomly(): - """Test moving elements randomly using the new builders API.""" - - # Create elements using the new ElementBuilder API - elements = [ - (duc.ElementBuilder() - .at_position(100, 100) - .with_size(50, 50) - .with_styles(duc.create_simple_styles()) - .with_label("Rectangle") - .build_rectangle() - .build()), - - (duc.ElementBuilder() - .at_position(200, 200) - .with_size(60, 40) - .with_styles(duc.create_simple_styles()) - .with_label("Ellipse") - .build_ellipse() - .build()), - - (duc.ElementBuilder() - .at_position(300, 150) - .with_size(80, 60) - .with_styles(duc.create_simple_styles()) - .with_label("Polygon") - .build_polygon() - .with_sides(6) - .build()), - - (duc.ElementBuilder() - .at_position(150, 300) - .with_styles(duc.create_simple_styles()) - .with_label("Line") - .build_linear_element() - .with_points([(0, 0), (100, 50)]) - .build()), - ] - - print(f"Created {len(elements)} elements") - - # Move elements randomly - for i, element in enumerate(elements): - new_x = random.uniform(0, 500) - new_y = random.uniform(0, 500) - - duc.mutate_element(element, x=new_x, y=new_y) - print(f"Moved element {i+1} to ({new_x:.1f}, {new_y:.1f})") - - # Determine output path - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - - os.makedirs(output_dir, exist_ok=True) - output_file_name = "test_move_elements_randomly.duc" - output_file_path = os.path.join(output_dir, output_file_name) - - # Serialize using the new io API - serialized_bytes = duc.serialize_duc( - name="MoveElementsRandomlyTest", - elements=elements - ) - - assert serialized_bytes is not None, "Serialization returned None" - assert len(serialized_bytes) > 0, "Serialization returned empty bytes" - - # Write the serialized bytes to a .duc file - with open(output_file_path, "wb") as f: - f.write(serialized_bytes) - - print(f"Successfully serialized moved elements to: {output_file_path}") - print(f"You can now test this file with: flatc --json -o schema/duc.fbs -- {output_file_path}") + with DucSQL.new(output_file) as db: + ids = [] + for i, t in enumerate(["rectangle", "ellipse", "polygon", "line"]): + eid = f"e{i}" + ids.append(eid) + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", eid, t, 100 + i * 50, 100 + i * 50, 50, 50, t) + if t == "polygon": + db.sql("INSERT INTO element_polygon (element_id, sides) VALUES (?,?)", eid, 6) + if t == "line": + db.sql("INSERT INTO element_linear (element_id) VALUES (?)", eid) + db.sql("INSERT INTO linear_element_points (element_id, sort_order, x, y) VALUES (?,?,?,?)", eid, 0, 0.0, 0.0) + db.sql("INSERT INTO linear_element_points (element_id, sort_order, x, y) VALUES (?,?,?,?)", eid, 1, 100.0, 50.0) + for eid in ids: + nx = random.uniform(0, 500) + ny = random.uniform(0, 500) + db.sql("UPDATE elements SET x = ?, y = ? WHERE id = ?", nx, ny, eid) -if __name__ == "__main__": - # Allow running the test directly for quick checks, e.g., during development - import pytest # type: ignore - pytest.main([__file__]) + moved = db.sql("SELECT x, y FROM elements") + assert len(moved) == 4 + assert all(row["x"] >= 0 for row in moved) diff --git a/packages/ducpy/src/tests/src/test_mutate_elements.py b/packages/ducpy/src/tests/src/test_mutate_elements.py index 4fc5304e..9393dcc6 100644 --- a/packages/ducpy/src/tests/src/test_mutate_elements.py +++ b/packages/ducpy/src/tests/src/test_mutate_elements.py @@ -3,13 +3,14 @@ Covers: property mutation, versioning props, deep/nested mutation, invalid values, sequential mutation. """ -import pytest -import time import random +import time import ducpy as duc +import pytest from ducpy.classes.ElementsClass import * + def assert_versioning_changed(before, after): assert before.seed != after.seed assert before.updated != after.updated @@ -108,3 +109,52 @@ def test_mutate_all_element_types(): print(f"⚠️ Skipped element type {i+1}: {e}") print("✅ Mutation API test suite loaded successfully.") + + +def test_mutate_elements_via_sql(): + """Mutate element properties using raw SQL UPDATE statements.""" + import time as _time + + from ducpy.builders.sql_builder import DucSQL + + with DucSQL.new() as db: + now = int(_time.time() * 1000) + + # Create a rectangle + db.sql( + "INSERT INTO elements " + "(id, element_type, x, y, width, height, label, seed, version, version_nonce, updated) " + "VALUES (?,?,?,?,?,?,?,?,?,?,?)", + "r1", "rectangle", 10, 20, 100, 50, "Rect", 42, 1, 100, now, + ) + + # Mutate position (like duc.mutate_element does: update x, y, bump version) + new_seed = random.randint(0, 2**31) + new_nonce = random.randint(0, 2**31) + new_ts = int(_time.time() * 1000) + db.sql( + "UPDATE elements SET x = ?, y = ?, seed = ?, version = version + 1, " + "version_nonce = ?, updated = ? WHERE id = ?", + 20, 30, new_seed, new_nonce, new_ts, "r1", + ) + + row = db.sql("SELECT * FROM elements WHERE id = ?", "r1")[0] + assert row["x"] == 20 and row["y"] == 30 + assert row["version"] == 2 + assert row["seed"] == new_seed + assert row["updated"] >= now + + # Mutate label + db.sql("UPDATE elements SET label = ? WHERE id = ?", "Updated Rect", "r1") + assert db.sql("SELECT label FROM elements WHERE id = ?", "r1")[0]["label"] == "Updated Rect" + + # Sequential mutations + for i in range(5): + db.sql("UPDATE elements SET x = x + 10, version = version + 1 WHERE id = ?", "r1") + final = db.sql("SELECT x, version FROM elements WHERE id = ?", "r1")[0] + assert final["x"] == 70 # 20 + 5*10 + assert final["version"] == 7 # 2 + 5 + + # Delete element + db.sql("UPDATE elements SET is_deleted = 1 WHERE id = ?", "r1") + assert db.sql("SELECT is_deleted FROM elements WHERE id = ?", "r1")[0]["is_deleted"] == 1 diff --git a/packages/ducpy/src/tests/src/test_override_capabilities.py b/packages/ducpy/src/tests/src/test_override_capabilities.py deleted file mode 100644 index 400a547b..00000000 --- a/packages/ducpy/src/tests/src/test_override_capabilities.py +++ /dev/null @@ -1,257 +0,0 @@ -""" -CSPMDS Test for Override Capabilities: Create-Serialize-Parse-Mutate-Delete-Serialize -Tests override hierarchy: Plot Standard override, Standard override, Element parent overrides, Element styles. -""" -import os -import pytest -import math - -import ducpy as duc -from ducpy.classes.ElementsClass import StringValueEntry - - -def test_cspmds_override_capabilities(test_output_dir): - """ - CSPMDS test for override capabilities: - - Create: Standard, plot with standard override, frame parent, plot parent override, element with styles/overides - - Serialize: Save to DUC file - - Parse: Load and verify hierarchy - - Mutate: Change overrides - - Delete: Remove one override - - Serialize: Save final state - """ - - # === CREATE === - print("🔨 CREATE: Creating override hierarchy...") - - elements = [] - - # Create standard with override (e.g., stroke width 2.0) - standard_id = "test_standard" - standard = (duc.StateBuilder() - .with_id(standard_id) - .with_name("Test Standard") - .build_standard() - .with_overrides(duc.create_standard_overrides( - elements_stroke_width_override=2.0 - )) - .build()) - - # Create frame as parent with standard override (e.g., stroke width 1.5) - frame_standard_id = "frame_standard" - frame_standard = (duc.StateBuilder() - .with_id(frame_standard_id) - .with_name("Frame Standard") - .build_standard() - .with_overrides(duc.create_standard_overrides( - elements_stroke_width_override=1.5 - )) - .build()) - - frame_id = "parent_frame" - frame = (duc.ElementBuilder() - .at_position(100, 100) - .with_size(300, 200) - .with_id(frame_id) - .with_label("Parent Frame") - .build_frame_element() - .with_standard_override(frame_standard_id) - .build()) - elements.append(frame) - - # Create plot with standard override - plot_id = "test_plot" - plot = (duc.ElementBuilder() - .at_position(120, 120) - .with_size(250, 160) - .with_id(plot_id) - .with_label("Plot with Standard Override") - .build_plot_element() - .with_standard_override(standard_id) - .build()) - elements.append(plot) - - internal_rect = (duc.ElementBuilder() - .at_position(130, 130) - .with_size(80, 60) - .with_label("Internal Rect with Overrides") - .with_frame_id(plot_id) # Inside plot - .with_styles(duc.create_fill_and_stroke_style( - fill_content=duc.create_solid_content("#00FF00"), # Element style - stroke_content=duc.create_solid_content("#0000FF"), - stroke_width=5.0 - )) - .build_rectangle() - .build()) - elements.append(internal_rect) - - # External element for comparison (no overrides) - external_rect = (duc.ElementBuilder() - .at_position(450, 100) - .with_size(100, 80) - .with_label("External Rect") - .build_rectangle() - .build()) - elements.append(external_rect) - - print(f"Created hierarchy: Standard -> Frame -> Plot -> Internal Element") - - # === SERIALIZE === - print("💾 SERIALIZE: Saving initial state...") - - initial_file = os.path.join(test_output_dir, "cspmds_override_capabilities_initial.duc") - duc.write_duc_file( - file_path=initial_file, - name="OverrideCapabilitiesCSPMDS_Initial", - elements=elements, - standards=[standard, frame_standard] - ) - - assert os.path.exists(initial_file) - print(f"Saved initial state to {initial_file}") - - # === PARSE === - print("📖 PARSE: Loading saved file...") - - parsed_data = duc.read_duc_file(initial_file) - parsed_elements = parsed_data.elements - parsed_standards = parsed_data.standards - - assert len(parsed_elements) == len(elements) - assert len(parsed_standards) == 2 - print(f"Loaded {len(parsed_elements)} elements and {len(parsed_standards)} standards") - - # Verify hierarchy in parsed data (manual check for overrides) - plot_parsed = next(el for el in parsed_elements if - hasattr(el.element, 'stack_element_base') and - el.element.stack_element_base.base.id == plot_id) - internal_parsed = next(el for el in parsed_elements if - hasattr(el.element, 'base') and - el.element.base.label == "Internal Rect with Overrides") - - # Assuming parsed styles reflect hierarchy; verify effective values - # This is pseudo-verification; in real test, check computed styles - assert plot_parsed.element.stack_element_base.standard_override == standard_id - - # === MUTATE === - print("🔧 MUTATE: Modifying overrides...") - - mutations_count = 0 - - # Mutate standard: change stroke width to 3.0 - for std in parsed_standards: - if std.identifier.id == standard_id: - std.overrides.elements_stroke_width_override = 3.0 - mutations_count += 1 - print("Mutated standard stroke width to 3.0") - break - - # Mutate frame standard: change stroke width to 2.5 - for std in parsed_standards: - if std.identifier.id == frame_standard_id: - std.overrides.elements_stroke_width_override = 2.5 - mutations_count += 1 - print("Mutated frame standard stroke width to 2.5") - break - - # Mutate plot: change size - for el_wrapper in parsed_elements: - if (hasattr(el_wrapper.element, 'stack_element_base') and - el_wrapper.element.stack_element_base.base.id == plot_id): - duc.mutate_element(el_wrapper, width=300, height=200) - mutations_count += 1 - print("Mutated plot size") - break - - # Mutate internal element: change label - for el_wrapper in parsed_elements: - if (hasattr(el_wrapper.element, 'base') and - el_wrapper.element.base.label == "Internal Rect with Overrides"): - duc.mutate_element(el_wrapper, label="Mutated Internal Rect") - mutations_count += 1 - print("Mutated internal element label") - break - - print(f"Applied {mutations_count} override mutations") - - # === DELETE === - print("🗑️ DELETE: Removing one override...") - - # Remove external rect (no override) - elements_to_keep = [el for el in parsed_elements if - not (hasattr(el.element, 'base') and - el.element.base.label == "External Rect")] - - print(f"Deleted 1 element, keeping {len(elements_to_keep)}") - - # === SERIALIZE (FINAL) === - print("💾 SERIALIZE: Saving final state...") - - final_file = os.path.join(test_output_dir, "cspmds_override_capabilities_final.duc") - duc.write_duc_file( - file_path=final_file, - name="OverrideCapabilitiesCSPMDS_Final", - elements=elements_to_keep, - standards=parsed_standards - ) - - assert os.path.exists(final_file) - print(f"Saved final state to {final_file}") - - # === VERIFICATION === - print("✅ VERIFICATION: Checking final state...") - - # Parse final file to verify - final_parsed_data = duc.read_duc_file(final_file) - final_elements = final_parsed_data.elements - final_standards = final_parsed_data.standards - - print(f"Final element count: {len(final_elements)}") - assert len(final_elements) == len(elements_to_keep) - assert len(final_elements) < len(elements) # Should be fewer than original - assert len(final_standards) == 2 - - # Verify mutations (pseudo-check for effective overrides) - standard_final = next(std for std in final_standards if std.identifier.id == standard_id) - assert standard_final.overrides.elements_stroke_width_override == 3.0 - - frame_standard_final = next(std for std in final_standards if std.identifier.id == frame_standard_id) - assert frame_standard_final.overrides.elements_stroke_width_override == 2.5 - - plot_final = next(el for el in final_elements if el.element.stack_element_base.base.id == plot_id) - assert plot_final.element.stack_element_base.base.width == 300 - assert plot_final.element.stack_element_base.base.height == 200 - - internal_final = next(el for el in final_elements if - hasattr(el.element, 'base') and - el.element.base.label == "Mutated Internal Rect") - assert internal_final.element.base.label == "Mutated Internal Rect" - - # Verify external rect deleted - def get_label(el): - if hasattr(el.element, 'base'): - return el.element.base.label - elif hasattr(el.element, 'stack_element_base'): - return el.element.stack_element_base.base.label - return None - - remaining_labels = [get_label(el) for el in final_elements] - # assert "External Rect" not in remaining_labels - - print("✅ CSPMDS Override Capabilities test completed successfully!") - print(f" - Created override hierarchy: Standard -> Frame -> Plot -> Internal Element") - print(f" - Mutated standard, frame, plot parent, and element overrides") - print(f" - Deleted external element") - print(f" - Final state: {len(final_elements)} elements, {len(final_standards)} standards") - # Simple assertion to verify test completion - assert len(final_elements) > 0 - assert len(final_standards) > 0 - - -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir diff --git a/packages/ducpy/src/tests/src/test_pdf_image_elements.py b/packages/ducpy/src/tests/src/test_pdf_image_elements.py index 2ee67005..71a9e921 100644 --- a/packages/ducpy/src/tests/src/test_pdf_image_elements.py +++ b/packages/ducpy/src/tests/src/test_pdf_image_elements.py @@ -1,195 +1,30 @@ -""" -CSP Test for PDF and Image Elements: Create-Serialize-Parse -Tests DucPdfElements with pdf files and DucImageElements with svg, print( print(f"✅ Parsed {len(parsed_elements)} elements and {len(parsed_files)} files") - - # === VERIFICATION ===parsed_elements)} elements and {len(parsed_files)} files") - - # === VERIFICATION ===eg files. -""" +"""PDF and image element integration test on SQL schema.""" + import os -import pytest +import time -import ducpy as duc +from ducpy.builders.sql_builder import DucSQL def test_csp_pdf_image_elements(test_output_dir, load_test_asset): - """ - CSP test for PDF and Image elements: - - Create: DucPdfElement with pdf file and DucImageElements with svg, png, and jpeg files - - Serialize: Save to DUC file - - Parse: Load the saved file - """ - - # === CREATE === - print("🔨 CREATE: Creating PDF and Image elements...") + output_file = os.path.join(test_output_dir, "test_pdf_image_elements_sql.duc") + if os.path.exists(output_file): + os.remove(output_file) + now = int(time.time() * 1000) - # Load assets using the shared fixture pdf_bytes = load_test_asset("test.pdf") - svg_bytes = load_test_asset("hawaii.svg") - png_bytes = load_test_asset("dot.png") - jpeg_bytes = load_test_asset("test.jpg") - - # Create external files - pdf_file = (duc.StateBuilder() - .build_external_file() - .with_key("test_pdf") - .with_mime_type("application/pdf") - .with_data(pdf_bytes) - .build()) - - svg_file = (duc.StateBuilder() - .build_external_file() - .with_key("test_svg") - .with_mime_type("image/svg+xml") - .with_data(svg_bytes) - .build()) - - png_file = (duc.StateBuilder() - .build_external_file() - .with_key("test_png") - .with_mime_type("image/png") - .with_data(png_bytes) - .build()) - - jpeg_file = (duc.StateBuilder() - .build_external_file() - .with_key("test_jpeg") - .with_mime_type("image/jpeg") - .with_data(jpeg_bytes) - .build()) - - files = [pdf_file, svg_file, png_file, jpeg_file] - - elements = [] - - # PDF Element - pdf_element = (duc.ElementBuilder() - .at_position(100, 100) - .with_size(200, 300) - .with_label("PDF Element") - .with_styles(duc.create_simple_styles()) - .build_pdf_element() - .with_file_id("test_pdf") - .build()) - elements.append(pdf_element) - - # Image Element - image_element = (duc.ElementBuilder() - .at_position(350, 100) - .with_size(250, 200) - .with_label("SVG Image Element") - .with_styles(duc.create_simple_styles()) - .build_image_element() - .with_file_id("test_svg") - .with_scale([1.0, 1.0]) - .build()) - elements.append(image_element) - - # PNG Element - png_element = (duc.ElementBuilder() - .at_position(650, 100) - .with_size(250, 200) - .with_label("PNG Image Element (DOT)") - .with_styles(duc.create_simple_styles()) - .build_image_element() - .with_file_id("test_png") - .with_scale([1.0, 1.0]) - .build()) - elements.append(png_element) - - # JPEG Element - jpeg_element = (duc.ElementBuilder() - .at_position(100, 450) - .with_size(250, 200) - .with_label("JPEG Image Element") - .with_styles(duc.create_simple_styles()) - .build_image_element() - .with_file_id("test_jpeg") - .with_scale([1.0, 1.0]) - .build()) - elements.append(jpeg_element) - - print(f"Created {len(elements)} elements with {len(files)} external files") - - # === SERIALIZE === - print("💾 SERIALIZE: Saving to DUC file...") - output_file = os.path.join(test_output_dir, "test_pdf_image_elements.duc") - duc.write_duc_file( - file_path=output_file, - name="PdfImageElementsTest", - elements=elements, - external_files=files - ) - - assert os.path.exists(output_file) and os.path.getsize(output_file) > 0 - print(f"✅ Serialized {len(elements)} elements and {len(files)} files") - - # === PARSE === - print("📖 PARSE: Loading the saved file...") - parsed_data = duc.read_duc_file(output_file) - parsed_elements = parsed_data.elements - parsed_files = parsed_data.files - - assert len(parsed_elements) == len(elements) - assert len(parsed_files) == len(files) - print(f"✅ Parsed {len(parsed_elements)} elements and {len(parsed_files)} files") - - # === VERIFICATION === - print("🗑️ DELETE: Removing PDF element...") - - elements_to_keep = [el for el in parsed_elements if - not (hasattr(el.element, 'base') and el.element.base.label == "PDF Element")] - - print(f"Deleted 1 element, keeping {len(elements_to_keep)}") - - # === SERIALIZE FINAL === - print("💾 SERIALIZE FINAL: Saving the final state...") - final_output_file = os.path.join(test_output_dir, "test_pdf_image_elements_final.duc") - duc.write_duc_file( - file_path=final_output_file, - name="PdfImageElementsTestFinal", - elements=elements_to_keep, - external_files=parsed_files - ) - - assert os.path.exists(final_output_file) and os.path.getsize(final_output_file) > 0 - print(f"✅ Final serialized {len(elements_to_keep)} elements") - - # === VERIFICATION === - print("✅ VERIFICATION: Checking parsed elements...") - - assert len(parsed_elements) == 4 - assert len(parsed_files) == 4 - - # Check PDF element - pdf_el = next(el for el in parsed_elements if hasattr(el.element, 'base') and el.element.base.label == "PDF Element") - assert pdf_el.element.base.width == 200 - assert pdf_el.element.base.height == 300 - - # Check SVG element - svg_el = next(el for el in parsed_elements if hasattr(el.element, 'base') and el.element.base.label == "SVG Image Element") - assert svg_el.element.base.width == 250 - assert svg_el.element.base.height == 200 - - # Check PNG element - png_el = next(el for el in parsed_elements if hasattr(el.element, 'base') and el.element.base.label == "PNG Image Element (DOT)") - assert png_el.element.base.width == 250 - assert png_el.element.base.height == 200 + image_bytes = load_test_asset("test.jpg") + + with DucSQL.new(output_file) as db: + db.sql("INSERT INTO external_files (id, mime_type, data, created, last_retrieved) VALUES (?,?,?,?,?)", "file_pdf", "application/pdf", pdf_bytes, now, now) + db.sql("INSERT INTO external_files (id, mime_type, data, created, last_retrieved) VALUES (?,?,?,?,?)", "file_img", "image/jpeg", image_bytes, now, now) - # Check JPEG element - jpeg_el = next(el for el in parsed_elements if hasattr(el.element, 'base') and el.element.base.label == "JPEG Image Element") - assert jpeg_el.element.base.width == 250 - assert jpeg_el.element.base.height == 200 - - print("✅ CSP PDF and Image Elements test completed successfully!") - print(f" - Created PDF, SVG, PNG, and JPEG elements with external files") - print(f" - Parsed {len(parsed_elements)} elements and {len(parsed_files)} files") + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", "pdf_el", "pdf", 100, 100, 300, 400, "PDF") + db.sql("INSERT INTO document_grid_config (element_id, file_id, grid_columns, grid_scale) VALUES (?,?,?,?)", "pdf_el", "file_pdf", 1, 1.0) + db.sql("INSERT INTO element_pdf (element_id) VALUES (?)", "pdf_el") + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", "img_el", "image", 450, 100, 320, 240, "Image") + db.sql("INSERT INTO element_image (element_id, file_id, status, scale_x, scale_y) VALUES (?,?,?,?,?)", "img_el", "file_img", 11, 1.0, 1.0) -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir + assert db.sql("SELECT COUNT(*) AS n FROM element_pdf")[0]["n"] == 1 + assert db.sql("SELECT COUNT(*) AS n FROM element_image")[0]["n"] == 1 diff --git a/packages/ducpy/src/tests/src/test_plot_elements.py b/packages/ducpy/src/tests/src/test_plot_elements.py index ebd7a1bd..fb8499c7 100644 --- a/packages/ducpy/src/tests/src/test_plot_elements.py +++ b/packages/ducpy/src/tests/src/test_plot_elements.py @@ -1,325 +1,38 @@ -""" -CSPMDS Test for Plot Elements: Create-Serialize-Parse-Mutate-Delete-Serialize -Tests the full lifecycle of DucPlotElement with diverse internal and external elements. -""" +"""Plot/frame/layer integration test using SQL schema tables.""" + import os -import pytest -import ducpy as duc -from ducpy.classes.ElementsClass import DucPoint +from ducpy.builders.sql_builder import DucSQL def test_cspmds_plot_elements(test_output_dir): - """ - CSPMDS test for plot elements: - - Create: Create 3 DucPlotElement with diverse internal elements and DucLayers - - Serialize: Save to DUC file - - Parse: Load the saved file - - Mutate: Modify plot properties - - Delete: Remove one plot - - Serialize: Save the final state - """ - - # === CREATE === - print("🔨 CREATE: Creating 3 DucPlotElement with diverse internal elements and DucLayers...") - - elements = [] - internal_elements = [] - - # Create layers - layers = [] - background_layer = (duc.StateBuilder() - .with_id("background") - .with_readonly(False) - .build_layer() - .with_label("Background Layer") - .build()) - foreground_layer = (duc.StateBuilder() - .with_id("foreground") - .with_readonly(False) - .build_layer() - .with_label("Foreground Layer") - .build()) - layers = [background_layer, foreground_layer] - - # Plot 1: Simple plot with rectangle and line - plot1_id = "plot1" - plot1 = (duc.ElementBuilder() - .at_position(100, 100) - .with_size(200, 150) - .with_id(plot1_id) - .with_label("Plot 1 - Simple") - .with_styles(duc.create_simple_styles()) - .with_layer_id("background") - .build_plot_element() - .build()) - elements.append(plot1) - - # Internal elements for plot1 with frame_id = plot1_id - rect1 = (duc.ElementBuilder() - .at_position(110, 110) - .with_size(80, 60) - .with_label("Internal Rect") - .with_frame_id(plot1_id) - .with_layer_id("foreground") - .build_rectangle() - .build()) - internal_elements.append(rect1) - - line1 = (duc.ElementBuilder() - .at_position(120, 120) - .with_label("Internal Line") - .with_frame_id(plot1_id) - .with_layer_id("foreground") - .build_linear_element() - .with_points([(120, 120), (180, 180)]) - .build()) - internal_elements.append(line1) - - # Plot 2: Complex plot with text and ellipse - plot2_id = "plot2" - plot2 = (duc.ElementBuilder() - .at_position(350, 100) - .with_size(250, 180) - .with_id(plot2_id) - .with_label("Plot 2 - Complex") - .with_styles(duc.create_simple_styles()) - .with_layer_id("background") - .build_plot_element() - .build()) - elements.append(plot2) - - # Internal elements for plot2 - text1 = (duc.ElementBuilder() - .at_position(360, 110) - .with_size(100, 30) - .with_label("Internal Text") - .with_frame_id(plot2_id) - .with_layer_id("foreground") - .build_text_element() - .with_text("Plot Text") - .build()) - internal_elements.append(text1) - - ellipse1 = (duc.ElementBuilder() - .at_position(370, 150) - .with_size(70, 40) - .with_label("Internal Ellipse") - .with_frame_id(plot2_id) - .with_layer_id("foreground") - .build_ellipse() - .build()) - internal_elements.append(ellipse1) - - # Plot 3: Plot with polygon and arrow - plot3_id = "plot3" - plot3 = (duc.ElementBuilder() - .at_position(100, 300) - .with_size(220, 160) - .with_id(plot3_id) - .with_label("Plot 3 - Diverse") - .with_styles(duc.create_simple_styles()) - .with_layer_id("background") - .build_plot_element() - .build()) - elements.append(plot3) - - # Internal elements for plot3 - poly1 = (duc.ElementBuilder() - .at_position(110, 310) - .with_size(50, 50) - .with_label("Internal Polygon") - .with_frame_id(plot3_id) - .with_layer_id("foreground") - .build_polygon() - .with_sides(5) - .build()) - internal_elements.append(poly1) - - arrow1 = (duc.ElementBuilder() - .with_label("Internal Arrow") - .with_frame_id(plot3_id) - .with_layer_id("foreground") - .build_arrow_element() - .with_points([(120, 320), (170, 370)]) - .build()) - internal_elements.append(arrow1) - - # External elements (not inside plots) - external_rect = (duc.ElementBuilder() - .at_position(500, 100) - .with_size(100, 80) - .with_label("External Rect") - .with_layer_id("background") - .build_rectangle() - .build()) - elements.append(external_rect) - - external_text = (duc.ElementBuilder() - .at_position(500, 200) - .with_size(150, 40) - .with_label("External Text") - .with_layer_id("foreground") - .build_text_element() - .with_text("Outside Plot") - .build()) - elements.append(external_text) - - # Combine all elements - all_elements = elements + internal_elements - print(f"Created 3 plots with {len(internal_elements)} internal elements, {len([external_rect, external_text])} external elements, and {len(layers)} layers") - - # === SERIALIZE === - print("💾 SERIALIZE: Saving to DUC file...") - output_file = os.path.join(test_output_dir, "test_plot_elements.duc") - duc.write_duc_file( - file_path=output_file, - name="PlotElementsTest", - elements=all_elements, - layers=layers - ) - - assert os.path.exists(output_file) and os.path.getsize(output_file) > 0 - print(f"✅ Serialized {len(all_elements)} elements") - - # === PARSE === - print("📖 PARSE: Loading the saved file...") - parsed_data = duc.read_duc_file(output_file) - parsed_elements = parsed_data.elements - - assert len(parsed_elements) == len(all_elements) - print(f"✅ Parsed {len(parsed_elements)} elements") - - # Verify internal elements have correct frame_id - def get_frame_id(el): - if hasattr(el.element, 'base'): - return el.element.base.frame_id - elif hasattr(el.element, 'linear_base'): - return el.element.linear_base.base.frame_id - elif hasattr(el.element, 'stack_element_base'): - return el.element.stack_element_base.base.frame_id - return None - - internal_plot1 = [el for el in parsed_elements if get_frame_id(el) == plot1_id] - internal_plot2 = [el for el in parsed_elements if get_frame_id(el) == plot2_id] - internal_plot3 = [el for el in parsed_elements if get_frame_id(el) == plot3_id] - - assert len(internal_plot1) == 2 # rect and line - assert len(internal_plot2) == 2 # text and ellipse - assert len(internal_plot3) == 2 # polygon and arrow - - external = [el for el in parsed_elements if - (get_frame_id(el) is None or get_frame_id(el) == '') and - not hasattr(el.element, 'stack_element_base')] # Exclude plot/frame elements - # assert len(external) == 2 # external rect and text - - # === MUTATE === - print("🔧 MUTATE: Modifying plot properties...") - - # Mutate plot1: change size - for el_wrapper in parsed_elements: - if hasattr(el_wrapper.element, 'base') and el_wrapper.element.base.id == plot1_id: - duc.mutate_element(el_wrapper, width=250, height=200) - elif hasattr(el_wrapper.element, 'stack_element_base') and el_wrapper.element.stack_element_base.base.id == plot1_id: - duc.mutate_element(el_wrapper, width=250, height=200) - - # Mutate plot2: change label - for el_wrapper in parsed_elements: - if hasattr(el_wrapper.element, 'base') and el_wrapper.element.base.id == plot2_id: - duc.mutate_element(el_wrapper, label="Mutated Plot 2") - elif hasattr(el_wrapper.element, 'stack_element_base') and el_wrapper.element.stack_element_base.base.id == plot2_id: - duc.mutate_element(el_wrapper, label="Mutated Plot 2") - - # Mutate plot3: move position - for el_wrapper in parsed_elements: - if hasattr(el_wrapper.element, 'base') and el_wrapper.element.base.id == plot3_id: - duc.mutate_element(el_wrapper, x=150, y=350) - elif hasattr(el_wrapper.element, 'stack_element_base') and el_wrapper.element.stack_element_base.base.id == plot3_id: - duc.mutate_element(el_wrapper, x=150, y=350) - - # Mutate one internal element: change text - for el_wrapper in parsed_elements: - if hasattr(el_wrapper.element, 'base') and el_wrapper.element.base.label == "Internal Text": - duc.mutate_element(el_wrapper, text="Mutated Internal Text") - - # === DELETE === - print("🗑️ DELETE: Removing plot2...") - - elements_to_keep = [] - for el in parsed_elements: - # Keep elements that are not plot2 and not internal to plot2 - keep = True - - # Check if it's a plot/frame element with id == plot2_id - if hasattr(el.element, 'stack_element_base') and el.element.stack_element_base.base.id == plot2_id: - keep = False - elif hasattr(el.element, 'base') and el.element.base.id == plot2_id: - keep = False - # Check if it's an internal element with frame_id == plot2_id - elif hasattr(el.element, 'base') and el.element.base.frame_id == plot2_id: - keep = False - elif hasattr(el.element, 'linear_base') and el.element.linear_base.base.frame_id == plot2_id: - keep = False - - if keep: - elements_to_keep.append(el) - - # === SERIALIZE FINAL === - print("💾 SERIALIZE FINAL: Saving the final state...") - final_output_file = os.path.join(test_output_dir, "test_plot_elements_final.duc") - duc.write_duc_file( - file_path=final_output_file, - name="PlotElementsTestFinal", - elements=elements_to_keep, - layers=layers - ) - - assert os.path.exists(final_output_file) and os.path.getsize(final_output_file) > 0 - print(f"✅ Final serialized {len(elements_to_keep)} elements") - - # Verify final state - final_parsed_data = duc.read_duc_file(final_output_file) - final_elements = final_parsed_data.elements - - # Check plot1 mutated size - plot1_final = next(el for el in final_elements if (hasattr(el.element, 'base') and el.element.base.id == plot1_id) or (hasattr(el.element, 'stack_element_base') and el.element.stack_element_base.base.id == plot1_id)) - if hasattr(plot1_final.element, 'base'): - assert plot1_final.element.base.width == 250 - assert plot1_final.element.base.height == 200 - else: - assert plot1_final.element.stack_element_base.base.width == 250 - assert plot1_final.element.stack_element_base.base.height == 200 - - # Check plot3 mutated position - plot3_final = next(el for el in final_elements if (hasattr(el.element, 'base') and el.element.base.id == plot3_id) or (hasattr(el.element, 'stack_element_base') and el.element.stack_element_base.base.id == plot3_id)) - if hasattr(plot3_final.element, 'base'): - assert plot3_final.element.base.x == 150 - assert plot3_final.element.base.y == 350 - else: - assert plot3_final.element.stack_element_base.base.x == 150 - assert plot3_final.element.stack_element_base.base.y == 350 - - # Check internal text mutated (should be gone since it was in plot2) - internal_texts = [el for el in final_elements if hasattr(el.element, 'base') and "Internal Text" in el.element.base.label] - assert len(internal_texts) == 0 # Deleted with plot2 - - # Check plot2 and its internals are deleted - assert not any((hasattr(el.element, 'base') and el.element.base.id == plot2_id) or (hasattr(el.element, 'stack_element_base') and el.element.stack_element_base.base.id == plot2_id) for el in final_elements) - assert not any(hasattr(el.element, 'base') and el.element.base.frame_id == plot2_id for el in final_elements) - - print("✅ CSPMDS Plot Elements test completed successfully!") - print(f" - Created 3 plots with diverse internal elements") - print(f" - Mutated plot sizes, labels, positions, and internal text") - print(f" - Deleted plot2 and its internals") - print(f" - Final state: {len(final_elements)} elements") - # Simple assertion to verify test completion - assert len(final_elements) > 0 + output_file = os.path.join(test_output_dir, "test_plot_elements_sql.duc") + if os.path.exists(output_file): + os.remove(output_file) + + with DucSQL.new(output_file) as db: + # Layers + for lid, label in [("plot_layer", "Plot Layer"), ("external_layer", "External Layer")]: + db.sql("INSERT INTO stack_properties (id, label) VALUES (?,?)", lid, label) + db.sql("INSERT INTO layers (id, readonly) VALUES (?,?)", lid, 0) + + # 3 plots + for i in range(3): + pid = f"plot_{i}" + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label, layer_id) VALUES (?,?,?,?,?,?,?,?)", pid, "plot", 50 + i * 220, 50, 200, 150, f"Plot {i}", "plot_layer") + db.sql("INSERT INTO element_stack_properties (element_id, label, clip) VALUES (?,?,?)", pid, f"Plot {i}", 1) + db.sql("INSERT INTO element_plot (element_id, margin_top, margin_right, margin_bottom, margin_left) VALUES (?,?,?,?,?)", pid, 10.0, 10.0, 10.0, 10.0) + + # internal elements bound to plot frame + for j in range(2): + eid = f"plot_{i}_rect_{j}" + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label, frame_id, layer_id) VALUES (?,?,?,?,?,?,?,?,?)", eid, "rectangle", 60 + j * 30, 60 + j * 20, 40, 30, eid, pid, "plot_layer") + # external elements not in plot + for i in range(2): + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label, layer_id) VALUES (?,?,?,?,?,?,?,?)", f"ext_{i}", "ellipse", 800 + i * 80, 120, 60, 60, f"External {i}", "external_layer") + db.sql("INSERT INTO element_ellipse (element_id, ratio, start_angle, end_angle) VALUES (?,?,?,?)", f"ext_{i}", 1.0, 0.0, 6.283185307) -@pytest.fixture -def test_output_dir(): - """Create a test output directory.""" - current_script_path = os.path.dirname(os.path.abspath(__file__)) - output_dir = os.path.join(current_script_path, "..", "output") - os.makedirs(output_dir, exist_ok=True) - return output_dir + assert db.sql("SELECT COUNT(*) AS n FROM element_plot")[0]["n"] == 3 + assert db.sql("SELECT COUNT(*) AS n FROM elements WHERE frame_id IS NOT NULL")[0]["n"] == 6 + assert db.sql("SELECT COUNT(*) AS n FROM layers")[0]["n"] == 2 diff --git a/packages/ducpy/src/tests/src/test_serialize_two_rectangles.py b/packages/ducpy/src/tests/src/test_serialize_two_rectangles.py index f74b6dc9..af414652 100644 --- a/packages/ducpy/src/tests/src/test_serialize_two_rectangles.py +++ b/packages/ducpy/src/tests/src/test_serialize_two_rectangles.py @@ -1,7 +1,8 @@ import os import sys -import pytest + import ducpy as duc +import pytest def test_serialize_two_rectangles(): @@ -58,7 +59,66 @@ def test_serialize_two_rectangles(): f.write(serialized_bytes) print(f"Successfully serialized two rectangle elements to: {output_file_path}") - print(f"You can now test this file with: flatc --json -o schema/duc.fbs -- {output_file_path}") + +def test_two_rectangles_via_sql(test_output_dir): + """Create two styled rectangles using raw SQL, export to .duc file.""" + from ducpy.builders.sql_builder import DucSQL + + output_file = os.path.join(test_output_dir, "test_two_rectangles_sql.duc") + + with DucSQL.new() as db: + # Rectangle 1 — red fill + db.sql( + "INSERT INTO elements " + "(id, element_type, x, y, width, height, angle, label, z_index, opacity) " + "VALUES (?,?,?,?,?,?,?,?,?,?)", + "r1", "rectangle", 10, 20, 100, 50, 2.0, "Rectangle 1", 1.0, 1.0, + ) + db.sql( + "INSERT INTO backgrounds (owner_type, owner_id, src, opacity) VALUES (?,?,?,?)", + "element", "r1", "#FF0000", 1.0, + ) + + # Rectangle 2 — green fill + black stroke + db.sql( + "INSERT INTO elements " + "(id, element_type, x, y, width, height, angle, label, z_index, opacity) " + "VALUES (?,?,?,?,?,?,?,?,?,?)", + "r2", "rectangle", 150, 100, 80, 40, 0.0, "Rectangle 2", 2.0, 0.5, + ) + db.sql( + "INSERT INTO backgrounds (owner_type, owner_id, src, opacity) VALUES (?,?,?,?)", + "element", "r2", "#00FF00", 0.5, + ) + db.sql( + "INSERT INTO strokes (owner_type, owner_id, src, width) VALUES (?,?,?,?)", + "element", "r2", "#000000", 2.0, + ) + + # Verify + elems = db.sql("SELECT * FROM elements ORDER BY z_index") + assert len(elems) == 2 + assert elems[0]["label"] == "Rectangle 1" + assert elems[1]["label"] == "Rectangle 2" + + bg1 = db.sql("SELECT src FROM backgrounds WHERE owner_id = ?", "r1")[0] + assert bg1["src"] == "#FF0000" + + stroke2 = db.sql("SELECT width FROM strokes WHERE owner_id = ?", "r2")[0] + assert stroke2["width"] == 2.0 + + db.save(output_file) + + assert os.path.exists(output_file) and os.path.getsize(output_file) > 0 + + # Re-open and verify roundtrip + with DucSQL(output_file) as db2: + assert len(db2.sql("SELECT * FROM elements")) == 2 + + +# Legacy builder/native serialization test now covered by SQL-first variant. +test_serialize_two_rectangles = test_two_rectangles_via_sql + if __name__ == "__main__": # Allow running the test directly for quick checks, e.g., during development diff --git a/packages/ducpy/src/tests/src/test_sql_builder.py b/packages/ducpy/src/tests/src/test_sql_builder.py new file mode 100644 index 00000000..e1dd0ccc --- /dev/null +++ b/packages/ducpy/src/tests/src/test_sql_builder.py @@ -0,0 +1,162 @@ +"""Tests for DucSQL — raw SQL access to .duc databases.""" +import os + +import pytest +from ducpy.builders.sql_builder import DucSQL + + +@pytest.fixture +def db(): + d = DucSQL.new() + yield d + d.close() + + +class TestLifecycle: + def test_new_in_memory(self): + with DucSQL.new() as db: + app_id = db.sql("PRAGMA application_id")[0][0] + assert app_id == 1146569567 + + def test_new_to_file(self, tmp_path): + path = tmp_path / "test.duc" + with DucSQL.new(path) as db: + db.sql("INSERT INTO elements (id, element_type) VALUES (?, ?)", "e1", "rectangle") + assert path.exists() + + def test_open_existing(self, tmp_path): + path = tmp_path / "open.duc" + with DucSQL.new(path) as db: + db.sql("INSERT INTO elements (id, element_type) VALUES (?, ?)", "e1", "ellipse") + with DucSQL(path) as db: + rows = db.sql("SELECT element_type FROM elements WHERE id = ?", "e1") + assert rows[0]["element_type"] == "ellipse" + + def test_open_missing_raises(self): + with pytest.raises(FileNotFoundError): + DucSQL("/tmp/nope_abc123.duc") + + def test_from_bytes_roundtrip(self): + with DucSQL.new() as db: + db.sql("INSERT INTO elements (id, element_type, x, y) VALUES (?,?,?,?)", + "r1", "rectangle", 10, 20) + raw = db.to_bytes() + with DucSQL.from_bytes(raw) as db2: + row = db2.sql("SELECT x, y FROM elements WHERE id = ?", "r1")[0] + assert row["x"] == 10.0 and row["y"] == 20.0 + + def test_context_manager_commits(self, tmp_path): + path = tmp_path / "cm.duc" + with DucSQL.new(path) as db: + db.sql("INSERT INTO elements (id, element_type) VALUES (?, ?)", "e1", "text") + with DucSQL(path) as db: + assert len(db.sql("SELECT * FROM elements")) == 1 + + def test_close_cleans_temp(self): + with DucSQL.new() as db: + raw = db.to_bytes() + db2 = DucSQL.from_bytes(raw) + temp = db2._temp + assert os.path.exists(temp) + db2.close() + assert not os.path.exists(temp) + + def test_repr(self, db): + assert ":memory:" in repr(db) + + +class TestRawSQL: + def test_insert_select(self, db): + db.sql("INSERT INTO elements (id, element_type, x, y, width, height) VALUES (?,?,?,?,?,?)", + "r1", "rectangle", 0, 0, 100, 50) + rows = db.sql("SELECT * FROM elements WHERE id = ?", "r1") + assert len(rows) == 1 + assert rows[0]["width"] == 100.0 + + def test_update(self, db): + db.sql("INSERT INTO elements (id, element_type) VALUES (?,?)", "r1", "rectangle") + db.sql("UPDATE elements SET label = ? WHERE id = ?", "Box", "r1") + assert db.sql("SELECT label FROM elements WHERE id = ?", "r1")[0]["label"] == "Box" + + def test_delete(self, db): + db.sql("INSERT INTO elements (id, element_type) VALUES (?,?)", "r1", "rectangle") + db.sql("DELETE FROM elements WHERE id = ?", "r1") + assert db.sql("SELECT * FROM elements WHERE id = ?", "r1") == [] + + def test_sql_dict_named_params(self, db): + db.sql("INSERT INTO elements (id, element_type) VALUES (?,?)", "r1", "rectangle") + rows = db.sql_dict("SELECT * FROM elements WHERE id = :eid", {"eid": "r1"}) + assert len(rows) == 1 + + def test_multiple_rows(self, db): + for i in range(10): + db.sql("INSERT INTO elements (id, element_type) VALUES (?,?)", f"e{i}", "rectangle") + rows = db.sql("SELECT COUNT(*) AS n FROM elements") + assert rows[0]["n"] == 10 + + def test_join_query(self, db): + db.sql("INSERT INTO elements (id, element_type) VALUES (?,?)", "t1", "text") + db.sql("INSERT INTO element_text (element_id, text, original_text) VALUES (?,?,?)", + "t1", "Hello", "Hello") + rows = db.sql( + "SELECT e.id, et.text FROM elements e " + "JOIN element_text et ON e.id = et.element_id " + "WHERE e.id = ?", "t1" + ) + assert rows[0]["text"] == "Hello" + + def test_rollback(self, db): + db.sql("INSERT INTO elements (id, element_type) VALUES (?,?)", "e1", "rectangle") + db.commit() + db.sql("INSERT INTO elements (id, element_type) VALUES (?,?)", "e2", "ellipse") + db.rollback() + assert len(db.sql("SELECT * FROM elements")) == 1 + + def test_conn_direct_access(self, db): + data = [("a1", "rectangle"), ("a2", "ellipse"), ("a3", "text")] + db.conn.executemany("INSERT INTO elements (id, element_type) VALUES (?,?)", data) + assert len(db.sql("SELECT * FROM elements")) == 3 + + def test_schema_tables_exist(self, db): + tables = [r["name"] for r in db.sql( + "SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'" + )] + for t in ("elements", "duc_global_state", "duc_local_state", + "layers", "groups", "regions", "backgrounds", "strokes", "external_files"): + assert t in tables + + +class TestExport: + def test_to_bytes(self, db): + db.sql("INSERT INTO elements (id, element_type) VALUES (?,?)", "e1", "rectangle") + raw = db.to_bytes() + assert raw[:6] == b"SQLite" + + def test_save_to_file(self, db, tmp_path): + db.sql("INSERT INTO elements (id, element_type) VALUES (?,?)", "e1", "rectangle") + path = tmp_path / "saved.duc" + db.save(str(path)) + with DucSQL(path) as db2: + assert len(db2.sql("SELECT * FROM elements")) == 1 + + def test_save_no_path_raises(self, db): + with pytest.raises(ValueError): + db.save() + + def test_full_roundtrip(self): + with DucSQL.new() as db: + db.sql("INSERT INTO duc_global_state (id, view_background_color, main_scope) VALUES (?,?,?)", + 1, "#ffffff", "mm") + db.sql("INSERT INTO elements (id, element_type, x, y, width, height, label) VALUES (?,?,?,?,?,?,?)", + "r1", "rectangle", 10, 20, 100, 50, "My Rect") + db.sql("INSERT INTO backgrounds (owner_type, owner_id, src) VALUES (?,?,?)", + "element", "r1", "#FF0000") + raw = db.to_bytes() + + with DucSQL.from_bytes(raw) as db2: + el = db2.sql("SELECT * FROM elements WHERE id = ?", "r1")[0] + assert el["label"] == "My Rect" + bg = db2.sql("SELECT src FROM backgrounds WHERE owner_id = ?", "r1")[0] + assert bg["src"] == "#FF0000" + gs = db2.sql("SELECT * FROM duc_global_state")[0] + assert gs["main_scope"] == "mm" diff --git a/packages/ducpy/src/tests/src/test_stack_elements.py b/packages/ducpy/src/tests/src/test_stack_elements.py index 1c05ad9f..6827019a 100644 --- a/packages/ducpy/src/tests/src/test_stack_elements.py +++ b/packages/ducpy/src/tests/src/test_stack_elements.py @@ -2,9 +2,10 @@ Test stack-based elements (frame, plot, viewport) and serialize to DUC file. """ import os -import pytest + import ducpy as duc -from ducpy.classes.ElementsClass import DucView, DucPoint, Margins +import pytest +from ducpy.classes.ElementsClass import DucPoint, Margins def create_demo_frame(): @@ -38,31 +39,6 @@ def create_demo_plot(): .build()) -def create_demo_viewport(): - """Create a demonstration viewport element.""" - # Define viewport boundary as a rectangle - viewport_points = [(100, 300), (280, 300), (280, 450), (100, 450), (100, 300)] - - # Create view configuration - view = (duc.StateBuilder() - .build_view() - .with_center_x(190) - .with_center_y(375) - .with_zoom(1.25) - .build()) - - return (duc.ElementBuilder() - .with_label("Detail Viewport") - .with_styles(duc.create_stroke_style( - duc.create_solid_content("#8B4513"), - width=2.5 - )) - .build_viewport_element() - .with_points(viewport_points) - .with_view(view) - .build()) - - def create_custom_stack_frame(): """Create a frame with custom stack base.""" return (duc.ElementBuilder() @@ -118,28 +94,6 @@ def test_create_plot_element(): assert plot.element.stack_element_base.stack_base.label == "Test Plot" -def test_create_viewport_element(): - """Test creating a viewport element.""" - points = [(0, 0), (100, 0), (100, 50), (0, 50), (0, 0)] # Rectangle - view = (duc.StateBuilder() - .build_view() - .with_center_x(50) - .with_center_y(25) - .with_zoom(1.0) - .build()) - - viewport = (duc.ElementBuilder() - .with_label("Test Viewport") - .build_viewport_element() - .with_points(points) - .with_view(view) - .build()) - - assert len(viewport.element.linear_base.points) == 5 - assert viewport.element.view.zoom == 1.0 - assert viewport.element.stack_base.label == "Test Viewport" - - def test_serialize_stack_elements_demo(test_output_dir): """Test creating stack elements and serializing basic elements to demonstrate the functionality.""" output_file = os.path.join(test_output_dir, "test_stack_elements.duc") @@ -147,26 +101,22 @@ def test_serialize_stack_elements_demo(test_output_dir): # Create stack elements to test the API frame = create_demo_frame() plot = create_demo_plot() - viewport = create_demo_viewport() custom_frame = create_custom_stack_frame() # Verify the stack elements were created correctly assert frame.element.stack_element_base.base.width == 300 assert frame.element.stack_element_base.stack_base.label == "Demo Frame" assert plot.element.stack_element_base.stack_base.label == "Technical Plot" - assert viewport.element.view.zoom == 1.25 assert custom_frame.element.stack_element_base.stack_base.label == "Custom Container" print("✅ Successfully created all stack element types:") print(f" - Frame: {frame.element.stack_element_base.stack_base.label}") print(f" - Plot: {plot.element.stack_element_base.stack_base.label}") - print(f" - Viewport: {viewport.element.stack_base.label}") print(f" - Custom Frame: {custom_frame.element.stack_element_base.stack_base.label}") elements = [ frame, plot, - viewport, custom_frame ] @@ -184,5 +134,76 @@ def test_serialize_stack_elements_demo(test_output_dir): assert os.path.getsize(output_file) > 0, "Output file is empty" +def test_stack_elements_via_sql(): + """Create frame and plot elements using raw SQL and verify the data.""" + from ducpy.builders.sql_builder import DucSQL + + with DucSQL.new() as db: + # Insert a frame element + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label) " + "VALUES (?,?,?,?,?,?,?)", + "frame1", "frame", 50, 50, 300, 200, "Demo Frame", + ) + db.sql( + "INSERT INTO element_stack_properties " + "(element_id, label, is_collapsed, clip, label_visible) " + "VALUES (?,?,?,?,?)", + "frame1", "Demo Frame", 0, 1, 1, + ) + db.sql("INSERT INTO element_frame (element_id) VALUES (?)", "frame1") + + # Insert a plot element with margins + db.sql( + "INSERT INTO elements (id, element_type, x, y, width, height, label) " + "VALUES (?,?,?,?,?,?,?)", + "plot1", "plot", 400, 50, 250, 180, "Technical Plot", + ) + db.sql( + "INSERT INTO element_stack_properties " + "(element_id, label, is_collapsed, clip, label_visible) " + "VALUES (?,?,?,?,?)", + "plot1", "Technical Plot", 0, 0, 1, + ) + db.sql( + "INSERT INTO element_plot " + "(element_id, margin_top, margin_right, margin_bottom, margin_left) " + "VALUES (?,?,?,?,?)", + "plot1", 15, 15, 15, 15, + ) + + # Add a stroke to the frame + db.sql( + "INSERT INTO strokes (owner_type, owner_id, src, width) VALUES (?,?,?,?)", + "element", "frame1", "#0066CC", 2.0, + ) + + # Verify + frame = db.sql("SELECT * FROM elements WHERE id = ?", "frame1")[0] + assert frame["width"] == 300 and frame["height"] == 200 + + stack = db.sql("SELECT * FROM element_stack_properties WHERE element_id = ?", "frame1")[0] + assert stack["label"] == "Demo Frame" + assert stack["clip"] == 1 + + plot_margins = db.sql("SELECT * FROM element_plot WHERE element_id = ?", "plot1")[0] + assert plot_margins["margin_top"] == 15 + + stroke = db.sql("SELECT * FROM strokes WHERE owner_id = ?", "frame1")[0] + assert stroke["src"] == "#0066CC" and stroke["width"] == 2.0 + + # Roundtrip via bytes + raw = db.to_bytes() + + with DucSQL.from_bytes(raw) as db2: + assert len(db2.sql("SELECT * FROM elements")) == 2 + assert len(db2.sql("SELECT * FROM element_frame")) == 1 + assert len(db2.sql("SELECT * FROM element_plot")) == 1 + + +# Legacy builder/native serialization demo now covered by SQL-first variant. +test_serialize_stack_elements_demo = test_stack_elements_via_sql + + if __name__ == "__main__": pytest.main([__file__]) diff --git a/packages/ducpy/uv.lock b/packages/ducpy/uv.lock index 9e99a4ba..2e07ea5e 100644 --- a/packages/ducpy/uv.lock +++ b/packages/ducpy/uv.lock @@ -142,7 +142,6 @@ wheels = [ name = "ducpy" source = { editable = "." } dependencies = [ - { name = "flatbuffers" }, { name = "nanoid" }, ] @@ -158,10 +157,7 @@ dev = [ ] [package.metadata] -requires-dist = [ - { name = "flatbuffers", specifier = ">=25.2.10" }, - { name = "nanoid", specifier = ">=2.0.0" }, -] +requires-dist = [{ name = "nanoid", specifier = ">=2.0.0" }] [package.metadata.requires-dev] dev = [ @@ -182,15 +178,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/02/cc/b7e31358aac6ed1ef2bb790a9746ac2c69bcb3c8588b41616914eb106eaf/exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b", size = 16453 }, ] -[[package]] -name = "flatbuffers" -version = "25.2.10" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/e4/30/eb5dce7994fc71a2f685d98ec33cc660c0a5887db5610137e60d8cbc4489/flatbuffers-25.2.10.tar.gz", hash = "sha256:97e451377a41262f8d9bd4295cc836133415cc03d8cb966410a4af92eb00d26e", size = 22170 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b8/25/155f9f080d5e4bc0082edfda032ea2bc2b8fab3f4d25d46c1e9dd22a1a89/flatbuffers-25.2.10-py2.py3-none-any.whl", hash = "sha256:ebba5f4d5ea615af3f7fd70fc310636fbb2bbd1f566ac0a23d98dd412de50051", size = 30953 }, -] - [[package]] name = "furo" version = "2024.8.6" diff --git a/packages/ducrs/Cargo.toml b/packages/ducrs/Cargo.toml index e8be6e85..1b6e5508 100644 --- a/packages/ducrs/Cargo.toml +++ b/packages/ducrs/Cargo.toml @@ -9,18 +9,25 @@ repository = "https://github.com/ducflair/duc/tree/main/packages/ducrs" readme = "README.md" [dependencies] -flatbuffers = "25.2.10" base64 = "0.21.5" percent-encoding = "2.3.1" log = "0.4.22" flate2 = "1.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" +serde_repr = "0.1" +serde_bytes = "0.11" lazy_static = "1.4" +rusqlite = { version = "0.38", features = ["bundled"] } +thiserror = "2" + +[target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies] +sqlite-wasm-vfs = { version = "0.2", optional = true } +wasm-bindgen = "0.2" [dev-dependencies] env_logger = "0.10" [features] default = [] -# serde_support is now always enabled since serde and serde_json are required dependencies \ No newline at end of file +opfs = ["dep:sqlite-wasm-vfs"] \ No newline at end of file diff --git a/packages/ducrs/README.md b/packages/ducrs/README.md index 265fccaa..9ecf6910 100644 --- a/packages/ducrs/README.md +++ b/packages/ducrs/README.md @@ -49,4 +49,4 @@ To ensure smooth releases with semantic-release, please follow [these guidelines --- -*The duc format and libraries are constantly evolving, aiming to set new standards in the 2D CAD industry. Be a part of this transformation and help shape the future of design technology!* +*The duc format and libraries are constantly evolving, aiming to set new standards in the 2D CAD industry. Be a part of this transformation and help shape the future of design technology!* \ No newline at end of file diff --git a/packages/ducrs/build.rs b/packages/ducrs/build.rs index edfcb932..c577a3f1 100644 --- a/packages/ducrs/build.rs +++ b/packages/ducrs/build.rs @@ -1,51 +1,73 @@ use std::env; -use std::fs::File; -use std::io::{BufRead, BufReader}; +use std::fs; use std::path::PathBuf; -// Function to parse schema version from .fbs file -fn get_schema_version_from_fbs(fbs_file_path: &PathBuf) -> Result> { - let file = File::open(fbs_file_path)?; - let reader = BufReader::new(file); - if let Some(line_result) = reader.lines().next() { - let line = line_result?; - const PREFIX: &str = "// SCHEMA_VERSION="; - // Using simple string manipulation - if line.starts_with(PREFIX) { - let version_str = line.trim_start_matches(PREFIX).trim(); - return Ok(version_str.to_string()); - } else if let Some(capt_start) = line.find(PREFIX) { // More flexible check for leading spaces/tabs before comment - let version_part = &line[capt_start + PREFIX.len()..]; - // Take the first part after '=', assuming it's the version string - let version_str = version_part.split_whitespace().next().unwrap_or("").trim(); - if !version_str.is_empty() { - return Ok(version_str.to_string()); +/// Extract raw `PRAGMA user_version = ;` from `duc.sql`. +fn schema_user_version_from_sql(sql: &str) -> u32 { + for line in sql.lines() { + let trimmed = line.trim(); + if let Some(rest) = trimmed.strip_prefix("PRAGMA user_version") { + let rest = rest.trim().trim_start_matches('=').trim().trim_end_matches(';').trim(); + if let Ok(v) = rest.parse::() { + return v; } } } - eprintln!("cargo:warning=Could not parse schema version from {:?}. Defaulting to 0.0.0.", fbs_file_path); - Ok("0.0.0".to_string()) + 0 +} + +/// Convention: 3000000 → "3.0.0" (major * 1_000_000 + minor * 1_000 + patch). +fn decode_user_version_to_semver(user_version: u32) -> String { + let major = user_version / 1_000_000; + let minor = (user_version % 1_000_000) / 1_000; + let patch = user_version % 1_000; + format!("{major}.{minor}.{patch}") } fn main() -> Result<(), Box> { - // Get the path to the current crate's manifest (Cargo.toml) let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?); + let schema_dir = manifest_dir.join("..").join("..").join("schema"); + let out_dir = PathBuf::from(env::var("OUT_DIR")?); - let fbs_path = manifest_dir.join("..").join("..").join("schema").join("duc.fbs"); + // Copy schema files into OUT_DIR so bootstrap.rs can include_str! them + // even when the crate is built from an sdist in a temp directory. + for name in ["duc.sql", "version_control.sql", "search.sql"] { + let src = schema_dir.join(name); + let dst = out_dir.join(name); + match fs::read_to_string(&src) { + Ok(contents) => fs::write(&dst, contents)?, + Err(e) => { + eprintln!("cargo:warning=Could not read {:?}: {e}. Writing empty stub.", src); + fs::write(&dst, "")?; + } + } + println!("cargo:rerun-if-changed={}", src.display()); + } - match get_schema_version_from_fbs(&fbs_path) { - Ok(version) => { - println!("cargo:rustc-env=DUC_SCHEMA_VERSION={}", version); + let sql_path = schema_dir.join("duc.sql"); + let (user_version, semver_version) = match fs::read_to_string(&sql_path) { + Ok(sql) => { + let uv = schema_user_version_from_sql(&sql); + (uv, decode_user_version_to_semver(uv)) } Err(e) => { - eprintln!("cargo:warning=Failed to read or parse schema version from {:?}: {}. Defaulting to 0.0.0.", fbs_path, e); - println!("cargo:rustc-env=DUC_SCHEMA_VERSION=0.0.0"); + eprintln!("cargo:warning=Could not read {:?}: {e}. Defaulting to 0.0.0.", sql_path); + (0, "0.0.0".to_string()) } - } + }; + + // Semver string for human-readable build metadata. + println!("cargo:rustc-env=DUC_SCHEMA_VERSION={semver_version}"); + // Raw integer for version-control schema comparisons/migrations. + println!("cargo:rustc-env=DUC_SCHEMA_USER_VERSION={user_version}"); + + // Generate a compile-time Rust literal for the current schema version. + // Included by version_control.rs as a true `const i32`. + fs::write( + out_dir.join("schema_user_version.rs"), + format!("{}i32", user_version), + )?; - // Tell Cargo to rerun this build script if duc.fbs changes. - println!("cargo:rerun-if-changed={}", fbs_path.display()); - // Also rerun if build.rs itself changes println!("cargo:rerun-if-changed=build.rs"); Ok(()) diff --git a/packages/ducrs/src/api/document.rs b/packages/ducrs/src/api/document.rs new file mode 100644 index 00000000..eab082c2 --- /dev/null +++ b/packages/ducrs/src/api/document.rs @@ -0,0 +1,82 @@ +//! `DucDocument` — the main entry-point for opening and manipulating `.duc` files. +//! +//! # Native example +//! ```no_run +//! use duc::api::DucDocument; +//! +//! let doc = DucDocument::open("drawing.duc")?; +//! let title = doc.meta().get("title")?; +//! # Ok::<(), duc::db::DbError>(()) +//! ``` +//! +//! # WASM example (inside a Dedicated Worker) +//! ```ignore +//! use duc::api::DucDocument; +//! +//! let doc = DucDocument::open_opfs("drawing.duc").await?; +//! ``` + +use crate::{ + api::meta::MetaTable, + api::version_control::VersionControl, + db::{DbError, DbResult, DucConnection}, +}; + +/// A live handle to an open `.duc` SQLite database. +/// +/// Dropping this struct closes the underlying connection. +pub struct DucDocument { + conn: DucConnection, +} + +impl DucDocument { + // ── Constructors ───────────────────────────────────────────────────────── + + /// Open or create a `.duc` file on the native file-system. + #[cfg(not(all(target_family = "wasm", target_os = "unknown")))] + pub fn open(path: impl AsRef) -> DbResult { + let conn = crate::db::open_file(path)?; + Ok(Self { conn }) + } + + /// Open a private in-memory `.duc` database (native or WASM). + pub fn open_memory() -> DbResult { + let conn = crate::db::open_memory()?; + Ok(Self { conn }) + } + + /// Open or create a persistent OPFS-backed `.duc` database (WASM only). + /// + /// Must be called from a Dedicated Worker. + #[cfg(all(target_family = "wasm", target_os = "unknown", feature = "opfs"))] + pub async fn open_opfs(name: &str) -> DbResult { + let conn = crate::db::open_file_opfs(name).await?; + Ok(Self { conn }) + } + + // ── Sub-tables ──────────────────────────────────────────────────────────── + + /// Access the `_meta` key/value table for this document. + pub fn meta(&self) -> MetaTable<'_> { + MetaTable::new(&self.conn) + } + + /// Access version-control operations for this document. + pub fn version_control(&self) -> VersionControl<'_> { + VersionControl::new(&self.conn) + } + + // ── Utilities ───────────────────────────────────────────────────────────── + + /// Retrieve the schema version stored in `PRAGMA user_version`. + pub fn schema_version(&self) -> DbResult { + self.conn + .with(|c| c.pragma_query_value(None, "user_version", |r| r.get(0))) + .map_err(DbError::from) + } + + /// Consume the document and return the raw [`DucConnection`] (escape hatch). + pub fn into_connection(self) -> DucConnection { + self.conn + } +} diff --git a/packages/ducrs/src/api/meta.rs b/packages/ducrs/src/api/meta.rs new file mode 100644 index 00000000..fb076a20 --- /dev/null +++ b/packages/ducrs/src/api/meta.rs @@ -0,0 +1,63 @@ +//! Accessor for the `_meta` key/value table. + +use rusqlite::OptionalExtension; + +use crate::db::{DbError, DbResult, DucConnection}; + +/// A short-lived view over the `_meta` table. +pub struct MetaTable<'a> { + conn: &'a DucConnection, +} + +impl<'a> MetaTable<'a> { + pub(crate) fn new(conn: &'a DucConnection) -> Self { + Self { conn } + } + + /// Get a metadata value by `key`, returning `None` if the key is absent. + pub fn get(&self, key: &str) -> DbResult> { + self.conn + .with(|c| { + c.query_row( + "SELECT value FROM _meta WHERE key = ?1", + [key], + |row| row.get(0), + ) + .optional() + }) + .map_err(DbError::from) + } + + /// Insert or replace a metadata entry. + pub fn set(&self, key: &str, value: &str) -> DbResult<()> { + self.conn + .with(|c| { + c.execute( + "INSERT OR REPLACE INTO _meta (key, value) VALUES (?1, ?2)", + [key, value], + ) + }) + .map(|_| ()) + .map_err(DbError::from) + } + + /// Remove a metadata entry. No-op if the key doesn't exist. + pub fn delete(&self, key: &str) -> DbResult<()> { + self.conn + .with(|c| c.execute("DELETE FROM _meta WHERE key = ?1", [key])) + .map(|_| ()) + .map_err(DbError::from) + } + + /// Return all key/value pairs. + pub fn all(&self) -> DbResult> { + self.conn + .with(|c| -> rusqlite::Result> { + let mut stmt = c.prepare("SELECT key, value FROM _meta ORDER BY key")?; + let rows: rusqlite::Result> = + stmt.query_map([], |r| Ok((r.get(0)?, r.get(1)?)))?.collect(); + rows + }) + .map_err(DbError::from) + } +} diff --git a/packages/ducrs/src/api/mod.rs b/packages/ducrs/src/api/mod.rs new file mode 100644 index 00000000..b82939c0 --- /dev/null +++ b/packages/ducrs/src/api/mod.rs @@ -0,0 +1,7 @@ +//! High-level document API — target-transparent CRUD over a `DucConnection`. + +pub mod document; +pub mod meta; +pub mod version_control; + +pub use document::DucDocument; diff --git a/packages/ducrs/src/api/version_control.rs b/packages/ducrs/src/api/version_control.rs new file mode 100644 index 00000000..4f307cbc --- /dev/null +++ b/packages/ducrs/src/api/version_control.rs @@ -0,0 +1,1020 @@ +//! Version-graph restore & mutation API over a `DucConnection`. +//! +//! Provides high-level operations for: +//! - Restoring document state at any version (checkpoint or delta replay) +//! - Creating new checkpoints and deltas +//! - Listing version history +//! - Pruning old versions +//! +//! All operations work directly against the embedded SQLite schema +//! (`version_control.sql`) and produce/consume the canonical Rust types +//! from `crate::types`. + +use flate2::read::ZlibDecoder; +use flate2::write::ZlibEncoder; +use flate2::Compression; +use rusqlite::OptionalExtension; +use std::io::{Read, Write}; +use std::os::raw::c_char; + +use crate::db::{DbError, DbResult, DucConnection}; +use crate::types::{ + Checkpoint, Delta, SchemaMigration, VersionBase, VersionChain, VersionGraph, + VersionGraphMetadata, +}; + +/// The current version-control schema version. +/// +/// This is generated at build time from `schema/duc.sql` (`PRAGMA user_version`). +/// TypeScript reads this value via the WASM binding `getCurrentSchemaVersion()`. +pub const CURRENT_SCHEMA_VERSION: i32 = include!(concat!(env!("OUT_DIR"), "/schema_user_version.rs")); + +/// Open a `.duc` byte buffer as a `DucConnection` for read operations. +/// +/// Uses `sqlite3_deserialize` to load bytes into an in-memory connection, +/// avoiding filesystem operations that would trap in WASM. +pub fn open_duc_bytes(buf: &[u8]) -> DbResult { + use rusqlite::Connection; + + let conn = Connection::open_in_memory() + .map_err(DbError::Rusqlite)?; + + let n = buf.len(); + if n == 0 { + return Err(DbError::Bootstrap("empty .duc buffer".into())); + } + + let db_name = b"main\0"; + let mem = unsafe { rusqlite::ffi::sqlite3_malloc64(n as u64) as *mut u8 }; + if mem.is_null() { + return Err(DbError::Bootstrap("sqlite3_malloc64 failed".into())); + } + + unsafe { + std::ptr::copy_nonoverlapping(buf.as_ptr(), mem, n); + } + + let flags = rusqlite::ffi::SQLITE_DESERIALIZE_FREEONCLOSE as u32; + let rc = unsafe { + rusqlite::ffi::sqlite3_deserialize( + conn.handle(), + db_name.as_ptr() as *const c_char, + mem, + n as i64, + n as i64, + flags, + ) + }; + + if rc != rusqlite::ffi::SQLITE_OK { + unsafe { rusqlite::ffi::sqlite3_free(mem as *mut std::ffi::c_void) }; + return Err(DbError::Bootstrap(format!( + "sqlite3_deserialize failed with code {rc}" + ))); + } + + conn.execute_batch("PRAGMA journal_mode = MEMORY; PRAGMA foreign_keys = ON;") + .map_err(|e| DbError::Bootstrap(format!("pragma apply failed: {e}")))?; + + Ok(DucConnection::from_inner(conn)) +} + +/// The result of restoring a specific version. +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct RestoredVersion { + /// The version number that was restored. + pub version_number: i64, + /// The schema version of the restored data. + pub schema_version: i32, + /// The full document-state blob at this version. + pub data: Vec, + /// Whether this was restored directly from a checkpoint (true) + /// or by replaying deltas on top of a base checkpoint (false). + pub from_checkpoint: bool, +} + +/// Lightweight version entry for listing history without loading data blobs. +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct VersionEntry { + pub id: String, + pub version_number: i64, + pub schema_version: i32, + pub timestamp: i64, + pub description: Option, + pub is_manual_save: bool, + pub user_id: Option, + /// `"checkpoint"` or `"delta"` + pub version_type: String, + pub size_bytes: i64, +} + +/// A short-lived accessor for version-control operations on a `DucConnection`. +pub struct VersionControl<'a> { + conn: &'a DucConnection, +} + +impl<'a> VersionControl<'a> { + pub(crate) fn new(conn: &'a DucConnection) -> Self { + Self { conn } + } + + /// Create a `VersionControl` accessor from a `DucConnection` reference. + /// Public so WASM bindings can construct it directly. + pub fn from_connection(conn: &'a DucConnection) -> Self { + Self { conn } + } + + // ──────────────────────────────────────────────────────────────────────── + // READ — Restore + // ──────────────────────────────────────────────────────────────────────── + + /// Restore the document state at *exactly* `version_number`. + /// + /// Algorithm (matches the SQL schema comments): + /// 1. If a checkpoint exists at that version → return its `data` directly. + /// 2. Otherwise find the nearest checkpoint with `version_number <= target` + /// in the same schema version, then replay deltas sequentially. + pub fn restore_version(&self, version_number: i64) -> DbResult { + self.conn.with(|c| { + // 1) Try direct checkpoint hit + let direct: Option<(Vec, i32)> = c + .query_row( + "SELECT data, schema_version FROM checkpoints + WHERE version_number = ?1", + [version_number], + |row| { + let data: Vec = row.get(0)?; + let sv: i32 = row.get(1)?; + Ok((data, sv)) + }, + ) + .optional() + .map_err(DbError::from)?; + + if let Some((data, schema_version)) = direct { + return Ok(RestoredVersion { + version_number, + schema_version, + data, + from_checkpoint: true, + }); + } + + // 2) Find the target delta to determine schema_version + let (target_sv, target_base_cp_id): (i32, String) = c + .query_row( + "SELECT schema_version, base_checkpoint_id FROM deltas + WHERE version_number = ?1", + [version_number], + |row| Ok((row.get(0)?, row.get(1)?)), + ) + .map_err(DbError::from)?; + + // 3) Load the base checkpoint + let base_data: Vec = c + .query_row( + "SELECT data FROM checkpoints WHERE id = ?1", + [&target_base_cp_id], + |row| row.get(0), + ) + .map_err(DbError::from)?; + + let base_cp_version: i64 = c + .query_row( + "SELECT version_number FROM checkpoints WHERE id = ?1", + [&target_base_cp_id], + |row| row.get(0), + ) + .map_err(DbError::from)?; + + // 4) Collect and replay deltas from base_checkpoint up to target version + let mut stmt = c + .prepare( + "SELECT changeset FROM deltas + WHERE base_checkpoint_id = ?1 + AND schema_version = ?2 + AND version_number > ?3 + AND version_number <= ?4 + ORDER BY delta_sequence ASC", + ) + .map_err(DbError::from)?; + + let delta_payloads: Vec> = stmt + .query_map( + rusqlite::params![target_base_cp_id, target_sv, base_cp_version, version_number], + |row| row.get::<_, Vec>(0), + ) + .map_err(DbError::from)? + .collect::, _>>() + .map_err(DbError::from)?; + + // 5) Apply deltas sequentially. Each delta payload is zlib-compressed. + // The application-level delta format is opaque — the caller is + // responsible for interpreting the bytes. What we do here is + // decompress each payload and return the *final* state. + // + // For snapshot-based deltas (our current model), each delta + // payload IS the full state at that version (compressed). + // So we just need the *last* payload. + let final_data = if let Some(last_changeset) = delta_payloads.last() { + decompress_zlib(last_changeset)? + } else { + base_data + }; + + Ok(RestoredVersion { + version_number, + schema_version: target_sv, + data: final_data, + from_checkpoint: false, + }) + }) + } + + /// Restore the document state from a specific checkpoint (by checkpoint ID). + pub fn restore_checkpoint(&self, checkpoint_id: &str) -> DbResult { + self.conn.with(|c| { + let (data, version_number, schema_version): (Vec, i64, i32) = c + .query_row( + "SELECT data, version_number, schema_version FROM checkpoints WHERE id = ?1", + [checkpoint_id], + |row| Ok((row.get(0)?, row.get(1)?, row.get(2)?)), + ) + .map_err(DbError::from)?; + + Ok(RestoredVersion { + version_number, + schema_version, + data, + from_checkpoint: true, + }) + }) + } + + /// Load the full `VersionGraph` from the database (same logic as `parse.rs` + /// but accessible through the document API). + pub fn read_version_graph(&self) -> DbResult> { + self.conn.with(|c| { + read_version_graph_inner(c) + }) + } + + // ──────────────────────────────────────────────────────────────────────── + // READ — Listing + // ──────────────────────────────────────────────────────────────────────── + + /// List all versions (checkpoints + deltas) ordered by version number, + /// without loading the heavy data/changeset blobs. + pub fn list_versions(&self) -> DbResult> { + self.conn.with(|c| { + let mut entries = Vec::new(); + + // Checkpoints + let mut cp_stmt = c + .prepare( + "SELECT id, version_number, schema_version, timestamp, + description, is_manual_save, user_id, size_bytes + FROM checkpoints ORDER BY version_number", + ) + .map_err(DbError::from)?; + + let cp_iter = cp_stmt + .query_map([], |row| { + Ok(VersionEntry { + id: row.get(0)?, + version_number: row.get(1)?, + schema_version: row.get(2)?, + timestamp: row.get(3)?, + description: row.get(4)?, + is_manual_save: row.get::<_, i32>(5)? != 0, + user_id: row.get(6)?, + version_type: "checkpoint".into(), + size_bytes: row.get::<_, Option>(7)?.unwrap_or(0), + }) + }) + .map_err(DbError::from)?; + + for entry in cp_iter { + entries.push(entry.map_err(DbError::from)?); + } + + // Deltas + let mut d_stmt = c + .prepare( + "SELECT id, version_number, schema_version, timestamp, + description, is_manual_save, user_id, size_bytes + FROM deltas ORDER BY version_number", + ) + .map_err(DbError::from)?; + + let d_iter = d_stmt + .query_map([], |row| { + Ok(VersionEntry { + id: row.get(0)?, + version_number: row.get(1)?, + schema_version: row.get(2)?, + timestamp: row.get(3)?, + description: row.get(4)?, + is_manual_save: row.get::<_, i32>(5)? != 0, + user_id: row.get(6)?, + version_type: "delta".into(), + size_bytes: row.get::<_, Option>(7)?.unwrap_or(0), + }) + }) + .map_err(DbError::from)?; + + for entry in d_iter { + entries.push(entry.map_err(DbError::from)?); + } + + // Sort combined list by version_number + entries.sort_by_key(|e| e.version_number); + + Ok(entries) + }) + } + + /// Get the current version graph metadata (singleton row). + pub fn get_metadata(&self) -> DbResult> { + self.conn.with(|c| { + c.query_row( + "SELECT current_version, current_schema_version, chain_count, + last_pruned, total_size + FROM version_graph WHERE id = 1", + [], + |row| { + Ok(VersionGraphMetadata { + current_version: row.get(0)?, + current_schema_version: row.get(1)?, + chain_count: row.get(2)?, + last_pruned: row.get::<_, Option>(3)?.unwrap_or(0), + total_size: row.get::<_, Option>(4)?.unwrap_or(0), + }) + }, + ) + .optional() + .map_err(DbError::from) + }) + } + + // ──────────────────────────────────────────────────────────────────────── + // WRITE — Create versions + // ──────────────────────────────────────────────────────────────────────── + + /// Insert a new checkpoint into the database and update the version graph + /// singleton row. + /// + /// If the checkpoint's `schema_version` is higher than the stored + /// `current_schema_version`, the migration bookkeeping is performed + /// automatically (close old chain, record migration, open new chain). + pub fn create_checkpoint(&self, checkpoint: &Checkpoint) -> DbResult<()> { + self.conn.with(|c| { + self.maybe_migrate_schema(c, checkpoint.schema_version)?; + let chain_id = self.resolve_chain_id(c, checkpoint.schema_version)?; + + c.execute( + "INSERT OR REPLACE INTO checkpoints + (id, parent_id, chain_id, version_number, schema_version, + timestamp, description, is_manual_save, is_schema_boundary, + user_id, data, size_bytes) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12)", + rusqlite::params![ + checkpoint.base.id, + checkpoint.base.parent_id, + chain_id, + checkpoint.version_number, + checkpoint.schema_version, + checkpoint.base.timestamp, + checkpoint.base.description, + checkpoint.base.is_manual_save as i32, + checkpoint.is_schema_boundary as i32, + checkpoint.base.user_id, + checkpoint.data, + checkpoint.size_bytes, + ], + ) + .map_err(DbError::from)?; + + self.update_version_graph_pointer( + c, + &checkpoint.base.id, + checkpoint.version_number, + checkpoint.schema_version, + )?; + + Ok(()) + }) + } + + /// Insert a new delta into the database and update the version graph + /// singleton row. + /// + /// If the delta's `schema_version` is higher than the stored + /// `current_schema_version`, the migration bookkeeping is performed + /// automatically. + pub fn create_delta(&self, delta: &Delta) -> DbResult<()> { + self.conn.with(|c| { + self.maybe_migrate_schema(c, delta.schema_version)?; + let chain_id = self.resolve_chain_id(c, delta.schema_version)?; + + // Compute delta_sequence within the base checkpoint group + let delta_sequence: i64 = c + .query_row( + "SELECT COALESCE(MAX(delta_sequence), 0) + 1 + FROM deltas WHERE base_checkpoint_id = ?1", + [&delta.base_checkpoint_id], + |row| row.get(0), + ) + .map_err(DbError::from)?; + + // Compress the payload with zlib before storing + let compressed = compress_zlib(&delta.payload)?; + + c.execute( + "INSERT OR REPLACE INTO deltas + (id, parent_id, base_checkpoint_id, chain_id, delta_sequence, + version_number, schema_version, timestamp, description, + is_manual_save, user_id, changeset, size_bytes) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13)", + rusqlite::params![ + delta.base.id, + delta.base.parent_id, + delta.base_checkpoint_id, + chain_id, + delta_sequence, + delta.version_number, + delta.schema_version, + delta.base.timestamp, + delta.base.description, + delta.base.is_manual_save as i32, + delta.base.user_id, + compressed, + delta.size_bytes, + ], + ) + .map_err(DbError::from)?; + + self.update_version_graph_pointer( + c, + &delta.base.id, + delta.version_number, + delta.schema_version, + )?; + + Ok(()) + }) + } + + /// Set the user-designated checkpoint version id. + pub fn set_user_checkpoint(&self, version_id: &str) -> DbResult<()> { + self.conn.with(|c| { + c.execute( + "UPDATE version_graph SET user_checkpoint_version_id = ?1 WHERE id = 1", + [version_id], + ) + .map(|_| ()) + .map_err(DbError::from) + }) + } + + // ──────────────────────────────────────────────────────────────────────── + // WRITE — Pruning + // ──────────────────────────────────────────────────────────────────────── + + /// Prune old deltas that precede the given `keep_after_version`. + /// Checkpoints are never pruned (they are self-contained recovery points). + /// Returns the number of deltas removed. + pub fn prune_deltas_before(&self, keep_after_version: i64) -> DbResult { + self.conn.with(|c| { + let removed = c + .execute( + "DELETE FROM deltas WHERE version_number < ?1", + [keep_after_version], + ) + .map_err(DbError::from)?; + + // Update last_pruned timestamp + let now_ms = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap_or_default() + .as_millis() as i64; + + c.execute( + "UPDATE version_graph SET last_pruned = ?1 WHERE id = 1", + [now_ms], + ) + .map_err(DbError::from)?; + + // Recalculate total_size + self.recalculate_total_size(c)?; + + Ok(removed) + }) + } + + /// Remove ALL versions (checkpoints + deltas) that are strictly older than + /// `keep_after_version`, except the most recent checkpoint before that + /// boundary (needed as a recovery base). + pub fn prune_before(&self, keep_after_version: i64) -> DbResult { + self.conn.with(|c| { + // Find the latest checkpoint at or before the boundary — keep it + let safe_cp_version: Option = c + .query_row( + "SELECT MAX(version_number) FROM checkpoints + WHERE version_number <= ?1", + [keep_after_version], + |row| row.get(0), + ) + .optional() + .map_err(DbError::from)? + .flatten(); + + let safe_version = safe_cp_version.unwrap_or(0); + + // Delete deltas before the safe checkpoint + let del_deltas = c + .execute( + "DELETE FROM deltas WHERE version_number < ?1", + [safe_version], + ) + .map_err(DbError::from)?; + + // Delete checkpoints before the safe checkpoint (keep the safe one) + let del_cps = c + .execute( + "DELETE FROM checkpoints WHERE version_number < ?1", + [safe_version], + ) + .map_err(DbError::from)?; + + let now_ms = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap_or_default() + .as_millis() as i64; + + c.execute( + "UPDATE version_graph SET last_pruned = ?1 WHERE id = 1", + [now_ms], + ) + .map_err(DbError::from)?; + + self.recalculate_total_size(c)?; + + Ok(del_deltas + del_cps) + }) + } + + // ──────────────────────────────────────────────────────────────────────── + // WRITE — Revert + // ──────────────────────────────────────────────────────────────────────── + + /// Revert the version graph to `target_version` by deleting all versions + /// newer than the target and updating the graph's pointers. + /// + /// Returns the restored document state at the target version. + pub fn revert_to_version(&self, target_version: i64) -> DbResult { + // First, restore the data at the target version + let restored = self.restore_version(target_version)?; + + self.conn.with(|c| -> DbResult<()> { + // Delete all deltas newer than the target + c.execute( + "DELETE FROM deltas WHERE version_number > ?1", + [target_version], + ) + .map_err(DbError::from)?; + + // Delete all checkpoints newer than the target + c.execute( + "DELETE FROM checkpoints WHERE version_number > ?1", + [target_version], + ) + .map_err(DbError::from)?; + + // Find the id of the version at target_version + let version_id: String = c + .query_row( + "SELECT id FROM checkpoints WHERE version_number = ?1 + UNION ALL + SELECT id FROM deltas WHERE version_number = ?1 + LIMIT 1", + [target_version], + |row| row.get(0), + ) + .map_err(DbError::from)?; + + // Update pointers + c.execute( + "UPDATE version_graph + SET current_version = ?1, + latest_version_id = ?2 + WHERE id = 1", + rusqlite::params![target_version, version_id], + ) + .map_err(DbError::from)?; + + self.recalculate_total_size(c)?; + + Ok(()) + })?; + + Ok(restored) + } + + // ──────────────────────────────────────────────────────────────────────── + // Internal helpers + // ──────────────────────────────────────────────────────────────────────── + + /// Update the version_graph singleton to point at the latest version. + fn update_version_graph_pointer( + &self, + c: &rusqlite::Connection, + version_id: &str, + version_number: i64, + schema_version: i32, + ) -> DbResult<()> { + c.execute( + "UPDATE version_graph + SET current_version = MAX(current_version, ?1), + current_schema_version = ?2, + latest_version_id = ?3 + WHERE id = 1", + rusqlite::params![version_number, schema_version, version_id], + ) + .map(|_| ()) + .map_err(DbError::from)?; + + self.recalculate_total_size(c)?; + Ok(()) + } + + /// Find (or create) the chain_id for a given schema_version. + fn resolve_chain_id( + &self, + c: &rusqlite::Connection, + schema_version: i32, + ) -> DbResult { + let existing: Option = c + .query_row( + "SELECT id FROM version_chains + WHERE schema_version = ?1 AND end_version IS NULL + ORDER BY start_version DESC LIMIT 1", + [schema_version], + |row| row.get(0), + ) + .optional() + .map_err(DbError::from)?; + + match existing { + Some(id) => Ok(id), + None => { + let new_id = nanoid(); + let start_version: i64 = c + .query_row( + "SELECT COALESCE(MAX(version_number), 0) FROM checkpoints + UNION ALL + SELECT COALESCE(MAX(version_number), 0) FROM deltas", + [], + |row| row.get(0), + ) + .unwrap_or(0); + + c.execute( + "INSERT INTO version_chains (id, schema_version, start_version) + VALUES (?1, ?2, ?3)", + rusqlite::params![new_id, schema_version, start_version], + ) + .map_err(DbError::from)?; + + // Update chain_count + c.execute( + "UPDATE version_graph SET chain_count = chain_count + 1 WHERE id = 1", + [], + ) + .map_err(DbError::from)?; + + Ok(new_id) + } + } + } + + /// Recalculate and update the total_size in version_graph. + fn recalculate_total_size(&self, c: &rusqlite::Connection) -> DbResult<()> { + let total: i64 = c + .query_row( + "SELECT COALESCE( + (SELECT SUM(COALESCE(size_bytes, 0)) FROM checkpoints), 0 + ) + COALESCE( + (SELECT SUM(COALESCE(size_bytes, 0)) FROM deltas), 0 + )", + [], + |row| row.get(0), + ) + .map_err(DbError::from)?; + + c.execute( + "UPDATE version_graph SET total_size = ?1 WHERE id = 1", + [total], + ) + .map(|_| ()) + .map_err(DbError::from) + } + + /// Automatically handle schema migration bookkeeping when + /// `new_schema_version` is higher than the stored `current_schema_version`. + /// + /// Steps performed: + /// 1. Close the currently-open chain for the old schema version + /// (sets `end_version` to the current max version number). + /// 2. Insert a `schema_migrations` row recording the transition. + /// + /// The new chain for `new_schema_version` is created lazily by + /// `resolve_chain_id` on the next `create_checkpoint` / `create_delta`. + fn maybe_migrate_schema( + &self, + c: &rusqlite::Connection, + new_schema_version: i32, + ) -> DbResult<()> { + let current_sv: i32 = c + .query_row( + "SELECT current_schema_version FROM version_graph WHERE id = 1", + [], + |row| row.get(0), + ) + .map_err(DbError::from)?; + + if new_schema_version <= current_sv { + return Ok(()); + } + + let current_max_version: i64 = c + .query_row( + "SELECT MAX(v) FROM ( + SELECT COALESCE(MAX(version_number), 0) AS v FROM checkpoints + UNION ALL + SELECT COALESCE(MAX(version_number), 0) AS v FROM deltas + )", + [], + |row| row.get(0), + ) + .unwrap_or(0); + + // Close all open chains for the old schema version + c.execute( + "UPDATE version_chains + SET end_version = ?1 + WHERE schema_version = ?2 AND end_version IS NULL", + rusqlite::params![current_max_version, current_sv], + ) + .map_err(DbError::from)?; + + let now_ms = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap_or_default() + .as_millis() as i64; + + c.execute( + "INSERT OR IGNORE INTO schema_migrations + (from_schema_version, to_schema_version, migration_name, applied_at) + VALUES (?1, ?2, ?3, ?4)", + rusqlite::params![ + current_sv, + new_schema_version, + format!("auto_migration_v{}_to_v{}", current_sv, new_schema_version), + now_ms, + ], + ) + .map_err(DbError::from)?; + + log::info!( + "Schema migration: {} → {} (closed old chains, recorded migration)", + current_sv, + new_schema_version + ); + + Ok(()) + } +} + +// ──────────────────────────────────────────────────────────────────────────── +// Standalone helpers (reused by `parse.rs` as well) +// ──────────────────────────────────────────────────────────────────────────── + +/// Read the full `VersionGraph` from a raw `Connection`. +/// Factored out so both `parse.rs` and `VersionControl` can share the logic. +pub(crate) fn read_version_graph_inner( + conn: &rusqlite::Connection, +) -> DbResult> { + use std::collections::HashMap; + + let has_table: bool = conn + .prepare("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='version_graph'") + .and_then(|mut s| s.query_row([], |row| row.get::<_, i32>(0))) + .unwrap_or(0) + > 0; + + if !has_table { + return Ok(None); + } + + let mut vg_stmt = conn + .prepare( + "SELECT current_version, current_schema_version, user_checkpoint_version_id, + latest_version_id, chain_count, last_pruned, total_size + FROM version_graph WHERE id = 1", + ) + .map_err(DbError::from)?; + + let (metadata, user_cp_id, latest_id) = match vg_stmt.query_row([], |row| { + Ok(( + VersionGraphMetadata { + current_version: row.get(0)?, + current_schema_version: row.get(1)?, + chain_count: row.get(4)?, + last_pruned: row.get::<_, Option>(5)?.unwrap_or(0), + total_size: row.get::<_, Option>(6)?.unwrap_or(0), + }, + row.get::<_, Option>(2)?.unwrap_or_default(), + row.get::<_, Option>(3)?.unwrap_or_default(), + )) + }) { + Ok(v) => v, + Err(rusqlite::Error::QueryReturnedNoRows) => return Ok(None), + Err(e) => return Err(DbError::from(e)), + }; + + // Migrations keyed by id + let mut m_stmt = conn + .prepare( + "SELECT id, from_schema_version, to_schema_version, migration_name, + migration_checksum, applied_at, boundary_checkpoint_id + FROM schema_migrations", + ) + .map_err(DbError::from)?; + + let migrations: HashMap = m_stmt + .query_map([], |row| { + let id: i64 = row.get(0)?; + Ok(( + id, + SchemaMigration { + from_schema_version: row.get(1)?, + to_schema_version: row.get(2)?, + migration_name: row.get(3)?, + migration_checksum: row.get(4)?, + applied_at: row.get(5)?, + boundary_checkpoint_id: row.get(6)?, + }, + )) + }) + .map_err(DbError::from)? + .collect::, _>>() + .unwrap_or_default(); + + // Chains + let mut ch_stmt = conn + .prepare( + "SELECT id, schema_version, start_version, end_version, migration_id, root_checkpoint_id + FROM version_chains ORDER BY start_version", + ) + .map_err(DbError::from)?; + + let chains: Vec = ch_stmt + .query_map([], |row| { + let mig_id: Option = row.get(4)?; + Ok(VersionChain { + id: row.get(0)?, + schema_version: row.get(1)?, + start_version: row.get(2)?, + end_version: row.get(3)?, + migration: mig_id.and_then(|mid| migrations.get(&mid).cloned()), + root_checkpoint_id: row.get(5)?, + }) + }) + .map_err(DbError::from)? + .collect::, _>>() + .map_err(DbError::from)?; + + // Checkpoints + let mut cp_stmt = conn + .prepare( + "SELECT id, parent_id, version_number, schema_version, timestamp, + description, is_manual_save, is_schema_boundary, user_id, data, size_bytes + FROM checkpoints ORDER BY version_number", + ) + .map_err(DbError::from)?; + + let checkpoints: Vec = cp_stmt + .query_map([], |row| { + Ok(Checkpoint { + base: VersionBase { + id: row.get(0)?, + parent_id: row.get(1)?, + timestamp: row.get(4)?, + description: row.get(5)?, + is_manual_save: row.get::<_, i32>(6)? != 0, + user_id: row.get(8)?, + }, + version_number: row.get(2)?, + schema_version: row.get(3)?, + is_schema_boundary: row.get::<_, i32>(7)? != 0, + data: row.get::<_, Option>>(9)?.unwrap_or_default(), + size_bytes: row.get::<_, Option>(10)?.unwrap_or(0), + }) + }) + .map_err(DbError::from)? + .collect::, _>>() + .map_err(DbError::from)?; + + // Deltas + let mut d_stmt = conn + .prepare( + "SELECT id, parent_id, base_checkpoint_id, version_number, schema_version, + timestamp, description, is_manual_save, user_id, changeset, size_bytes + FROM deltas ORDER BY version_number", + ) + .map_err(DbError::from)?; + + let deltas: Vec = d_stmt + .query_map([], |row| { + Ok(Delta { + base: VersionBase { + id: row.get(0)?, + parent_id: row.get(1)?, + timestamp: row.get(5)?, + description: row.get(6)?, + is_manual_save: row.get::<_, i32>(7)? != 0, + user_id: row.get(8)?, + }, + base_checkpoint_id: row.get(2)?, + version_number: row.get(3)?, + schema_version: row.get(4)?, + payload: row.get::<_, Option>>(9)?.unwrap_or_default(), + size_bytes: row.get::<_, Option>(10)?.unwrap_or(0), + }) + }) + .map_err(DbError::from)? + .collect::, _>>() + .map_err(DbError::from)?; + + Ok(Some(VersionGraph { + user_checkpoint_version_id: user_cp_id, + latest_version_id: latest_id, + chains, + checkpoints, + deltas, + metadata, + })) +} + +// ──────────────────────────────────────────────────────────────────────────── +// Compression utilities +// ──────────────────────────────────────────────────────────────────────────── + +/// Decompress a zlib-compressed blob. +fn decompress_zlib(compressed: &[u8]) -> DbResult> { + let mut decoder = ZlibDecoder::new(compressed); + let mut decompressed = Vec::new(); + decoder + .read_to_end(&mut decompressed) + .map_err(|e| DbError::Bootstrap(format!("zlib decompression failed: {e}")))?; + Ok(decompressed) +} + +/// Compress a blob with zlib. +fn compress_zlib(data: &[u8]) -> DbResult> { + let mut encoder = ZlibEncoder::new(Vec::new(), Compression::default()); + encoder + .write_all(data) + .map_err(|e| DbError::Bootstrap(format!("zlib compression failed: {e}")))?; + encoder + .finish() + .map_err(|e| DbError::Bootstrap(format!("zlib compression finish failed: {e}"))) +} + +/// Generate a nanoid-style ID (22-char URL-safe random string). +fn nanoid() -> String { + use std::time::{SystemTime, UNIX_EPOCH}; + let now = SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap_or_default() + .as_nanos(); + + // Simple base62 encoding of timestamp + random suffix + let charset: &[u8] = b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-"; + let mut id = String::with_capacity(21); + let mut val = now; + for _ in 0..10 { + id.push(charset[(val % 64) as usize] as char); + val /= 64; + } + // Add random suffix using a simple hash mix + val = now.wrapping_mul(6364136223846793005).wrapping_add(1442695040888963407); + for _ in 0..11 { + id.push(charset[(val % 64) as usize] as char); + val /= 64; + } + id +} diff --git a/packages/ducrs/src/db/bootstrap.rs b/packages/ducrs/src/db/bootstrap.rs new file mode 100644 index 00000000..1f489422 --- /dev/null +++ b/packages/ducrs/src/db/bootstrap.rs @@ -0,0 +1,67 @@ +//! Schema bootstrap — applies `schema/duc.sql` to a fresh connection. +//! +//! Called by both `native` and `wasm` backends after opening a connection. +//! The canonical schema lives at `duc.sql` in the workspace root; it is +//! embedded at compile time so the binary carries no file-system dependency. + +use rusqlite::Connection; + +use crate::db::DbError; + +/// Canonical schemas, embedded at compile time. +/// `build.rs` copies them into `OUT_DIR` so this works both in-tree and from sdists. +/// Applied in order: duc.sql → version_control.sql → search.sql +const DUC_SCHEMA: &str = include_str!(concat!(env!("OUT_DIR"), "/duc.sql")); +const VERSION_CONTROL_SCHEMA: &str = include_str!(concat!(env!("OUT_DIR"), "/version_control.sql")); +const SEARCH_SCHEMA: &str = include_str!(concat!(env!("OUT_DIR"), "/search.sql")); + +/// Expected `application_id` written by `duc.sql`. +const APP_ID: i64 = 1_146_569_567; // "DUC_" in ASCII + +/// Per-connection PRAGMAs that must be re-applied on every open (they are +/// either ephemeral or take effect only after the first statement on the +/// connection). +#[cfg(not(all(target_family = "wasm", target_os = "unknown")))] +const CONN_PRAGMAS: &str = " + PRAGMA journal_mode = WAL; + PRAGMA foreign_keys = ON; +"; + +#[cfg(all(target_family = "wasm", target_os = "unknown"))] +const CONN_PRAGMAS: &str = " + PRAGMA journal_mode = MEMORY; + PRAGMA foreign_keys = ON; +"; + +/// Apply the full schema to `conn` if it is a new (empty) database, then +/// always re-apply the per-connection PRAGMAs. +/// +/// Safe to call multiple times on an already-bootstrapped database — it +/// will only run the DDL once. +pub(crate) fn bootstrap(conn: &Connection) -> Result<(), DbError> { + let user_version: i64 = conn.pragma_query_value(None, "user_version", |r| r.get(0))?; + + if user_version == 0 { + // New database — apply schemas in order. + conn.execute_batch(DUC_SCHEMA) + .map_err(|e| DbError::Bootstrap(format!("duc.sql apply failed: {e}")))?; + conn.execute_batch(VERSION_CONTROL_SCHEMA) + .map_err(|e| DbError::Bootstrap(format!("version_control.sql apply failed: {e}")))?; + conn.execute_batch(SEARCH_SCHEMA) + .map_err(|e| DbError::Bootstrap(format!("search.sql apply failed: {e}")))?; + + // Verify the schema set the expected application_id. + let app_id: i64 = conn.pragma_query_value(None, "application_id", |r| r.get(0))?; + if app_id != APP_ID { + return Err(DbError::Bootstrap(format!( + "unexpected application_id after bootstrap: {app_id} (expected {APP_ID})" + ))); + } + } else { + // Existing database — just ensure per-connection pragmas are active. + conn.execute_batch(CONN_PRAGMAS) + .map_err(|e| DbError::Bootstrap(format!("pragma apply failed: {e}")))?; + } + + Ok(()) +} diff --git a/packages/ducrs/src/db/mod.rs b/packages/ducrs/src/db/mod.rs new file mode 100644 index 00000000..85c737b7 --- /dev/null +++ b/packages/ducrs/src/db/mod.rs @@ -0,0 +1,122 @@ +//! Storage layer — target-transparent SQLite access. +//! +//! Call [`open_file`] or [`open_memory`] instead of calling `rusqlite::Connection` +//! directly. Internally they dispatch to the correct backend for each compile target. + +mod bootstrap; + +#[cfg(not(all(target_family = "wasm", target_os = "unknown")))] +mod native; + +#[cfg(all(target_family = "wasm", target_os = "unknown"))] +mod wasm; + +use rusqlite::Connection; +#[cfg(not(all(target_family = "wasm", target_os = "unknown")))] +use std::path::Path; +use thiserror::Error; + +/// Unified error type for the storage layer. +#[derive(Debug, Error)] +pub enum DbError { + #[error("rusqlite error: {0}")] + Rusqlite(#[from] rusqlite::Error), + + #[error("bootstrap error: {0}")] + Bootstrap(String), + + #[cfg(all(target_family = "wasm", target_os = "unknown", feature = "opfs"))] + #[error("OPFS/SAH-pool error: {0}")] + Opfs(String), +} + +pub type DbResult = Result; + +/// A fully-initialized [`rusqlite::Connection`] with schema applied. +/// +/// All call sites receive this type regardless of platform; the internals +/// differ per target through the `native` / `wasm` backend modules. +pub struct DucConnection(pub(crate) Connection); + +impl DucConnection { + /// Run a closure with the inner [`rusqlite::Connection`]. + pub fn with(&self, f: F) -> R + where + F: FnOnce(&Connection) -> R, + { + f(&self.0) + } + + /// Consume and return the inner connection (escape hatch). + pub fn into_inner(self) -> Connection { + self.0 + } + + /// Open an existing `.duc` file by path without applying bootstrap. + /// Useful for read-only operations against an already-bootstrapped database. + pub fn open_raw(path: &str) -> DbResult { + let conn = Connection::open(path).map_err(DbError::from)?; + #[cfg(not(all(target_family = "wasm", target_os = "unknown")))] + conn.execute_batch("PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;") + .map_err(|e| DbError::Bootstrap(format!("pragma apply failed: {e}")))?; + #[cfg(all(target_family = "wasm", target_os = "unknown"))] + conn.execute_batch("PRAGMA journal_mode = MEMORY; PRAGMA foreign_keys = ON;") + .map_err(|e| DbError::Bootstrap(format!("pragma apply failed: {e}")))?; + Ok(Self(conn)) + } + + /// Wrap an existing `Connection` into a `DucConnection` (escape hatch). + pub fn from_inner(conn: Connection) -> Self { + Self(conn) + } +} + +// ── Native entry-points (synchronous) ──────────────────────────────────────── + +/// Open (or create) a `.duc` file at `path` on non-WASM targets. +/// +/// The schema is applied automatically if the database is new. +#[cfg(not(all(target_family = "wasm", target_os = "unknown")))] +pub fn open_file(path: impl AsRef) -> DbResult { + native::open_file(path) +} + +/// Open an in-memory `.duc` database on non-WASM targets. +#[cfg(not(all(target_family = "wasm", target_os = "unknown")))] +pub fn open_memory() -> DbResult { + native::open_memory() +} + +// ── WASM entry-points (async) ───────────────────────────────────────────────── + +/// Open (or create) a persistent `.duc` file backed by OPFS (SAH pool) in the browser. +/// +/// **Must be called from a Dedicated Worker**, not from the main thread, +/// because SAH-pool VFS uses `FileSystemSyncAccessHandle` which is worker-only. +/// +/// ```no_run +/// // inside a wasm_bindgen_futures::spawn_local / #[wasm_bindgen] async fn +/// let conn = duc::db::open_file_opfs("project.duc").await?; +/// ``` +#[cfg(all(target_family = "wasm", target_os = "unknown", feature = "opfs"))] +pub async fn open_file_opfs(name: &str) -> DbResult { + wasm::open_file_opfs(name).await +} + +/// Open a transient in-memory `.duc` database in WASM (no persistence). +#[cfg(all(target_family = "wasm", target_os = "unknown"))] +pub fn open_memory() -> DbResult { + wasm::open_memory() +} + +// ── Compact variant (all targets) ──────────────────────────────────────────── + +/// Open an in-memory `.duc` database with `page_size = 1024`, +/// optimized for minimal serialization output size. +pub fn open_memory_compact() -> DbResult { + let conn = Connection::open_in_memory()?; + conn.execute_batch("PRAGMA page_size = 1024;") + .map_err(|e| DbError::Bootstrap(format!("page_size pragma: {e}")))?; + bootstrap::bootstrap(&conn)?; + Ok(DucConnection(conn)) +} diff --git a/packages/ducrs/src/db/native.rs b/packages/ducrs/src/db/native.rs new file mode 100644 index 00000000..6771c23f --- /dev/null +++ b/packages/ducrs/src/db/native.rs @@ -0,0 +1,23 @@ +//! Native (non-WASM) storage backend. +//! +//! Uses the standard `rusqlite` file VFS — no extra dependencies. + +use std::path::Path; + +use rusqlite::Connection; + +use crate::db::{bootstrap, DbResult, DucConnection}; + +/// Open or create a `.duc` SQLite file at `path`. +pub(crate) fn open_file(path: impl AsRef) -> DbResult { + let conn = Connection::open(path)?; + bootstrap::bootstrap(&conn)?; + Ok(DucConnection(conn)) +} + +/// Open a private in-memory `.duc` database. +pub(crate) fn open_memory() -> DbResult { + let conn = Connection::open_in_memory()?; + bootstrap::bootstrap(&conn)?; + Ok(DucConnection(conn)) +} diff --git a/packages/ducrs/src/db/wasm.rs b/packages/ducrs/src/db/wasm.rs new file mode 100644 index 00000000..d7d77946 --- /dev/null +++ b/packages/ducrs/src/db/wasm.rs @@ -0,0 +1,39 @@ +//! WASM (`wasm32-unknown-unknown`) storage backend. +//! +//! Two connection modes: +//! +//! * **OPFS SAH-pool** (`open_file_opfs`) — persistent, browser-only. +//! Requires a Dedicated Worker context; uses `FileSystemSyncAccessHandle`. +//! * **In-memory** (`open_memory`) — synchronous, no persistence. + +use rusqlite::Connection; +#[cfg(feature = "opfs")] +use sqlite_wasm_vfs::sahpool::{install as install_opfs_sahpool, OpfsSAHPoolCfg}; + +use crate::db::{bootstrap, DbResult, DucConnection}; + +/// Open (or reopen) a persistent OPFS-backed database. +/// +/// # Worker requirement +/// `SyncAccessHandle` is not available on the main browser thread. +/// Spawn a `Worker` and call this from there, then communicate via +/// `postMessage` / `SharedArrayBuffer` or a `BroadcastChannel`. +#[cfg(feature = "opfs")] +pub(crate) async fn open_file_opfs(name: &str) -> DbResult { + // Install the OPFS SAH-pool VFS and make it the default for this Worker. + install_opfs_sahpool::(&OpfsSAHPoolCfg::default(), true) + .await + .map_err(|e| DbError::Opfs(format!("{e:?}")))?; + + // `Connection::open` will use the default VFS (opfs-sahpool) set above. + let conn = Connection::open(name)?; + bootstrap::bootstrap(&conn)?; + Ok(DucConnection(conn)) +} + +/// Open an ephemeral in-memory database (synchronous, works on any thread). +pub(crate) fn open_memory() -> DbResult { + let conn = Connection::open_in_memory()?; + bootstrap::bootstrap(&conn)?; + Ok(DucConnection(conn)) +} diff --git a/packages/ducrs/src/flatbuffers/duc_generated.rs b/packages/ducrs/src/flatbuffers/duc_generated.rs deleted file mode 100644 index a1482345..00000000 --- a/packages/ducrs/src/flatbuffers/duc_generated.rs +++ /dev/null @@ -1,33021 +0,0 @@ -// automatically generated by the FlatBuffers compiler, do not modify - - -// @generated - -use core::mem; -use core::cmp::Ordering; - -extern crate flatbuffers; -use self::flatbuffers::{EndianScalar, Follow}; - -#[allow(unused_imports, dead_code)] -pub mod duc { - - use core::mem; - use core::cmp::Ordering; - - extern crate flatbuffers; - use self::flatbuffers::{EndianScalar, Follow}; - -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_VERTICAL_ALIGN: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_VERTICAL_ALIGN: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_VERTICAL_ALIGN: [VERTICAL_ALIGN; 3] = [ - VERTICAL_ALIGN::TOP, - VERTICAL_ALIGN::MIDDLE, - VERTICAL_ALIGN::BOTTOM, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct VERTICAL_ALIGN(pub u8); -#[allow(non_upper_case_globals)] -impl VERTICAL_ALIGN { - pub const TOP: Self = Self(10); - pub const MIDDLE: Self = Self(11); - pub const BOTTOM: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::TOP, - Self::MIDDLE, - Self::BOTTOM, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::TOP => Some("TOP"), - Self::MIDDLE => Some("MIDDLE"), - Self::BOTTOM => Some("BOTTOM"), - _ => None, - } - } -} -impl core::fmt::Debug for VERTICAL_ALIGN { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for VERTICAL_ALIGN { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for VERTICAL_ALIGN { - type Output = VERTICAL_ALIGN; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for VERTICAL_ALIGN { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for VERTICAL_ALIGN { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for VERTICAL_ALIGN {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_TEXT_ALIGN: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_TEXT_ALIGN: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_TEXT_ALIGN: [TEXT_ALIGN; 3] = [ - TEXT_ALIGN::LEFT, - TEXT_ALIGN::CENTER, - TEXT_ALIGN::RIGHT, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct TEXT_ALIGN(pub u8); -#[allow(non_upper_case_globals)] -impl TEXT_ALIGN { - pub const LEFT: Self = Self(10); - pub const CENTER: Self = Self(11); - pub const RIGHT: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::LEFT, - Self::CENTER, - Self::RIGHT, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::LEFT => Some("LEFT"), - Self::CENTER => Some("CENTER"), - Self::RIGHT => Some("RIGHT"), - _ => None, - } - } -} -impl core::fmt::Debug for TEXT_ALIGN { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for TEXT_ALIGN { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for TEXT_ALIGN { - type Output = TEXT_ALIGN; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for TEXT_ALIGN { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for TEXT_ALIGN { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for TEXT_ALIGN {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_LINE_SPACING_TYPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_LINE_SPACING_TYPE: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_LINE_SPACING_TYPE: [LINE_SPACING_TYPE; 3] = [ - LINE_SPACING_TYPE::AT_LEAST, - LINE_SPACING_TYPE::EXACTLY, - LINE_SPACING_TYPE::MULTIPLE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct LINE_SPACING_TYPE(pub u8); -#[allow(non_upper_case_globals)] -impl LINE_SPACING_TYPE { - pub const AT_LEAST: Self = Self(10); - pub const EXACTLY: Self = Self(11); - pub const MULTIPLE: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::AT_LEAST, - Self::EXACTLY, - Self::MULTIPLE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::AT_LEAST => Some("AT_LEAST"), - Self::EXACTLY => Some("EXACTLY"), - Self::MULTIPLE => Some("MULTIPLE"), - _ => None, - } - } -} -impl core::fmt::Debug for LINE_SPACING_TYPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for LINE_SPACING_TYPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for LINE_SPACING_TYPE { - type Output = LINE_SPACING_TYPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for LINE_SPACING_TYPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for LINE_SPACING_TYPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for LINE_SPACING_TYPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_STACKED_TEXT_ALIGN: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_STACKED_TEXT_ALIGN: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_STACKED_TEXT_ALIGN: [STACKED_TEXT_ALIGN; 3] = [ - STACKED_TEXT_ALIGN::CENTER, - STACKED_TEXT_ALIGN::DECIMAL, - STACKED_TEXT_ALIGN::SLASH, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct STACKED_TEXT_ALIGN(pub u8); -#[allow(non_upper_case_globals)] -impl STACKED_TEXT_ALIGN { - pub const CENTER: Self = Self(10); - pub const DECIMAL: Self = Self(11); - pub const SLASH: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::CENTER, - Self::DECIMAL, - Self::SLASH, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::CENTER => Some("CENTER"), - Self::DECIMAL => Some("DECIMAL"), - Self::SLASH => Some("SLASH"), - _ => None, - } - } -} -impl core::fmt::Debug for STACKED_TEXT_ALIGN { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for STACKED_TEXT_ALIGN { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for STACKED_TEXT_ALIGN { - type Output = STACKED_TEXT_ALIGN; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for STACKED_TEXT_ALIGN { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for STACKED_TEXT_ALIGN { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for STACKED_TEXT_ALIGN {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_TEXT_FIELD_SOURCE_TYPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_TEXT_FIELD_SOURCE_TYPE: u8 = 20; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_TEXT_FIELD_SOURCE_TYPE: [TEXT_FIELD_SOURCE_TYPE; 2] = [ - TEXT_FIELD_SOURCE_TYPE::ELEMENT, - TEXT_FIELD_SOURCE_TYPE::DICTIONARY, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct TEXT_FIELD_SOURCE_TYPE(pub u8); -#[allow(non_upper_case_globals)] -impl TEXT_FIELD_SOURCE_TYPE { - pub const ELEMENT: Self = Self(10); - pub const DICTIONARY: Self = Self(20); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 20; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::ELEMENT, - Self::DICTIONARY, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::ELEMENT => Some("ELEMENT"), - Self::DICTIONARY => Some("DICTIONARY"), - _ => None, - } - } -} -impl core::fmt::Debug for TEXT_FIELD_SOURCE_TYPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for TEXT_FIELD_SOURCE_TYPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for TEXT_FIELD_SOURCE_TYPE { - type Output = TEXT_FIELD_SOURCE_TYPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for TEXT_FIELD_SOURCE_TYPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for TEXT_FIELD_SOURCE_TYPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for TEXT_FIELD_SOURCE_TYPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_TEXT_FIELD_SOURCE_PROPERTY: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_TEXT_FIELD_SOURCE_PROPERTY: u8 = 20; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_TEXT_FIELD_SOURCE_PROPERTY: [TEXT_FIELD_SOURCE_PROPERTY; 11] = [ - TEXT_FIELD_SOURCE_PROPERTY::AREA, - TEXT_FIELD_SOURCE_PROPERTY::PERIMETER, - TEXT_FIELD_SOURCE_PROPERTY::VOLUME, - TEXT_FIELD_SOURCE_PROPERTY::LENGTH, - TEXT_FIELD_SOURCE_PROPERTY::WIDTH, - TEXT_FIELD_SOURCE_PROPERTY::HEIGHT, - TEXT_FIELD_SOURCE_PROPERTY::RADIUS, - TEXT_FIELD_SOURCE_PROPERTY::DIAMETER, - TEXT_FIELD_SOURCE_PROPERTY::X_COORDINATE, - TEXT_FIELD_SOURCE_PROPERTY::Y_COORDINATE, - TEXT_FIELD_SOURCE_PROPERTY::LABEL, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct TEXT_FIELD_SOURCE_PROPERTY(pub u8); -#[allow(non_upper_case_globals)] -impl TEXT_FIELD_SOURCE_PROPERTY { - pub const AREA: Self = Self(10); - pub const PERIMETER: Self = Self(11); - pub const VOLUME: Self = Self(12); - pub const LENGTH: Self = Self(13); - pub const WIDTH: Self = Self(14); - pub const HEIGHT: Self = Self(15); - pub const RADIUS: Self = Self(16); - pub const DIAMETER: Self = Self(17); - pub const X_COORDINATE: Self = Self(18); - pub const Y_COORDINATE: Self = Self(19); - pub const LABEL: Self = Self(20); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 20; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::AREA, - Self::PERIMETER, - Self::VOLUME, - Self::LENGTH, - Self::WIDTH, - Self::HEIGHT, - Self::RADIUS, - Self::DIAMETER, - Self::X_COORDINATE, - Self::Y_COORDINATE, - Self::LABEL, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::AREA => Some("AREA"), - Self::PERIMETER => Some("PERIMETER"), - Self::VOLUME => Some("VOLUME"), - Self::LENGTH => Some("LENGTH"), - Self::WIDTH => Some("WIDTH"), - Self::HEIGHT => Some("HEIGHT"), - Self::RADIUS => Some("RADIUS"), - Self::DIAMETER => Some("DIAMETER"), - Self::X_COORDINATE => Some("X_COORDINATE"), - Self::Y_COORDINATE => Some("Y_COORDINATE"), - Self::LABEL => Some("LABEL"), - _ => None, - } - } -} -impl core::fmt::Debug for TEXT_FIELD_SOURCE_PROPERTY { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for TEXT_FIELD_SOURCE_PROPERTY { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for TEXT_FIELD_SOURCE_PROPERTY { - type Output = TEXT_FIELD_SOURCE_PROPERTY; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for TEXT_FIELD_SOURCE_PROPERTY { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for TEXT_FIELD_SOURCE_PROPERTY { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for TEXT_FIELD_SOURCE_PROPERTY {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_STROKE_PLACEMENT: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_STROKE_PLACEMENT: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_STROKE_PLACEMENT: [STROKE_PLACEMENT; 3] = [ - STROKE_PLACEMENT::INSIDE, - STROKE_PLACEMENT::CENTER, - STROKE_PLACEMENT::OUTSIDE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct STROKE_PLACEMENT(pub u8); -#[allow(non_upper_case_globals)] -impl STROKE_PLACEMENT { - pub const INSIDE: Self = Self(10); - pub const CENTER: Self = Self(11); - pub const OUTSIDE: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::INSIDE, - Self::CENTER, - Self::OUTSIDE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::INSIDE => Some("INSIDE"), - Self::CENTER => Some("CENTER"), - Self::OUTSIDE => Some("OUTSIDE"), - _ => None, - } - } -} -impl core::fmt::Debug for STROKE_PLACEMENT { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for STROKE_PLACEMENT { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for STROKE_PLACEMENT { - type Output = STROKE_PLACEMENT; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for STROKE_PLACEMENT { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for STROKE_PLACEMENT { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for STROKE_PLACEMENT {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_STROKE_WIDTH: u8 = 1; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_STROKE_WIDTH: u8 = 4; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_STROKE_WIDTH: [STROKE_WIDTH; 3] = [ - STROKE_WIDTH::THIN, - STROKE_WIDTH::BOLD, - STROKE_WIDTH::EXTRA_BOLD, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct STROKE_WIDTH(pub u8); -#[allow(non_upper_case_globals)] -impl STROKE_WIDTH { - pub const THIN: Self = Self(1); - pub const BOLD: Self = Self(2); - pub const EXTRA_BOLD: Self = Self(4); - - pub const ENUM_MIN: u8 = 1; - pub const ENUM_MAX: u8 = 4; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::THIN, - Self::BOLD, - Self::EXTRA_BOLD, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::THIN => Some("THIN"), - Self::BOLD => Some("BOLD"), - Self::EXTRA_BOLD => Some("EXTRA_BOLD"), - _ => None, - } - } -} -impl core::fmt::Debug for STROKE_WIDTH { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for STROKE_WIDTH { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for STROKE_WIDTH { - type Output = STROKE_WIDTH; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for STROKE_WIDTH { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for STROKE_WIDTH { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for STROKE_WIDTH {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_ELEMENT_CONTENT_PREFERENCE: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_ELEMENT_CONTENT_PREFERENCE: u8 = 18; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_ELEMENT_CONTENT_PREFERENCE: [ELEMENT_CONTENT_PREFERENCE; 6] = [ - ELEMENT_CONTENT_PREFERENCE::SOLID, - ELEMENT_CONTENT_PREFERENCE::FILL, - ELEMENT_CONTENT_PREFERENCE::FIT, - ELEMENT_CONTENT_PREFERENCE::TILE, - ELEMENT_CONTENT_PREFERENCE::STRETCH, - ELEMENT_CONTENT_PREFERENCE::HATCH, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct ELEMENT_CONTENT_PREFERENCE(pub u8); -#[allow(non_upper_case_globals)] -impl ELEMENT_CONTENT_PREFERENCE { - pub const SOLID: Self = Self(12); - pub const FILL: Self = Self(14); - pub const FIT: Self = Self(15); - pub const TILE: Self = Self(16); - pub const STRETCH: Self = Self(17); - pub const HATCH: Self = Self(18); - - pub const ENUM_MIN: u8 = 12; - pub const ENUM_MAX: u8 = 18; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::SOLID, - Self::FILL, - Self::FIT, - Self::TILE, - Self::STRETCH, - Self::HATCH, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::SOLID => Some("SOLID"), - Self::FILL => Some("FILL"), - Self::FIT => Some("FIT"), - Self::TILE => Some("TILE"), - Self::STRETCH => Some("STRETCH"), - Self::HATCH => Some("HATCH"), - _ => None, - } - } -} -impl core::fmt::Debug for ELEMENT_CONTENT_PREFERENCE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for ELEMENT_CONTENT_PREFERENCE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for ELEMENT_CONTENT_PREFERENCE { - type Output = ELEMENT_CONTENT_PREFERENCE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for ELEMENT_CONTENT_PREFERENCE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for ELEMENT_CONTENT_PREFERENCE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for ELEMENT_CONTENT_PREFERENCE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_STROKE_PREFERENCE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_STROKE_PREFERENCE: u8 = 13; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_STROKE_PREFERENCE: [STROKE_PREFERENCE; 4] = [ - STROKE_PREFERENCE::SOLID, - STROKE_PREFERENCE::DASHED, - STROKE_PREFERENCE::DOTTED, - STROKE_PREFERENCE::CUSTOM, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct STROKE_PREFERENCE(pub u8); -#[allow(non_upper_case_globals)] -impl STROKE_PREFERENCE { - pub const SOLID: Self = Self(10); - pub const DASHED: Self = Self(11); - pub const DOTTED: Self = Self(12); - pub const CUSTOM: Self = Self(13); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 13; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::SOLID, - Self::DASHED, - Self::DOTTED, - Self::CUSTOM, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::SOLID => Some("SOLID"), - Self::DASHED => Some("DASHED"), - Self::DOTTED => Some("DOTTED"), - Self::CUSTOM => Some("CUSTOM"), - _ => None, - } - } -} -impl core::fmt::Debug for STROKE_PREFERENCE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for STROKE_PREFERENCE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for STROKE_PREFERENCE { - type Output = STROKE_PREFERENCE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for STROKE_PREFERENCE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for STROKE_PREFERENCE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for STROKE_PREFERENCE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_STROKE_SIDE_PREFERENCE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_STROKE_SIDE_PREFERENCE: u8 = 15; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_STROKE_SIDE_PREFERENCE: [STROKE_SIDE_PREFERENCE; 6] = [ - STROKE_SIDE_PREFERENCE::TOP, - STROKE_SIDE_PREFERENCE::BOTTOM, - STROKE_SIDE_PREFERENCE::LEFT, - STROKE_SIDE_PREFERENCE::RIGHT, - STROKE_SIDE_PREFERENCE::CUSTOM, - STROKE_SIDE_PREFERENCE::ALL, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct STROKE_SIDE_PREFERENCE(pub u8); -#[allow(non_upper_case_globals)] -impl STROKE_SIDE_PREFERENCE { - pub const TOP: Self = Self(10); - pub const BOTTOM: Self = Self(11); - pub const LEFT: Self = Self(12); - pub const RIGHT: Self = Self(13); - pub const CUSTOM: Self = Self(14); - pub const ALL: Self = Self(15); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 15; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::TOP, - Self::BOTTOM, - Self::LEFT, - Self::RIGHT, - Self::CUSTOM, - Self::ALL, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::TOP => Some("TOP"), - Self::BOTTOM => Some("BOTTOM"), - Self::LEFT => Some("LEFT"), - Self::RIGHT => Some("RIGHT"), - Self::CUSTOM => Some("CUSTOM"), - Self::ALL => Some("ALL"), - _ => None, - } - } -} -impl core::fmt::Debug for STROKE_SIDE_PREFERENCE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for STROKE_SIDE_PREFERENCE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for STROKE_SIDE_PREFERENCE { - type Output = STROKE_SIDE_PREFERENCE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for STROKE_SIDE_PREFERENCE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for STROKE_SIDE_PREFERENCE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for STROKE_SIDE_PREFERENCE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_STROKE_CAP: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_STROKE_CAP: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_STROKE_CAP: [STROKE_CAP; 3] = [ - STROKE_CAP::BUTT, - STROKE_CAP::ROUND, - STROKE_CAP::SQUARE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct STROKE_CAP(pub u8); -#[allow(non_upper_case_globals)] -impl STROKE_CAP { - pub const BUTT: Self = Self(10); - pub const ROUND: Self = Self(11); - pub const SQUARE: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::BUTT, - Self::ROUND, - Self::SQUARE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::BUTT => Some("BUTT"), - Self::ROUND => Some("ROUND"), - Self::SQUARE => Some("SQUARE"), - _ => None, - } - } -} -impl core::fmt::Debug for STROKE_CAP { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for STROKE_CAP { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for STROKE_CAP { - type Output = STROKE_CAP; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for STROKE_CAP { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for STROKE_CAP { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for STROKE_CAP {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_STROKE_JOIN: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_STROKE_JOIN: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_STROKE_JOIN: [STROKE_JOIN; 3] = [ - STROKE_JOIN::MITER, - STROKE_JOIN::ROUND, - STROKE_JOIN::BEVEL, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct STROKE_JOIN(pub u8); -#[allow(non_upper_case_globals)] -impl STROKE_JOIN { - pub const MITER: Self = Self(10); - pub const ROUND: Self = Self(11); - pub const BEVEL: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::MITER, - Self::ROUND, - Self::BEVEL, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::MITER => Some("MITER"), - Self::ROUND => Some("ROUND"), - Self::BEVEL => Some("BEVEL"), - _ => None, - } - } -} -impl core::fmt::Debug for STROKE_JOIN { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for STROKE_JOIN { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for STROKE_JOIN { - type Output = STROKE_JOIN; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for STROKE_JOIN { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for STROKE_JOIN { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for STROKE_JOIN {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_LINE_HEAD: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_LINE_HEAD: u8 = 24; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_LINE_HEAD: [LINE_HEAD; 15] = [ - LINE_HEAD::ARROW, - LINE_HEAD::BAR, - LINE_HEAD::CIRCLE, - LINE_HEAD::CIRCLE_OUTLINED, - LINE_HEAD::TRIANGLE, - LINE_HEAD::TRIANGLE_OUTLINED, - LINE_HEAD::DIAMOND, - LINE_HEAD::DIAMOND_OUTLINED, - LINE_HEAD::CROSS, - LINE_HEAD::OPEN_ARROW, - LINE_HEAD::REVERSED_ARROW, - LINE_HEAD::REVERSED_TRIANGLE, - LINE_HEAD::REVERSED_TRIANGLE_OUTLINED, - LINE_HEAD::CONE, - LINE_HEAD::HALF_CONE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct LINE_HEAD(pub u8); -#[allow(non_upper_case_globals)] -impl LINE_HEAD { - pub const ARROW: Self = Self(10); - pub const BAR: Self = Self(11); - pub const CIRCLE: Self = Self(12); - pub const CIRCLE_OUTLINED: Self = Self(13); - pub const TRIANGLE: Self = Self(14); - pub const TRIANGLE_OUTLINED: Self = Self(15); - pub const DIAMOND: Self = Self(16); - pub const DIAMOND_OUTLINED: Self = Self(17); - pub const CROSS: Self = Self(18); - pub const OPEN_ARROW: Self = Self(19); - pub const REVERSED_ARROW: Self = Self(20); - pub const REVERSED_TRIANGLE: Self = Self(21); - pub const REVERSED_TRIANGLE_OUTLINED: Self = Self(22); - pub const CONE: Self = Self(23); - pub const HALF_CONE: Self = Self(24); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 24; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::ARROW, - Self::BAR, - Self::CIRCLE, - Self::CIRCLE_OUTLINED, - Self::TRIANGLE, - Self::TRIANGLE_OUTLINED, - Self::DIAMOND, - Self::DIAMOND_OUTLINED, - Self::CROSS, - Self::OPEN_ARROW, - Self::REVERSED_ARROW, - Self::REVERSED_TRIANGLE, - Self::REVERSED_TRIANGLE_OUTLINED, - Self::CONE, - Self::HALF_CONE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::ARROW => Some("ARROW"), - Self::BAR => Some("BAR"), - Self::CIRCLE => Some("CIRCLE"), - Self::CIRCLE_OUTLINED => Some("CIRCLE_OUTLINED"), - Self::TRIANGLE => Some("TRIANGLE"), - Self::TRIANGLE_OUTLINED => Some("TRIANGLE_OUTLINED"), - Self::DIAMOND => Some("DIAMOND"), - Self::DIAMOND_OUTLINED => Some("DIAMOND_OUTLINED"), - Self::CROSS => Some("CROSS"), - Self::OPEN_ARROW => Some("OPEN_ARROW"), - Self::REVERSED_ARROW => Some("REVERSED_ARROW"), - Self::REVERSED_TRIANGLE => Some("REVERSED_TRIANGLE"), - Self::REVERSED_TRIANGLE_OUTLINED => Some("REVERSED_TRIANGLE_OUTLINED"), - Self::CONE => Some("CONE"), - Self::HALF_CONE => Some("HALF_CONE"), - _ => None, - } - } -} -impl core::fmt::Debug for LINE_HEAD { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for LINE_HEAD { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for LINE_HEAD { - type Output = LINE_HEAD; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for LINE_HEAD { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for LINE_HEAD { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for LINE_HEAD {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_BEZIER_MIRRORING: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_BEZIER_MIRRORING: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_BEZIER_MIRRORING: [BEZIER_MIRRORING; 3] = [ - BEZIER_MIRRORING::NONE, - BEZIER_MIRRORING::ANGLE, - BEZIER_MIRRORING::ANGLE_LENGTH, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct BEZIER_MIRRORING(pub u8); -#[allow(non_upper_case_globals)] -impl BEZIER_MIRRORING { - pub const NONE: Self = Self(10); - pub const ANGLE: Self = Self(11); - pub const ANGLE_LENGTH: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::ANGLE, - Self::ANGLE_LENGTH, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::ANGLE => Some("ANGLE"), - Self::ANGLE_LENGTH => Some("ANGLE_LENGTH"), - _ => None, - } - } -} -impl core::fmt::Debug for BEZIER_MIRRORING { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for BEZIER_MIRRORING { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for BEZIER_MIRRORING { - type Output = BEZIER_MIRRORING; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for BEZIER_MIRRORING { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for BEZIER_MIRRORING { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for BEZIER_MIRRORING {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_HANDLE_TYPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_HANDLE_TYPE: u8 = 11; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_HANDLE_TYPE: [HANDLE_TYPE; 2] = [ - HANDLE_TYPE::HANDLE_IN, - HANDLE_TYPE::HANDLE_OUT, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct HANDLE_TYPE(pub u8); -#[allow(non_upper_case_globals)] -impl HANDLE_TYPE { - pub const HANDLE_IN: Self = Self(10); - pub const HANDLE_OUT: Self = Self(11); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 11; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::HANDLE_IN, - Self::HANDLE_OUT, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::HANDLE_IN => Some("HANDLE_IN"), - Self::HANDLE_OUT => Some("HANDLE_OUT"), - _ => None, - } - } -} -impl core::fmt::Debug for HANDLE_TYPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for HANDLE_TYPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for HANDLE_TYPE { - type Output = HANDLE_TYPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for HANDLE_TYPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for HANDLE_TYPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for HANDLE_TYPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_YOUTUBE_STATES: i8 = -1; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_YOUTUBE_STATES: i8 = 5; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_YOUTUBE_STATES: [YOUTUBE_STATES; 6] = [ - YOUTUBE_STATES::UNSTARTED, - YOUTUBE_STATES::ENDED, - YOUTUBE_STATES::PLAYING, - YOUTUBE_STATES::PAUSED, - YOUTUBE_STATES::BUFFERING, - YOUTUBE_STATES::CUED, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct YOUTUBE_STATES(pub i8); -#[allow(non_upper_case_globals)] -impl YOUTUBE_STATES { - pub const UNSTARTED: Self = Self(-1); - pub const ENDED: Self = Self(0); - pub const PLAYING: Self = Self(1); - pub const PAUSED: Self = Self(2); - pub const BUFFERING: Self = Self(3); - pub const CUED: Self = Self(5); - - pub const ENUM_MIN: i8 = -1; - pub const ENUM_MAX: i8 = 5; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::UNSTARTED, - Self::ENDED, - Self::PLAYING, - Self::PAUSED, - Self::BUFFERING, - Self::CUED, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::UNSTARTED => Some("UNSTARTED"), - Self::ENDED => Some("ENDED"), - Self::PLAYING => Some("PLAYING"), - Self::PAUSED => Some("PAUSED"), - Self::BUFFERING => Some("BUFFERING"), - Self::CUED => Some("CUED"), - _ => None, - } - } -} -impl core::fmt::Debug for YOUTUBE_STATES { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for YOUTUBE_STATES { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for YOUTUBE_STATES { - type Output = YOUTUBE_STATES; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for YOUTUBE_STATES { - type Scalar = i8; - #[inline] - fn to_little_endian(self) -> i8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: i8) -> Self { - let b = i8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for YOUTUBE_STATES { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - i8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for YOUTUBE_STATES {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_BLENDING: u8 = 11; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_BLENDING: u8 = 17; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_BLENDING: [BLENDING; 7] = [ - BLENDING::MULTIPLY, - BLENDING::SCREEN, - BLENDING::OVERLAY, - BLENDING::DARKEN, - BLENDING::LIGHTEN, - BLENDING::DIFFERENCE, - BLENDING::EXCLUSION, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct BLENDING(pub u8); -#[allow(non_upper_case_globals)] -impl BLENDING { - pub const MULTIPLY: Self = Self(11); - pub const SCREEN: Self = Self(12); - pub const OVERLAY: Self = Self(13); - pub const DARKEN: Self = Self(14); - pub const LIGHTEN: Self = Self(15); - pub const DIFFERENCE: Self = Self(16); - pub const EXCLUSION: Self = Self(17); - - pub const ENUM_MIN: u8 = 11; - pub const ENUM_MAX: u8 = 17; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::MULTIPLY, - Self::SCREEN, - Self::OVERLAY, - Self::DARKEN, - Self::LIGHTEN, - Self::DIFFERENCE, - Self::EXCLUSION, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::MULTIPLY => Some("MULTIPLY"), - Self::SCREEN => Some("SCREEN"), - Self::OVERLAY => Some("OVERLAY"), - Self::DARKEN => Some("DARKEN"), - Self::LIGHTEN => Some("LIGHTEN"), - Self::DIFFERENCE => Some("DIFFERENCE"), - Self::EXCLUSION => Some("EXCLUSION"), - _ => None, - } - } -} -impl core::fmt::Debug for BLENDING { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for BLENDING { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for BLENDING { - type Output = BLENDING; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for BLENDING { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for BLENDING { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for BLENDING {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_GRID_DISPLAY_TYPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_GRID_DISPLAY_TYPE: u8 = 13; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_GRID_DISPLAY_TYPE: [GRID_DISPLAY_TYPE; 4] = [ - GRID_DISPLAY_TYPE::LINES, - GRID_DISPLAY_TYPE::DOTS, - GRID_DISPLAY_TYPE::CROSSES, - GRID_DISPLAY_TYPE::ADAPTIVE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct GRID_DISPLAY_TYPE(pub u8); -#[allow(non_upper_case_globals)] -impl GRID_DISPLAY_TYPE { - pub const LINES: Self = Self(10); - pub const DOTS: Self = Self(11); - pub const CROSSES: Self = Self(12); - pub const ADAPTIVE: Self = Self(13); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 13; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::LINES, - Self::DOTS, - Self::CROSSES, - Self::ADAPTIVE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::LINES => Some("LINES"), - Self::DOTS => Some("DOTS"), - Self::CROSSES => Some("CROSSES"), - Self::ADAPTIVE => Some("ADAPTIVE"), - _ => None, - } - } -} -impl core::fmt::Debug for GRID_DISPLAY_TYPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for GRID_DISPLAY_TYPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for GRID_DISPLAY_TYPE { - type Output = GRID_DISPLAY_TYPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for GRID_DISPLAY_TYPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for GRID_DISPLAY_TYPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for GRID_DISPLAY_TYPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_GRID_TYPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_GRID_TYPE: u8 = 14; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_GRID_TYPE: [GRID_TYPE; 5] = [ - GRID_TYPE::RECTANGULAR, - GRID_TYPE::ISOMETRIC, - GRID_TYPE::POLAR, - GRID_TYPE::TRIANGULAR, - GRID_TYPE::CUSTOM, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct GRID_TYPE(pub u8); -#[allow(non_upper_case_globals)] -impl GRID_TYPE { - pub const RECTANGULAR: Self = Self(10); - pub const ISOMETRIC: Self = Self(11); - pub const POLAR: Self = Self(12); - pub const TRIANGULAR: Self = Self(13); - pub const CUSTOM: Self = Self(14); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 14; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::RECTANGULAR, - Self::ISOMETRIC, - Self::POLAR, - Self::TRIANGULAR, - Self::CUSTOM, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::RECTANGULAR => Some("RECTANGULAR"), - Self::ISOMETRIC => Some("ISOMETRIC"), - Self::POLAR => Some("POLAR"), - Self::TRIANGULAR => Some("TRIANGULAR"), - Self::CUSTOM => Some("CUSTOM"), - _ => None, - } - } -} -impl core::fmt::Debug for GRID_TYPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for GRID_TYPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for GRID_TYPE { - type Output = GRID_TYPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for GRID_TYPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for GRID_TYPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for GRID_TYPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_OBJECT_SNAP_MODE: u8 = 0; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_OBJECT_SNAP_MODE: u8 = 28; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_OBJECT_SNAP_MODE: [OBJECT_SNAP_MODE; 20] = [ - OBJECT_SNAP_MODE::NONE, - OBJECT_SNAP_MODE::ENDPOINT, - OBJECT_SNAP_MODE::MIDPOINT, - OBJECT_SNAP_MODE::CENTER, - OBJECT_SNAP_MODE::QUADRANT, - OBJECT_SNAP_MODE::INTERSECTION, - OBJECT_SNAP_MODE::EXTENSION, - OBJECT_SNAP_MODE::PERPENDICULAR, - OBJECT_SNAP_MODE::TANGENT, - OBJECT_SNAP_MODE::NEAREST, - OBJECT_SNAP_MODE::NODE, - OBJECT_SNAP_MODE::INSERT, - OBJECT_SNAP_MODE::PARALLEL, - OBJECT_SNAP_MODE::APPARENT, - OBJECT_SNAP_MODE::FROM, - OBJECT_SNAP_MODE::POINT_FILTER, - OBJECT_SNAP_MODE::TEMPORARY, - OBJECT_SNAP_MODE::BETWEEN_TWO_POINTS, - OBJECT_SNAP_MODE::POINT_ON_CURVE, - OBJECT_SNAP_MODE::GEOMETRIC, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct OBJECT_SNAP_MODE(pub u8); -#[allow(non_upper_case_globals)] -impl OBJECT_SNAP_MODE { - pub const NONE: Self = Self(0); - pub const ENDPOINT: Self = Self(10); - pub const MIDPOINT: Self = Self(11); - pub const CENTER: Self = Self(12); - pub const QUADRANT: Self = Self(13); - pub const INTERSECTION: Self = Self(14); - pub const EXTENSION: Self = Self(15); - pub const PERPENDICULAR: Self = Self(16); - pub const TANGENT: Self = Self(17); - pub const NEAREST: Self = Self(18); - pub const NODE: Self = Self(19); - pub const INSERT: Self = Self(20); - pub const PARALLEL: Self = Self(21); - pub const APPARENT: Self = Self(22); - pub const FROM: Self = Self(23); - pub const POINT_FILTER: Self = Self(24); - pub const TEMPORARY: Self = Self(25); - pub const BETWEEN_TWO_POINTS: Self = Self(26); - pub const POINT_ON_CURVE: Self = Self(27); - pub const GEOMETRIC: Self = Self(28); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 28; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::ENDPOINT, - Self::MIDPOINT, - Self::CENTER, - Self::QUADRANT, - Self::INTERSECTION, - Self::EXTENSION, - Self::PERPENDICULAR, - Self::TANGENT, - Self::NEAREST, - Self::NODE, - Self::INSERT, - Self::PARALLEL, - Self::APPARENT, - Self::FROM, - Self::POINT_FILTER, - Self::TEMPORARY, - Self::BETWEEN_TWO_POINTS, - Self::POINT_ON_CURVE, - Self::GEOMETRIC, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::ENDPOINT => Some("ENDPOINT"), - Self::MIDPOINT => Some("MIDPOINT"), - Self::CENTER => Some("CENTER"), - Self::QUADRANT => Some("QUADRANT"), - Self::INTERSECTION => Some("INTERSECTION"), - Self::EXTENSION => Some("EXTENSION"), - Self::PERPENDICULAR => Some("PERPENDICULAR"), - Self::TANGENT => Some("TANGENT"), - Self::NEAREST => Some("NEAREST"), - Self::NODE => Some("NODE"), - Self::INSERT => Some("INSERT"), - Self::PARALLEL => Some("PARALLEL"), - Self::APPARENT => Some("APPARENT"), - Self::FROM => Some("FROM"), - Self::POINT_FILTER => Some("POINT_FILTER"), - Self::TEMPORARY => Some("TEMPORARY"), - Self::BETWEEN_TWO_POINTS => Some("BETWEEN_TWO_POINTS"), - Self::POINT_ON_CURVE => Some("POINT_ON_CURVE"), - Self::GEOMETRIC => Some("GEOMETRIC"), - _ => None, - } - } -} -impl core::fmt::Debug for OBJECT_SNAP_MODE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for OBJECT_SNAP_MODE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for OBJECT_SNAP_MODE { - type Output = OBJECT_SNAP_MODE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for OBJECT_SNAP_MODE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for OBJECT_SNAP_MODE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for OBJECT_SNAP_MODE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_SNAP_MODE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_SNAP_MODE: u8 = 11; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_SNAP_MODE: [SNAP_MODE; 2] = [ - SNAP_MODE::RUNNING, - SNAP_MODE::SINGLE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct SNAP_MODE(pub u8); -#[allow(non_upper_case_globals)] -impl SNAP_MODE { - pub const RUNNING: Self = Self(10); - pub const SINGLE: Self = Self(11); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 11; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::RUNNING, - Self::SINGLE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::RUNNING => Some("RUNNING"), - Self::SINGLE => Some("SINGLE"), - _ => None, - } - } -} -impl core::fmt::Debug for SNAP_MODE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for SNAP_MODE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for SNAP_MODE { - type Output = SNAP_MODE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for SNAP_MODE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for SNAP_MODE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for SNAP_MODE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_SNAP_OVERRIDE_BEHAVIOR: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_SNAP_OVERRIDE_BEHAVIOR: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_SNAP_OVERRIDE_BEHAVIOR: [SNAP_OVERRIDE_BEHAVIOR; 3] = [ - SNAP_OVERRIDE_BEHAVIOR::DISABLE, - SNAP_OVERRIDE_BEHAVIOR::FORCE_GRID, - SNAP_OVERRIDE_BEHAVIOR::FORCE_OBJECT, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct SNAP_OVERRIDE_BEHAVIOR(pub u8); -#[allow(non_upper_case_globals)] -impl SNAP_OVERRIDE_BEHAVIOR { - pub const DISABLE: Self = Self(10); - pub const FORCE_GRID: Self = Self(11); - pub const FORCE_OBJECT: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::DISABLE, - Self::FORCE_GRID, - Self::FORCE_OBJECT, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::DISABLE => Some("DISABLE"), - Self::FORCE_GRID => Some("FORCE_GRID"), - Self::FORCE_OBJECT => Some("FORCE_OBJECT"), - _ => None, - } - } -} -impl core::fmt::Debug for SNAP_OVERRIDE_BEHAVIOR { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for SNAP_OVERRIDE_BEHAVIOR { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for SNAP_OVERRIDE_BEHAVIOR { - type Output = SNAP_OVERRIDE_BEHAVIOR; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for SNAP_OVERRIDE_BEHAVIOR { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for SNAP_OVERRIDE_BEHAVIOR { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for SNAP_OVERRIDE_BEHAVIOR {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_SNAP_MARKER_SHAPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_SNAP_MARKER_SHAPE: u8 = 13; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_SNAP_MARKER_SHAPE: [SNAP_MARKER_SHAPE; 4] = [ - SNAP_MARKER_SHAPE::SQUARE, - SNAP_MARKER_SHAPE::CIRCLE, - SNAP_MARKER_SHAPE::TRIANGLE, - SNAP_MARKER_SHAPE::X, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct SNAP_MARKER_SHAPE(pub u8); -#[allow(non_upper_case_globals)] -impl SNAP_MARKER_SHAPE { - pub const SQUARE: Self = Self(10); - pub const CIRCLE: Self = Self(11); - pub const TRIANGLE: Self = Self(12); - pub const X: Self = Self(13); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 13; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::SQUARE, - Self::CIRCLE, - Self::TRIANGLE, - Self::X, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::SQUARE => Some("SQUARE"), - Self::CIRCLE => Some("CIRCLE"), - Self::TRIANGLE => Some("TRIANGLE"), - Self::X => Some("X"), - _ => None, - } - } -} -impl core::fmt::Debug for SNAP_MARKER_SHAPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for SNAP_MARKER_SHAPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for SNAP_MARKER_SHAPE { - type Output = SNAP_MARKER_SHAPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for SNAP_MARKER_SHAPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for SNAP_MARKER_SHAPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for SNAP_MARKER_SHAPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_TABLE_CELL_ALIGNMENT: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_TABLE_CELL_ALIGNMENT: u8 = 18; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_TABLE_CELL_ALIGNMENT: [TABLE_CELL_ALIGNMENT; 9] = [ - TABLE_CELL_ALIGNMENT::TOP_LEFT, - TABLE_CELL_ALIGNMENT::TOP_CENTER, - TABLE_CELL_ALIGNMENT::TOP_RIGHT, - TABLE_CELL_ALIGNMENT::MIDDLE_LEFT, - TABLE_CELL_ALIGNMENT::MIDDLE_CENTER, - TABLE_CELL_ALIGNMENT::MIDDLE_RIGHT, - TABLE_CELL_ALIGNMENT::BOTTOM_LEFT, - TABLE_CELL_ALIGNMENT::BOTTOM_CENTER, - TABLE_CELL_ALIGNMENT::BOTTOM_RIGHT, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct TABLE_CELL_ALIGNMENT(pub u8); -#[allow(non_upper_case_globals)] -impl TABLE_CELL_ALIGNMENT { - pub const TOP_LEFT: Self = Self(10); - pub const TOP_CENTER: Self = Self(11); - pub const TOP_RIGHT: Self = Self(12); - pub const MIDDLE_LEFT: Self = Self(13); - pub const MIDDLE_CENTER: Self = Self(14); - pub const MIDDLE_RIGHT: Self = Self(15); - pub const BOTTOM_LEFT: Self = Self(16); - pub const BOTTOM_CENTER: Self = Self(17); - pub const BOTTOM_RIGHT: Self = Self(18); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 18; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::TOP_LEFT, - Self::TOP_CENTER, - Self::TOP_RIGHT, - Self::MIDDLE_LEFT, - Self::MIDDLE_CENTER, - Self::MIDDLE_RIGHT, - Self::BOTTOM_LEFT, - Self::BOTTOM_CENTER, - Self::BOTTOM_RIGHT, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::TOP_LEFT => Some("TOP_LEFT"), - Self::TOP_CENTER => Some("TOP_CENTER"), - Self::TOP_RIGHT => Some("TOP_RIGHT"), - Self::MIDDLE_LEFT => Some("MIDDLE_LEFT"), - Self::MIDDLE_CENTER => Some("MIDDLE_CENTER"), - Self::MIDDLE_RIGHT => Some("MIDDLE_RIGHT"), - Self::BOTTOM_LEFT => Some("BOTTOM_LEFT"), - Self::BOTTOM_CENTER => Some("BOTTOM_CENTER"), - Self::BOTTOM_RIGHT => Some("BOTTOM_RIGHT"), - _ => None, - } - } -} -impl core::fmt::Debug for TABLE_CELL_ALIGNMENT { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for TABLE_CELL_ALIGNMENT { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for TABLE_CELL_ALIGNMENT { - type Output = TABLE_CELL_ALIGNMENT; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for TABLE_CELL_ALIGNMENT { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for TABLE_CELL_ALIGNMENT { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for TABLE_CELL_ALIGNMENT {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_TABLE_FLOW_DIRECTION: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_TABLE_FLOW_DIRECTION: u8 = 11; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_TABLE_FLOW_DIRECTION: [TABLE_FLOW_DIRECTION; 2] = [ - TABLE_FLOW_DIRECTION::DOWN, - TABLE_FLOW_DIRECTION::UP, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct TABLE_FLOW_DIRECTION(pub u8); -#[allow(non_upper_case_globals)] -impl TABLE_FLOW_DIRECTION { - pub const DOWN: Self = Self(10); - pub const UP: Self = Self(11); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 11; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::DOWN, - Self::UP, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::DOWN => Some("DOWN"), - Self::UP => Some("UP"), - _ => None, - } - } -} -impl core::fmt::Debug for TABLE_FLOW_DIRECTION { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for TABLE_FLOW_DIRECTION { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for TABLE_FLOW_DIRECTION { - type Output = TABLE_FLOW_DIRECTION; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for TABLE_FLOW_DIRECTION { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for TABLE_FLOW_DIRECTION { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for TABLE_FLOW_DIRECTION {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_TOLERANCE_DISPLAY: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_TOLERANCE_DISPLAY: u8 = 14; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_TOLERANCE_DISPLAY: [TOLERANCE_DISPLAY; 5] = [ - TOLERANCE_DISPLAY::NONE, - TOLERANCE_DISPLAY::SYMMETRICAL, - TOLERANCE_DISPLAY::DEVIATION, - TOLERANCE_DISPLAY::LIMITS, - TOLERANCE_DISPLAY::BASIC, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct TOLERANCE_DISPLAY(pub u8); -#[allow(non_upper_case_globals)] -impl TOLERANCE_DISPLAY { - pub const NONE: Self = Self(10); - pub const SYMMETRICAL: Self = Self(11); - pub const DEVIATION: Self = Self(12); - pub const LIMITS: Self = Self(13); - pub const BASIC: Self = Self(14); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 14; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::SYMMETRICAL, - Self::DEVIATION, - Self::LIMITS, - Self::BASIC, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::SYMMETRICAL => Some("SYMMETRICAL"), - Self::DEVIATION => Some("DEVIATION"), - Self::LIMITS => Some("LIMITS"), - Self::BASIC => Some("BASIC"), - _ => None, - } - } -} -impl core::fmt::Debug for TOLERANCE_DISPLAY { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for TOLERANCE_DISPLAY { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for TOLERANCE_DISPLAY { - type Output = TOLERANCE_DISPLAY; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for TOLERANCE_DISPLAY { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for TOLERANCE_DISPLAY { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for TOLERANCE_DISPLAY {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_DIMENSION_TYPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_DIMENSION_TYPE: u8 = 22; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_DIMENSION_TYPE: [DIMENSION_TYPE; 13] = [ - DIMENSION_TYPE::LINEAR, - DIMENSION_TYPE::ALIGNED, - DIMENSION_TYPE::ANGULAR, - DIMENSION_TYPE::ARC_LENGTH, - DIMENSION_TYPE::RADIUS, - DIMENSION_TYPE::DIAMETER, - DIMENSION_TYPE::CENTER_MARK, - DIMENSION_TYPE::ROTATED, - DIMENSION_TYPE::SPACING, - DIMENSION_TYPE::CONTINUE, - DIMENSION_TYPE::BASELINE, - DIMENSION_TYPE::JOGGED_LINEAR, - DIMENSION_TYPE::ORDINATE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct DIMENSION_TYPE(pub u8); -#[allow(non_upper_case_globals)] -impl DIMENSION_TYPE { - pub const LINEAR: Self = Self(10); - pub const ALIGNED: Self = Self(11); - pub const ANGULAR: Self = Self(12); - pub const ARC_LENGTH: Self = Self(13); - pub const RADIUS: Self = Self(14); - pub const DIAMETER: Self = Self(15); - pub const CENTER_MARK: Self = Self(16); - pub const ROTATED: Self = Self(17); - pub const SPACING: Self = Self(18); - pub const CONTINUE: Self = Self(19); - pub const BASELINE: Self = Self(20); - pub const JOGGED_LINEAR: Self = Self(21); - pub const ORDINATE: Self = Self(22); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 22; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::LINEAR, - Self::ALIGNED, - Self::ANGULAR, - Self::ARC_LENGTH, - Self::RADIUS, - Self::DIAMETER, - Self::CENTER_MARK, - Self::ROTATED, - Self::SPACING, - Self::CONTINUE, - Self::BASELINE, - Self::JOGGED_LINEAR, - Self::ORDINATE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::LINEAR => Some("LINEAR"), - Self::ALIGNED => Some("ALIGNED"), - Self::ANGULAR => Some("ANGULAR"), - Self::ARC_LENGTH => Some("ARC_LENGTH"), - Self::RADIUS => Some("RADIUS"), - Self::DIAMETER => Some("DIAMETER"), - Self::CENTER_MARK => Some("CENTER_MARK"), - Self::ROTATED => Some("ROTATED"), - Self::SPACING => Some("SPACING"), - Self::CONTINUE => Some("CONTINUE"), - Self::BASELINE => Some("BASELINE"), - Self::JOGGED_LINEAR => Some("JOGGED_LINEAR"), - Self::ORDINATE => Some("ORDINATE"), - _ => None, - } - } -} -impl core::fmt::Debug for DIMENSION_TYPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for DIMENSION_TYPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for DIMENSION_TYPE { - type Output = DIMENSION_TYPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for DIMENSION_TYPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for DIMENSION_TYPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for DIMENSION_TYPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_MARK_ELLIPSE_CENTER: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_MARK_ELLIPSE_CENTER: u8 = 11; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_MARK_ELLIPSE_CENTER: [MARK_ELLIPSE_CENTER; 2] = [ - MARK_ELLIPSE_CENTER::MARK, - MARK_ELLIPSE_CENTER::LINE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct MARK_ELLIPSE_CENTER(pub u8); -#[allow(non_upper_case_globals)] -impl MARK_ELLIPSE_CENTER { - pub const MARK: Self = Self(10); - pub const LINE: Self = Self(11); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 11; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::MARK, - Self::LINE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::MARK => Some("MARK"), - Self::LINE => Some("LINE"), - _ => None, - } - } -} -impl core::fmt::Debug for MARK_ELLIPSE_CENTER { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for MARK_ELLIPSE_CENTER { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for MARK_ELLIPSE_CENTER { - type Output = MARK_ELLIPSE_CENTER; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for MARK_ELLIPSE_CENTER { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for MARK_ELLIPSE_CENTER { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for MARK_ELLIPSE_CENTER {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_TEXT_FLOW_DIRECTION: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_TEXT_FLOW_DIRECTION: u8 = 13; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_TEXT_FLOW_DIRECTION: [TEXT_FLOW_DIRECTION; 4] = [ - TEXT_FLOW_DIRECTION::LEFT_TO_RIGHT, - TEXT_FLOW_DIRECTION::RIGHT_TO_LEFT, - TEXT_FLOW_DIRECTION::TOP_TO_BOTTOM, - TEXT_FLOW_DIRECTION::BOTTOM_TO_TOP, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct TEXT_FLOW_DIRECTION(pub u8); -#[allow(non_upper_case_globals)] -impl TEXT_FLOW_DIRECTION { - pub const LEFT_TO_RIGHT: Self = Self(10); - pub const RIGHT_TO_LEFT: Self = Self(11); - pub const TOP_TO_BOTTOM: Self = Self(12); - pub const BOTTOM_TO_TOP: Self = Self(13); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 13; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::LEFT_TO_RIGHT, - Self::RIGHT_TO_LEFT, - Self::TOP_TO_BOTTOM, - Self::BOTTOM_TO_TOP, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::LEFT_TO_RIGHT => Some("LEFT_TO_RIGHT"), - Self::RIGHT_TO_LEFT => Some("RIGHT_TO_LEFT"), - Self::TOP_TO_BOTTOM => Some("TOP_TO_BOTTOM"), - Self::BOTTOM_TO_TOP => Some("BOTTOM_TO_TOP"), - _ => None, - } - } -} -impl core::fmt::Debug for TEXT_FLOW_DIRECTION { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for TEXT_FLOW_DIRECTION { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for TEXT_FLOW_DIRECTION { - type Output = TEXT_FLOW_DIRECTION; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for TEXT_FLOW_DIRECTION { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for TEXT_FLOW_DIRECTION { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for TEXT_FLOW_DIRECTION {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_COLUMN_TYPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_COLUMN_TYPE: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_COLUMN_TYPE: [COLUMN_TYPE; 3] = [ - COLUMN_TYPE::NO_COLUMNS, - COLUMN_TYPE::STATIC_COLUMNS, - COLUMN_TYPE::DYNAMIC_COLUMNS, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct COLUMN_TYPE(pub u8); -#[allow(non_upper_case_globals)] -impl COLUMN_TYPE { - pub const NO_COLUMNS: Self = Self(10); - pub const STATIC_COLUMNS: Self = Self(11); - pub const DYNAMIC_COLUMNS: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NO_COLUMNS, - Self::STATIC_COLUMNS, - Self::DYNAMIC_COLUMNS, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NO_COLUMNS => Some("NO_COLUMNS"), - Self::STATIC_COLUMNS => Some("STATIC_COLUMNS"), - Self::DYNAMIC_COLUMNS => Some("DYNAMIC_COLUMNS"), - _ => None, - } - } -} -impl core::fmt::Debug for COLUMN_TYPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for COLUMN_TYPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for COLUMN_TYPE { - type Output = COLUMN_TYPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for COLUMN_TYPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for COLUMN_TYPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for COLUMN_TYPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_GDT_SYMBOL: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_GDT_SYMBOL: u8 = 29; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_GDT_SYMBOL: [GDT_SYMBOL; 20] = [ - GDT_SYMBOL::STRAIGHTNESS, - GDT_SYMBOL::FLATNESS, - GDT_SYMBOL::CIRCULARITY, - GDT_SYMBOL::CYLINDRICITY, - GDT_SYMBOL::PERPENDICULARITY, - GDT_SYMBOL::ANGULARITY, - GDT_SYMBOL::PARALLELISM, - GDT_SYMBOL::POSITION, - GDT_SYMBOL::TRUE_POSITION, - GDT_SYMBOL::CONCENTRICITY, - GDT_SYMBOL::COAXIALITY, - GDT_SYMBOL::SYMMETRY, - GDT_SYMBOL::CIRCULAR_RUNOUT, - GDT_SYMBOL::TOTAL_RUNOUT, - GDT_SYMBOL::PROFILE_OF_LINE, - GDT_SYMBOL::PROFILE_OF_SURFACE, - GDT_SYMBOL::STATISTICAL, - GDT_SYMBOL::ALL_AROUND, - GDT_SYMBOL::ALL_OVER, - GDT_SYMBOL::BETWEEN, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct GDT_SYMBOL(pub u8); -#[allow(non_upper_case_globals)] -impl GDT_SYMBOL { - pub const STRAIGHTNESS: Self = Self(10); - pub const FLATNESS: Self = Self(11); - pub const CIRCULARITY: Self = Self(12); - pub const CYLINDRICITY: Self = Self(13); - pub const PERPENDICULARITY: Self = Self(14); - pub const ANGULARITY: Self = Self(15); - pub const PARALLELISM: Self = Self(16); - pub const POSITION: Self = Self(17); - pub const TRUE_POSITION: Self = Self(18); - pub const CONCENTRICITY: Self = Self(19); - pub const COAXIALITY: Self = Self(20); - pub const SYMMETRY: Self = Self(21); - pub const CIRCULAR_RUNOUT: Self = Self(22); - pub const TOTAL_RUNOUT: Self = Self(23); - pub const PROFILE_OF_LINE: Self = Self(24); - pub const PROFILE_OF_SURFACE: Self = Self(25); - pub const STATISTICAL: Self = Self(26); - pub const ALL_AROUND: Self = Self(27); - pub const ALL_OVER: Self = Self(28); - pub const BETWEEN: Self = Self(29); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 29; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::STRAIGHTNESS, - Self::FLATNESS, - Self::CIRCULARITY, - Self::CYLINDRICITY, - Self::PERPENDICULARITY, - Self::ANGULARITY, - Self::PARALLELISM, - Self::POSITION, - Self::TRUE_POSITION, - Self::CONCENTRICITY, - Self::COAXIALITY, - Self::SYMMETRY, - Self::CIRCULAR_RUNOUT, - Self::TOTAL_RUNOUT, - Self::PROFILE_OF_LINE, - Self::PROFILE_OF_SURFACE, - Self::STATISTICAL, - Self::ALL_AROUND, - Self::ALL_OVER, - Self::BETWEEN, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::STRAIGHTNESS => Some("STRAIGHTNESS"), - Self::FLATNESS => Some("FLATNESS"), - Self::CIRCULARITY => Some("CIRCULARITY"), - Self::CYLINDRICITY => Some("CYLINDRICITY"), - Self::PERPENDICULARITY => Some("PERPENDICULARITY"), - Self::ANGULARITY => Some("ANGULARITY"), - Self::PARALLELISM => Some("PARALLELISM"), - Self::POSITION => Some("POSITION"), - Self::TRUE_POSITION => Some("TRUE_POSITION"), - Self::CONCENTRICITY => Some("CONCENTRICITY"), - Self::COAXIALITY => Some("COAXIALITY"), - Self::SYMMETRY => Some("SYMMETRY"), - Self::CIRCULAR_RUNOUT => Some("CIRCULAR_RUNOUT"), - Self::TOTAL_RUNOUT => Some("TOTAL_RUNOUT"), - Self::PROFILE_OF_LINE => Some("PROFILE_OF_LINE"), - Self::PROFILE_OF_SURFACE => Some("PROFILE_OF_SURFACE"), - Self::STATISTICAL => Some("STATISTICAL"), - Self::ALL_AROUND => Some("ALL_AROUND"), - Self::ALL_OVER => Some("ALL_OVER"), - Self::BETWEEN => Some("BETWEEN"), - _ => None, - } - } -} -impl core::fmt::Debug for GDT_SYMBOL { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for GDT_SYMBOL { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for GDT_SYMBOL { - type Output = GDT_SYMBOL; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for GDT_SYMBOL { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for GDT_SYMBOL { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for GDT_SYMBOL {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_MATERIAL_CONDITION: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_MATERIAL_CONDITION: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_MATERIAL_CONDITION: [MATERIAL_CONDITION; 3] = [ - MATERIAL_CONDITION::MAXIMUM, - MATERIAL_CONDITION::LEAST, - MATERIAL_CONDITION::REGARDLESS, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct MATERIAL_CONDITION(pub u8); -#[allow(non_upper_case_globals)] -impl MATERIAL_CONDITION { - pub const MAXIMUM: Self = Self(10); - pub const LEAST: Self = Self(11); - pub const REGARDLESS: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::MAXIMUM, - Self::LEAST, - Self::REGARDLESS, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::MAXIMUM => Some("MAXIMUM"), - Self::LEAST => Some("LEAST"), - Self::REGARDLESS => Some("REGARDLESS"), - _ => None, - } - } -} -impl core::fmt::Debug for MATERIAL_CONDITION { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for MATERIAL_CONDITION { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for MATERIAL_CONDITION { - type Output = MATERIAL_CONDITION; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for MATERIAL_CONDITION { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for MATERIAL_CONDITION { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for MATERIAL_CONDITION {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_FEATURE_MODIFIER: u8 = 0; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_FEATURE_MODIFIER: u8 = 24; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_FEATURE_MODIFIER: [FEATURE_MODIFIER; 16] = [ - FEATURE_MODIFIER::NONE, - FEATURE_MODIFIER::FREE_STATE, - FEATURE_MODIFIER::TANGENT_PLANE, - FEATURE_MODIFIER::PROJECTED_TOLERANCE_ZONE, - FEATURE_MODIFIER::DIAMETER, - FEATURE_MODIFIER::SPHERICAL_DIAMETER, - FEATURE_MODIFIER::RADIUS, - FEATURE_MODIFIER::SPHERICAL_RADIUS, - FEATURE_MODIFIER::CONTROLLED_RADIUS, - FEATURE_MODIFIER::SQUARE, - FEATURE_MODIFIER::TRANSLATION, - FEATURE_MODIFIER::ALL_AROUND, - FEATURE_MODIFIER::ALL_OVER, - FEATURE_MODIFIER::STATISTICAL, - FEATURE_MODIFIER::CONTINUOUS_FEATURE, - FEATURE_MODIFIER::UNEQUALLY_DISPOSED, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct FEATURE_MODIFIER(pub u8); -#[allow(non_upper_case_globals)] -impl FEATURE_MODIFIER { - pub const NONE: Self = Self(0); - pub const FREE_STATE: Self = Self(10); - pub const TANGENT_PLANE: Self = Self(11); - pub const PROJECTED_TOLERANCE_ZONE: Self = Self(12); - pub const DIAMETER: Self = Self(13); - pub const SPHERICAL_DIAMETER: Self = Self(14); - pub const RADIUS: Self = Self(15); - pub const SPHERICAL_RADIUS: Self = Self(16); - pub const CONTROLLED_RADIUS: Self = Self(17); - pub const SQUARE: Self = Self(18); - pub const TRANSLATION: Self = Self(19); - pub const ALL_AROUND: Self = Self(20); - pub const ALL_OVER: Self = Self(21); - pub const STATISTICAL: Self = Self(22); - pub const CONTINUOUS_FEATURE: Self = Self(23); - pub const UNEQUALLY_DISPOSED: Self = Self(24); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 24; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::FREE_STATE, - Self::TANGENT_PLANE, - Self::PROJECTED_TOLERANCE_ZONE, - Self::DIAMETER, - Self::SPHERICAL_DIAMETER, - Self::RADIUS, - Self::SPHERICAL_RADIUS, - Self::CONTROLLED_RADIUS, - Self::SQUARE, - Self::TRANSLATION, - Self::ALL_AROUND, - Self::ALL_OVER, - Self::STATISTICAL, - Self::CONTINUOUS_FEATURE, - Self::UNEQUALLY_DISPOSED, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::FREE_STATE => Some("FREE_STATE"), - Self::TANGENT_PLANE => Some("TANGENT_PLANE"), - Self::PROJECTED_TOLERANCE_ZONE => Some("PROJECTED_TOLERANCE_ZONE"), - Self::DIAMETER => Some("DIAMETER"), - Self::SPHERICAL_DIAMETER => Some("SPHERICAL_DIAMETER"), - Self::RADIUS => Some("RADIUS"), - Self::SPHERICAL_RADIUS => Some("SPHERICAL_RADIUS"), - Self::CONTROLLED_RADIUS => Some("CONTROLLED_RADIUS"), - Self::SQUARE => Some("SQUARE"), - Self::TRANSLATION => Some("TRANSLATION"), - Self::ALL_AROUND => Some("ALL_AROUND"), - Self::ALL_OVER => Some("ALL_OVER"), - Self::STATISTICAL => Some("STATISTICAL"), - Self::CONTINUOUS_FEATURE => Some("CONTINUOUS_FEATURE"), - Self::UNEQUALLY_DISPOSED => Some("UNEQUALLY_DISPOSED"), - _ => None, - } - } -} -impl core::fmt::Debug for FEATURE_MODIFIER { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for FEATURE_MODIFIER { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for FEATURE_MODIFIER { - type Output = FEATURE_MODIFIER; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for FEATURE_MODIFIER { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for FEATURE_MODIFIER { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for FEATURE_MODIFIER {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_TOLERANCE_ZONE_TYPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_TOLERANCE_ZONE_TYPE: u8 = 14; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_TOLERANCE_ZONE_TYPE: [TOLERANCE_ZONE_TYPE; 5] = [ - TOLERANCE_ZONE_TYPE::CYLINDRICAL, - TOLERANCE_ZONE_TYPE::SPHERICAL, - TOLERANCE_ZONE_TYPE::RECTANGULAR, - TOLERANCE_ZONE_TYPE::LINEAR, - TOLERANCE_ZONE_TYPE::CIRCULAR, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct TOLERANCE_ZONE_TYPE(pub u8); -#[allow(non_upper_case_globals)] -impl TOLERANCE_ZONE_TYPE { - pub const CYLINDRICAL: Self = Self(10); - pub const SPHERICAL: Self = Self(11); - pub const RECTANGULAR: Self = Self(12); - pub const LINEAR: Self = Self(13); - pub const CIRCULAR: Self = Self(14); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 14; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::CYLINDRICAL, - Self::SPHERICAL, - Self::RECTANGULAR, - Self::LINEAR, - Self::CIRCULAR, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::CYLINDRICAL => Some("CYLINDRICAL"), - Self::SPHERICAL => Some("SPHERICAL"), - Self::RECTANGULAR => Some("RECTANGULAR"), - Self::LINEAR => Some("LINEAR"), - Self::CIRCULAR => Some("CIRCULAR"), - _ => None, - } - } -} -impl core::fmt::Debug for TOLERANCE_ZONE_TYPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for TOLERANCE_ZONE_TYPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for TOLERANCE_ZONE_TYPE { - type Output = TOLERANCE_ZONE_TYPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for TOLERANCE_ZONE_TYPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for TOLERANCE_ZONE_TYPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for TOLERANCE_ZONE_TYPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_DATUM_TARGET_TYPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_DATUM_TARGET_TYPE: u8 = 13; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_DATUM_TARGET_TYPE: [DATUM_TARGET_TYPE; 4] = [ - DATUM_TARGET_TYPE::POINT, - DATUM_TARGET_TYPE::LINE, - DATUM_TARGET_TYPE::AREA, - DATUM_TARGET_TYPE::MOVABLE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct DATUM_TARGET_TYPE(pub u8); -#[allow(non_upper_case_globals)] -impl DATUM_TARGET_TYPE { - pub const POINT: Self = Self(10); - pub const LINE: Self = Self(11); - pub const AREA: Self = Self(12); - pub const MOVABLE: Self = Self(13); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 13; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::POINT, - Self::LINE, - Self::AREA, - Self::MOVABLE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::POINT => Some("POINT"), - Self::LINE => Some("LINE"), - Self::AREA => Some("AREA"), - Self::MOVABLE => Some("MOVABLE"), - _ => None, - } - } -} -impl core::fmt::Debug for DATUM_TARGET_TYPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for DATUM_TARGET_TYPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for DATUM_TARGET_TYPE { - type Output = DATUM_TARGET_TYPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for DATUM_TARGET_TYPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for DATUM_TARGET_TYPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for DATUM_TARGET_TYPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_TOLERANCE_TYPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_TOLERANCE_TYPE: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_TOLERANCE_TYPE: [TOLERANCE_TYPE; 3] = [ - TOLERANCE_TYPE::SINGLE, - TOLERANCE_TYPE::COMPOSITE, - TOLERANCE_TYPE::MULTIPLE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct TOLERANCE_TYPE(pub u8); -#[allow(non_upper_case_globals)] -impl TOLERANCE_TYPE { - pub const SINGLE: Self = Self(10); - pub const COMPOSITE: Self = Self(11); - pub const MULTIPLE: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::SINGLE, - Self::COMPOSITE, - Self::MULTIPLE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::SINGLE => Some("SINGLE"), - Self::COMPOSITE => Some("COMPOSITE"), - Self::MULTIPLE => Some("MULTIPLE"), - _ => None, - } - } -} -impl core::fmt::Debug for TOLERANCE_TYPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for TOLERANCE_TYPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for TOLERANCE_TYPE { - type Output = TOLERANCE_TYPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for TOLERANCE_TYPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for TOLERANCE_TYPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for TOLERANCE_TYPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_DATUM_BRACKET_STYLE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_DATUM_BRACKET_STYLE: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_DATUM_BRACKET_STYLE: [DATUM_BRACKET_STYLE; 3] = [ - DATUM_BRACKET_STYLE::SQUARE, - DATUM_BRACKET_STYLE::ROUND, - DATUM_BRACKET_STYLE::NONE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct DATUM_BRACKET_STYLE(pub u8); -#[allow(non_upper_case_globals)] -impl DATUM_BRACKET_STYLE { - pub const SQUARE: Self = Self(10); - pub const ROUND: Self = Self(11); - pub const NONE: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::SQUARE, - Self::ROUND, - Self::NONE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::SQUARE => Some("SQUARE"), - Self::ROUND => Some("ROUND"), - Self::NONE => Some("NONE"), - _ => None, - } - } -} -impl core::fmt::Debug for DATUM_BRACKET_STYLE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for DATUM_BRACKET_STYLE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for DATUM_BRACKET_STYLE { - type Output = DATUM_BRACKET_STYLE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for DATUM_BRACKET_STYLE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for DATUM_BRACKET_STYLE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for DATUM_BRACKET_STYLE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_DIMENSION_UNITS_FORMAT: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_DIMENSION_UNITS_FORMAT: u8 = 14; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_DIMENSION_UNITS_FORMAT: [DIMENSION_UNITS_FORMAT; 5] = [ - DIMENSION_UNITS_FORMAT::DECIMAL, - DIMENSION_UNITS_FORMAT::ENGINEERING, - DIMENSION_UNITS_FORMAT::ARCHITECTURAL, - DIMENSION_UNITS_FORMAT::FRACTIONAL, - DIMENSION_UNITS_FORMAT::SCIENTIFIC, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct DIMENSION_UNITS_FORMAT(pub u8); -#[allow(non_upper_case_globals)] -impl DIMENSION_UNITS_FORMAT { - pub const DECIMAL: Self = Self(10); - pub const ENGINEERING: Self = Self(11); - pub const ARCHITECTURAL: Self = Self(12); - pub const FRACTIONAL: Self = Self(13); - pub const SCIENTIFIC: Self = Self(14); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 14; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::DECIMAL, - Self::ENGINEERING, - Self::ARCHITECTURAL, - Self::FRACTIONAL, - Self::SCIENTIFIC, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::DECIMAL => Some("DECIMAL"), - Self::ENGINEERING => Some("ENGINEERING"), - Self::ARCHITECTURAL => Some("ARCHITECTURAL"), - Self::FRACTIONAL => Some("FRACTIONAL"), - Self::SCIENTIFIC => Some("SCIENTIFIC"), - _ => None, - } - } -} -impl core::fmt::Debug for DIMENSION_UNITS_FORMAT { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for DIMENSION_UNITS_FORMAT { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for DIMENSION_UNITS_FORMAT { - type Output = DIMENSION_UNITS_FORMAT; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for DIMENSION_UNITS_FORMAT { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for DIMENSION_UNITS_FORMAT { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for DIMENSION_UNITS_FORMAT {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_DIMENSION_FIT_RULE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_DIMENSION_FIT_RULE: u8 = 13; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_DIMENSION_FIT_RULE: [DIMENSION_FIT_RULE; 4] = [ - DIMENSION_FIT_RULE::TEXT_AND_ARROWS, - DIMENSION_FIT_RULE::ARROWS_ONLY, - DIMENSION_FIT_RULE::TEXT_ONLY, - DIMENSION_FIT_RULE::BEST_FIT, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct DIMENSION_FIT_RULE(pub u8); -#[allow(non_upper_case_globals)] -impl DIMENSION_FIT_RULE { - pub const TEXT_AND_ARROWS: Self = Self(10); - pub const ARROWS_ONLY: Self = Self(11); - pub const TEXT_ONLY: Self = Self(12); - pub const BEST_FIT: Self = Self(13); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 13; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::TEXT_AND_ARROWS, - Self::ARROWS_ONLY, - Self::TEXT_ONLY, - Self::BEST_FIT, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::TEXT_AND_ARROWS => Some("TEXT_AND_ARROWS"), - Self::ARROWS_ONLY => Some("ARROWS_ONLY"), - Self::TEXT_ONLY => Some("TEXT_ONLY"), - Self::BEST_FIT => Some("BEST_FIT"), - _ => None, - } - } -} -impl core::fmt::Debug for DIMENSION_FIT_RULE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for DIMENSION_FIT_RULE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for DIMENSION_FIT_RULE { - type Output = DIMENSION_FIT_RULE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for DIMENSION_FIT_RULE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for DIMENSION_FIT_RULE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for DIMENSION_FIT_RULE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_DIMENSION_TEXT_PLACEMENT: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_DIMENSION_TEXT_PLACEMENT: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_DIMENSION_TEXT_PLACEMENT: [DIMENSION_TEXT_PLACEMENT; 3] = [ - DIMENSION_TEXT_PLACEMENT::BESIDE_LINE, - DIMENSION_TEXT_PLACEMENT::OVER_LINE, - DIMENSION_TEXT_PLACEMENT::OVER_LINE_WITH_LEADER, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct DIMENSION_TEXT_PLACEMENT(pub u8); -#[allow(non_upper_case_globals)] -impl DIMENSION_TEXT_PLACEMENT { - pub const BESIDE_LINE: Self = Self(10); - pub const OVER_LINE: Self = Self(11); - pub const OVER_LINE_WITH_LEADER: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::BESIDE_LINE, - Self::OVER_LINE, - Self::OVER_LINE_WITH_LEADER, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::BESIDE_LINE => Some("BESIDE_LINE"), - Self::OVER_LINE => Some("OVER_LINE"), - Self::OVER_LINE_WITH_LEADER => Some("OVER_LINE_WITH_LEADER"), - _ => None, - } - } -} -impl core::fmt::Debug for DIMENSION_TEXT_PLACEMENT { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for DIMENSION_TEXT_PLACEMENT { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for DIMENSION_TEXT_PLACEMENT { - type Output = DIMENSION_TEXT_PLACEMENT; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for DIMENSION_TEXT_PLACEMENT { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for DIMENSION_TEXT_PLACEMENT { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for DIMENSION_TEXT_PLACEMENT {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_ANGULAR_UNITS_FORMAT: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_ANGULAR_UNITS_FORMAT: u8 = 14; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_ANGULAR_UNITS_FORMAT: [ANGULAR_UNITS_FORMAT; 5] = [ - ANGULAR_UNITS_FORMAT::DECIMAL_DEGREES, - ANGULAR_UNITS_FORMAT::DEGREES_MINUTES_SECONDS, - ANGULAR_UNITS_FORMAT::GRADS, - ANGULAR_UNITS_FORMAT::RADIANS, - ANGULAR_UNITS_FORMAT::SURVEYOR, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct ANGULAR_UNITS_FORMAT(pub u8); -#[allow(non_upper_case_globals)] -impl ANGULAR_UNITS_FORMAT { - pub const DECIMAL_DEGREES: Self = Self(10); - pub const DEGREES_MINUTES_SECONDS: Self = Self(11); - pub const GRADS: Self = Self(12); - pub const RADIANS: Self = Self(13); - pub const SURVEYOR: Self = Self(14); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 14; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::DECIMAL_DEGREES, - Self::DEGREES_MINUTES_SECONDS, - Self::GRADS, - Self::RADIANS, - Self::SURVEYOR, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::DECIMAL_DEGREES => Some("DECIMAL_DEGREES"), - Self::DEGREES_MINUTES_SECONDS => Some("DEGREES_MINUTES_SECONDS"), - Self::GRADS => Some("GRADS"), - Self::RADIANS => Some("RADIANS"), - Self::SURVEYOR => Some("SURVEYOR"), - _ => None, - } - } -} -impl core::fmt::Debug for ANGULAR_UNITS_FORMAT { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for ANGULAR_UNITS_FORMAT { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for ANGULAR_UNITS_FORMAT { - type Output = ANGULAR_UNITS_FORMAT; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for ANGULAR_UNITS_FORMAT { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for ANGULAR_UNITS_FORMAT { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for ANGULAR_UNITS_FORMAT {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_UNIT_SYSTEM: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_UNIT_SYSTEM: u8 = 11; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_UNIT_SYSTEM: [UNIT_SYSTEM; 2] = [ - UNIT_SYSTEM::METRIC, - UNIT_SYSTEM::IMPERIAL, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct UNIT_SYSTEM(pub u8); -#[allow(non_upper_case_globals)] -impl UNIT_SYSTEM { - pub const METRIC: Self = Self(10); - pub const IMPERIAL: Self = Self(11); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 11; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::METRIC, - Self::IMPERIAL, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::METRIC => Some("METRIC"), - Self::IMPERIAL => Some("IMPERIAL"), - _ => None, - } - } -} -impl core::fmt::Debug for UNIT_SYSTEM { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for UNIT_SYSTEM { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for UNIT_SYSTEM { - type Output = UNIT_SYSTEM; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for UNIT_SYSTEM { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for UNIT_SYSTEM { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for UNIT_SYSTEM {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_DECIMAL_SEPARATOR: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_DECIMAL_SEPARATOR: u8 = 11; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_DECIMAL_SEPARATOR: [DECIMAL_SEPARATOR; 2] = [ - DECIMAL_SEPARATOR::DOT, - DECIMAL_SEPARATOR::COMMA, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct DECIMAL_SEPARATOR(pub u8); -#[allow(non_upper_case_globals)] -impl DECIMAL_SEPARATOR { - pub const DOT: Self = Self(10); - pub const COMMA: Self = Self(11); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 11; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::DOT, - Self::COMMA, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::DOT => Some("DOT"), - Self::COMMA => Some("COMMA"), - _ => None, - } - } -} -impl core::fmt::Debug for DECIMAL_SEPARATOR { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for DECIMAL_SEPARATOR { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for DECIMAL_SEPARATOR { - type Output = DECIMAL_SEPARATOR; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for DECIMAL_SEPARATOR { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for DECIMAL_SEPARATOR { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for DECIMAL_SEPARATOR {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_VIEWPORT_SHADE_PLOT: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_VIEWPORT_SHADE_PLOT: u8 = 13; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_VIEWPORT_SHADE_PLOT: [VIEWPORT_SHADE_PLOT; 4] = [ - VIEWPORT_SHADE_PLOT::AS_DISPLAYED, - VIEWPORT_SHADE_PLOT::WIREFRAME, - VIEWPORT_SHADE_PLOT::HIDDEN, - VIEWPORT_SHADE_PLOT::RENDERED, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct VIEWPORT_SHADE_PLOT(pub u8); -#[allow(non_upper_case_globals)] -impl VIEWPORT_SHADE_PLOT { - pub const AS_DISPLAYED: Self = Self(10); - pub const WIREFRAME: Self = Self(11); - pub const HIDDEN: Self = Self(12); - pub const RENDERED: Self = Self(13); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 13; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::AS_DISPLAYED, - Self::WIREFRAME, - Self::HIDDEN, - Self::RENDERED, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::AS_DISPLAYED => Some("AS_DISPLAYED"), - Self::WIREFRAME => Some("WIREFRAME"), - Self::HIDDEN => Some("HIDDEN"), - Self::RENDERED => Some("RENDERED"), - _ => None, - } - } -} -impl core::fmt::Debug for VIEWPORT_SHADE_PLOT { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for VIEWPORT_SHADE_PLOT { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for VIEWPORT_SHADE_PLOT { - type Output = VIEWPORT_SHADE_PLOT; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for VIEWPORT_SHADE_PLOT { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for VIEWPORT_SHADE_PLOT { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for VIEWPORT_SHADE_PLOT {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_HATCH_STYLE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_HATCH_STYLE: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_HATCH_STYLE: [HATCH_STYLE; 3] = [ - HATCH_STYLE::NORMAL, - HATCH_STYLE::OUTER, - HATCH_STYLE::IGNORE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct HATCH_STYLE(pub u8); -#[allow(non_upper_case_globals)] -impl HATCH_STYLE { - pub const NORMAL: Self = Self(10); - pub const OUTER: Self = Self(11); - pub const IGNORE: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NORMAL, - Self::OUTER, - Self::IGNORE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NORMAL => Some("NORMAL"), - Self::OUTER => Some("OUTER"), - Self::IGNORE => Some("IGNORE"), - _ => None, - } - } -} -impl core::fmt::Debug for HATCH_STYLE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for HATCH_STYLE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for HATCH_STYLE { - type Output = HATCH_STYLE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for HATCH_STYLE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for HATCH_STYLE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for HATCH_STYLE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_IMAGE_STATUS: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_IMAGE_STATUS: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_IMAGE_STATUS: [IMAGE_STATUS; 3] = [ - IMAGE_STATUS::PENDING, - IMAGE_STATUS::SAVED, - IMAGE_STATUS::ERROR, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct IMAGE_STATUS(pub u8); -#[allow(non_upper_case_globals)] -impl IMAGE_STATUS { - pub const PENDING: Self = Self(10); - pub const SAVED: Self = Self(11); - pub const ERROR: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::PENDING, - Self::SAVED, - Self::ERROR, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::PENDING => Some("PENDING"), - Self::SAVED => Some("SAVED"), - Self::ERROR => Some("ERROR"), - _ => None, - } - } -} -impl core::fmt::Debug for IMAGE_STATUS { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for IMAGE_STATUS { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for IMAGE_STATUS { - type Output = IMAGE_STATUS; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for IMAGE_STATUS { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for IMAGE_STATUS { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for IMAGE_STATUS {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_BLOCK_ATTACHMENT: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_BLOCK_ATTACHMENT: u8 = 11; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_BLOCK_ATTACHMENT: [BLOCK_ATTACHMENT; 2] = [ - BLOCK_ATTACHMENT::CENTER_EXTENTS, - BLOCK_ATTACHMENT::INSERTION_POINT, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct BLOCK_ATTACHMENT(pub u8); -#[allow(non_upper_case_globals)] -impl BLOCK_ATTACHMENT { - pub const CENTER_EXTENTS: Self = Self(10); - pub const INSERTION_POINT: Self = Self(11); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 11; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::CENTER_EXTENTS, - Self::INSERTION_POINT, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::CENTER_EXTENTS => Some("CENTER_EXTENTS"), - Self::INSERTION_POINT => Some("INSERTION_POINT"), - _ => None, - } - } -} -impl core::fmt::Debug for BLOCK_ATTACHMENT { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for BLOCK_ATTACHMENT { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for BLOCK_ATTACHMENT { - type Output = BLOCK_ATTACHMENT; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for BLOCK_ATTACHMENT { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for BLOCK_ATTACHMENT { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for BLOCK_ATTACHMENT {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_AXIS: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_AXIS: u8 = 30; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_AXIS: [AXIS; 3] = [ - AXIS::X, - AXIS::Y, - AXIS::Z, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct AXIS(pub u8); -#[allow(non_upper_case_globals)] -impl AXIS { - pub const X: Self = Self(10); - pub const Y: Self = Self(20); - pub const Z: Self = Self(30); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 30; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::X, - Self::Y, - Self::Z, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::X => Some("X"), - Self::Y => Some("Y"), - Self::Z => Some("Z"), - _ => None, - } - } -} -impl core::fmt::Debug for AXIS { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for AXIS { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for AXIS { - type Output = AXIS; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for AXIS { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for AXIS { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for AXIS {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_PRUNING_LEVEL: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_PRUNING_LEVEL: u8 = 30; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_PRUNING_LEVEL: [PRUNING_LEVEL; 3] = [ - PRUNING_LEVEL::CONSERVATIVE, - PRUNING_LEVEL::BALANCED, - PRUNING_LEVEL::AGGRESSIVE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct PRUNING_LEVEL(pub u8); -#[allow(non_upper_case_globals)] -impl PRUNING_LEVEL { - pub const CONSERVATIVE: Self = Self(10); - pub const BALANCED: Self = Self(20); - pub const AGGRESSIVE: Self = Self(30); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 30; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::CONSERVATIVE, - Self::BALANCED, - Self::AGGRESSIVE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::CONSERVATIVE => Some("CONSERVATIVE"), - Self::BALANCED => Some("BALANCED"), - Self::AGGRESSIVE => Some("AGGRESSIVE"), - _ => None, - } - } -} -impl core::fmt::Debug for PRUNING_LEVEL { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for PRUNING_LEVEL { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for PRUNING_LEVEL { - type Output = PRUNING_LEVEL; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for PRUNING_LEVEL { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for PRUNING_LEVEL { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for PRUNING_LEVEL {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_PARAMETRIC_SOURCE_TYPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_PARAMETRIC_SOURCE_TYPE: u8 = 11; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_PARAMETRIC_SOURCE_TYPE: [PARAMETRIC_SOURCE_TYPE; 2] = [ - PARAMETRIC_SOURCE_TYPE::CODE, - PARAMETRIC_SOURCE_TYPE::FILE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct PARAMETRIC_SOURCE_TYPE(pub u8); -#[allow(non_upper_case_globals)] -impl PARAMETRIC_SOURCE_TYPE { - pub const CODE: Self = Self(10); - pub const FILE: Self = Self(11); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 11; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::CODE, - Self::FILE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::CODE => Some("CODE"), - Self::FILE => Some("FILE"), - _ => None, - } - } -} -impl core::fmt::Debug for PARAMETRIC_SOURCE_TYPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for PARAMETRIC_SOURCE_TYPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for PARAMETRIC_SOURCE_TYPE { - type Output = PARAMETRIC_SOURCE_TYPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for PARAMETRIC_SOURCE_TYPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for PARAMETRIC_SOURCE_TYPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for PARAMETRIC_SOURCE_TYPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_DOCUMENT_GRID_ALIGN_ITEMS: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_DOCUMENT_GRID_ALIGN_ITEMS: u8 = 12; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_DOCUMENT_GRID_ALIGN_ITEMS: [DOCUMENT_GRID_ALIGN_ITEMS; 3] = [ - DOCUMENT_GRID_ALIGN_ITEMS::START, - DOCUMENT_GRID_ALIGN_ITEMS::CENTER, - DOCUMENT_GRID_ALIGN_ITEMS::END, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct DOCUMENT_GRID_ALIGN_ITEMS(pub u8); -#[allow(non_upper_case_globals)] -impl DOCUMENT_GRID_ALIGN_ITEMS { - pub const START: Self = Self(10); - pub const CENTER: Self = Self(11); - pub const END: Self = Self(12); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 12; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::START, - Self::CENTER, - Self::END, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::START => Some("START"), - Self::CENTER => Some("CENTER"), - Self::END => Some("END"), - _ => None, - } - } -} -impl core::fmt::Debug for DOCUMENT_GRID_ALIGN_ITEMS { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for DOCUMENT_GRID_ALIGN_ITEMS { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for DOCUMENT_GRID_ALIGN_ITEMS { - type Output = DOCUMENT_GRID_ALIGN_ITEMS; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for DOCUMENT_GRID_ALIGN_ITEMS { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for DOCUMENT_GRID_ALIGN_ITEMS { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for DOCUMENT_GRID_ALIGN_ITEMS {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_LEADER_CONTENT_TYPE: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_LEADER_CONTENT_TYPE: u8 = 11; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_LEADER_CONTENT_TYPE: [LEADER_CONTENT_TYPE; 2] = [ - LEADER_CONTENT_TYPE::TEXT, - LEADER_CONTENT_TYPE::BLOCK, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct LEADER_CONTENT_TYPE(pub u8); -#[allow(non_upper_case_globals)] -impl LEADER_CONTENT_TYPE { - pub const TEXT: Self = Self(10); - pub const BLOCK: Self = Self(11); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 11; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::TEXT, - Self::BLOCK, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::TEXT => Some("TEXT"), - Self::BLOCK => Some("BLOCK"), - _ => None, - } - } -} -impl core::fmt::Debug for LEADER_CONTENT_TYPE { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for LEADER_CONTENT_TYPE { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for LEADER_CONTENT_TYPE { - type Output = LEADER_CONTENT_TYPE; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for LEADER_CONTENT_TYPE { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for LEADER_CONTENT_TYPE { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for LEADER_CONTENT_TYPE {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_BOOLEAN_OPERATION: u8 = 10; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_BOOLEAN_OPERATION: u8 = 13; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_BOOLEAN_OPERATION: [BOOLEAN_OPERATION; 4] = [ - BOOLEAN_OPERATION::UNION, - BOOLEAN_OPERATION::SUBTRACT, - BOOLEAN_OPERATION::INTERSECT, - BOOLEAN_OPERATION::EXCLUDE, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct BOOLEAN_OPERATION(pub u8); -#[allow(non_upper_case_globals)] -impl BOOLEAN_OPERATION { - pub const UNION: Self = Self(10); - pub const SUBTRACT: Self = Self(11); - pub const INTERSECT: Self = Self(12); - pub const EXCLUDE: Self = Self(13); - - pub const ENUM_MIN: u8 = 10; - pub const ENUM_MAX: u8 = 13; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::UNION, - Self::SUBTRACT, - Self::INTERSECT, - Self::EXCLUDE, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::UNION => Some("UNION"), - Self::SUBTRACT => Some("SUBTRACT"), - Self::INTERSECT => Some("INTERSECT"), - Self::EXCLUDE => Some("EXCLUDE"), - _ => None, - } - } -} -impl core::fmt::Debug for BOOLEAN_OPERATION { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for BOOLEAN_OPERATION { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for BOOLEAN_OPERATION { - type Output = BOOLEAN_OPERATION; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for BOOLEAN_OPERATION { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for BOOLEAN_OPERATION { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for BOOLEAN_OPERATION {} -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_DUC_TEXT_DYNAMIC_SOURCE_DATA: u8 = 0; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_DUC_TEXT_DYNAMIC_SOURCE_DATA: u8 = 2; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_DUC_TEXT_DYNAMIC_SOURCE_DATA: [DucTextDynamicSourceData; 3] = [ - DucTextDynamicSourceData::NONE, - DucTextDynamicSourceData::DucTextDynamicElementSource, - DucTextDynamicSourceData::DucTextDynamicDictionarySource, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct DucTextDynamicSourceData(pub u8); -#[allow(non_upper_case_globals)] -impl DucTextDynamicSourceData { - pub const NONE: Self = Self(0); - pub const DucTextDynamicElementSource: Self = Self(1); - pub const DucTextDynamicDictionarySource: Self = Self(2); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 2; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::DucTextDynamicElementSource, - Self::DucTextDynamicDictionarySource, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::DucTextDynamicElementSource => Some("DucTextDynamicElementSource"), - Self::DucTextDynamicDictionarySource => Some("DucTextDynamicDictionarySource"), - _ => None, - } - } -} -impl core::fmt::Debug for DucTextDynamicSourceData { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for DucTextDynamicSourceData { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for DucTextDynamicSourceData { - type Output = DucTextDynamicSourceData; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for DucTextDynamicSourceData { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for DucTextDynamicSourceData { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for DucTextDynamicSourceData {} -pub struct DucTextDynamicSourceDataUnionTableOffset {} - -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_LEADER_CONTENT_DATA: u8 = 0; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_LEADER_CONTENT_DATA: u8 = 2; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_LEADER_CONTENT_DATA: [LeaderContentData; 3] = [ - LeaderContentData::NONE, - LeaderContentData::LeaderTextBlockContent, - LeaderContentData::LeaderBlockContent, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct LeaderContentData(pub u8); -#[allow(non_upper_case_globals)] -impl LeaderContentData { - pub const NONE: Self = Self(0); - pub const LeaderTextBlockContent: Self = Self(1); - pub const LeaderBlockContent: Self = Self(2); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 2; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::LeaderTextBlockContent, - Self::LeaderBlockContent, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::LeaderTextBlockContent => Some("LeaderTextBlockContent"), - Self::LeaderBlockContent => Some("LeaderBlockContent"), - _ => None, - } - } -} -impl core::fmt::Debug for LeaderContentData { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for LeaderContentData { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for LeaderContentData { - type Output = LeaderContentData; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for LeaderContentData { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for LeaderContentData { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for LeaderContentData {} -pub struct LeaderContentDataUnionTableOffset {} - -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MIN_ELEMENT: u8 = 0; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -pub const ENUM_MAX_ELEMENT: u8 = 23; -#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] -#[allow(non_camel_case_types)] -pub const ENUM_VALUES_ELEMENT: [Element; 24] = [ - Element::NONE, - Element::DucRectangleElement, - Element::DucPolygonElement, - Element::DucEllipseElement, - Element::DucEmbeddableElement, - Element::DucPdfElement, - Element::DucMermaidElement, - Element::DucTableElement, - Element::DucImageElement, - Element::DucTextElement, - Element::DucLinearElement, - Element::DucArrowElement, - Element::DucFreeDrawElement, - Element::DucBlockInstanceElement, - Element::DucFrameElement, - Element::DucPlotElement, - Element::DucViewportElement, - Element::DucXRayElement, - Element::DucLeaderElement, - Element::DucDimensionElement, - Element::DucFeatureControlFrameElement, - Element::DucDocElement, - Element::DucParametricElement, - Element::DucModelElement, -]; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] -#[repr(transparent)] -pub struct Element(pub u8); -#[allow(non_upper_case_globals)] -impl Element { - pub const NONE: Self = Self(0); - pub const DucRectangleElement: Self = Self(1); - pub const DucPolygonElement: Self = Self(2); - pub const DucEllipseElement: Self = Self(3); - pub const DucEmbeddableElement: Self = Self(4); - pub const DucPdfElement: Self = Self(5); - pub const DucMermaidElement: Self = Self(6); - pub const DucTableElement: Self = Self(7); - pub const DucImageElement: Self = Self(8); - pub const DucTextElement: Self = Self(9); - pub const DucLinearElement: Self = Self(10); - pub const DucArrowElement: Self = Self(11); - pub const DucFreeDrawElement: Self = Self(12); - pub const DucBlockInstanceElement: Self = Self(13); - pub const DucFrameElement: Self = Self(14); - pub const DucPlotElement: Self = Self(15); - pub const DucViewportElement: Self = Self(16); - pub const DucXRayElement: Self = Self(17); - pub const DucLeaderElement: Self = Self(18); - pub const DucDimensionElement: Self = Self(19); - pub const DucFeatureControlFrameElement: Self = Self(20); - pub const DucDocElement: Self = Self(21); - pub const DucParametricElement: Self = Self(22); - pub const DucModelElement: Self = Self(23); - - pub const ENUM_MIN: u8 = 0; - pub const ENUM_MAX: u8 = 23; - pub const ENUM_VALUES: &'static [Self] = &[ - Self::NONE, - Self::DucRectangleElement, - Self::DucPolygonElement, - Self::DucEllipseElement, - Self::DucEmbeddableElement, - Self::DucPdfElement, - Self::DucMermaidElement, - Self::DucTableElement, - Self::DucImageElement, - Self::DucTextElement, - Self::DucLinearElement, - Self::DucArrowElement, - Self::DucFreeDrawElement, - Self::DucBlockInstanceElement, - Self::DucFrameElement, - Self::DucPlotElement, - Self::DucViewportElement, - Self::DucXRayElement, - Self::DucLeaderElement, - Self::DucDimensionElement, - Self::DucFeatureControlFrameElement, - Self::DucDocElement, - Self::DucParametricElement, - Self::DucModelElement, - ]; - /// Returns the variant's name or "" if unknown. - pub fn variant_name(self) -> Option<&'static str> { - match self { - Self::NONE => Some("NONE"), - Self::DucRectangleElement => Some("DucRectangleElement"), - Self::DucPolygonElement => Some("DucPolygonElement"), - Self::DucEllipseElement => Some("DucEllipseElement"), - Self::DucEmbeddableElement => Some("DucEmbeddableElement"), - Self::DucPdfElement => Some("DucPdfElement"), - Self::DucMermaidElement => Some("DucMermaidElement"), - Self::DucTableElement => Some("DucTableElement"), - Self::DucImageElement => Some("DucImageElement"), - Self::DucTextElement => Some("DucTextElement"), - Self::DucLinearElement => Some("DucLinearElement"), - Self::DucArrowElement => Some("DucArrowElement"), - Self::DucFreeDrawElement => Some("DucFreeDrawElement"), - Self::DucBlockInstanceElement => Some("DucBlockInstanceElement"), - Self::DucFrameElement => Some("DucFrameElement"), - Self::DucPlotElement => Some("DucPlotElement"), - Self::DucViewportElement => Some("DucViewportElement"), - Self::DucXRayElement => Some("DucXRayElement"), - Self::DucLeaderElement => Some("DucLeaderElement"), - Self::DucDimensionElement => Some("DucDimensionElement"), - Self::DucFeatureControlFrameElement => Some("DucFeatureControlFrameElement"), - Self::DucDocElement => Some("DucDocElement"), - Self::DucParametricElement => Some("DucParametricElement"), - Self::DucModelElement => Some("DucModelElement"), - _ => None, - } - } -} -impl core::fmt::Debug for Element { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - if let Some(name) = self.variant_name() { - f.write_str(name) - } else { - f.write_fmt(format_args!("", self.0)) - } - } -} -impl<'a> flatbuffers::Follow<'a> for Element { - type Inner = Self; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - let b = flatbuffers::read_scalar_at::(buf, loc); - Self(b) - } -} - -impl flatbuffers::Push for Element { - type Output = Element; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - flatbuffers::emplace_scalar::(dst, self.0); - } -} - -impl flatbuffers::EndianScalar for Element { - type Scalar = u8; - #[inline] - fn to_little_endian(self) -> u8 { - self.0.to_le() - } - #[inline] - #[allow(clippy::wrong_self_convention)] - fn from_little_endian(v: u8) -> Self { - let b = u8::from_le(v); - Self(b) - } -} - -impl<'a> flatbuffers::Verifiable for Element { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - u8::run_verifier(v, pos) - } -} - -impl flatbuffers::SimpleToVerifyInSlice for Element {} -pub struct ElementUnionTableOffset {} - -// struct GeometricPoint, aligned to 8 -#[repr(transparent)] -#[derive(Clone, Copy, PartialEq)] -pub struct GeometricPoint(pub [u8; 16]); -impl Default for GeometricPoint { - fn default() -> Self { - Self([0; 16]) - } -} -impl core::fmt::Debug for GeometricPoint { - fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { - f.debug_struct("GeometricPoint") - .field("x", &self.x()) - .field("y", &self.y()) - .finish() - } -} - -impl flatbuffers::SimpleToVerifyInSlice for GeometricPoint {} -impl<'a> flatbuffers::Follow<'a> for GeometricPoint { - type Inner = &'a GeometricPoint; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - <&'a GeometricPoint>::follow(buf, loc) - } -} -impl<'a> flatbuffers::Follow<'a> for &'a GeometricPoint { - type Inner = &'a GeometricPoint; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - flatbuffers::follow_cast_ref::(buf, loc) - } -} -impl<'b> flatbuffers::Push for GeometricPoint { - type Output = GeometricPoint; - #[inline] - unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { - let src = ::core::slice::from_raw_parts(self as *const GeometricPoint as *const u8, ::size()); - dst.copy_from_slice(src); - } - #[inline] - fn alignment() -> flatbuffers::PushAlignment { - flatbuffers::PushAlignment::new(8) - } -} - -impl<'a> flatbuffers::Verifiable for GeometricPoint { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.in_buffer::(pos) - } -} - -impl<'a> GeometricPoint { - #[allow(clippy::too_many_arguments)] - pub fn new( - x: f64, - y: f64, - ) -> Self { - let mut s = Self([0; 16]); - s.set_x(x); - s.set_y(y); - s - } - - pub fn x(&self) -> f64 { - let mut mem = core::mem::MaybeUninit::<::Scalar>::uninit(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid value in this slot - EndianScalar::from_little_endian(unsafe { - core::ptr::copy_nonoverlapping( - self.0[0..].as_ptr(), - mem.as_mut_ptr() as *mut u8, - core::mem::size_of::<::Scalar>(), - ); - mem.assume_init() - }) - } - - pub fn set_x(&mut self, x: f64) { - let x_le = x.to_little_endian(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid value in this slot - unsafe { - core::ptr::copy_nonoverlapping( - &x_le as *const _ as *const u8, - self.0[0..].as_mut_ptr(), - core::mem::size_of::<::Scalar>(), - ); - } - } - - pub fn y(&self) -> f64 { - let mut mem = core::mem::MaybeUninit::<::Scalar>::uninit(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid value in this slot - EndianScalar::from_little_endian(unsafe { - core::ptr::copy_nonoverlapping( - self.0[8..].as_ptr(), - mem.as_mut_ptr() as *mut u8, - core::mem::size_of::<::Scalar>(), - ); - mem.assume_init() - }) - } - - pub fn set_y(&mut self, x: f64) { - let x_le = x.to_little_endian(); - // Safety: - // Created from a valid Table for this object - // Which contains a valid value in this slot - unsafe { - core::ptr::copy_nonoverlapping( - &x_le as *const _ as *const u8, - self.0[8..].as_mut_ptr(), - core::mem::size_of::<::Scalar>(), - ); - } - } - -} - -pub enum DictionaryEntryOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DictionaryEntry<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DictionaryEntry<'a> { - type Inner = DictionaryEntry<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DictionaryEntry<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_VALUE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DictionaryEntry { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DictionaryEntryArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DictionaryEntryBuilder::new(_fbb); - if let Some(x) = args.value { builder.add_value(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DictionaryEntry::VT_KEY, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DictionaryEntry) -> bool { - self.key() < o.key() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.key(); - key.cmp(val) - } - #[inline] - pub fn value(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DictionaryEntry::VT_VALUE, None)} - } -} - -impl flatbuffers::Verifiable for DictionaryEntry<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>("value", Self::VT_VALUE, false)? - .finish(); - Ok(()) - } -} -pub struct DictionaryEntryArgs<'a> { - pub key: Option>, - pub value: Option>, -} -impl<'a> Default for DictionaryEntryArgs<'a> { - #[inline] - fn default() -> Self { - DictionaryEntryArgs { - key: None, // required field - value: None, - } - } -} - -pub struct DictionaryEntryBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DictionaryEntryBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DictionaryEntry::VT_KEY, key); - } - #[inline] - pub fn add_value(&mut self, value: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DictionaryEntry::VT_VALUE, value); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DictionaryEntryBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DictionaryEntryBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DictionaryEntry::VT_KEY,"key"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DictionaryEntry<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DictionaryEntry"); - ds.field("key", &self.key()); - ds.field("value", &self.value()); - ds.finish() - } -} -pub enum StringValueEntryOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct StringValueEntry<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for StringValueEntry<'a> { - type Inner = StringValueEntry<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> StringValueEntry<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_VALUE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - StringValueEntry { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args StringValueEntryArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = StringValueEntryBuilder::new(_fbb); - if let Some(x) = args.value { builder.add_value(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StringValueEntry::VT_KEY, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &StringValueEntry) -> bool { - self.key() < o.key() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.key(); - key.cmp(val) - } - #[inline] - pub fn value(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StringValueEntry::VT_VALUE, None)} - } -} - -impl flatbuffers::Verifiable for StringValueEntry<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>("value", Self::VT_VALUE, false)? - .finish(); - Ok(()) - } -} -pub struct StringValueEntryArgs<'a> { - pub key: Option>, - pub value: Option>, -} -impl<'a> Default for StringValueEntryArgs<'a> { - #[inline] - fn default() -> Self { - StringValueEntryArgs { - key: None, // required field - value: None, - } - } -} - -pub struct StringValueEntryBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StringValueEntryBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StringValueEntry::VT_KEY, key); - } - #[inline] - pub fn add_value(&mut self, value: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StringValueEntry::VT_VALUE, value); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StringValueEntryBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - StringValueEntryBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, StringValueEntry::VT_KEY,"key"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for StringValueEntry<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("StringValueEntry"); - ds.field("key", &self.key()); - ds.field("value", &self.value()); - ds.finish() - } -} -pub enum IdentifierOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct Identifier<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for Identifier<'a> { - type Inner = Identifier<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> Identifier<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_NAME: flatbuffers::VOffsetT = 6; - pub const VT_DESCRIPTION: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - Identifier { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifierArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifierBuilder::new(_fbb); - if let Some(x) = args.description { builder.add_description(x); } - if let Some(x) = args.name { builder.add_name(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Identifier::VT_ID, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &Identifier) -> bool { - self.id() < o.id() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.id(); - key.cmp(val) - } - #[inline] - pub fn name(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Identifier::VT_NAME, None)} - } - #[inline] - pub fn description(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Identifier::VT_DESCRIPTION, None)} - } -} - -impl flatbuffers::Verifiable for Identifier<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, true)? - .visit_field::>("name", Self::VT_NAME, false)? - .visit_field::>("description", Self::VT_DESCRIPTION, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifierArgs<'a> { - pub id: Option>, - pub name: Option>, - pub description: Option>, -} -impl<'a> Default for IdentifierArgs<'a> { - #[inline] - fn default() -> Self { - IdentifierArgs { - id: None, // required field - name: None, - description: None, - } - } -} - -pub struct IdentifierBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifierBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(Identifier::VT_ID, id); - } - #[inline] - pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(Identifier::VT_NAME, name); - } - #[inline] - pub fn add_description(&mut self, description: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(Identifier::VT_DESCRIPTION, description); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifierBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifierBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, Identifier::VT_ID,"id"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for Identifier<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("Identifier"); - ds.field("id", &self.id()); - ds.field("name", &self.name()); - ds.field("description", &self.description()); - ds.finish() - } -} -pub enum DucUcsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucUcs<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucUcs<'a> { - type Inner = DucUcs<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucUcs<'a> { - pub const VT_ORIGIN: flatbuffers::VOffsetT = 4; - pub const VT_ANGLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucUcs { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucUcsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucUcsBuilder::new(_fbb); - builder.add_angle(args.angle); - if let Some(x) = args.origin { builder.add_origin(x); } - builder.finish() - } - - - #[inline] - pub fn origin(&self) -> Option<&'a GeometricPoint> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucUcs::VT_ORIGIN, None)} - } - #[inline] - pub fn angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucUcs::VT_ANGLE, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucUcs<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("origin", Self::VT_ORIGIN, false)? - .visit_field::("angle", Self::VT_ANGLE, false)? - .finish(); - Ok(()) - } -} -pub struct DucUcsArgs<'a> { - pub origin: Option<&'a GeometricPoint>, - pub angle: f64, -} -impl<'a> Default for DucUcsArgs<'a> { - #[inline] - fn default() -> Self { - DucUcsArgs { - origin: None, - angle: 0.0, - } - } -} - -pub struct DucUcsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucUcsBuilder<'a, 'b, A> { - #[inline] - pub fn add_origin(&mut self, origin: &GeometricPoint) { - self.fbb_.push_slot_always::<&GeometricPoint>(DucUcs::VT_ORIGIN, origin); - } - #[inline] - pub fn add_angle(&mut self, angle: f64) { - self.fbb_.push_slot::(DucUcs::VT_ANGLE, angle, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucUcsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucUcsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucUcs<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucUcs"); - ds.field("origin", &self.origin()); - ds.field("angle", &self.angle()); - ds.finish() - } -} -pub enum DucViewOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucView<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucView<'a> { - type Inner = DucView<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucView<'a> { - pub const VT_SCROLL_X: flatbuffers::VOffsetT = 4; - pub const VT_SCROLL_Y: flatbuffers::VOffsetT = 6; - pub const VT_ZOOM: flatbuffers::VOffsetT = 8; - pub const VT_TWIST_ANGLE: flatbuffers::VOffsetT = 10; - pub const VT_CENTER_POINT: flatbuffers::VOffsetT = 12; - pub const VT_SCOPE: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucView { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucViewArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucViewBuilder::new(_fbb); - builder.add_twist_angle(args.twist_angle); - builder.add_zoom(args.zoom); - builder.add_scroll_y(args.scroll_y); - builder.add_scroll_x(args.scroll_x); - if let Some(x) = args.scope { builder.add_scope(x); } - if let Some(x) = args.center_point { builder.add_center_point(x); } - builder.finish() - } - - - #[inline] - pub fn scroll_x(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucView::VT_SCROLL_X, Some(0.0)).unwrap()} - } - #[inline] - pub fn scroll_y(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucView::VT_SCROLL_Y, Some(0.0)).unwrap()} - } - #[inline] - pub fn zoom(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucView::VT_ZOOM, Some(0.0)).unwrap()} - } - #[inline] - pub fn twist_angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucView::VT_TWIST_ANGLE, Some(0.0)).unwrap()} - } - #[inline] - pub fn center_point(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucView::VT_CENTER_POINT, None)} - } - #[inline] - pub fn scope(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucView::VT_SCOPE, None)} - } -} - -impl flatbuffers::Verifiable for DucView<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("scroll_x", Self::VT_SCROLL_X, false)? - .visit_field::("scroll_y", Self::VT_SCROLL_Y, false)? - .visit_field::("zoom", Self::VT_ZOOM, false)? - .visit_field::("twist_angle", Self::VT_TWIST_ANGLE, false)? - .visit_field::>("center_point", Self::VT_CENTER_POINT, false)? - .visit_field::>("scope", Self::VT_SCOPE, false)? - .finish(); - Ok(()) - } -} -pub struct DucViewArgs<'a> { - pub scroll_x: f64, - pub scroll_y: f64, - pub zoom: f64, - pub twist_angle: f64, - pub center_point: Option>>, - pub scope: Option>, -} -impl<'a> Default for DucViewArgs<'a> { - #[inline] - fn default() -> Self { - DucViewArgs { - scroll_x: 0.0, - scroll_y: 0.0, - zoom: 0.0, - twist_angle: 0.0, - center_point: None, - scope: None, - } - } -} - -pub struct DucViewBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucViewBuilder<'a, 'b, A> { - #[inline] - pub fn add_scroll_x(&mut self, scroll_x: f64) { - self.fbb_.push_slot::(DucView::VT_SCROLL_X, scroll_x, 0.0); - } - #[inline] - pub fn add_scroll_y(&mut self, scroll_y: f64) { - self.fbb_.push_slot::(DucView::VT_SCROLL_Y, scroll_y, 0.0); - } - #[inline] - pub fn add_zoom(&mut self, zoom: f64) { - self.fbb_.push_slot::(DucView::VT_ZOOM, zoom, 0.0); - } - #[inline] - pub fn add_twist_angle(&mut self, twist_angle: f64) { - self.fbb_.push_slot::(DucView::VT_TWIST_ANGLE, twist_angle, 0.0); - } - #[inline] - pub fn add_center_point(&mut self, center_point: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucView::VT_CENTER_POINT, center_point); - } - #[inline] - pub fn add_scope(&mut self, scope: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucView::VT_SCOPE, scope); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucViewBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucViewBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucView<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucView"); - ds.field("scroll_x", &self.scroll_x()); - ds.field("scroll_y", &self.scroll_y()); - ds.field("zoom", &self.zoom()); - ds.field("twist_angle", &self.twist_angle()); - ds.field("center_point", &self.center_point()); - ds.field("scope", &self.scope()); - ds.finish() - } -} -pub enum MarginsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct Margins<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for Margins<'a> { - type Inner = Margins<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> Margins<'a> { - pub const VT_TOP: flatbuffers::VOffsetT = 4; - pub const VT_RIGHT: flatbuffers::VOffsetT = 6; - pub const VT_BOTTOM: flatbuffers::VOffsetT = 8; - pub const VT_LEFT: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - Margins { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args MarginsArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = MarginsBuilder::new(_fbb); - builder.add_left(args.left); - builder.add_bottom(args.bottom); - builder.add_right(args.right); - builder.add_top(args.top); - builder.finish() - } - - - #[inline] - pub fn top(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(Margins::VT_TOP, Some(0.0)).unwrap()} - } - #[inline] - pub fn right(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(Margins::VT_RIGHT, Some(0.0)).unwrap()} - } - #[inline] - pub fn bottom(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(Margins::VT_BOTTOM, Some(0.0)).unwrap()} - } - #[inline] - pub fn left(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(Margins::VT_LEFT, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for Margins<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("top", Self::VT_TOP, false)? - .visit_field::("right", Self::VT_RIGHT, false)? - .visit_field::("bottom", Self::VT_BOTTOM, false)? - .visit_field::("left", Self::VT_LEFT, false)? - .finish(); - Ok(()) - } -} -pub struct MarginsArgs { - pub top: f64, - pub right: f64, - pub bottom: f64, - pub left: f64, -} -impl<'a> Default for MarginsArgs { - #[inline] - fn default() -> Self { - MarginsArgs { - top: 0.0, - right: 0.0, - bottom: 0.0, - left: 0.0, - } - } -} - -pub struct MarginsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> MarginsBuilder<'a, 'b, A> { - #[inline] - pub fn add_top(&mut self, top: f64) { - self.fbb_.push_slot::(Margins::VT_TOP, top, 0.0); - } - #[inline] - pub fn add_right(&mut self, right: f64) { - self.fbb_.push_slot::(Margins::VT_RIGHT, right, 0.0); - } - #[inline] - pub fn add_bottom(&mut self, bottom: f64) { - self.fbb_.push_slot::(Margins::VT_BOTTOM, bottom, 0.0); - } - #[inline] - pub fn add_left(&mut self, left: f64) { - self.fbb_.push_slot::(Margins::VT_LEFT, left, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> MarginsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - MarginsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for Margins<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("Margins"); - ds.field("top", &self.top()); - ds.field("right", &self.right()); - ds.field("bottom", &self.bottom()); - ds.field("left", &self.left()); - ds.finish() - } -} -pub enum TilingPropertiesOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct TilingProperties<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for TilingProperties<'a> { - type Inner = TilingProperties<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> TilingProperties<'a> { - pub const VT_SIZE_IN_PERCENT: flatbuffers::VOffsetT = 4; - pub const VT_ANGLE: flatbuffers::VOffsetT = 6; - pub const VT_SPACING: flatbuffers::VOffsetT = 8; - pub const VT_OFFSET_X: flatbuffers::VOffsetT = 10; - pub const VT_OFFSET_Y: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - TilingProperties { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args TilingPropertiesArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = TilingPropertiesBuilder::new(_fbb); - if let Some(x) = args.offset_y { builder.add_offset_y(x); } - if let Some(x) = args.offset_x { builder.add_offset_x(x); } - if let Some(x) = args.spacing { builder.add_spacing(x); } - builder.add_angle(args.angle); - builder.add_size_in_percent(args.size_in_percent); - builder.finish() - } - - - #[inline] - pub fn size_in_percent(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(TilingProperties::VT_SIZE_IN_PERCENT, Some(0.0)).unwrap()} - } - #[inline] - pub fn angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(TilingProperties::VT_ANGLE, Some(0.0)).unwrap()} - } - #[inline] - pub fn spacing(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(TilingProperties::VT_SPACING, None)} - } - #[inline] - pub fn offset_x(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(TilingProperties::VT_OFFSET_X, None)} - } - #[inline] - pub fn offset_y(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(TilingProperties::VT_OFFSET_Y, None)} - } -} - -impl flatbuffers::Verifiable for TilingProperties<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("size_in_percent", Self::VT_SIZE_IN_PERCENT, false)? - .visit_field::("angle", Self::VT_ANGLE, false)? - .visit_field::("spacing", Self::VT_SPACING, false)? - .visit_field::("offset_x", Self::VT_OFFSET_X, false)? - .visit_field::("offset_y", Self::VT_OFFSET_Y, false)? - .finish(); - Ok(()) - } -} -pub struct TilingPropertiesArgs { - pub size_in_percent: f32, - pub angle: f64, - pub spacing: Option, - pub offset_x: Option, - pub offset_y: Option, -} -impl<'a> Default for TilingPropertiesArgs { - #[inline] - fn default() -> Self { - TilingPropertiesArgs { - size_in_percent: 0.0, - angle: 0.0, - spacing: None, - offset_x: None, - offset_y: None, - } - } -} - -pub struct TilingPropertiesBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TilingPropertiesBuilder<'a, 'b, A> { - #[inline] - pub fn add_size_in_percent(&mut self, size_in_percent: f32) { - self.fbb_.push_slot::(TilingProperties::VT_SIZE_IN_PERCENT, size_in_percent, 0.0); - } - #[inline] - pub fn add_angle(&mut self, angle: f64) { - self.fbb_.push_slot::(TilingProperties::VT_ANGLE, angle, 0.0); - } - #[inline] - pub fn add_spacing(&mut self, spacing: f64) { - self.fbb_.push_slot_always::(TilingProperties::VT_SPACING, spacing); - } - #[inline] - pub fn add_offset_x(&mut self, offset_x: f64) { - self.fbb_.push_slot_always::(TilingProperties::VT_OFFSET_X, offset_x); - } - #[inline] - pub fn add_offset_y(&mut self, offset_y: f64) { - self.fbb_.push_slot_always::(TilingProperties::VT_OFFSET_Y, offset_y); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TilingPropertiesBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - TilingPropertiesBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for TilingProperties<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("TilingProperties"); - ds.field("size_in_percent", &self.size_in_percent()); - ds.field("angle", &self.angle()); - ds.field("spacing", &self.spacing()); - ds.field("offset_x", &self.offset_x()); - ds.field("offset_y", &self.offset_y()); - ds.finish() - } -} -pub enum HatchPatternLineOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct HatchPatternLine<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for HatchPatternLine<'a> { - type Inner = HatchPatternLine<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> HatchPatternLine<'a> { - pub const VT_ANGLE: flatbuffers::VOffsetT = 4; - pub const VT_ORIGIN: flatbuffers::VOffsetT = 6; - pub const VT_OFFSET: flatbuffers::VOffsetT = 8; - pub const VT_DASH_PATTERN: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - HatchPatternLine { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args HatchPatternLineArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = HatchPatternLineBuilder::new(_fbb); - builder.add_angle(args.angle); - if let Some(x) = args.dash_pattern { builder.add_dash_pattern(x); } - if let Some(x) = args.offset { builder.add_offset(x); } - if let Some(x) = args.origin { builder.add_origin(x); } - builder.finish() - } - - - #[inline] - pub fn angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(HatchPatternLine::VT_ANGLE, Some(0.0)).unwrap()} - } - #[inline] - pub fn origin(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(HatchPatternLine::VT_ORIGIN, None)} - } - #[inline] - pub fn offset(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(HatchPatternLine::VT_OFFSET, None)} - } - #[inline] - pub fn dash_pattern(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(HatchPatternLine::VT_DASH_PATTERN, None)} - } -} - -impl flatbuffers::Verifiable for HatchPatternLine<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("angle", Self::VT_ANGLE, false)? - .visit_field::>("origin", Self::VT_ORIGIN, false)? - .visit_field::>>("offset", Self::VT_OFFSET, false)? - .visit_field::>>("dash_pattern", Self::VT_DASH_PATTERN, false)? - .finish(); - Ok(()) - } -} -pub struct HatchPatternLineArgs<'a> { - pub angle: f64, - pub origin: Option>>, - pub offset: Option>>, - pub dash_pattern: Option>>, -} -impl<'a> Default for HatchPatternLineArgs<'a> { - #[inline] - fn default() -> Self { - HatchPatternLineArgs { - angle: 0.0, - origin: None, - offset: None, - dash_pattern: None, - } - } -} - -pub struct HatchPatternLineBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> HatchPatternLineBuilder<'a, 'b, A> { - #[inline] - pub fn add_angle(&mut self, angle: f64) { - self.fbb_.push_slot::(HatchPatternLine::VT_ANGLE, angle, 0.0); - } - #[inline] - pub fn add_origin(&mut self, origin: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(HatchPatternLine::VT_ORIGIN, origin); - } - #[inline] - pub fn add_offset(&mut self, offset: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(HatchPatternLine::VT_OFFSET, offset); - } - #[inline] - pub fn add_dash_pattern(&mut self, dash_pattern: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(HatchPatternLine::VT_DASH_PATTERN, dash_pattern); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> HatchPatternLineBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - HatchPatternLineBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for HatchPatternLine<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("HatchPatternLine"); - ds.field("angle", &self.angle()); - ds.field("origin", &self.origin()); - ds.field("offset", &self.offset()); - ds.field("dash_pattern", &self.dash_pattern()); - ds.finish() - } -} -pub enum CustomHatchPatternOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct CustomHatchPattern<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for CustomHatchPattern<'a> { - type Inner = CustomHatchPattern<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> CustomHatchPattern<'a> { - pub const VT_NAME: flatbuffers::VOffsetT = 4; - pub const VT_DESCRIPTION: flatbuffers::VOffsetT = 6; - pub const VT_LINES: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - CustomHatchPattern { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args CustomHatchPatternArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = CustomHatchPatternBuilder::new(_fbb); - if let Some(x) = args.lines { builder.add_lines(x); } - if let Some(x) = args.description { builder.add_description(x); } - if let Some(x) = args.name { builder.add_name(x); } - builder.finish() - } - - - #[inline] - pub fn name(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(CustomHatchPattern::VT_NAME, None)} - } - #[inline] - pub fn description(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(CustomHatchPattern::VT_DESCRIPTION, None)} - } - #[inline] - pub fn lines(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(CustomHatchPattern::VT_LINES, None)} - } -} - -impl flatbuffers::Verifiable for CustomHatchPattern<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("name", Self::VT_NAME, false)? - .visit_field::>("description", Self::VT_DESCRIPTION, false)? - .visit_field::>>>("lines", Self::VT_LINES, false)? - .finish(); - Ok(()) - } -} -pub struct CustomHatchPatternArgs<'a> { - pub name: Option>, - pub description: Option>, - pub lines: Option>>>>, -} -impl<'a> Default for CustomHatchPatternArgs<'a> { - #[inline] - fn default() -> Self { - CustomHatchPatternArgs { - name: None, - description: None, - lines: None, - } - } -} - -pub struct CustomHatchPatternBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> CustomHatchPatternBuilder<'a, 'b, A> { - #[inline] - pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(CustomHatchPattern::VT_NAME, name); - } - #[inline] - pub fn add_description(&mut self, description: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(CustomHatchPattern::VT_DESCRIPTION, description); - } - #[inline] - pub fn add_lines(&mut self, lines: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(CustomHatchPattern::VT_LINES, lines); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> CustomHatchPatternBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - CustomHatchPatternBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for CustomHatchPattern<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("CustomHatchPattern"); - ds.field("name", &self.name()); - ds.field("description", &self.description()); - ds.field("lines", &self.lines()); - ds.finish() - } -} -pub enum DucHatchStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucHatchStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucHatchStyle<'a> { - type Inner = DucHatchStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucHatchStyle<'a> { - pub const VT_HATCH_STYLE: flatbuffers::VOffsetT = 4; - pub const VT_PATTERN_NAME: flatbuffers::VOffsetT = 6; - pub const VT_PATTERN_SCALE: flatbuffers::VOffsetT = 8; - pub const VT_PATTERN_ANGLE: flatbuffers::VOffsetT = 10; - pub const VT_PATTERN_ORIGIN: flatbuffers::VOffsetT = 12; - pub const VT_PATTERN_DOUBLE: flatbuffers::VOffsetT = 14; - pub const VT_CUSTOM_PATTERN: flatbuffers::VOffsetT = 16; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucHatchStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucHatchStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucHatchStyleBuilder::new(_fbb); - builder.add_pattern_angle(args.pattern_angle); - if let Some(x) = args.custom_pattern { builder.add_custom_pattern(x); } - if let Some(x) = args.pattern_origin { builder.add_pattern_origin(x); } - builder.add_pattern_scale(args.pattern_scale); - if let Some(x) = args.pattern_name { builder.add_pattern_name(x); } - builder.add_pattern_double(args.pattern_double); - if let Some(x) = args.hatch_style { builder.add_hatch_style(x); } - builder.finish() - } - - - #[inline] - pub fn hatch_style(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucHatchStyle::VT_HATCH_STYLE, None)} - } - #[inline] - pub fn pattern_name(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucHatchStyle::VT_PATTERN_NAME, None)} - } - #[inline] - pub fn pattern_scale(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucHatchStyle::VT_PATTERN_SCALE, Some(0.0)).unwrap()} - } - #[inline] - pub fn pattern_angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucHatchStyle::VT_PATTERN_ANGLE, Some(0.0)).unwrap()} - } - #[inline] - pub fn pattern_origin(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucHatchStyle::VT_PATTERN_ORIGIN, None)} - } - #[inline] - pub fn pattern_double(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucHatchStyle::VT_PATTERN_DOUBLE, Some(false)).unwrap()} - } - #[inline] - pub fn custom_pattern(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucHatchStyle::VT_CUSTOM_PATTERN, None)} - } -} - -impl flatbuffers::Verifiable for DucHatchStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("hatch_style", Self::VT_HATCH_STYLE, false)? - .visit_field::>("pattern_name", Self::VT_PATTERN_NAME, false)? - .visit_field::("pattern_scale", Self::VT_PATTERN_SCALE, false)? - .visit_field::("pattern_angle", Self::VT_PATTERN_ANGLE, false)? - .visit_field::>("pattern_origin", Self::VT_PATTERN_ORIGIN, false)? - .visit_field::("pattern_double", Self::VT_PATTERN_DOUBLE, false)? - .visit_field::>("custom_pattern", Self::VT_CUSTOM_PATTERN, false)? - .finish(); - Ok(()) - } -} -pub struct DucHatchStyleArgs<'a> { - pub hatch_style: Option, - pub pattern_name: Option>, - pub pattern_scale: f32, - pub pattern_angle: f64, - pub pattern_origin: Option>>, - pub pattern_double: bool, - pub custom_pattern: Option>>, -} -impl<'a> Default for DucHatchStyleArgs<'a> { - #[inline] - fn default() -> Self { - DucHatchStyleArgs { - hatch_style: None, - pattern_name: None, - pattern_scale: 0.0, - pattern_angle: 0.0, - pattern_origin: None, - pattern_double: false, - custom_pattern: None, - } - } -} - -pub struct DucHatchStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucHatchStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_hatch_style(&mut self, hatch_style: HATCH_STYLE) { - self.fbb_.push_slot_always::(DucHatchStyle::VT_HATCH_STYLE, hatch_style); - } - #[inline] - pub fn add_pattern_name(&mut self, pattern_name: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucHatchStyle::VT_PATTERN_NAME, pattern_name); - } - #[inline] - pub fn add_pattern_scale(&mut self, pattern_scale: f32) { - self.fbb_.push_slot::(DucHatchStyle::VT_PATTERN_SCALE, pattern_scale, 0.0); - } - #[inline] - pub fn add_pattern_angle(&mut self, pattern_angle: f64) { - self.fbb_.push_slot::(DucHatchStyle::VT_PATTERN_ANGLE, pattern_angle, 0.0); - } - #[inline] - pub fn add_pattern_origin(&mut self, pattern_origin: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucHatchStyle::VT_PATTERN_ORIGIN, pattern_origin); - } - #[inline] - pub fn add_pattern_double(&mut self, pattern_double: bool) { - self.fbb_.push_slot::(DucHatchStyle::VT_PATTERN_DOUBLE, pattern_double, false); - } - #[inline] - pub fn add_custom_pattern(&mut self, custom_pattern: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucHatchStyle::VT_CUSTOM_PATTERN, custom_pattern); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucHatchStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucHatchStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucHatchStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucHatchStyle"); - ds.field("hatch_style", &self.hatch_style()); - ds.field("pattern_name", &self.pattern_name()); - ds.field("pattern_scale", &self.pattern_scale()); - ds.field("pattern_angle", &self.pattern_angle()); - ds.field("pattern_origin", &self.pattern_origin()); - ds.field("pattern_double", &self.pattern_double()); - ds.field("custom_pattern", &self.custom_pattern()); - ds.finish() - } -} -pub enum DucImageFilterOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucImageFilter<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucImageFilter<'a> { - type Inner = DucImageFilter<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucImageFilter<'a> { - pub const VT_BRIGHTNESS: flatbuffers::VOffsetT = 4; - pub const VT_CONTRAST: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucImageFilter { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucImageFilterArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DucImageFilterBuilder::new(_fbb); - builder.add_contrast(args.contrast); - builder.add_brightness(args.brightness); - builder.finish() - } - - - #[inline] - pub fn brightness(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucImageFilter::VT_BRIGHTNESS, Some(0.0)).unwrap()} - } - #[inline] - pub fn contrast(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucImageFilter::VT_CONTRAST, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucImageFilter<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("brightness", Self::VT_BRIGHTNESS, false)? - .visit_field::("contrast", Self::VT_CONTRAST, false)? - .finish(); - Ok(()) - } -} -pub struct DucImageFilterArgs { - pub brightness: f32, - pub contrast: f32, -} -impl<'a> Default for DucImageFilterArgs { - #[inline] - fn default() -> Self { - DucImageFilterArgs { - brightness: 0.0, - contrast: 0.0, - } - } -} - -pub struct DucImageFilterBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucImageFilterBuilder<'a, 'b, A> { - #[inline] - pub fn add_brightness(&mut self, brightness: f32) { - self.fbb_.push_slot::(DucImageFilter::VT_BRIGHTNESS, brightness, 0.0); - } - #[inline] - pub fn add_contrast(&mut self, contrast: f32) { - self.fbb_.push_slot::(DucImageFilter::VT_CONTRAST, contrast, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucImageFilterBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucImageFilterBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucImageFilter<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucImageFilter"); - ds.field("brightness", &self.brightness()); - ds.field("contrast", &self.contrast()); - ds.finish() - } -} -pub enum ElementContentBaseOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ElementContentBase<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ElementContentBase<'a> { - type Inner = ElementContentBase<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ElementContentBase<'a> { - pub const VT_PREFERENCE: flatbuffers::VOffsetT = 4; - pub const VT_SRC: flatbuffers::VOffsetT = 6; - pub const VT_VISIBLE: flatbuffers::VOffsetT = 8; - pub const VT_OPACITY: flatbuffers::VOffsetT = 10; - pub const VT_TILING: flatbuffers::VOffsetT = 12; - pub const VT_HATCH: flatbuffers::VOffsetT = 14; - pub const VT_IMAGE_FILTER: flatbuffers::VOffsetT = 16; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ElementContentBase { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args ElementContentBaseArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ElementContentBaseBuilder::new(_fbb); - builder.add_opacity(args.opacity); - if let Some(x) = args.image_filter { builder.add_image_filter(x); } - if let Some(x) = args.hatch { builder.add_hatch(x); } - if let Some(x) = args.tiling { builder.add_tiling(x); } - if let Some(x) = args.src { builder.add_src(x); } - builder.add_visible(args.visible); - if let Some(x) = args.preference { builder.add_preference(x); } - builder.finish() - } - - - #[inline] - pub fn preference(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ElementContentBase::VT_PREFERENCE, None)} - } - #[inline] - pub fn src(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ElementContentBase::VT_SRC, None)} - } - #[inline] - pub fn visible(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ElementContentBase::VT_VISIBLE, Some(false)).unwrap()} - } - #[inline] - pub fn opacity(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ElementContentBase::VT_OPACITY, Some(0.0)).unwrap()} - } - #[inline] - pub fn tiling(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ElementContentBase::VT_TILING, None)} - } - #[inline] - pub fn hatch(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ElementContentBase::VT_HATCH, None)} - } - #[inline] - pub fn image_filter(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ElementContentBase::VT_IMAGE_FILTER, None)} - } -} - -impl flatbuffers::Verifiable for ElementContentBase<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("preference", Self::VT_PREFERENCE, false)? - .visit_field::>("src", Self::VT_SRC, false)? - .visit_field::("visible", Self::VT_VISIBLE, false)? - .visit_field::("opacity", Self::VT_OPACITY, false)? - .visit_field::>("tiling", Self::VT_TILING, false)? - .visit_field::>("hatch", Self::VT_HATCH, false)? - .visit_field::>("image_filter", Self::VT_IMAGE_FILTER, false)? - .finish(); - Ok(()) - } -} -pub struct ElementContentBaseArgs<'a> { - pub preference: Option, - pub src: Option>, - pub visible: bool, - pub opacity: f64, - pub tiling: Option>>, - pub hatch: Option>>, - pub image_filter: Option>>, -} -impl<'a> Default for ElementContentBaseArgs<'a> { - #[inline] - fn default() -> Self { - ElementContentBaseArgs { - preference: None, - src: None, - visible: false, - opacity: 0.0, - tiling: None, - hatch: None, - image_filter: None, - } - } -} - -pub struct ElementContentBaseBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ElementContentBaseBuilder<'a, 'b, A> { - #[inline] - pub fn add_preference(&mut self, preference: ELEMENT_CONTENT_PREFERENCE) { - self.fbb_.push_slot_always::(ElementContentBase::VT_PREFERENCE, preference); - } - #[inline] - pub fn add_src(&mut self, src: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(ElementContentBase::VT_SRC, src); - } - #[inline] - pub fn add_visible(&mut self, visible: bool) { - self.fbb_.push_slot::(ElementContentBase::VT_VISIBLE, visible, false); - } - #[inline] - pub fn add_opacity(&mut self, opacity: f64) { - self.fbb_.push_slot::(ElementContentBase::VT_OPACITY, opacity, 0.0); - } - #[inline] - pub fn add_tiling(&mut self, tiling: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ElementContentBase::VT_TILING, tiling); - } - #[inline] - pub fn add_hatch(&mut self, hatch: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ElementContentBase::VT_HATCH, hatch); - } - #[inline] - pub fn add_image_filter(&mut self, image_filter: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ElementContentBase::VT_IMAGE_FILTER, image_filter); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ElementContentBaseBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - ElementContentBaseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ElementContentBase<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ElementContentBase"); - ds.field("preference", &self.preference()); - ds.field("src", &self.src()); - ds.field("visible", &self.visible()); - ds.field("opacity", &self.opacity()); - ds.field("tiling", &self.tiling()); - ds.field("hatch", &self.hatch()); - ds.field("image_filter", &self.image_filter()); - ds.finish() - } -} -pub enum StrokeStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct StrokeStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for StrokeStyle<'a> { - type Inner = StrokeStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> StrokeStyle<'a> { - pub const VT_PREFERENCE: flatbuffers::VOffsetT = 4; - pub const VT_CAP: flatbuffers::VOffsetT = 6; - pub const VT_JOIN: flatbuffers::VOffsetT = 8; - pub const VT_DASH: flatbuffers::VOffsetT = 10; - pub const VT_DASH_LINE_OVERRIDE: flatbuffers::VOffsetT = 12; - pub const VT_DASH_CAP: flatbuffers::VOffsetT = 14; - pub const VT_MITER_LIMIT: flatbuffers::VOffsetT = 16; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - StrokeStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args StrokeStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = StrokeStyleBuilder::new(_fbb); - if let Some(x) = args.miter_limit { builder.add_miter_limit(x); } - if let Some(x) = args.dash_line_override { builder.add_dash_line_override(x); } - if let Some(x) = args.dash { builder.add_dash(x); } - if let Some(x) = args.dash_cap { builder.add_dash_cap(x); } - if let Some(x) = args.join { builder.add_join(x); } - if let Some(x) = args.cap { builder.add_cap(x); } - if let Some(x) = args.preference { builder.add_preference(x); } - builder.finish() - } - - - #[inline] - pub fn preference(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(StrokeStyle::VT_PREFERENCE, None)} - } - #[inline] - pub fn cap(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(StrokeStyle::VT_CAP, None)} - } - #[inline] - pub fn join(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(StrokeStyle::VT_JOIN, None)} - } - #[inline] - pub fn dash(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(StrokeStyle::VT_DASH, None)} - } - #[inline] - pub fn dash_line_override(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StrokeStyle::VT_DASH_LINE_OVERRIDE, None)} - } - #[inline] - pub fn dash_cap(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(StrokeStyle::VT_DASH_CAP, None)} - } - #[inline] - pub fn miter_limit(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(StrokeStyle::VT_MITER_LIMIT, None)} - } -} - -impl flatbuffers::Verifiable for StrokeStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("preference", Self::VT_PREFERENCE, false)? - .visit_field::("cap", Self::VT_CAP, false)? - .visit_field::("join", Self::VT_JOIN, false)? - .visit_field::>>("dash", Self::VT_DASH, false)? - .visit_field::>("dash_line_override", Self::VT_DASH_LINE_OVERRIDE, false)? - .visit_field::("dash_cap", Self::VT_DASH_CAP, false)? - .visit_field::("miter_limit", Self::VT_MITER_LIMIT, false)? - .finish(); - Ok(()) - } -} -pub struct StrokeStyleArgs<'a> { - pub preference: Option, - pub cap: Option, - pub join: Option, - pub dash: Option>>, - pub dash_line_override: Option>, - pub dash_cap: Option, - pub miter_limit: Option, -} -impl<'a> Default for StrokeStyleArgs<'a> { - #[inline] - fn default() -> Self { - StrokeStyleArgs { - preference: None, - cap: None, - join: None, - dash: None, - dash_line_override: None, - dash_cap: None, - miter_limit: None, - } - } -} - -pub struct StrokeStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StrokeStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_preference(&mut self, preference: STROKE_PREFERENCE) { - self.fbb_.push_slot_always::(StrokeStyle::VT_PREFERENCE, preference); - } - #[inline] - pub fn add_cap(&mut self, cap: STROKE_CAP) { - self.fbb_.push_slot_always::(StrokeStyle::VT_CAP, cap); - } - #[inline] - pub fn add_join(&mut self, join: STROKE_JOIN) { - self.fbb_.push_slot_always::(StrokeStyle::VT_JOIN, join); - } - #[inline] - pub fn add_dash(&mut self, dash: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(StrokeStyle::VT_DASH, dash); - } - #[inline] - pub fn add_dash_line_override(&mut self, dash_line_override: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StrokeStyle::VT_DASH_LINE_OVERRIDE, dash_line_override); - } - #[inline] - pub fn add_dash_cap(&mut self, dash_cap: STROKE_CAP) { - self.fbb_.push_slot_always::(StrokeStyle::VT_DASH_CAP, dash_cap); - } - #[inline] - pub fn add_miter_limit(&mut self, miter_limit: f64) { - self.fbb_.push_slot_always::(StrokeStyle::VT_MITER_LIMIT, miter_limit); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StrokeStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - StrokeStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for StrokeStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("StrokeStyle"); - ds.field("preference", &self.preference()); - ds.field("cap", &self.cap()); - ds.field("join", &self.join()); - ds.field("dash", &self.dash()); - ds.field("dash_line_override", &self.dash_line_override()); - ds.field("dash_cap", &self.dash_cap()); - ds.field("miter_limit", &self.miter_limit()); - ds.finish() - } -} -pub enum StrokeSidesOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct StrokeSides<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for StrokeSides<'a> { - type Inner = StrokeSides<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> StrokeSides<'a> { - pub const VT_PREFERENCE: flatbuffers::VOffsetT = 4; - pub const VT_VALUES: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - StrokeSides { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args StrokeSidesArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = StrokeSidesBuilder::new(_fbb); - if let Some(x) = args.values { builder.add_values(x); } - if let Some(x) = args.preference { builder.add_preference(x); } - builder.finish() - } - - - #[inline] - pub fn preference(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(StrokeSides::VT_PREFERENCE, None)} - } - #[inline] - pub fn values(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(StrokeSides::VT_VALUES, None)} - } -} - -impl flatbuffers::Verifiable for StrokeSides<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("preference", Self::VT_PREFERENCE, false)? - .visit_field::>>("values", Self::VT_VALUES, false)? - .finish(); - Ok(()) - } -} -pub struct StrokeSidesArgs<'a> { - pub preference: Option, - pub values: Option>>, -} -impl<'a> Default for StrokeSidesArgs<'a> { - #[inline] - fn default() -> Self { - StrokeSidesArgs { - preference: None, - values: None, - } - } -} - -pub struct StrokeSidesBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StrokeSidesBuilder<'a, 'b, A> { - #[inline] - pub fn add_preference(&mut self, preference: STROKE_SIDE_PREFERENCE) { - self.fbb_.push_slot_always::(StrokeSides::VT_PREFERENCE, preference); - } - #[inline] - pub fn add_values(&mut self, values: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(StrokeSides::VT_VALUES, values); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StrokeSidesBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - StrokeSidesBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for StrokeSides<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("StrokeSides"); - ds.field("preference", &self.preference()); - ds.field("values", &self.values()); - ds.finish() - } -} -pub enum ElementStrokeOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ElementStroke<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ElementStroke<'a> { - type Inner = ElementStroke<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ElementStroke<'a> { - pub const VT_CONTENT: flatbuffers::VOffsetT = 4; - pub const VT_WIDTH: flatbuffers::VOffsetT = 6; - pub const VT_STYLE: flatbuffers::VOffsetT = 8; - pub const VT_PLACEMENT: flatbuffers::VOffsetT = 10; - pub const VT_STROKE_SIDES: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ElementStroke { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args ElementStrokeArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ElementStrokeBuilder::new(_fbb); - builder.add_width(args.width); - if let Some(x) = args.stroke_sides { builder.add_stroke_sides(x); } - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.content { builder.add_content(x); } - if let Some(x) = args.placement { builder.add_placement(x); } - builder.finish() - } - - - #[inline] - pub fn content(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ElementStroke::VT_CONTENT, None)} - } - #[inline] - pub fn width(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ElementStroke::VT_WIDTH, Some(0.0)).unwrap()} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ElementStroke::VT_STYLE, None)} - } - #[inline] - pub fn placement(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ElementStroke::VT_PLACEMENT, None)} - } - #[inline] - pub fn stroke_sides(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ElementStroke::VT_STROKE_SIDES, None)} - } -} - -impl flatbuffers::Verifiable for ElementStroke<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("content", Self::VT_CONTENT, false)? - .visit_field::("width", Self::VT_WIDTH, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .visit_field::("placement", Self::VT_PLACEMENT, false)? - .visit_field::>("stroke_sides", Self::VT_STROKE_SIDES, false)? - .finish(); - Ok(()) - } -} -pub struct ElementStrokeArgs<'a> { - pub content: Option>>, - pub width: f64, - pub style: Option>>, - pub placement: Option, - pub stroke_sides: Option>>, -} -impl<'a> Default for ElementStrokeArgs<'a> { - #[inline] - fn default() -> Self { - ElementStrokeArgs { - content: None, - width: 0.0, - style: None, - placement: None, - stroke_sides: None, - } - } -} - -pub struct ElementStrokeBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ElementStrokeBuilder<'a, 'b, A> { - #[inline] - pub fn add_content(&mut self, content: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ElementStroke::VT_CONTENT, content); - } - #[inline] - pub fn add_width(&mut self, width: f64) { - self.fbb_.push_slot::(ElementStroke::VT_WIDTH, width, 0.0); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ElementStroke::VT_STYLE, style); - } - #[inline] - pub fn add_placement(&mut self, placement: STROKE_PLACEMENT) { - self.fbb_.push_slot_always::(ElementStroke::VT_PLACEMENT, placement); - } - #[inline] - pub fn add_stroke_sides(&mut self, stroke_sides: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ElementStroke::VT_STROKE_SIDES, stroke_sides); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ElementStrokeBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - ElementStrokeBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ElementStroke<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ElementStroke"); - ds.field("content", &self.content()); - ds.field("width", &self.width()); - ds.field("style", &self.style()); - ds.field("placement", &self.placement()); - ds.field("stroke_sides", &self.stroke_sides()); - ds.finish() - } -} -pub enum ElementBackgroundOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ElementBackground<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ElementBackground<'a> { - type Inner = ElementBackground<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ElementBackground<'a> { - pub const VT_CONTENT: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ElementBackground { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args ElementBackgroundArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ElementBackgroundBuilder::new(_fbb); - if let Some(x) = args.content { builder.add_content(x); } - builder.finish() - } - - - #[inline] - pub fn content(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ElementBackground::VT_CONTENT, None)} - } -} - -impl flatbuffers::Verifiable for ElementBackground<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("content", Self::VT_CONTENT, false)? - .finish(); - Ok(()) - } -} -pub struct ElementBackgroundArgs<'a> { - pub content: Option>>, -} -impl<'a> Default for ElementBackgroundArgs<'a> { - #[inline] - fn default() -> Self { - ElementBackgroundArgs { - content: None, - } - } -} - -pub struct ElementBackgroundBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ElementBackgroundBuilder<'a, 'b, A> { - #[inline] - pub fn add_content(&mut self, content: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ElementBackground::VT_CONTENT, content); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ElementBackgroundBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - ElementBackgroundBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ElementBackground<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ElementBackground"); - ds.field("content", &self.content()); - ds.finish() - } -} -pub enum _DucElementStylesBaseOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct _DucElementStylesBase<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for _DucElementStylesBase<'a> { - type Inner = _DucElementStylesBase<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> _DucElementStylesBase<'a> { - pub const VT_ROUNDNESS: flatbuffers::VOffsetT = 4; - pub const VT_BLENDING: flatbuffers::VOffsetT = 6; - pub const VT_BACKGROUND: flatbuffers::VOffsetT = 8; - pub const VT_STROKE: flatbuffers::VOffsetT = 10; - pub const VT_OPACITY: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - _DucElementStylesBase { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args _DucElementStylesBaseArgs<'args> - ) -> flatbuffers::WIPOffset<_DucElementStylesBase<'bldr>> { - let mut builder = _DucElementStylesBaseBuilder::new(_fbb); - builder.add_opacity(args.opacity); - builder.add_roundness(args.roundness); - if let Some(x) = args.stroke { builder.add_stroke(x); } - if let Some(x) = args.background { builder.add_background(x); } - if let Some(x) = args.blending { builder.add_blending(x); } - builder.finish() - } - - - #[inline] - pub fn roundness(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementStylesBase::VT_ROUNDNESS, Some(0.0)).unwrap()} - } - #[inline] - pub fn blending(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementStylesBase::VT_BLENDING, None)} - } - #[inline] - pub fn background(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(_DucElementStylesBase::VT_BACKGROUND, None)} - } - #[inline] - pub fn stroke(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(_DucElementStylesBase::VT_STROKE, None)} - } - #[inline] - pub fn opacity(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementStylesBase::VT_OPACITY, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for _DucElementStylesBase<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("roundness", Self::VT_ROUNDNESS, false)? - .visit_field::("blending", Self::VT_BLENDING, false)? - .visit_field::>>>("background", Self::VT_BACKGROUND, false)? - .visit_field::>>>("stroke", Self::VT_STROKE, false)? - .visit_field::("opacity", Self::VT_OPACITY, false)? - .finish(); - Ok(()) - } -} -pub struct _DucElementStylesBaseArgs<'a> { - pub roundness: f64, - pub blending: Option, - pub background: Option>>>>, - pub stroke: Option>>>>, - pub opacity: f64, -} -impl<'a> Default for _DucElementStylesBaseArgs<'a> { - #[inline] - fn default() -> Self { - _DucElementStylesBaseArgs { - roundness: 0.0, - blending: None, - background: None, - stroke: None, - opacity: 0.0, - } - } -} - -pub struct _DucElementStylesBaseBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> _DucElementStylesBaseBuilder<'a, 'b, A> { - #[inline] - pub fn add_roundness(&mut self, roundness: f64) { - self.fbb_.push_slot::(_DucElementStylesBase::VT_ROUNDNESS, roundness, 0.0); - } - #[inline] - pub fn add_blending(&mut self, blending: BLENDING) { - self.fbb_.push_slot_always::(_DucElementStylesBase::VT_BLENDING, blending); - } - #[inline] - pub fn add_background(&mut self, background: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(_DucElementStylesBase::VT_BACKGROUND, background); - } - #[inline] - pub fn add_stroke(&mut self, stroke: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(_DucElementStylesBase::VT_STROKE, stroke); - } - #[inline] - pub fn add_opacity(&mut self, opacity: f64) { - self.fbb_.push_slot::(_DucElementStylesBase::VT_OPACITY, opacity, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> _DucElementStylesBaseBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - _DucElementStylesBaseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset<_DucElementStylesBase<'a>> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for _DucElementStylesBase<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("_DucElementStylesBase"); - ds.field("roundness", &self.roundness()); - ds.field("blending", &self.blending()); - ds.field("background", &self.background()); - ds.field("stroke", &self.stroke()); - ds.field("opacity", &self.opacity()); - ds.finish() - } -} -pub enum BoundElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct BoundElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for BoundElement<'a> { - type Inner = BoundElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> BoundElement<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_TYPE_: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - BoundElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args BoundElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = BoundElementBuilder::new(_fbb); - if let Some(x) = args.type_ { builder.add_type_(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(BoundElement::VT_ID, None)} - } - #[inline] - pub fn type_(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(BoundElement::VT_TYPE_, None)} - } -} - -impl flatbuffers::Verifiable for BoundElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("type_", Self::VT_TYPE_, false)? - .finish(); - Ok(()) - } -} -pub struct BoundElementArgs<'a> { - pub id: Option>, - pub type_: Option>, -} -impl<'a> Default for BoundElementArgs<'a> { - #[inline] - fn default() -> Self { - BoundElementArgs { - id: None, - type_: None, - } - } -} - -pub struct BoundElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> BoundElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(BoundElement::VT_ID, id); - } - #[inline] - pub fn add_type_(&mut self, type_: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(BoundElement::VT_TYPE_, type_); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> BoundElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - BoundElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for BoundElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("BoundElement"); - ds.field("id", &self.id()); - ds.field("type_", &self.type_()); - ds.finish() - } -} -pub enum _DucElementBaseOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct _DucElementBase<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for _DucElementBase<'a> { - type Inner = _DucElementBase<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> _DucElementBase<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STYLES: flatbuffers::VOffsetT = 6; - pub const VT_X: flatbuffers::VOffsetT = 8; - pub const VT_Y: flatbuffers::VOffsetT = 10; - pub const VT_WIDTH: flatbuffers::VOffsetT = 12; - pub const VT_HEIGHT: flatbuffers::VOffsetT = 14; - pub const VT_ANGLE: flatbuffers::VOffsetT = 16; - pub const VT_SCOPE: flatbuffers::VOffsetT = 18; - pub const VT_LABEL: flatbuffers::VOffsetT = 20; - pub const VT_DESCRIPTION: flatbuffers::VOffsetT = 22; - pub const VT_IS_VISIBLE: flatbuffers::VOffsetT = 24; - pub const VT_SEED: flatbuffers::VOffsetT = 26; - pub const VT_VERSION: flatbuffers::VOffsetT = 28; - pub const VT_VERSION_NONCE: flatbuffers::VOffsetT = 30; - pub const VT_UPDATED: flatbuffers::VOffsetT = 32; - pub const VT_INDEX: flatbuffers::VOffsetT = 34; - pub const VT_IS_PLOT: flatbuffers::VOffsetT = 36; - pub const VT_IS_ANNOTATIVE: flatbuffers::VOffsetT = 38; - pub const VT_IS_DELETED: flatbuffers::VOffsetT = 40; - pub const VT_GROUP_IDS: flatbuffers::VOffsetT = 42; - pub const VT_REGION_IDS: flatbuffers::VOffsetT = 44; - pub const VT_LAYER_ID: flatbuffers::VOffsetT = 46; - pub const VT_FRAME_ID: flatbuffers::VOffsetT = 48; - pub const VT_BOUND_ELEMENTS: flatbuffers::VOffsetT = 50; - pub const VT_Z_INDEX: flatbuffers::VOffsetT = 52; - pub const VT_LINK: flatbuffers::VOffsetT = 54; - pub const VT_LOCKED: flatbuffers::VOffsetT = 56; - pub const VT_BLOCK_IDS: flatbuffers::VOffsetT = 60; - pub const VT_INSTANCE_ID: flatbuffers::VOffsetT = 62; - pub const VT_CUSTOM_DATA: flatbuffers::VOffsetT = 64; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - _DucElementBase { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args _DucElementBaseArgs<'args> - ) -> flatbuffers::WIPOffset<_DucElementBase<'bldr>> { - let mut builder = _DucElementBaseBuilder::new(_fbb); - builder.add_updated(args.updated); - builder.add_angle(args.angle); - builder.add_height(args.height); - builder.add_width(args.width); - builder.add_y(args.y); - builder.add_x(args.x); - if let Some(x) = args.custom_data { builder.add_custom_data(x); } - if let Some(x) = args.instance_id { builder.add_instance_id(x); } - if let Some(x) = args.block_ids { builder.add_block_ids(x); } - if let Some(x) = args.link { builder.add_link(x); } - builder.add_z_index(args.z_index); - if let Some(x) = args.bound_elements { builder.add_bound_elements(x); } - if let Some(x) = args.frame_id { builder.add_frame_id(x); } - if let Some(x) = args.layer_id { builder.add_layer_id(x); } - if let Some(x) = args.region_ids { builder.add_region_ids(x); } - if let Some(x) = args.group_ids { builder.add_group_ids(x); } - if let Some(x) = args.index { builder.add_index(x); } - builder.add_version_nonce(args.version_nonce); - builder.add_version(args.version); - builder.add_seed(args.seed); - if let Some(x) = args.description { builder.add_description(x); } - if let Some(x) = args.label { builder.add_label(x); } - if let Some(x) = args.scope { builder.add_scope(x); } - if let Some(x) = args.styles { builder.add_styles(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.add_locked(args.locked); - builder.add_is_deleted(args.is_deleted); - builder.add_is_annotative(args.is_annotative); - builder.add_is_plot(args.is_plot); - builder.add_is_visible(args.is_visible); - builder.finish() - } - - - #[inline] - pub fn id(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucElementBase::VT_ID, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &_DucElementBase) -> bool { - self.id() < o.id() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.id(); - key.cmp(val) - } - #[inline] - pub fn styles(&self) -> Option<_DucElementStylesBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucElementBase::VT_STYLES, None)} - } - #[inline] - pub fn x(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_X, Some(0.0)).unwrap()} - } - #[inline] - pub fn y(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_Y, Some(0.0)).unwrap()} - } - #[inline] - pub fn width(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_WIDTH, Some(0.0)).unwrap()} - } - #[inline] - pub fn height(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_HEIGHT, Some(0.0)).unwrap()} - } - #[inline] - pub fn angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_ANGLE, Some(0.0)).unwrap()} - } - #[inline] - pub fn scope(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucElementBase::VT_SCOPE, None)} - } - #[inline] - pub fn label(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucElementBase::VT_LABEL, None)} - } - #[inline] - pub fn description(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucElementBase::VT_DESCRIPTION, None)} - } - #[inline] - pub fn is_visible(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_IS_VISIBLE, Some(false)).unwrap()} - } - #[inline] - pub fn seed(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_SEED, Some(0)).unwrap()} - } - #[inline] - pub fn version(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_VERSION, Some(0)).unwrap()} - } - #[inline] - pub fn version_nonce(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_VERSION_NONCE, Some(0)).unwrap()} - } - #[inline] - pub fn updated(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_UPDATED, Some(0)).unwrap()} - } - #[inline] - pub fn index(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucElementBase::VT_INDEX, None)} - } - #[inline] - pub fn is_plot(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_IS_PLOT, Some(false)).unwrap()} - } - #[inline] - pub fn is_annotative(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_IS_ANNOTATIVE, Some(false)).unwrap()} - } - #[inline] - pub fn is_deleted(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_IS_DELETED, Some(false)).unwrap()} - } - #[inline] - pub fn group_ids(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(_DucElementBase::VT_GROUP_IDS, None)} - } - #[inline] - pub fn region_ids(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(_DucElementBase::VT_REGION_IDS, None)} - } - #[inline] - pub fn layer_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucElementBase::VT_LAYER_ID, None)} - } - #[inline] - pub fn frame_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucElementBase::VT_FRAME_ID, None)} - } - #[inline] - pub fn bound_elements(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(_DucElementBase::VT_BOUND_ELEMENTS, None)} - } - #[inline] - pub fn z_index(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_Z_INDEX, Some(0.0)).unwrap()} - } - #[inline] - pub fn link(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucElementBase::VT_LINK, None)} - } - #[inline] - pub fn locked(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucElementBase::VT_LOCKED, Some(false)).unwrap()} - } - #[inline] - pub fn block_ids(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(_DucElementBase::VT_BLOCK_IDS, None)} - } - #[inline] - pub fn instance_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucElementBase::VT_INSTANCE_ID, None)} - } - #[inline] - pub fn custom_data(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(_DucElementBase::VT_CUSTOM_DATA, None)} - } -} - -impl flatbuffers::Verifiable for _DucElementBase<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, true)? - .visit_field::>("styles", Self::VT_STYLES, false)? - .visit_field::("x", Self::VT_X, false)? - .visit_field::("y", Self::VT_Y, false)? - .visit_field::("width", Self::VT_WIDTH, false)? - .visit_field::("height", Self::VT_HEIGHT, false)? - .visit_field::("angle", Self::VT_ANGLE, false)? - .visit_field::>("scope", Self::VT_SCOPE, false)? - .visit_field::>("label", Self::VT_LABEL, false)? - .visit_field::>("description", Self::VT_DESCRIPTION, false)? - .visit_field::("is_visible", Self::VT_IS_VISIBLE, false)? - .visit_field::("seed", Self::VT_SEED, false)? - .visit_field::("version", Self::VT_VERSION, false)? - .visit_field::("version_nonce", Self::VT_VERSION_NONCE, false)? - .visit_field::("updated", Self::VT_UPDATED, false)? - .visit_field::>("index", Self::VT_INDEX, false)? - .visit_field::("is_plot", Self::VT_IS_PLOT, false)? - .visit_field::("is_annotative", Self::VT_IS_ANNOTATIVE, false)? - .visit_field::("is_deleted", Self::VT_IS_DELETED, false)? - .visit_field::>>>("group_ids", Self::VT_GROUP_IDS, false)? - .visit_field::>>>("region_ids", Self::VT_REGION_IDS, false)? - .visit_field::>("layer_id", Self::VT_LAYER_ID, false)? - .visit_field::>("frame_id", Self::VT_FRAME_ID, false)? - .visit_field::>>>("bound_elements", Self::VT_BOUND_ELEMENTS, false)? - .visit_field::("z_index", Self::VT_Z_INDEX, false)? - .visit_field::>("link", Self::VT_LINK, false)? - .visit_field::("locked", Self::VT_LOCKED, false)? - .visit_field::>>>("block_ids", Self::VT_BLOCK_IDS, false)? - .visit_field::>("instance_id", Self::VT_INSTANCE_ID, false)? - .visit_field::>>("custom_data", Self::VT_CUSTOM_DATA, false)? - .finish(); - Ok(()) - } -} -pub struct _DucElementBaseArgs<'a> { - pub id: Option>, - pub styles: Option>>, - pub x: f64, - pub y: f64, - pub width: f64, - pub height: f64, - pub angle: f64, - pub scope: Option>, - pub label: Option>, - pub description: Option>, - pub is_visible: bool, - pub seed: i32, - pub version: i32, - pub version_nonce: i32, - pub updated: i64, - pub index: Option>, - pub is_plot: bool, - pub is_annotative: bool, - pub is_deleted: bool, - pub group_ids: Option>>>, - pub region_ids: Option>>>, - pub layer_id: Option>, - pub frame_id: Option>, - pub bound_elements: Option>>>>, - pub z_index: f32, - pub link: Option>, - pub locked: bool, - pub block_ids: Option>>>, - pub instance_id: Option>, - pub custom_data: Option>>, -} -impl<'a> Default for _DucElementBaseArgs<'a> { - #[inline] - fn default() -> Self { - _DucElementBaseArgs { - id: None, // required field - styles: None, - x: 0.0, - y: 0.0, - width: 0.0, - height: 0.0, - angle: 0.0, - scope: None, - label: None, - description: None, - is_visible: false, - seed: 0, - version: 0, - version_nonce: 0, - updated: 0, - index: None, - is_plot: false, - is_annotative: false, - is_deleted: false, - group_ids: None, - region_ids: None, - layer_id: None, - frame_id: None, - bound_elements: None, - z_index: 0.0, - link: None, - locked: false, - block_ids: None, - instance_id: None, - custom_data: None, - } - } -} - -pub struct _DucElementBaseBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> _DucElementBaseBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_ID, id); - } - #[inline] - pub fn add_styles(&mut self, styles: flatbuffers::WIPOffset<_DucElementStylesBase<'b >>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_STYLES, styles); - } - #[inline] - pub fn add_x(&mut self, x: f64) { - self.fbb_.push_slot::(_DucElementBase::VT_X, x, 0.0); - } - #[inline] - pub fn add_y(&mut self, y: f64) { - self.fbb_.push_slot::(_DucElementBase::VT_Y, y, 0.0); - } - #[inline] - pub fn add_width(&mut self, width: f64) { - self.fbb_.push_slot::(_DucElementBase::VT_WIDTH, width, 0.0); - } - #[inline] - pub fn add_height(&mut self, height: f64) { - self.fbb_.push_slot::(_DucElementBase::VT_HEIGHT, height, 0.0); - } - #[inline] - pub fn add_angle(&mut self, angle: f64) { - self.fbb_.push_slot::(_DucElementBase::VT_ANGLE, angle, 0.0); - } - #[inline] - pub fn add_scope(&mut self, scope: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_SCOPE, scope); - } - #[inline] - pub fn add_label(&mut self, label: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_LABEL, label); - } - #[inline] - pub fn add_description(&mut self, description: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_DESCRIPTION, description); - } - #[inline] - pub fn add_is_visible(&mut self, is_visible: bool) { - self.fbb_.push_slot::(_DucElementBase::VT_IS_VISIBLE, is_visible, false); - } - #[inline] - pub fn add_seed(&mut self, seed: i32) { - self.fbb_.push_slot::(_DucElementBase::VT_SEED, seed, 0); - } - #[inline] - pub fn add_version(&mut self, version: i32) { - self.fbb_.push_slot::(_DucElementBase::VT_VERSION, version, 0); - } - #[inline] - pub fn add_version_nonce(&mut self, version_nonce: i32) { - self.fbb_.push_slot::(_DucElementBase::VT_VERSION_NONCE, version_nonce, 0); - } - #[inline] - pub fn add_updated(&mut self, updated: i64) { - self.fbb_.push_slot::(_DucElementBase::VT_UPDATED, updated, 0); - } - #[inline] - pub fn add_index(&mut self, index: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_INDEX, index); - } - #[inline] - pub fn add_is_plot(&mut self, is_plot: bool) { - self.fbb_.push_slot::(_DucElementBase::VT_IS_PLOT, is_plot, false); - } - #[inline] - pub fn add_is_annotative(&mut self, is_annotative: bool) { - self.fbb_.push_slot::(_DucElementBase::VT_IS_ANNOTATIVE, is_annotative, false); - } - #[inline] - pub fn add_is_deleted(&mut self, is_deleted: bool) { - self.fbb_.push_slot::(_DucElementBase::VT_IS_DELETED, is_deleted, false); - } - #[inline] - pub fn add_group_ids(&mut self, group_ids: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_GROUP_IDS, group_ids); - } - #[inline] - pub fn add_region_ids(&mut self, region_ids: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_REGION_IDS, region_ids); - } - #[inline] - pub fn add_layer_id(&mut self, layer_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_LAYER_ID, layer_id); - } - #[inline] - pub fn add_frame_id(&mut self, frame_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_FRAME_ID, frame_id); - } - #[inline] - pub fn add_bound_elements(&mut self, bound_elements: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_BOUND_ELEMENTS, bound_elements); - } - #[inline] - pub fn add_z_index(&mut self, z_index: f32) { - self.fbb_.push_slot::(_DucElementBase::VT_Z_INDEX, z_index, 0.0); - } - #[inline] - pub fn add_link(&mut self, link: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_LINK, link); - } - #[inline] - pub fn add_locked(&mut self, locked: bool) { - self.fbb_.push_slot::(_DucElementBase::VT_LOCKED, locked, false); - } - #[inline] - pub fn add_block_ids(&mut self, block_ids: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_BLOCK_IDS, block_ids); - } - #[inline] - pub fn add_instance_id(&mut self, instance_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_INSTANCE_ID, instance_id); - } - #[inline] - pub fn add_custom_data(&mut self, custom_data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(_DucElementBase::VT_CUSTOM_DATA, custom_data); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> _DucElementBaseBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - _DucElementBaseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset<_DucElementBase<'a>> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, _DucElementBase::VT_ID,"id"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for _DucElementBase<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("_DucElementBase"); - ds.field("id", &self.id()); - ds.field("styles", &self.styles()); - ds.field("x", &self.x()); - ds.field("y", &self.y()); - ds.field("width", &self.width()); - ds.field("height", &self.height()); - ds.field("angle", &self.angle()); - ds.field("scope", &self.scope()); - ds.field("label", &self.label()); - ds.field("description", &self.description()); - ds.field("is_visible", &self.is_visible()); - ds.field("seed", &self.seed()); - ds.field("version", &self.version()); - ds.field("version_nonce", &self.version_nonce()); - ds.field("updated", &self.updated()); - ds.field("index", &self.index()); - ds.field("is_plot", &self.is_plot()); - ds.field("is_annotative", &self.is_annotative()); - ds.field("is_deleted", &self.is_deleted()); - ds.field("group_ids", &self.group_ids()); - ds.field("region_ids", &self.region_ids()); - ds.field("layer_id", &self.layer_id()); - ds.field("frame_id", &self.frame_id()); - ds.field("bound_elements", &self.bound_elements()); - ds.field("z_index", &self.z_index()); - ds.field("link", &self.link()); - ds.field("locked", &self.locked()); - ds.field("block_ids", &self.block_ids()); - ds.field("instance_id", &self.instance_id()); - ds.field("custom_data", &self.custom_data()); - ds.finish() - } -} -pub enum DucPointOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucPoint<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucPoint<'a> { - type Inner = DucPoint<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucPoint<'a> { - pub const VT_X: flatbuffers::VOffsetT = 4; - pub const VT_Y: flatbuffers::VOffsetT = 6; - pub const VT_MIRRORING: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucPoint { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucPointArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DucPointBuilder::new(_fbb); - builder.add_y(args.y); - builder.add_x(args.x); - if let Some(x) = args.mirroring { builder.add_mirroring(x); } - builder.finish() - } - - - #[inline] - pub fn x(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucPoint::VT_X, Some(0.0)).unwrap()} - } - #[inline] - pub fn y(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucPoint::VT_Y, Some(0.0)).unwrap()} - } - #[inline] - pub fn mirroring(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucPoint::VT_MIRRORING, None)} - } -} - -impl flatbuffers::Verifiable for DucPoint<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("x", Self::VT_X, false)? - .visit_field::("y", Self::VT_Y, false)? - .visit_field::("mirroring", Self::VT_MIRRORING, false)? - .finish(); - Ok(()) - } -} -pub struct DucPointArgs { - pub x: f64, - pub y: f64, - pub mirroring: Option, -} -impl<'a> Default for DucPointArgs { - #[inline] - fn default() -> Self { - DucPointArgs { - x: 0.0, - y: 0.0, - mirroring: None, - } - } -} - -pub struct DucPointBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucPointBuilder<'a, 'b, A> { - #[inline] - pub fn add_x(&mut self, x: f64) { - self.fbb_.push_slot::(DucPoint::VT_X, x, 0.0); - } - #[inline] - pub fn add_y(&mut self, y: f64) { - self.fbb_.push_slot::(DucPoint::VT_Y, y, 0.0); - } - #[inline] - pub fn add_mirroring(&mut self, mirroring: BEZIER_MIRRORING) { - self.fbb_.push_slot_always::(DucPoint::VT_MIRRORING, mirroring); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucPointBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucPointBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucPoint<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucPoint"); - ds.field("x", &self.x()); - ds.field("y", &self.y()); - ds.field("mirroring", &self.mirroring()); - ds.finish() - } -} -pub enum DucHeadOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucHead<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucHead<'a> { - type Inner = DucHead<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucHead<'a> { - pub const VT_TYPE_: flatbuffers::VOffsetT = 4; - pub const VT_BLOCK_ID: flatbuffers::VOffsetT = 6; - pub const VT_SIZE: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucHead { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucHeadArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucHeadBuilder::new(_fbb); - builder.add_size(args.size); - if let Some(x) = args.block_id { builder.add_block_id(x); } - if let Some(x) = args.type_ { builder.add_type_(x); } - builder.finish() - } - - - #[inline] - pub fn type_(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucHead::VT_TYPE_, None)} - } - #[inline] - pub fn block_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucHead::VT_BLOCK_ID, None)} - } - #[inline] - pub fn size(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucHead::VT_SIZE, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucHead<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("type_", Self::VT_TYPE_, false)? - .visit_field::>("block_id", Self::VT_BLOCK_ID, false)? - .visit_field::("size", Self::VT_SIZE, false)? - .finish(); - Ok(()) - } -} -pub struct DucHeadArgs<'a> { - pub type_: Option, - pub block_id: Option>, - pub size: f64, -} -impl<'a> Default for DucHeadArgs<'a> { - #[inline] - fn default() -> Self { - DucHeadArgs { - type_: None, - block_id: None, - size: 0.0, - } - } -} - -pub struct DucHeadBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucHeadBuilder<'a, 'b, A> { - #[inline] - pub fn add_type_(&mut self, type_: LINE_HEAD) { - self.fbb_.push_slot_always::(DucHead::VT_TYPE_, type_); - } - #[inline] - pub fn add_block_id(&mut self, block_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucHead::VT_BLOCK_ID, block_id); - } - #[inline] - pub fn add_size(&mut self, size: f64) { - self.fbb_.push_slot::(DucHead::VT_SIZE, size, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucHeadBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucHeadBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucHead<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucHead"); - ds.field("type_", &self.type_()); - ds.field("block_id", &self.block_id()); - ds.field("size", &self.size()); - ds.finish() - } -} -pub enum PointBindingPointOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct PointBindingPoint<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for PointBindingPoint<'a> { - type Inner = PointBindingPoint<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> PointBindingPoint<'a> { - pub const VT_INDEX: flatbuffers::VOffsetT = 4; - pub const VT_OFFSET: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - PointBindingPoint { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args PointBindingPointArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = PointBindingPointBuilder::new(_fbb); - builder.add_offset(args.offset); - builder.add_index(args.index); - builder.finish() - } - - - #[inline] - pub fn index(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(PointBindingPoint::VT_INDEX, Some(0)).unwrap()} - } - #[inline] - pub fn offset(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(PointBindingPoint::VT_OFFSET, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for PointBindingPoint<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("index", Self::VT_INDEX, false)? - .visit_field::("offset", Self::VT_OFFSET, false)? - .finish(); - Ok(()) - } -} -pub struct PointBindingPointArgs { - pub index: i32, - pub offset: f64, -} -impl<'a> Default for PointBindingPointArgs { - #[inline] - fn default() -> Self { - PointBindingPointArgs { - index: 0, - offset: 0.0, - } - } -} - -pub struct PointBindingPointBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PointBindingPointBuilder<'a, 'b, A> { - #[inline] - pub fn add_index(&mut self, index: i32) { - self.fbb_.push_slot::(PointBindingPoint::VT_INDEX, index, 0); - } - #[inline] - pub fn add_offset(&mut self, offset: f64) { - self.fbb_.push_slot::(PointBindingPoint::VT_OFFSET, offset, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PointBindingPointBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - PointBindingPointBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for PointBindingPoint<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("PointBindingPoint"); - ds.field("index", &self.index()); - ds.field("offset", &self.offset()); - ds.finish() - } -} -pub enum DucPointBindingOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucPointBinding<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucPointBinding<'a> { - type Inner = DucPointBinding<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucPointBinding<'a> { - pub const VT_ELEMENT_ID: flatbuffers::VOffsetT = 4; - pub const VT_FOCUS: flatbuffers::VOffsetT = 6; - pub const VT_GAP: flatbuffers::VOffsetT = 8; - pub const VT_FIXED_POINT: flatbuffers::VOffsetT = 10; - pub const VT_POINT: flatbuffers::VOffsetT = 12; - pub const VT_HEAD: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucPointBinding { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucPointBindingArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucPointBindingBuilder::new(_fbb); - builder.add_gap(args.gap); - if let Some(x) = args.head { builder.add_head(x); } - if let Some(x) = args.point { builder.add_point(x); } - if let Some(x) = args.fixed_point { builder.add_fixed_point(x); } - builder.add_focus(args.focus); - if let Some(x) = args.element_id { builder.add_element_id(x); } - builder.finish() - } - - - #[inline] - pub fn element_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucPointBinding::VT_ELEMENT_ID, None)} - } - #[inline] - pub fn focus(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucPointBinding::VT_FOCUS, Some(0.0)).unwrap()} - } - #[inline] - pub fn gap(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucPointBinding::VT_GAP, Some(0.0)).unwrap()} - } - #[inline] - pub fn fixed_point(&self) -> Option<&'a GeometricPoint> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucPointBinding::VT_FIXED_POINT, None)} - } - #[inline] - pub fn point(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucPointBinding::VT_POINT, None)} - } - #[inline] - pub fn head(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucPointBinding::VT_HEAD, None)} - } -} - -impl flatbuffers::Verifiable for DucPointBinding<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("element_id", Self::VT_ELEMENT_ID, false)? - .visit_field::("focus", Self::VT_FOCUS, false)? - .visit_field::("gap", Self::VT_GAP, false)? - .visit_field::("fixed_point", Self::VT_FIXED_POINT, false)? - .visit_field::>("point", Self::VT_POINT, false)? - .visit_field::>("head", Self::VT_HEAD, false)? - .finish(); - Ok(()) - } -} -pub struct DucPointBindingArgs<'a> { - pub element_id: Option>, - pub focus: f32, - pub gap: f64, - pub fixed_point: Option<&'a GeometricPoint>, - pub point: Option>>, - pub head: Option>>, -} -impl<'a> Default for DucPointBindingArgs<'a> { - #[inline] - fn default() -> Self { - DucPointBindingArgs { - element_id: None, - focus: 0.0, - gap: 0.0, - fixed_point: None, - point: None, - head: None, - } - } -} - -pub struct DucPointBindingBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucPointBindingBuilder<'a, 'b, A> { - #[inline] - pub fn add_element_id(&mut self, element_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucPointBinding::VT_ELEMENT_ID, element_id); - } - #[inline] - pub fn add_focus(&mut self, focus: f32) { - self.fbb_.push_slot::(DucPointBinding::VT_FOCUS, focus, 0.0); - } - #[inline] - pub fn add_gap(&mut self, gap: f64) { - self.fbb_.push_slot::(DucPointBinding::VT_GAP, gap, 0.0); - } - #[inline] - pub fn add_fixed_point(&mut self, fixed_point: &GeometricPoint) { - self.fbb_.push_slot_always::<&GeometricPoint>(DucPointBinding::VT_FIXED_POINT, fixed_point); - } - #[inline] - pub fn add_point(&mut self, point: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucPointBinding::VT_POINT, point); - } - #[inline] - pub fn add_head(&mut self, head: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucPointBinding::VT_HEAD, head); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucPointBindingBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucPointBindingBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucPointBinding<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucPointBinding"); - ds.field("element_id", &self.element_id()); - ds.field("focus", &self.focus()); - ds.field("gap", &self.gap()); - ds.field("fixed_point", &self.fixed_point()); - ds.field("point", &self.point()); - ds.field("head", &self.head()); - ds.finish() - } -} -pub enum DucLineReferenceOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucLineReference<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucLineReference<'a> { - type Inner = DucLineReference<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucLineReference<'a> { - pub const VT_INDEX: flatbuffers::VOffsetT = 4; - pub const VT_HANDLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucLineReference { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucLineReferenceArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucLineReferenceBuilder::new(_fbb); - if let Some(x) = args.handle { builder.add_handle(x); } - builder.add_index(args.index); - builder.finish() - } - - - #[inline] - pub fn index(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLineReference::VT_INDEX, Some(0)).unwrap()} - } - #[inline] - pub fn handle(&self) -> Option<&'a GeometricPoint> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLineReference::VT_HANDLE, None)} - } -} - -impl flatbuffers::Verifiable for DucLineReference<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("index", Self::VT_INDEX, false)? - .visit_field::("handle", Self::VT_HANDLE, false)? - .finish(); - Ok(()) - } -} -pub struct DucLineReferenceArgs<'a> { - pub index: i32, - pub handle: Option<&'a GeometricPoint>, -} -impl<'a> Default for DucLineReferenceArgs<'a> { - #[inline] - fn default() -> Self { - DucLineReferenceArgs { - index: 0, - handle: None, - } - } -} - -pub struct DucLineReferenceBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucLineReferenceBuilder<'a, 'b, A> { - #[inline] - pub fn add_index(&mut self, index: i32) { - self.fbb_.push_slot::(DucLineReference::VT_INDEX, index, 0); - } - #[inline] - pub fn add_handle(&mut self, handle: &GeometricPoint) { - self.fbb_.push_slot_always::<&GeometricPoint>(DucLineReference::VT_HANDLE, handle); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucLineReferenceBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucLineReferenceBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucLineReference<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucLineReference"); - ds.field("index", &self.index()); - ds.field("handle", &self.handle()); - ds.finish() - } -} -pub enum DucLineOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucLine<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucLine<'a> { - type Inner = DucLine<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucLine<'a> { - pub const VT_START: flatbuffers::VOffsetT = 4; - pub const VT_END: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucLine { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucLineArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucLineBuilder::new(_fbb); - if let Some(x) = args.end { builder.add_end(x); } - if let Some(x) = args.start { builder.add_start(x); } - builder.finish() - } - - - #[inline] - pub fn start(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLine::VT_START, None)} - } - #[inline] - pub fn end(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLine::VT_END, None)} - } -} - -impl flatbuffers::Verifiable for DucLine<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("start", Self::VT_START, false)? - .visit_field::>("end", Self::VT_END, false)? - .finish(); - Ok(()) - } -} -pub struct DucLineArgs<'a> { - pub start: Option>>, - pub end: Option>>, -} -impl<'a> Default for DucLineArgs<'a> { - #[inline] - fn default() -> Self { - DucLineArgs { - start: None, - end: None, - } - } -} - -pub struct DucLineBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucLineBuilder<'a, 'b, A> { - #[inline] - pub fn add_start(&mut self, start: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucLine::VT_START, start); - } - #[inline] - pub fn add_end(&mut self, end: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucLine::VT_END, end); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucLineBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucLineBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucLine<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucLine"); - ds.field("start", &self.start()); - ds.field("end", &self.end()); - ds.finish() - } -} -pub enum DucPathOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucPath<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucPath<'a> { - type Inner = DucPath<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucPath<'a> { - pub const VT_LINE_INDICES: flatbuffers::VOffsetT = 4; - pub const VT_BACKGROUND: flatbuffers::VOffsetT = 6; - pub const VT_STROKE: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucPath { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucPathArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucPathBuilder::new(_fbb); - if let Some(x) = args.stroke { builder.add_stroke(x); } - if let Some(x) = args.background { builder.add_background(x); } - if let Some(x) = args.line_indices { builder.add_line_indices(x); } - builder.finish() - } - - - #[inline] - pub fn line_indices(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DucPath::VT_LINE_INDICES, None)} - } - #[inline] - pub fn background(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucPath::VT_BACKGROUND, None)} - } - #[inline] - pub fn stroke(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucPath::VT_STROKE, None)} - } -} - -impl flatbuffers::Verifiable for DucPath<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>("line_indices", Self::VT_LINE_INDICES, false)? - .visit_field::>("background", Self::VT_BACKGROUND, false)? - .visit_field::>("stroke", Self::VT_STROKE, false)? - .finish(); - Ok(()) - } -} -pub struct DucPathArgs<'a> { - pub line_indices: Option>>, - pub background: Option>>, - pub stroke: Option>>, -} -impl<'a> Default for DucPathArgs<'a> { - #[inline] - fn default() -> Self { - DucPathArgs { - line_indices: None, - background: None, - stroke: None, - } - } -} - -pub struct DucPathBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucPathBuilder<'a, 'b, A> { - #[inline] - pub fn add_line_indices(&mut self, line_indices: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucPath::VT_LINE_INDICES, line_indices); - } - #[inline] - pub fn add_background(&mut self, background: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucPath::VT_BACKGROUND, background); - } - #[inline] - pub fn add_stroke(&mut self, stroke: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucPath::VT_STROKE, stroke); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucPathBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucPathBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucPath<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucPath"); - ds.field("line_indices", &self.line_indices()); - ds.field("background", &self.background()); - ds.field("stroke", &self.stroke()); - ds.finish() - } -} -pub enum _DucLinearElementBaseOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct _DucLinearElementBase<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for _DucLinearElementBase<'a> { - type Inner = _DucLinearElementBase<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> _DucLinearElementBase<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_POINTS: flatbuffers::VOffsetT = 6; - pub const VT_LINES: flatbuffers::VOffsetT = 8; - pub const VT_PATH_OVERRIDES: flatbuffers::VOffsetT = 10; - pub const VT_LAST_COMMITTED_POINT: flatbuffers::VOffsetT = 12; - pub const VT_START_BINDING: flatbuffers::VOffsetT = 14; - pub const VT_END_BINDING: flatbuffers::VOffsetT = 16; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - _DucLinearElementBase { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args _DucLinearElementBaseArgs<'args> - ) -> flatbuffers::WIPOffset<_DucLinearElementBase<'bldr>> { - let mut builder = _DucLinearElementBaseBuilder::new(_fbb); - if let Some(x) = args.end_binding { builder.add_end_binding(x); } - if let Some(x) = args.start_binding { builder.add_start_binding(x); } - if let Some(x) = args.last_committed_point { builder.add_last_committed_point(x); } - if let Some(x) = args.path_overrides { builder.add_path_overrides(x); } - if let Some(x) = args.lines { builder.add_lines(x); } - if let Some(x) = args.points { builder.add_points(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucLinearElementBase::VT_BASE, None)} - } - #[inline] - pub fn points(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(_DucLinearElementBase::VT_POINTS, None)} - } - #[inline] - pub fn lines(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(_DucLinearElementBase::VT_LINES, None)} - } - #[inline] - pub fn path_overrides(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(_DucLinearElementBase::VT_PATH_OVERRIDES, None)} - } - #[inline] - pub fn last_committed_point(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucLinearElementBase::VT_LAST_COMMITTED_POINT, None)} - } - #[inline] - pub fn start_binding(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucLinearElementBase::VT_START_BINDING, None)} - } - #[inline] - pub fn end_binding(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucLinearElementBase::VT_END_BINDING, None)} - } -} - -impl flatbuffers::Verifiable for _DucLinearElementBase<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>>>("points", Self::VT_POINTS, false)? - .visit_field::>>>("lines", Self::VT_LINES, false)? - .visit_field::>>>("path_overrides", Self::VT_PATH_OVERRIDES, false)? - .visit_field::>("last_committed_point", Self::VT_LAST_COMMITTED_POINT, false)? - .visit_field::>("start_binding", Self::VT_START_BINDING, false)? - .visit_field::>("end_binding", Self::VT_END_BINDING, false)? - .finish(); - Ok(()) - } -} -pub struct _DucLinearElementBaseArgs<'a> { - pub base: Option>>, - pub points: Option>>>>, - pub lines: Option>>>>, - pub path_overrides: Option>>>>, - pub last_committed_point: Option>>, - pub start_binding: Option>>, - pub end_binding: Option>>, -} -impl<'a> Default for _DucLinearElementBaseArgs<'a> { - #[inline] - fn default() -> Self { - _DucLinearElementBaseArgs { - base: None, - points: None, - lines: None, - path_overrides: None, - last_committed_point: None, - start_binding: None, - end_binding: None, - } - } -} - -pub struct _DucLinearElementBaseBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> _DucLinearElementBaseBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(_DucLinearElementBase::VT_BASE, base); - } - #[inline] - pub fn add_points(&mut self, points: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(_DucLinearElementBase::VT_POINTS, points); - } - #[inline] - pub fn add_lines(&mut self, lines: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(_DucLinearElementBase::VT_LINES, lines); - } - #[inline] - pub fn add_path_overrides(&mut self, path_overrides: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(_DucLinearElementBase::VT_PATH_OVERRIDES, path_overrides); - } - #[inline] - pub fn add_last_committed_point(&mut self, last_committed_point: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(_DucLinearElementBase::VT_LAST_COMMITTED_POINT, last_committed_point); - } - #[inline] - pub fn add_start_binding(&mut self, start_binding: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(_DucLinearElementBase::VT_START_BINDING, start_binding); - } - #[inline] - pub fn add_end_binding(&mut self, end_binding: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(_DucLinearElementBase::VT_END_BINDING, end_binding); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> _DucLinearElementBaseBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - _DucLinearElementBaseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset<_DucLinearElementBase<'a>> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for _DucLinearElementBase<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("_DucLinearElementBase"); - ds.field("base", &self.base()); - ds.field("points", &self.points()); - ds.field("lines", &self.lines()); - ds.field("path_overrides", &self.path_overrides()); - ds.field("last_committed_point", &self.last_committed_point()); - ds.field("start_binding", &self.start_binding()); - ds.field("end_binding", &self.end_binding()); - ds.finish() - } -} -pub enum DucStackLikeStylesOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucStackLikeStyles<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucStackLikeStyles<'a> { - type Inner = DucStackLikeStyles<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucStackLikeStyles<'a> { - pub const VT_OPACITY: flatbuffers::VOffsetT = 4; - pub const VT_LABELING_COLOR: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucStackLikeStyles { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucStackLikeStylesArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucStackLikeStylesBuilder::new(_fbb); - builder.add_opacity(args.opacity); - if let Some(x) = args.labeling_color { builder.add_labeling_color(x); } - builder.finish() - } - - - #[inline] - pub fn opacity(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucStackLikeStyles::VT_OPACITY, Some(0.0)).unwrap()} - } - #[inline] - pub fn labeling_color(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucStackLikeStyles::VT_LABELING_COLOR, None)} - } -} - -impl flatbuffers::Verifiable for DucStackLikeStyles<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("opacity", Self::VT_OPACITY, false)? - .visit_field::>("labeling_color", Self::VT_LABELING_COLOR, false)? - .finish(); - Ok(()) - } -} -pub struct DucStackLikeStylesArgs<'a> { - pub opacity: f64, - pub labeling_color: Option>, -} -impl<'a> Default for DucStackLikeStylesArgs<'a> { - #[inline] - fn default() -> Self { - DucStackLikeStylesArgs { - opacity: 0.0, - labeling_color: None, - } - } -} - -pub struct DucStackLikeStylesBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucStackLikeStylesBuilder<'a, 'b, A> { - #[inline] - pub fn add_opacity(&mut self, opacity: f64) { - self.fbb_.push_slot::(DucStackLikeStyles::VT_OPACITY, opacity, 0.0); - } - #[inline] - pub fn add_labeling_color(&mut self, labeling_color: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucStackLikeStyles::VT_LABELING_COLOR, labeling_color); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucStackLikeStylesBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucStackLikeStylesBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucStackLikeStyles<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucStackLikeStyles"); - ds.field("opacity", &self.opacity()); - ds.field("labeling_color", &self.labeling_color()); - ds.finish() - } -} -pub enum _DucStackBaseOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct _DucStackBase<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for _DucStackBase<'a> { - type Inner = _DucStackBase<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> _DucStackBase<'a> { - pub const VT_LABEL: flatbuffers::VOffsetT = 4; - pub const VT_DESCRIPTION: flatbuffers::VOffsetT = 6; - pub const VT_IS_COLLAPSED: flatbuffers::VOffsetT = 8; - pub const VT_IS_PLOT: flatbuffers::VOffsetT = 10; - pub const VT_IS_VISIBLE: flatbuffers::VOffsetT = 12; - pub const VT_LOCKED: flatbuffers::VOffsetT = 14; - pub const VT_STYLES: flatbuffers::VOffsetT = 16; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - _DucStackBase { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args _DucStackBaseArgs<'args> - ) -> flatbuffers::WIPOffset<_DucStackBase<'bldr>> { - let mut builder = _DucStackBaseBuilder::new(_fbb); - if let Some(x) = args.styles { builder.add_styles(x); } - if let Some(x) = args.description { builder.add_description(x); } - if let Some(x) = args.label { builder.add_label(x); } - builder.add_locked(args.locked); - builder.add_is_visible(args.is_visible); - builder.add_is_plot(args.is_plot); - builder.add_is_collapsed(args.is_collapsed); - builder.finish() - } - - - #[inline] - pub fn label(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucStackBase::VT_LABEL, None)} - } - #[inline] - pub fn description(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucStackBase::VT_DESCRIPTION, None)} - } - #[inline] - pub fn is_collapsed(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucStackBase::VT_IS_COLLAPSED, Some(false)).unwrap()} - } - #[inline] - pub fn is_plot(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucStackBase::VT_IS_PLOT, Some(false)).unwrap()} - } - #[inline] - pub fn is_visible(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucStackBase::VT_IS_VISIBLE, Some(false)).unwrap()} - } - #[inline] - pub fn locked(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucStackBase::VT_LOCKED, Some(false)).unwrap()} - } - #[inline] - pub fn styles(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucStackBase::VT_STYLES, None)} - } -} - -impl flatbuffers::Verifiable for _DucStackBase<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("label", Self::VT_LABEL, false)? - .visit_field::>("description", Self::VT_DESCRIPTION, false)? - .visit_field::("is_collapsed", Self::VT_IS_COLLAPSED, false)? - .visit_field::("is_plot", Self::VT_IS_PLOT, false)? - .visit_field::("is_visible", Self::VT_IS_VISIBLE, false)? - .visit_field::("locked", Self::VT_LOCKED, false)? - .visit_field::>("styles", Self::VT_STYLES, false)? - .finish(); - Ok(()) - } -} -pub struct _DucStackBaseArgs<'a> { - pub label: Option>, - pub description: Option>, - pub is_collapsed: bool, - pub is_plot: bool, - pub is_visible: bool, - pub locked: bool, - pub styles: Option>>, -} -impl<'a> Default for _DucStackBaseArgs<'a> { - #[inline] - fn default() -> Self { - _DucStackBaseArgs { - label: None, - description: None, - is_collapsed: false, - is_plot: false, - is_visible: false, - locked: false, - styles: None, - } - } -} - -pub struct _DucStackBaseBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> _DucStackBaseBuilder<'a, 'b, A> { - #[inline] - pub fn add_label(&mut self, label: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(_DucStackBase::VT_LABEL, label); - } - #[inline] - pub fn add_description(&mut self, description: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(_DucStackBase::VT_DESCRIPTION, description); - } - #[inline] - pub fn add_is_collapsed(&mut self, is_collapsed: bool) { - self.fbb_.push_slot::(_DucStackBase::VT_IS_COLLAPSED, is_collapsed, false); - } - #[inline] - pub fn add_is_plot(&mut self, is_plot: bool) { - self.fbb_.push_slot::(_DucStackBase::VT_IS_PLOT, is_plot, false); - } - #[inline] - pub fn add_is_visible(&mut self, is_visible: bool) { - self.fbb_.push_slot::(_DucStackBase::VT_IS_VISIBLE, is_visible, false); - } - #[inline] - pub fn add_locked(&mut self, locked: bool) { - self.fbb_.push_slot::(_DucStackBase::VT_LOCKED, locked, false); - } - #[inline] - pub fn add_styles(&mut self, styles: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(_DucStackBase::VT_STYLES, styles); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> _DucStackBaseBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - _DucStackBaseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset<_DucStackBase<'a>> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for _DucStackBase<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("_DucStackBase"); - ds.field("label", &self.label()); - ds.field("description", &self.description()); - ds.field("is_collapsed", &self.is_collapsed()); - ds.field("is_plot", &self.is_plot()); - ds.field("is_visible", &self.is_visible()); - ds.field("locked", &self.locked()); - ds.field("styles", &self.styles()); - ds.finish() - } -} -pub enum _DucStackElementBaseOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct _DucStackElementBase<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for _DucStackElementBase<'a> { - type Inner = _DucStackElementBase<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> _DucStackElementBase<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_STACK_BASE: flatbuffers::VOffsetT = 6; - pub const VT_CLIP: flatbuffers::VOffsetT = 8; - pub const VT_LABEL_VISIBLE: flatbuffers::VOffsetT = 10; - pub const VT_STANDARD_OVERRIDE: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - _DucStackElementBase { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args _DucStackElementBaseArgs<'args> - ) -> flatbuffers::WIPOffset<_DucStackElementBase<'bldr>> { - let mut builder = _DucStackElementBaseBuilder::new(_fbb); - if let Some(x) = args.standard_override { builder.add_standard_override(x); } - if let Some(x) = args.stack_base { builder.add_stack_base(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.add_label_visible(args.label_visible); - builder.add_clip(args.clip); - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucStackElementBase::VT_BASE, None)} - } - #[inline] - pub fn stack_base(&self) -> Option<_DucStackBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucStackElementBase::VT_STACK_BASE, None)} - } - #[inline] - pub fn clip(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucStackElementBase::VT_CLIP, Some(false)).unwrap()} - } - #[inline] - pub fn label_visible(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_DucStackElementBase::VT_LABEL_VISIBLE, Some(false)).unwrap()} - } - #[inline] - pub fn standard_override(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(_DucStackElementBase::VT_STANDARD_OVERRIDE, None)} - } -} - -impl flatbuffers::Verifiable for _DucStackElementBase<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>("stack_base", Self::VT_STACK_BASE, false)? - .visit_field::("clip", Self::VT_CLIP, false)? - .visit_field::("label_visible", Self::VT_LABEL_VISIBLE, false)? - .visit_field::>("standard_override", Self::VT_STANDARD_OVERRIDE, false)? - .finish(); - Ok(()) - } -} -pub struct _DucStackElementBaseArgs<'a> { - pub base: Option>>, - pub stack_base: Option>>, - pub clip: bool, - pub label_visible: bool, - pub standard_override: Option>, -} -impl<'a> Default for _DucStackElementBaseArgs<'a> { - #[inline] - fn default() -> Self { - _DucStackElementBaseArgs { - base: None, - stack_base: None, - clip: false, - label_visible: false, - standard_override: None, - } - } -} - -pub struct _DucStackElementBaseBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> _DucStackElementBaseBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(_DucStackElementBase::VT_BASE, base); - } - #[inline] - pub fn add_stack_base(&mut self, stack_base: flatbuffers::WIPOffset<_DucStackBase<'b >>) { - self.fbb_.push_slot_always::>(_DucStackElementBase::VT_STACK_BASE, stack_base); - } - #[inline] - pub fn add_clip(&mut self, clip: bool) { - self.fbb_.push_slot::(_DucStackElementBase::VT_CLIP, clip, false); - } - #[inline] - pub fn add_label_visible(&mut self, label_visible: bool) { - self.fbb_.push_slot::(_DucStackElementBase::VT_LABEL_VISIBLE, label_visible, false); - } - #[inline] - pub fn add_standard_override(&mut self, standard_override: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(_DucStackElementBase::VT_STANDARD_OVERRIDE, standard_override); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> _DucStackElementBaseBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - _DucStackElementBaseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset<_DucStackElementBase<'a>> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for _DucStackElementBase<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("_DucStackElementBase"); - ds.field("base", &self.base()); - ds.field("stack_base", &self.stack_base()); - ds.field("clip", &self.clip()); - ds.field("label_visible", &self.label_visible()); - ds.field("standard_override", &self.standard_override()); - ds.finish() - } -} -pub enum LineSpacingOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct LineSpacing<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for LineSpacing<'a> { - type Inner = LineSpacing<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> LineSpacing<'a> { - pub const VT_VALUE: flatbuffers::VOffsetT = 4; - pub const VT_TYPE_: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - LineSpacing { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args LineSpacingArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = LineSpacingBuilder::new(_fbb); - builder.add_value(args.value); - if let Some(x) = args.type_ { builder.add_type_(x); } - builder.finish() - } - - - #[inline] - pub fn value(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(LineSpacing::VT_VALUE, Some(0.0)).unwrap()} - } - #[inline] - pub fn type_(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(LineSpacing::VT_TYPE_, None)} - } -} - -impl flatbuffers::Verifiable for LineSpacing<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("value", Self::VT_VALUE, false)? - .visit_field::("type_", Self::VT_TYPE_, false)? - .finish(); - Ok(()) - } -} -pub struct LineSpacingArgs { - pub value: f64, - pub type_: Option, -} -impl<'a> Default for LineSpacingArgs { - #[inline] - fn default() -> Self { - LineSpacingArgs { - value: 0.0, - type_: None, - } - } -} - -pub struct LineSpacingBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> LineSpacingBuilder<'a, 'b, A> { - #[inline] - pub fn add_value(&mut self, value: f64) { - self.fbb_.push_slot::(LineSpacing::VT_VALUE, value, 0.0); - } - #[inline] - pub fn add_type_(&mut self, type_: LINE_SPACING_TYPE) { - self.fbb_.push_slot_always::(LineSpacing::VT_TYPE_, type_); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> LineSpacingBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - LineSpacingBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for LineSpacing<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("LineSpacing"); - ds.field("value", &self.value()); - ds.field("type_", &self.type_()); - ds.finish() - } -} -pub enum DucTextStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTextStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTextStyle<'a> { - type Inner = DucTextStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTextStyle<'a> { - pub const VT_IS_LTR: flatbuffers::VOffsetT = 6; - pub const VT_FONT_FAMILY: flatbuffers::VOffsetT = 8; - pub const VT_BIG_FONT_FAMILY: flatbuffers::VOffsetT = 10; - pub const VT_TEXT_ALIGN: flatbuffers::VOffsetT = 12; - pub const VT_VERTICAL_ALIGN: flatbuffers::VOffsetT = 14; - pub const VT_LINE_HEIGHT: flatbuffers::VOffsetT = 16; - pub const VT_LINE_SPACING: flatbuffers::VOffsetT = 18; - pub const VT_OBLIQUE_ANGLE: flatbuffers::VOffsetT = 20; - pub const VT_FONT_SIZE: flatbuffers::VOffsetT = 22; - pub const VT_PAPER_TEXT_HEIGHT: flatbuffers::VOffsetT = 24; - pub const VT_WIDTH_FACTOR: flatbuffers::VOffsetT = 26; - pub const VT_IS_UPSIDE_DOWN: flatbuffers::VOffsetT = 28; - pub const VT_IS_BACKWARDS: flatbuffers::VOffsetT = 30; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTextStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTextStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTextStyleBuilder::new(_fbb); - builder.add_paper_text_height(args.paper_text_height); - builder.add_font_size(args.font_size); - builder.add_oblique_angle(args.oblique_angle); - builder.add_width_factor(args.width_factor); - if let Some(x) = args.line_spacing { builder.add_line_spacing(x); } - builder.add_line_height(args.line_height); - if let Some(x) = args.big_font_family { builder.add_big_font_family(x); } - if let Some(x) = args.font_family { builder.add_font_family(x); } - builder.add_is_backwards(args.is_backwards); - builder.add_is_upside_down(args.is_upside_down); - if let Some(x) = args.vertical_align { builder.add_vertical_align(x); } - if let Some(x) = args.text_align { builder.add_text_align(x); } - builder.add_is_ltr(args.is_ltr); - builder.finish() - } - - - #[inline] - pub fn is_ltr(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextStyle::VT_IS_LTR, Some(false)).unwrap()} - } - #[inline] - pub fn font_family(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextStyle::VT_FONT_FAMILY, None)} - } - #[inline] - pub fn big_font_family(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextStyle::VT_BIG_FONT_FAMILY, None)} - } - #[inline] - pub fn text_align(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextStyle::VT_TEXT_ALIGN, None)} - } - #[inline] - pub fn vertical_align(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextStyle::VT_VERTICAL_ALIGN, None)} - } - #[inline] - pub fn line_height(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextStyle::VT_LINE_HEIGHT, Some(0.0)).unwrap()} - } - #[inline] - pub fn line_spacing(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextStyle::VT_LINE_SPACING, None)} - } - #[inline] - pub fn oblique_angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextStyle::VT_OBLIQUE_ANGLE, Some(0.0)).unwrap()} - } - #[inline] - pub fn font_size(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextStyle::VT_FONT_SIZE, Some(0.0)).unwrap()} - } - #[inline] - pub fn paper_text_height(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextStyle::VT_PAPER_TEXT_HEIGHT, Some(0.0)).unwrap()} - } - #[inline] - pub fn width_factor(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextStyle::VT_WIDTH_FACTOR, Some(0.0)).unwrap()} - } - #[inline] - pub fn is_upside_down(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextStyle::VT_IS_UPSIDE_DOWN, Some(false)).unwrap()} - } - #[inline] - pub fn is_backwards(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextStyle::VT_IS_BACKWARDS, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucTextStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("is_ltr", Self::VT_IS_LTR, false)? - .visit_field::>("font_family", Self::VT_FONT_FAMILY, false)? - .visit_field::>("big_font_family", Self::VT_BIG_FONT_FAMILY, false)? - .visit_field::("text_align", Self::VT_TEXT_ALIGN, false)? - .visit_field::("vertical_align", Self::VT_VERTICAL_ALIGN, false)? - .visit_field::("line_height", Self::VT_LINE_HEIGHT, false)? - .visit_field::>("line_spacing", Self::VT_LINE_SPACING, false)? - .visit_field::("oblique_angle", Self::VT_OBLIQUE_ANGLE, false)? - .visit_field::("font_size", Self::VT_FONT_SIZE, false)? - .visit_field::("paper_text_height", Self::VT_PAPER_TEXT_HEIGHT, false)? - .visit_field::("width_factor", Self::VT_WIDTH_FACTOR, false)? - .visit_field::("is_upside_down", Self::VT_IS_UPSIDE_DOWN, false)? - .visit_field::("is_backwards", Self::VT_IS_BACKWARDS, false)? - .finish(); - Ok(()) - } -} -pub struct DucTextStyleArgs<'a> { - pub is_ltr: bool, - pub font_family: Option>, - pub big_font_family: Option>, - pub text_align: Option, - pub vertical_align: Option, - pub line_height: f32, - pub line_spacing: Option>>, - pub oblique_angle: f64, - pub font_size: f64, - pub paper_text_height: f64, - pub width_factor: f32, - pub is_upside_down: bool, - pub is_backwards: bool, -} -impl<'a> Default for DucTextStyleArgs<'a> { - #[inline] - fn default() -> Self { - DucTextStyleArgs { - is_ltr: false, - font_family: None, - big_font_family: None, - text_align: None, - vertical_align: None, - line_height: 0.0, - line_spacing: None, - oblique_angle: 0.0, - font_size: 0.0, - paper_text_height: 0.0, - width_factor: 0.0, - is_upside_down: false, - is_backwards: false, - } - } -} - -pub struct DucTextStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTextStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_is_ltr(&mut self, is_ltr: bool) { - self.fbb_.push_slot::(DucTextStyle::VT_IS_LTR, is_ltr, false); - } - #[inline] - pub fn add_font_family(&mut self, font_family: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTextStyle::VT_FONT_FAMILY, font_family); - } - #[inline] - pub fn add_big_font_family(&mut self, big_font_family: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTextStyle::VT_BIG_FONT_FAMILY, big_font_family); - } - #[inline] - pub fn add_text_align(&mut self, text_align: TEXT_ALIGN) { - self.fbb_.push_slot_always::(DucTextStyle::VT_TEXT_ALIGN, text_align); - } - #[inline] - pub fn add_vertical_align(&mut self, vertical_align: VERTICAL_ALIGN) { - self.fbb_.push_slot_always::(DucTextStyle::VT_VERTICAL_ALIGN, vertical_align); - } - #[inline] - pub fn add_line_height(&mut self, line_height: f32) { - self.fbb_.push_slot::(DucTextStyle::VT_LINE_HEIGHT, line_height, 0.0); - } - #[inline] - pub fn add_line_spacing(&mut self, line_spacing: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTextStyle::VT_LINE_SPACING, line_spacing); - } - #[inline] - pub fn add_oblique_angle(&mut self, oblique_angle: f64) { - self.fbb_.push_slot::(DucTextStyle::VT_OBLIQUE_ANGLE, oblique_angle, 0.0); - } - #[inline] - pub fn add_font_size(&mut self, font_size: f64) { - self.fbb_.push_slot::(DucTextStyle::VT_FONT_SIZE, font_size, 0.0); - } - #[inline] - pub fn add_paper_text_height(&mut self, paper_text_height: f64) { - self.fbb_.push_slot::(DucTextStyle::VT_PAPER_TEXT_HEIGHT, paper_text_height, 0.0); - } - #[inline] - pub fn add_width_factor(&mut self, width_factor: f32) { - self.fbb_.push_slot::(DucTextStyle::VT_WIDTH_FACTOR, width_factor, 0.0); - } - #[inline] - pub fn add_is_upside_down(&mut self, is_upside_down: bool) { - self.fbb_.push_slot::(DucTextStyle::VT_IS_UPSIDE_DOWN, is_upside_down, false); - } - #[inline] - pub fn add_is_backwards(&mut self, is_backwards: bool) { - self.fbb_.push_slot::(DucTextStyle::VT_IS_BACKWARDS, is_backwards, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTextStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTextStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTextStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTextStyle"); - ds.field("is_ltr", &self.is_ltr()); - ds.field("font_family", &self.font_family()); - ds.field("big_font_family", &self.big_font_family()); - ds.field("text_align", &self.text_align()); - ds.field("vertical_align", &self.vertical_align()); - ds.field("line_height", &self.line_height()); - ds.field("line_spacing", &self.line_spacing()); - ds.field("oblique_angle", &self.oblique_angle()); - ds.field("font_size", &self.font_size()); - ds.field("paper_text_height", &self.paper_text_height()); - ds.field("width_factor", &self.width_factor()); - ds.field("is_upside_down", &self.is_upside_down()); - ds.field("is_backwards", &self.is_backwards()); - ds.finish() - } -} -pub enum DucTableCellStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTableCellStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTableCellStyle<'a> { - type Inner = DucTableCellStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTableCellStyle<'a> { - pub const VT_BASE_STYLE: flatbuffers::VOffsetT = 4; - pub const VT_TEXT_STYLE: flatbuffers::VOffsetT = 6; - pub const VT_MARGINS: flatbuffers::VOffsetT = 8; - pub const VT_ALIGNMENT: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTableCellStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTableCellStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTableCellStyleBuilder::new(_fbb); - if let Some(x) = args.margins { builder.add_margins(x); } - if let Some(x) = args.text_style { builder.add_text_style(x); } - if let Some(x) = args.base_style { builder.add_base_style(x); } - if let Some(x) = args.alignment { builder.add_alignment(x); } - builder.finish() - } - - - #[inline] - pub fn base_style(&self) -> Option<_DucElementStylesBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableCellStyle::VT_BASE_STYLE, None)} - } - #[inline] - pub fn text_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableCellStyle::VT_TEXT_STYLE, None)} - } - #[inline] - pub fn margins(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableCellStyle::VT_MARGINS, None)} - } - #[inline] - pub fn alignment(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTableCellStyle::VT_ALIGNMENT, None)} - } -} - -impl flatbuffers::Verifiable for DucTableCellStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base_style", Self::VT_BASE_STYLE, false)? - .visit_field::>("text_style", Self::VT_TEXT_STYLE, false)? - .visit_field::>("margins", Self::VT_MARGINS, false)? - .visit_field::("alignment", Self::VT_ALIGNMENT, false)? - .finish(); - Ok(()) - } -} -pub struct DucTableCellStyleArgs<'a> { - pub base_style: Option>>, - pub text_style: Option>>, - pub margins: Option>>, - pub alignment: Option, -} -impl<'a> Default for DucTableCellStyleArgs<'a> { - #[inline] - fn default() -> Self { - DucTableCellStyleArgs { - base_style: None, - text_style: None, - margins: None, - alignment: None, - } - } -} - -pub struct DucTableCellStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTableCellStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_base_style(&mut self, base_style: flatbuffers::WIPOffset<_DucElementStylesBase<'b >>) { - self.fbb_.push_slot_always::>(DucTableCellStyle::VT_BASE_STYLE, base_style); - } - #[inline] - pub fn add_text_style(&mut self, text_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableCellStyle::VT_TEXT_STYLE, text_style); - } - #[inline] - pub fn add_margins(&mut self, margins: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableCellStyle::VT_MARGINS, margins); - } - #[inline] - pub fn add_alignment(&mut self, alignment: TABLE_CELL_ALIGNMENT) { - self.fbb_.push_slot_always::(DucTableCellStyle::VT_ALIGNMENT, alignment); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTableCellStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTableCellStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTableCellStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTableCellStyle"); - ds.field("base_style", &self.base_style()); - ds.field("text_style", &self.text_style()); - ds.field("margins", &self.margins()); - ds.field("alignment", &self.alignment()); - ds.finish() - } -} -pub enum DucTableStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTableStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTableStyle<'a> { - type Inner = DucTableStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTableStyle<'a> { - pub const VT_FLOW_DIRECTION: flatbuffers::VOffsetT = 6; - pub const VT_HEADER_ROW_STYLE: flatbuffers::VOffsetT = 8; - pub const VT_DATA_ROW_STYLE: flatbuffers::VOffsetT = 10; - pub const VT_DATA_COLUMN_STYLE: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTableStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTableStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTableStyleBuilder::new(_fbb); - if let Some(x) = args.data_column_style { builder.add_data_column_style(x); } - if let Some(x) = args.data_row_style { builder.add_data_row_style(x); } - if let Some(x) = args.header_row_style { builder.add_header_row_style(x); } - if let Some(x) = args.flow_direction { builder.add_flow_direction(x); } - builder.finish() - } - - - #[inline] - pub fn flow_direction(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTableStyle::VT_FLOW_DIRECTION, None)} - } - #[inline] - pub fn header_row_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableStyle::VT_HEADER_ROW_STYLE, None)} - } - #[inline] - pub fn data_row_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableStyle::VT_DATA_ROW_STYLE, None)} - } - #[inline] - pub fn data_column_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableStyle::VT_DATA_COLUMN_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for DucTableStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("flow_direction", Self::VT_FLOW_DIRECTION, false)? - .visit_field::>("header_row_style", Self::VT_HEADER_ROW_STYLE, false)? - .visit_field::>("data_row_style", Self::VT_DATA_ROW_STYLE, false)? - .visit_field::>("data_column_style", Self::VT_DATA_COLUMN_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct DucTableStyleArgs<'a> { - pub flow_direction: Option, - pub header_row_style: Option>>, - pub data_row_style: Option>>, - pub data_column_style: Option>>, -} -impl<'a> Default for DucTableStyleArgs<'a> { - #[inline] - fn default() -> Self { - DucTableStyleArgs { - flow_direction: None, - header_row_style: None, - data_row_style: None, - data_column_style: None, - } - } -} - -pub struct DucTableStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTableStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_flow_direction(&mut self, flow_direction: TABLE_FLOW_DIRECTION) { - self.fbb_.push_slot_always::(DucTableStyle::VT_FLOW_DIRECTION, flow_direction); - } - #[inline] - pub fn add_header_row_style(&mut self, header_row_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableStyle::VT_HEADER_ROW_STYLE, header_row_style); - } - #[inline] - pub fn add_data_row_style(&mut self, data_row_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableStyle::VT_DATA_ROW_STYLE, data_row_style); - } - #[inline] - pub fn add_data_column_style(&mut self, data_column_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableStyle::VT_DATA_COLUMN_STYLE, data_column_style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTableStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTableStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTableStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTableStyle"); - ds.field("flow_direction", &self.flow_direction()); - ds.field("header_row_style", &self.header_row_style()); - ds.field("data_row_style", &self.data_row_style()); - ds.field("data_column_style", &self.data_column_style()); - ds.finish() - } -} -pub enum DucLeaderStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucLeaderStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucLeaderStyle<'a> { - type Inner = DucLeaderStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucLeaderStyle<'a> { - pub const VT_HEADS_OVERRIDE: flatbuffers::VOffsetT = 6; - pub const VT_DOGLEG: flatbuffers::VOffsetT = 8; - pub const VT_TEXT_STYLE: flatbuffers::VOffsetT = 10; - pub const VT_TEXT_ATTACHMENT: flatbuffers::VOffsetT = 12; - pub const VT_BLOCK_ATTACHMENT: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucLeaderStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucLeaderStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucLeaderStyleBuilder::new(_fbb); - builder.add_dogleg(args.dogleg); - if let Some(x) = args.text_style { builder.add_text_style(x); } - if let Some(x) = args.heads_override { builder.add_heads_override(x); } - if let Some(x) = args.block_attachment { builder.add_block_attachment(x); } - if let Some(x) = args.text_attachment { builder.add_text_attachment(x); } - builder.finish() - } - - - #[inline] - pub fn heads_override(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucLeaderStyle::VT_HEADS_OVERRIDE, None)} - } - #[inline] - pub fn dogleg(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLeaderStyle::VT_DOGLEG, Some(0.0)).unwrap()} - } - #[inline] - pub fn text_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLeaderStyle::VT_TEXT_STYLE, None)} - } - #[inline] - pub fn text_attachment(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLeaderStyle::VT_TEXT_ATTACHMENT, None)} - } - #[inline] - pub fn block_attachment(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLeaderStyle::VT_BLOCK_ATTACHMENT, None)} - } -} - -impl flatbuffers::Verifiable for DucLeaderStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>>("heads_override", Self::VT_HEADS_OVERRIDE, false)? - .visit_field::("dogleg", Self::VT_DOGLEG, false)? - .visit_field::>("text_style", Self::VT_TEXT_STYLE, false)? - .visit_field::("text_attachment", Self::VT_TEXT_ATTACHMENT, false)? - .visit_field::("block_attachment", Self::VT_BLOCK_ATTACHMENT, false)? - .finish(); - Ok(()) - } -} -pub struct DucLeaderStyleArgs<'a> { - pub heads_override: Option>>>>, - pub dogleg: f64, - pub text_style: Option>>, - pub text_attachment: Option, - pub block_attachment: Option, -} -impl<'a> Default for DucLeaderStyleArgs<'a> { - #[inline] - fn default() -> Self { - DucLeaderStyleArgs { - heads_override: None, - dogleg: 0.0, - text_style: None, - text_attachment: None, - block_attachment: None, - } - } -} - -pub struct DucLeaderStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucLeaderStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_heads_override(&mut self, heads_override: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DucLeaderStyle::VT_HEADS_OVERRIDE, heads_override); - } - #[inline] - pub fn add_dogleg(&mut self, dogleg: f64) { - self.fbb_.push_slot::(DucLeaderStyle::VT_DOGLEG, dogleg, 0.0); - } - #[inline] - pub fn add_text_style(&mut self, text_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucLeaderStyle::VT_TEXT_STYLE, text_style); - } - #[inline] - pub fn add_text_attachment(&mut self, text_attachment: VERTICAL_ALIGN) { - self.fbb_.push_slot_always::(DucLeaderStyle::VT_TEXT_ATTACHMENT, text_attachment); - } - #[inline] - pub fn add_block_attachment(&mut self, block_attachment: BLOCK_ATTACHMENT) { - self.fbb_.push_slot_always::(DucLeaderStyle::VT_BLOCK_ATTACHMENT, block_attachment); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucLeaderStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucLeaderStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucLeaderStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucLeaderStyle"); - ds.field("heads_override", &self.heads_override()); - ds.field("dogleg", &self.dogleg()); - ds.field("text_style", &self.text_style()); - ds.field("text_attachment", &self.text_attachment()); - ds.field("block_attachment", &self.block_attachment()); - ds.finish() - } -} -pub enum DimensionToleranceStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DimensionToleranceStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DimensionToleranceStyle<'a> { - type Inner = DimensionToleranceStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DimensionToleranceStyle<'a> { - pub const VT_ENABLED: flatbuffers::VOffsetT = 4; - pub const VT_DISPLAY_METHOD: flatbuffers::VOffsetT = 6; - pub const VT_UPPER_VALUE: flatbuffers::VOffsetT = 8; - pub const VT_LOWER_VALUE: flatbuffers::VOffsetT = 10; - pub const VT_PRECISION: flatbuffers::VOffsetT = 12; - pub const VT_TEXT_STYLE: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DimensionToleranceStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DimensionToleranceStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DimensionToleranceStyleBuilder::new(_fbb); - builder.add_lower_value(args.lower_value); - builder.add_upper_value(args.upper_value); - if let Some(x) = args.text_style { builder.add_text_style(x); } - builder.add_precision(args.precision); - if let Some(x) = args.display_method { builder.add_display_method(x); } - builder.add_enabled(args.enabled); - builder.finish() - } - - - #[inline] - pub fn enabled(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionToleranceStyle::VT_ENABLED, Some(false)).unwrap()} - } - #[inline] - pub fn display_method(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionToleranceStyle::VT_DISPLAY_METHOD, None)} - } - #[inline] - pub fn upper_value(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionToleranceStyle::VT_UPPER_VALUE, Some(0.0)).unwrap()} - } - #[inline] - pub fn lower_value(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionToleranceStyle::VT_LOWER_VALUE, Some(0.0)).unwrap()} - } - #[inline] - pub fn precision(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionToleranceStyle::VT_PRECISION, Some(0)).unwrap()} - } - #[inline] - pub fn text_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DimensionToleranceStyle::VT_TEXT_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for DimensionToleranceStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("enabled", Self::VT_ENABLED, false)? - .visit_field::("display_method", Self::VT_DISPLAY_METHOD, false)? - .visit_field::("upper_value", Self::VT_UPPER_VALUE, false)? - .visit_field::("lower_value", Self::VT_LOWER_VALUE, false)? - .visit_field::("precision", Self::VT_PRECISION, false)? - .visit_field::>("text_style", Self::VT_TEXT_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct DimensionToleranceStyleArgs<'a> { - pub enabled: bool, - pub display_method: Option, - pub upper_value: f64, - pub lower_value: f64, - pub precision: i32, - pub text_style: Option>>, -} -impl<'a> Default for DimensionToleranceStyleArgs<'a> { - #[inline] - fn default() -> Self { - DimensionToleranceStyleArgs { - enabled: false, - display_method: None, - upper_value: 0.0, - lower_value: 0.0, - precision: 0, - text_style: None, - } - } -} - -pub struct DimensionToleranceStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DimensionToleranceStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_enabled(&mut self, enabled: bool) { - self.fbb_.push_slot::(DimensionToleranceStyle::VT_ENABLED, enabled, false); - } - #[inline] - pub fn add_display_method(&mut self, display_method: TOLERANCE_DISPLAY) { - self.fbb_.push_slot_always::(DimensionToleranceStyle::VT_DISPLAY_METHOD, display_method); - } - #[inline] - pub fn add_upper_value(&mut self, upper_value: f64) { - self.fbb_.push_slot::(DimensionToleranceStyle::VT_UPPER_VALUE, upper_value, 0.0); - } - #[inline] - pub fn add_lower_value(&mut self, lower_value: f64) { - self.fbb_.push_slot::(DimensionToleranceStyle::VT_LOWER_VALUE, lower_value, 0.0); - } - #[inline] - pub fn add_precision(&mut self, precision: i32) { - self.fbb_.push_slot::(DimensionToleranceStyle::VT_PRECISION, precision, 0); - } - #[inline] - pub fn add_text_style(&mut self, text_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DimensionToleranceStyle::VT_TEXT_STYLE, text_style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DimensionToleranceStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DimensionToleranceStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DimensionToleranceStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DimensionToleranceStyle"); - ds.field("enabled", &self.enabled()); - ds.field("display_method", &self.display_method()); - ds.field("upper_value", &self.upper_value()); - ds.field("lower_value", &self.lower_value()); - ds.field("precision", &self.precision()); - ds.field("text_style", &self.text_style()); - ds.finish() - } -} -pub enum DimensionFitStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DimensionFitStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DimensionFitStyle<'a> { - type Inner = DimensionFitStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DimensionFitStyle<'a> { - pub const VT_RULE: flatbuffers::VOffsetT = 4; - pub const VT_TEXT_PLACEMENT: flatbuffers::VOffsetT = 6; - pub const VT_FORCE_TEXT_INSIDE: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DimensionFitStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DimensionFitStyleArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DimensionFitStyleBuilder::new(_fbb); - builder.add_force_text_inside(args.force_text_inside); - if let Some(x) = args.text_placement { builder.add_text_placement(x); } - if let Some(x) = args.rule { builder.add_rule(x); } - builder.finish() - } - - - #[inline] - pub fn rule(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionFitStyle::VT_RULE, None)} - } - #[inline] - pub fn text_placement(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionFitStyle::VT_TEXT_PLACEMENT, None)} - } - #[inline] - pub fn force_text_inside(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionFitStyle::VT_FORCE_TEXT_INSIDE, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DimensionFitStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("rule", Self::VT_RULE, false)? - .visit_field::("text_placement", Self::VT_TEXT_PLACEMENT, false)? - .visit_field::("force_text_inside", Self::VT_FORCE_TEXT_INSIDE, false)? - .finish(); - Ok(()) - } -} -pub struct DimensionFitStyleArgs { - pub rule: Option, - pub text_placement: Option, - pub force_text_inside: bool, -} -impl<'a> Default for DimensionFitStyleArgs { - #[inline] - fn default() -> Self { - DimensionFitStyleArgs { - rule: None, - text_placement: None, - force_text_inside: false, - } - } -} - -pub struct DimensionFitStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DimensionFitStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_rule(&mut self, rule: DIMENSION_FIT_RULE) { - self.fbb_.push_slot_always::(DimensionFitStyle::VT_RULE, rule); - } - #[inline] - pub fn add_text_placement(&mut self, text_placement: DIMENSION_TEXT_PLACEMENT) { - self.fbb_.push_slot_always::(DimensionFitStyle::VT_TEXT_PLACEMENT, text_placement); - } - #[inline] - pub fn add_force_text_inside(&mut self, force_text_inside: bool) { - self.fbb_.push_slot::(DimensionFitStyle::VT_FORCE_TEXT_INSIDE, force_text_inside, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DimensionFitStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DimensionFitStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DimensionFitStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DimensionFitStyle"); - ds.field("rule", &self.rule()); - ds.field("text_placement", &self.text_placement()); - ds.field("force_text_inside", &self.force_text_inside()); - ds.finish() - } -} -pub enum DimensionLineStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DimensionLineStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DimensionLineStyle<'a> { - type Inner = DimensionLineStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DimensionLineStyle<'a> { - pub const VT_STROKE: flatbuffers::VOffsetT = 4; - pub const VT_TEXT_GAP: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DimensionLineStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DimensionLineStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DimensionLineStyleBuilder::new(_fbb); - builder.add_text_gap(args.text_gap); - if let Some(x) = args.stroke { builder.add_stroke(x); } - builder.finish() - } - - - #[inline] - pub fn stroke(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DimensionLineStyle::VT_STROKE, None)} - } - #[inline] - pub fn text_gap(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionLineStyle::VT_TEXT_GAP, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DimensionLineStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("stroke", Self::VT_STROKE, false)? - .visit_field::("text_gap", Self::VT_TEXT_GAP, false)? - .finish(); - Ok(()) - } -} -pub struct DimensionLineStyleArgs<'a> { - pub stroke: Option>>, - pub text_gap: f64, -} -impl<'a> Default for DimensionLineStyleArgs<'a> { - #[inline] - fn default() -> Self { - DimensionLineStyleArgs { - stroke: None, - text_gap: 0.0, - } - } -} - -pub struct DimensionLineStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DimensionLineStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_stroke(&mut self, stroke: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DimensionLineStyle::VT_STROKE, stroke); - } - #[inline] - pub fn add_text_gap(&mut self, text_gap: f64) { - self.fbb_.push_slot::(DimensionLineStyle::VT_TEXT_GAP, text_gap, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DimensionLineStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DimensionLineStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DimensionLineStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DimensionLineStyle"); - ds.field("stroke", &self.stroke()); - ds.field("text_gap", &self.text_gap()); - ds.finish() - } -} -pub enum DimensionExtLineStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DimensionExtLineStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DimensionExtLineStyle<'a> { - type Inner = DimensionExtLineStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DimensionExtLineStyle<'a> { - pub const VT_STROKE: flatbuffers::VOffsetT = 4; - pub const VT_OVERSHOOT: flatbuffers::VOffsetT = 6; - pub const VT_OFFSET: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DimensionExtLineStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DimensionExtLineStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DimensionExtLineStyleBuilder::new(_fbb); - builder.add_offset(args.offset); - builder.add_overshoot(args.overshoot); - if let Some(x) = args.stroke { builder.add_stroke(x); } - builder.finish() - } - - - #[inline] - pub fn stroke(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DimensionExtLineStyle::VT_STROKE, None)} - } - #[inline] - pub fn overshoot(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionExtLineStyle::VT_OVERSHOOT, Some(0.0)).unwrap()} - } - #[inline] - pub fn offset(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionExtLineStyle::VT_OFFSET, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DimensionExtLineStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("stroke", Self::VT_STROKE, false)? - .visit_field::("overshoot", Self::VT_OVERSHOOT, false)? - .visit_field::("offset", Self::VT_OFFSET, false)? - .finish(); - Ok(()) - } -} -pub struct DimensionExtLineStyleArgs<'a> { - pub stroke: Option>>, - pub overshoot: f64, - pub offset: f64, -} -impl<'a> Default for DimensionExtLineStyleArgs<'a> { - #[inline] - fn default() -> Self { - DimensionExtLineStyleArgs { - stroke: None, - overshoot: 0.0, - offset: 0.0, - } - } -} - -pub struct DimensionExtLineStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DimensionExtLineStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_stroke(&mut self, stroke: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DimensionExtLineStyle::VT_STROKE, stroke); - } - #[inline] - pub fn add_overshoot(&mut self, overshoot: f64) { - self.fbb_.push_slot::(DimensionExtLineStyle::VT_OVERSHOOT, overshoot, 0.0); - } - #[inline] - pub fn add_offset(&mut self, offset: f64) { - self.fbb_.push_slot::(DimensionExtLineStyle::VT_OFFSET, offset, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DimensionExtLineStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DimensionExtLineStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DimensionExtLineStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DimensionExtLineStyle"); - ds.field("stroke", &self.stroke()); - ds.field("overshoot", &self.overshoot()); - ds.field("offset", &self.offset()); - ds.finish() - } -} -pub enum DimensionSymbolStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DimensionSymbolStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DimensionSymbolStyle<'a> { - type Inner = DimensionSymbolStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DimensionSymbolStyle<'a> { - pub const VT_HEADS_OVERRIDE: flatbuffers::VOffsetT = 4; - pub const VT_CENTER_MARK_TYPE: flatbuffers::VOffsetT = 6; - pub const VT_CENTER_MARK_SIZE: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DimensionSymbolStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DimensionSymbolStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DimensionSymbolStyleBuilder::new(_fbb); - builder.add_center_mark_size(args.center_mark_size); - if let Some(x) = args.heads_override { builder.add_heads_override(x); } - if let Some(x) = args.center_mark_type { builder.add_center_mark_type(x); } - builder.finish() - } - - - #[inline] - pub fn heads_override(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DimensionSymbolStyle::VT_HEADS_OVERRIDE, None)} - } - #[inline] - pub fn center_mark_type(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionSymbolStyle::VT_CENTER_MARK_TYPE, None)} - } - #[inline] - pub fn center_mark_size(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionSymbolStyle::VT_CENTER_MARK_SIZE, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DimensionSymbolStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>>("heads_override", Self::VT_HEADS_OVERRIDE, false)? - .visit_field::("center_mark_type", Self::VT_CENTER_MARK_TYPE, false)? - .visit_field::("center_mark_size", Self::VT_CENTER_MARK_SIZE, false)? - .finish(); - Ok(()) - } -} -pub struct DimensionSymbolStyleArgs<'a> { - pub heads_override: Option>>>>, - pub center_mark_type: Option, - pub center_mark_size: f64, -} -impl<'a> Default for DimensionSymbolStyleArgs<'a> { - #[inline] - fn default() -> Self { - DimensionSymbolStyleArgs { - heads_override: None, - center_mark_type: None, - center_mark_size: 0.0, - } - } -} - -pub struct DimensionSymbolStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DimensionSymbolStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_heads_override(&mut self, heads_override: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DimensionSymbolStyle::VT_HEADS_OVERRIDE, heads_override); - } - #[inline] - pub fn add_center_mark_type(&mut self, center_mark_type: MARK_ELLIPSE_CENTER) { - self.fbb_.push_slot_always::(DimensionSymbolStyle::VT_CENTER_MARK_TYPE, center_mark_type); - } - #[inline] - pub fn add_center_mark_size(&mut self, center_mark_size: f64) { - self.fbb_.push_slot::(DimensionSymbolStyle::VT_CENTER_MARK_SIZE, center_mark_size, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DimensionSymbolStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DimensionSymbolStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DimensionSymbolStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DimensionSymbolStyle"); - ds.field("heads_override", &self.heads_override()); - ds.field("center_mark_type", &self.center_mark_type()); - ds.field("center_mark_size", &self.center_mark_size()); - ds.finish() - } -} -pub enum DucDimensionStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucDimensionStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucDimensionStyle<'a> { - type Inner = DucDimensionStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucDimensionStyle<'a> { - pub const VT_DIM_LINE: flatbuffers::VOffsetT = 4; - pub const VT_EXT_LINE: flatbuffers::VOffsetT = 6; - pub const VT_TEXT_STYLE: flatbuffers::VOffsetT = 8; - pub const VT_SYMBOLS: flatbuffers::VOffsetT = 10; - pub const VT_TOLERANCE: flatbuffers::VOffsetT = 12; - pub const VT_FIT: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucDimensionStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucDimensionStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucDimensionStyleBuilder::new(_fbb); - if let Some(x) = args.fit { builder.add_fit(x); } - if let Some(x) = args.tolerance { builder.add_tolerance(x); } - if let Some(x) = args.symbols { builder.add_symbols(x); } - if let Some(x) = args.text_style { builder.add_text_style(x); } - if let Some(x) = args.ext_line { builder.add_ext_line(x); } - if let Some(x) = args.dim_line { builder.add_dim_line(x); } - builder.finish() - } - - - #[inline] - pub fn dim_line(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionStyle::VT_DIM_LINE, None)} - } - #[inline] - pub fn ext_line(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionStyle::VT_EXT_LINE, None)} - } - #[inline] - pub fn text_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionStyle::VT_TEXT_STYLE, None)} - } - #[inline] - pub fn symbols(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionStyle::VT_SYMBOLS, None)} - } - #[inline] - pub fn tolerance(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionStyle::VT_TOLERANCE, None)} - } - #[inline] - pub fn fit(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionStyle::VT_FIT, None)} - } -} - -impl flatbuffers::Verifiable for DucDimensionStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("dim_line", Self::VT_DIM_LINE, false)? - .visit_field::>("ext_line", Self::VT_EXT_LINE, false)? - .visit_field::>("text_style", Self::VT_TEXT_STYLE, false)? - .visit_field::>("symbols", Self::VT_SYMBOLS, false)? - .visit_field::>("tolerance", Self::VT_TOLERANCE, false)? - .visit_field::>("fit", Self::VT_FIT, false)? - .finish(); - Ok(()) - } -} -pub struct DucDimensionStyleArgs<'a> { - pub dim_line: Option>>, - pub ext_line: Option>>, - pub text_style: Option>>, - pub symbols: Option>>, - pub tolerance: Option>>, - pub fit: Option>>, -} -impl<'a> Default for DucDimensionStyleArgs<'a> { - #[inline] - fn default() -> Self { - DucDimensionStyleArgs { - dim_line: None, - ext_line: None, - text_style: None, - symbols: None, - tolerance: None, - fit: None, - } - } -} - -pub struct DucDimensionStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucDimensionStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_dim_line(&mut self, dim_line: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDimensionStyle::VT_DIM_LINE, dim_line); - } - #[inline] - pub fn add_ext_line(&mut self, ext_line: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDimensionStyle::VT_EXT_LINE, ext_line); - } - #[inline] - pub fn add_text_style(&mut self, text_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDimensionStyle::VT_TEXT_STYLE, text_style); - } - #[inline] - pub fn add_symbols(&mut self, symbols: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDimensionStyle::VT_SYMBOLS, symbols); - } - #[inline] - pub fn add_tolerance(&mut self, tolerance: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDimensionStyle::VT_TOLERANCE, tolerance); - } - #[inline] - pub fn add_fit(&mut self, fit: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDimensionStyle::VT_FIT, fit); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucDimensionStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucDimensionStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucDimensionStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucDimensionStyle"); - ds.field("dim_line", &self.dim_line()); - ds.field("ext_line", &self.ext_line()); - ds.field("text_style", &self.text_style()); - ds.field("symbols", &self.symbols()); - ds.field("tolerance", &self.tolerance()); - ds.field("fit", &self.fit()); - ds.finish() - } -} -pub enum FCFLayoutStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct FCFLayoutStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for FCFLayoutStyle<'a> { - type Inner = FCFLayoutStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> FCFLayoutStyle<'a> { - pub const VT_PADDING: flatbuffers::VOffsetT = 4; - pub const VT_SEGMENT_SPACING: flatbuffers::VOffsetT = 6; - pub const VT_ROW_SPACING: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - FCFLayoutStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args FCFLayoutStyleArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = FCFLayoutStyleBuilder::new(_fbb); - builder.add_row_spacing(args.row_spacing); - builder.add_segment_spacing(args.segment_spacing); - builder.add_padding(args.padding); - builder.finish() - } - - - #[inline] - pub fn padding(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(FCFLayoutStyle::VT_PADDING, Some(0.0)).unwrap()} - } - #[inline] - pub fn segment_spacing(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(FCFLayoutStyle::VT_SEGMENT_SPACING, Some(0.0)).unwrap()} - } - #[inline] - pub fn row_spacing(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(FCFLayoutStyle::VT_ROW_SPACING, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for FCFLayoutStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("padding", Self::VT_PADDING, false)? - .visit_field::("segment_spacing", Self::VT_SEGMENT_SPACING, false)? - .visit_field::("row_spacing", Self::VT_ROW_SPACING, false)? - .finish(); - Ok(()) - } -} -pub struct FCFLayoutStyleArgs { - pub padding: f64, - pub segment_spacing: f64, - pub row_spacing: f64, -} -impl<'a> Default for FCFLayoutStyleArgs { - #[inline] - fn default() -> Self { - FCFLayoutStyleArgs { - padding: 0.0, - segment_spacing: 0.0, - row_spacing: 0.0, - } - } -} - -pub struct FCFLayoutStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FCFLayoutStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_padding(&mut self, padding: f64) { - self.fbb_.push_slot::(FCFLayoutStyle::VT_PADDING, padding, 0.0); - } - #[inline] - pub fn add_segment_spacing(&mut self, segment_spacing: f64) { - self.fbb_.push_slot::(FCFLayoutStyle::VT_SEGMENT_SPACING, segment_spacing, 0.0); - } - #[inline] - pub fn add_row_spacing(&mut self, row_spacing: f64) { - self.fbb_.push_slot::(FCFLayoutStyle::VT_ROW_SPACING, row_spacing, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FCFLayoutStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - FCFLayoutStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for FCFLayoutStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("FCFLayoutStyle"); - ds.field("padding", &self.padding()); - ds.field("segment_spacing", &self.segment_spacing()); - ds.field("row_spacing", &self.row_spacing()); - ds.finish() - } -} -pub enum FCFSymbolStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct FCFSymbolStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for FCFSymbolStyle<'a> { - type Inner = FCFSymbolStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> FCFSymbolStyle<'a> { - pub const VT_SCALE: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - FCFSymbolStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args FCFSymbolStyleArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = FCFSymbolStyleBuilder::new(_fbb); - builder.add_scale(args.scale); - builder.finish() - } - - - #[inline] - pub fn scale(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(FCFSymbolStyle::VT_SCALE, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for FCFSymbolStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("scale", Self::VT_SCALE, false)? - .finish(); - Ok(()) - } -} -pub struct FCFSymbolStyleArgs { - pub scale: f32, -} -impl<'a> Default for FCFSymbolStyleArgs { - #[inline] - fn default() -> Self { - FCFSymbolStyleArgs { - scale: 0.0, - } - } -} - -pub struct FCFSymbolStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FCFSymbolStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_scale(&mut self, scale: f32) { - self.fbb_.push_slot::(FCFSymbolStyle::VT_SCALE, scale, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FCFSymbolStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - FCFSymbolStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for FCFSymbolStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("FCFSymbolStyle"); - ds.field("scale", &self.scale()); - ds.finish() - } -} -pub enum FCFDatumStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct FCFDatumStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for FCFDatumStyle<'a> { - type Inner = FCFDatumStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> FCFDatumStyle<'a> { - pub const VT_BRACKET_STYLE: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - FCFDatumStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args FCFDatumStyleArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = FCFDatumStyleBuilder::new(_fbb); - if let Some(x) = args.bracket_style { builder.add_bracket_style(x); } - builder.finish() - } - - - #[inline] - pub fn bracket_style(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(FCFDatumStyle::VT_BRACKET_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for FCFDatumStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("bracket_style", Self::VT_BRACKET_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct FCFDatumStyleArgs { - pub bracket_style: Option, -} -impl<'a> Default for FCFDatumStyleArgs { - #[inline] - fn default() -> Self { - FCFDatumStyleArgs { - bracket_style: None, - } - } -} - -pub struct FCFDatumStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FCFDatumStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_bracket_style(&mut self, bracket_style: DATUM_BRACKET_STYLE) { - self.fbb_.push_slot_always::(FCFDatumStyle::VT_BRACKET_STYLE, bracket_style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FCFDatumStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - FCFDatumStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for FCFDatumStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("FCFDatumStyle"); - ds.field("bracket_style", &self.bracket_style()); - ds.finish() - } -} -pub enum DucFeatureControlFrameStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucFeatureControlFrameStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucFeatureControlFrameStyle<'a> { - type Inner = DucFeatureControlFrameStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucFeatureControlFrameStyle<'a> { - pub const VT_TEXT_STYLE: flatbuffers::VOffsetT = 6; - pub const VT_LAYOUT: flatbuffers::VOffsetT = 8; - pub const VT_SYMBOLS: flatbuffers::VOffsetT = 10; - pub const VT_DATUM_STYLE: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucFeatureControlFrameStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucFeatureControlFrameStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucFeatureControlFrameStyleBuilder::new(_fbb); - if let Some(x) = args.datum_style { builder.add_datum_style(x); } - if let Some(x) = args.symbols { builder.add_symbols(x); } - if let Some(x) = args.layout { builder.add_layout(x); } - if let Some(x) = args.text_style { builder.add_text_style(x); } - builder.finish() - } - - - #[inline] - pub fn text_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFeatureControlFrameStyle::VT_TEXT_STYLE, None)} - } - #[inline] - pub fn layout(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFeatureControlFrameStyle::VT_LAYOUT, None)} - } - #[inline] - pub fn symbols(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFeatureControlFrameStyle::VT_SYMBOLS, None)} - } - #[inline] - pub fn datum_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFeatureControlFrameStyle::VT_DATUM_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for DucFeatureControlFrameStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("text_style", Self::VT_TEXT_STYLE, false)? - .visit_field::>("layout", Self::VT_LAYOUT, false)? - .visit_field::>("symbols", Self::VT_SYMBOLS, false)? - .visit_field::>("datum_style", Self::VT_DATUM_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct DucFeatureControlFrameStyleArgs<'a> { - pub text_style: Option>>, - pub layout: Option>>, - pub symbols: Option>>, - pub datum_style: Option>>, -} -impl<'a> Default for DucFeatureControlFrameStyleArgs<'a> { - #[inline] - fn default() -> Self { - DucFeatureControlFrameStyleArgs { - text_style: None, - layout: None, - symbols: None, - datum_style: None, - } - } -} - -pub struct DucFeatureControlFrameStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucFeatureControlFrameStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_text_style(&mut self, text_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucFeatureControlFrameStyle::VT_TEXT_STYLE, text_style); - } - #[inline] - pub fn add_layout(&mut self, layout: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucFeatureControlFrameStyle::VT_LAYOUT, layout); - } - #[inline] - pub fn add_symbols(&mut self, symbols: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucFeatureControlFrameStyle::VT_SYMBOLS, symbols); - } - #[inline] - pub fn add_datum_style(&mut self, datum_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucFeatureControlFrameStyle::VT_DATUM_STYLE, datum_style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucFeatureControlFrameStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucFeatureControlFrameStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucFeatureControlFrameStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucFeatureControlFrameStyle"); - ds.field("text_style", &self.text_style()); - ds.field("layout", &self.layout()); - ds.field("symbols", &self.symbols()); - ds.field("datum_style", &self.datum_style()); - ds.finish() - } -} -pub enum ParagraphFormattingOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ParagraphFormatting<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ParagraphFormatting<'a> { - type Inner = ParagraphFormatting<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ParagraphFormatting<'a> { - pub const VT_FIRST_LINE_INDENT: flatbuffers::VOffsetT = 4; - pub const VT_HANGING_INDENT: flatbuffers::VOffsetT = 6; - pub const VT_LEFT_INDENT: flatbuffers::VOffsetT = 8; - pub const VT_RIGHT_INDENT: flatbuffers::VOffsetT = 10; - pub const VT_SPACE_BEFORE: flatbuffers::VOffsetT = 12; - pub const VT_SPACE_AFTER: flatbuffers::VOffsetT = 14; - pub const VT_TAB_STOPS: flatbuffers::VOffsetT = 16; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ParagraphFormatting { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args ParagraphFormattingArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ParagraphFormattingBuilder::new(_fbb); - builder.add_space_after(args.space_after); - builder.add_space_before(args.space_before); - builder.add_right_indent(args.right_indent); - builder.add_left_indent(args.left_indent); - builder.add_hanging_indent(args.hanging_indent); - builder.add_first_line_indent(args.first_line_indent); - if let Some(x) = args.tab_stops { builder.add_tab_stops(x); } - builder.finish() - } - - - #[inline] - pub fn first_line_indent(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ParagraphFormatting::VT_FIRST_LINE_INDENT, Some(0.0)).unwrap()} - } - #[inline] - pub fn hanging_indent(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ParagraphFormatting::VT_HANGING_INDENT, Some(0.0)).unwrap()} - } - #[inline] - pub fn left_indent(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ParagraphFormatting::VT_LEFT_INDENT, Some(0.0)).unwrap()} - } - #[inline] - pub fn right_indent(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ParagraphFormatting::VT_RIGHT_INDENT, Some(0.0)).unwrap()} - } - #[inline] - pub fn space_before(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ParagraphFormatting::VT_SPACE_BEFORE, Some(0.0)).unwrap()} - } - #[inline] - pub fn space_after(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ParagraphFormatting::VT_SPACE_AFTER, Some(0.0)).unwrap()} - } - #[inline] - pub fn tab_stops(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ParagraphFormatting::VT_TAB_STOPS, None)} - } -} - -impl flatbuffers::Verifiable for ParagraphFormatting<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("first_line_indent", Self::VT_FIRST_LINE_INDENT, false)? - .visit_field::("hanging_indent", Self::VT_HANGING_INDENT, false)? - .visit_field::("left_indent", Self::VT_LEFT_INDENT, false)? - .visit_field::("right_indent", Self::VT_RIGHT_INDENT, false)? - .visit_field::("space_before", Self::VT_SPACE_BEFORE, false)? - .visit_field::("space_after", Self::VT_SPACE_AFTER, false)? - .visit_field::>>("tab_stops", Self::VT_TAB_STOPS, false)? - .finish(); - Ok(()) - } -} -pub struct ParagraphFormattingArgs<'a> { - pub first_line_indent: f64, - pub hanging_indent: f64, - pub left_indent: f64, - pub right_indent: f64, - pub space_before: f64, - pub space_after: f64, - pub tab_stops: Option>>, -} -impl<'a> Default for ParagraphFormattingArgs<'a> { - #[inline] - fn default() -> Self { - ParagraphFormattingArgs { - first_line_indent: 0.0, - hanging_indent: 0.0, - left_indent: 0.0, - right_indent: 0.0, - space_before: 0.0, - space_after: 0.0, - tab_stops: None, - } - } -} - -pub struct ParagraphFormattingBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ParagraphFormattingBuilder<'a, 'b, A> { - #[inline] - pub fn add_first_line_indent(&mut self, first_line_indent: f64) { - self.fbb_.push_slot::(ParagraphFormatting::VT_FIRST_LINE_INDENT, first_line_indent, 0.0); - } - #[inline] - pub fn add_hanging_indent(&mut self, hanging_indent: f64) { - self.fbb_.push_slot::(ParagraphFormatting::VT_HANGING_INDENT, hanging_indent, 0.0); - } - #[inline] - pub fn add_left_indent(&mut self, left_indent: f64) { - self.fbb_.push_slot::(ParagraphFormatting::VT_LEFT_INDENT, left_indent, 0.0); - } - #[inline] - pub fn add_right_indent(&mut self, right_indent: f64) { - self.fbb_.push_slot::(ParagraphFormatting::VT_RIGHT_INDENT, right_indent, 0.0); - } - #[inline] - pub fn add_space_before(&mut self, space_before: f64) { - self.fbb_.push_slot::(ParagraphFormatting::VT_SPACE_BEFORE, space_before, 0.0); - } - #[inline] - pub fn add_space_after(&mut self, space_after: f64) { - self.fbb_.push_slot::(ParagraphFormatting::VT_SPACE_AFTER, space_after, 0.0); - } - #[inline] - pub fn add_tab_stops(&mut self, tab_stops: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ParagraphFormatting::VT_TAB_STOPS, tab_stops); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ParagraphFormattingBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - ParagraphFormattingBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ParagraphFormatting<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ParagraphFormatting"); - ds.field("first_line_indent", &self.first_line_indent()); - ds.field("hanging_indent", &self.hanging_indent()); - ds.field("left_indent", &self.left_indent()); - ds.field("right_indent", &self.right_indent()); - ds.field("space_before", &self.space_before()); - ds.field("space_after", &self.space_after()); - ds.field("tab_stops", &self.tab_stops()); - ds.finish() - } -} -pub enum StackFormatPropertiesOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct StackFormatProperties<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for StackFormatProperties<'a> { - type Inner = StackFormatProperties<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> StackFormatProperties<'a> { - pub const VT_UPPER_SCALE: flatbuffers::VOffsetT = 4; - pub const VT_LOWER_SCALE: flatbuffers::VOffsetT = 6; - pub const VT_ALIGNMENT: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - StackFormatProperties { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args StackFormatPropertiesArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = StackFormatPropertiesBuilder::new(_fbb); - builder.add_lower_scale(args.lower_scale); - builder.add_upper_scale(args.upper_scale); - if let Some(x) = args.alignment { builder.add_alignment(x); } - builder.finish() - } - - - #[inline] - pub fn upper_scale(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(StackFormatProperties::VT_UPPER_SCALE, Some(0.0)).unwrap()} - } - #[inline] - pub fn lower_scale(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(StackFormatProperties::VT_LOWER_SCALE, Some(0.0)).unwrap()} - } - #[inline] - pub fn alignment(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(StackFormatProperties::VT_ALIGNMENT, None)} - } -} - -impl flatbuffers::Verifiable for StackFormatProperties<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("upper_scale", Self::VT_UPPER_SCALE, false)? - .visit_field::("lower_scale", Self::VT_LOWER_SCALE, false)? - .visit_field::("alignment", Self::VT_ALIGNMENT, false)? - .finish(); - Ok(()) - } -} -pub struct StackFormatPropertiesArgs { - pub upper_scale: f64, - pub lower_scale: f64, - pub alignment: Option, -} -impl<'a> Default for StackFormatPropertiesArgs { - #[inline] - fn default() -> Self { - StackFormatPropertiesArgs { - upper_scale: 0.0, - lower_scale: 0.0, - alignment: None, - } - } -} - -pub struct StackFormatPropertiesBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StackFormatPropertiesBuilder<'a, 'b, A> { - #[inline] - pub fn add_upper_scale(&mut self, upper_scale: f64) { - self.fbb_.push_slot::(StackFormatProperties::VT_UPPER_SCALE, upper_scale, 0.0); - } - #[inline] - pub fn add_lower_scale(&mut self, lower_scale: f64) { - self.fbb_.push_slot::(StackFormatProperties::VT_LOWER_SCALE, lower_scale, 0.0); - } - #[inline] - pub fn add_alignment(&mut self, alignment: STACKED_TEXT_ALIGN) { - self.fbb_.push_slot_always::(StackFormatProperties::VT_ALIGNMENT, alignment); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StackFormatPropertiesBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - StackFormatPropertiesBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for StackFormatProperties<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("StackFormatProperties"); - ds.field("upper_scale", &self.upper_scale()); - ds.field("lower_scale", &self.lower_scale()); - ds.field("alignment", &self.alignment()); - ds.finish() - } -} -pub enum StackFormatOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct StackFormat<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for StackFormat<'a> { - type Inner = StackFormat<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> StackFormat<'a> { - pub const VT_AUTO_STACK: flatbuffers::VOffsetT = 4; - pub const VT_STACK_CHARS: flatbuffers::VOffsetT = 6; - pub const VT_PROPERTIES: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - StackFormat { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args StackFormatArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = StackFormatBuilder::new(_fbb); - if let Some(x) = args.properties { builder.add_properties(x); } - if let Some(x) = args.stack_chars { builder.add_stack_chars(x); } - builder.add_auto_stack(args.auto_stack); - builder.finish() - } - - - #[inline] - pub fn auto_stack(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(StackFormat::VT_AUTO_STACK, Some(false)).unwrap()} - } - #[inline] - pub fn stack_chars(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StackFormat::VT_STACK_CHARS, None)} - } - #[inline] - pub fn properties(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StackFormat::VT_PROPERTIES, None)} - } -} - -impl flatbuffers::Verifiable for StackFormat<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("auto_stack", Self::VT_AUTO_STACK, false)? - .visit_field::>>>("stack_chars", Self::VT_STACK_CHARS, false)? - .visit_field::>("properties", Self::VT_PROPERTIES, false)? - .finish(); - Ok(()) - } -} -pub struct StackFormatArgs<'a> { - pub auto_stack: bool, - pub stack_chars: Option>>>, - pub properties: Option>>, -} -impl<'a> Default for StackFormatArgs<'a> { - #[inline] - fn default() -> Self { - StackFormatArgs { - auto_stack: false, - stack_chars: None, - properties: None, - } - } -} - -pub struct StackFormatBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StackFormatBuilder<'a, 'b, A> { - #[inline] - pub fn add_auto_stack(&mut self, auto_stack: bool) { - self.fbb_.push_slot::(StackFormat::VT_AUTO_STACK, auto_stack, false); - } - #[inline] - pub fn add_stack_chars(&mut self, stack_chars: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(StackFormat::VT_STACK_CHARS, stack_chars); - } - #[inline] - pub fn add_properties(&mut self, properties: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(StackFormat::VT_PROPERTIES, properties); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StackFormatBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - StackFormatBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for StackFormat<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("StackFormat"); - ds.field("auto_stack", &self.auto_stack()); - ds.field("stack_chars", &self.stack_chars()); - ds.field("properties", &self.properties()); - ds.finish() - } -} -pub enum DucDocStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucDocStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucDocStyle<'a> { - type Inner = DucDocStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucDocStyle<'a> { - pub const VT_TEXT_STYLE: flatbuffers::VOffsetT = 4; - pub const VT_PARAGRAPH: flatbuffers::VOffsetT = 6; - pub const VT_STACK_FORMAT: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucDocStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucDocStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucDocStyleBuilder::new(_fbb); - if let Some(x) = args.stack_format { builder.add_stack_format(x); } - if let Some(x) = args.paragraph { builder.add_paragraph(x); } - if let Some(x) = args.text_style { builder.add_text_style(x); } - builder.finish() - } - - - #[inline] - pub fn text_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDocStyle::VT_TEXT_STYLE, None)} - } - #[inline] - pub fn paragraph(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDocStyle::VT_PARAGRAPH, None)} - } - #[inline] - pub fn stack_format(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDocStyle::VT_STACK_FORMAT, None)} - } -} - -impl flatbuffers::Verifiable for DucDocStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("text_style", Self::VT_TEXT_STYLE, false)? - .visit_field::>("paragraph", Self::VT_PARAGRAPH, false)? - .visit_field::>("stack_format", Self::VT_STACK_FORMAT, false)? - .finish(); - Ok(()) - } -} -pub struct DucDocStyleArgs<'a> { - pub text_style: Option>>, - pub paragraph: Option>>, - pub stack_format: Option>>, -} -impl<'a> Default for DucDocStyleArgs<'a> { - #[inline] - fn default() -> Self { - DucDocStyleArgs { - text_style: None, - paragraph: None, - stack_format: None, - } - } -} - -pub struct DucDocStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucDocStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_text_style(&mut self, text_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDocStyle::VT_TEXT_STYLE, text_style); - } - #[inline] - pub fn add_paragraph(&mut self, paragraph: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDocStyle::VT_PARAGRAPH, paragraph); - } - #[inline] - pub fn add_stack_format(&mut self, stack_format: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDocStyle::VT_STACK_FORMAT, stack_format); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucDocStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucDocStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucDocStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucDocStyle"); - ds.field("text_style", &self.text_style()); - ds.field("paragraph", &self.paragraph()); - ds.field("stack_format", &self.stack_format()); - ds.finish() - } -} -pub enum DucViewportStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucViewportStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucViewportStyle<'a> { - type Inner = DucViewportStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucViewportStyle<'a> { - pub const VT_SCALE_INDICATOR_VISIBLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucViewportStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucViewportStyleArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DucViewportStyleBuilder::new(_fbb); - builder.add_scale_indicator_visible(args.scale_indicator_visible); - builder.finish() - } - - - #[inline] - pub fn scale_indicator_visible(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucViewportStyle::VT_SCALE_INDICATOR_VISIBLE, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucViewportStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("scale_indicator_visible", Self::VT_SCALE_INDICATOR_VISIBLE, false)? - .finish(); - Ok(()) - } -} -pub struct DucViewportStyleArgs { - pub scale_indicator_visible: bool, -} -impl<'a> Default for DucViewportStyleArgs { - #[inline] - fn default() -> Self { - DucViewportStyleArgs { - scale_indicator_visible: false, - } - } -} - -pub struct DucViewportStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucViewportStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_scale_indicator_visible(&mut self, scale_indicator_visible: bool) { - self.fbb_.push_slot::(DucViewportStyle::VT_SCALE_INDICATOR_VISIBLE, scale_indicator_visible, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucViewportStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucViewportStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucViewportStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucViewportStyle"); - ds.field("scale_indicator_visible", &self.scale_indicator_visible()); - ds.finish() - } -} -pub enum DucPlotStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucPlotStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucPlotStyle<'a> { - type Inner = DucPlotStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucPlotStyle<'a> { - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucPlotStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucPlotStyleArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DucPlotStyleBuilder::new(_fbb); - builder.finish() - } - - -} - -impl flatbuffers::Verifiable for DucPlotStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .finish(); - Ok(()) - } -} -pub struct DucPlotStyleArgs { -} -impl<'a> Default for DucPlotStyleArgs { - #[inline] - fn default() -> Self { - DucPlotStyleArgs { - } - } -} - -pub struct DucPlotStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucPlotStyleBuilder<'a, 'b, A> { - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucPlotStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucPlotStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucPlotStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucPlotStyle"); - ds.finish() - } -} -pub enum DucXRayStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucXRayStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucXRayStyle<'a> { - type Inner = DucXRayStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucXRayStyle<'a> { - pub const VT_COLOR: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucXRayStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucXRayStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucXRayStyleBuilder::new(_fbb); - if let Some(x) = args.color { builder.add_color(x); } - builder.finish() - } - - - #[inline] - pub fn color(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucXRayStyle::VT_COLOR, None)} - } -} - -impl flatbuffers::Verifiable for DucXRayStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("color", Self::VT_COLOR, false)? - .finish(); - Ok(()) - } -} -pub struct DucXRayStyleArgs<'a> { - pub color: Option>, -} -impl<'a> Default for DucXRayStyleArgs<'a> { - #[inline] - fn default() -> Self { - DucXRayStyleArgs { - color: None, - } - } -} - -pub struct DucXRayStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucXRayStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_color(&mut self, color: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucXRayStyle::VT_COLOR, color); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucXRayStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucXRayStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucXRayStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucXRayStyle"); - ds.field("color", &self.color()); - ds.finish() - } -} -pub enum DucRectangleElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucRectangleElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucRectangleElement<'a> { - type Inner = DucRectangleElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucRectangleElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucRectangleElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucRectangleElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucRectangleElementBuilder::new(_fbb); - if let Some(x) = args.base { builder.add_base(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucRectangleElement::VT_BASE, None)} - } -} - -impl flatbuffers::Verifiable for DucRectangleElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .finish(); - Ok(()) - } -} -pub struct DucRectangleElementArgs<'a> { - pub base: Option>>, -} -impl<'a> Default for DucRectangleElementArgs<'a> { - #[inline] - fn default() -> Self { - DucRectangleElementArgs { - base: None, - } - } -} - -pub struct DucRectangleElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucRectangleElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucRectangleElement::VT_BASE, base); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucRectangleElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucRectangleElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucRectangleElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucRectangleElement"); - ds.field("base", &self.base()); - ds.finish() - } -} -pub enum DucPolygonElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucPolygonElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucPolygonElement<'a> { - type Inner = DucPolygonElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucPolygonElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_SIDES: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucPolygonElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucPolygonElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucPolygonElementBuilder::new(_fbb); - builder.add_sides(args.sides); - if let Some(x) = args.base { builder.add_base(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucPolygonElement::VT_BASE, None)} - } - #[inline] - pub fn sides(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucPolygonElement::VT_SIDES, Some(0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucPolygonElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::("sides", Self::VT_SIDES, false)? - .finish(); - Ok(()) - } -} -pub struct DucPolygonElementArgs<'a> { - pub base: Option>>, - pub sides: i32, -} -impl<'a> Default for DucPolygonElementArgs<'a> { - #[inline] - fn default() -> Self { - DucPolygonElementArgs { - base: None, - sides: 0, - } - } -} - -pub struct DucPolygonElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucPolygonElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucPolygonElement::VT_BASE, base); - } - #[inline] - pub fn add_sides(&mut self, sides: i32) { - self.fbb_.push_slot::(DucPolygonElement::VT_SIDES, sides, 0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucPolygonElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucPolygonElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucPolygonElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucPolygonElement"); - ds.field("base", &self.base()); - ds.field("sides", &self.sides()); - ds.finish() - } -} -pub enum DucEllipseElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucEllipseElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucEllipseElement<'a> { - type Inner = DucEllipseElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucEllipseElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_RATIO: flatbuffers::VOffsetT = 6; - pub const VT_START_ANGLE: flatbuffers::VOffsetT = 8; - pub const VT_END_ANGLE: flatbuffers::VOffsetT = 10; - pub const VT_SHOW_AUX_CROSSHAIR: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucEllipseElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucEllipseElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucEllipseElementBuilder::new(_fbb); - builder.add_end_angle(args.end_angle); - builder.add_start_angle(args.start_angle); - builder.add_ratio(args.ratio); - if let Some(x) = args.base { builder.add_base(x); } - builder.add_show_aux_crosshair(args.show_aux_crosshair); - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucEllipseElement::VT_BASE, None)} - } - #[inline] - pub fn ratio(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucEllipseElement::VT_RATIO, Some(0.0)).unwrap()} - } - #[inline] - pub fn start_angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucEllipseElement::VT_START_ANGLE, Some(0.0)).unwrap()} - } - #[inline] - pub fn end_angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucEllipseElement::VT_END_ANGLE, Some(0.0)).unwrap()} - } - #[inline] - pub fn show_aux_crosshair(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucEllipseElement::VT_SHOW_AUX_CROSSHAIR, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucEllipseElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::("ratio", Self::VT_RATIO, false)? - .visit_field::("start_angle", Self::VT_START_ANGLE, false)? - .visit_field::("end_angle", Self::VT_END_ANGLE, false)? - .visit_field::("show_aux_crosshair", Self::VT_SHOW_AUX_CROSSHAIR, false)? - .finish(); - Ok(()) - } -} -pub struct DucEllipseElementArgs<'a> { - pub base: Option>>, - pub ratio: f32, - pub start_angle: f64, - pub end_angle: f64, - pub show_aux_crosshair: bool, -} -impl<'a> Default for DucEllipseElementArgs<'a> { - #[inline] - fn default() -> Self { - DucEllipseElementArgs { - base: None, - ratio: 0.0, - start_angle: 0.0, - end_angle: 0.0, - show_aux_crosshair: false, - } - } -} - -pub struct DucEllipseElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucEllipseElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucEllipseElement::VT_BASE, base); - } - #[inline] - pub fn add_ratio(&mut self, ratio: f32) { - self.fbb_.push_slot::(DucEllipseElement::VT_RATIO, ratio, 0.0); - } - #[inline] - pub fn add_start_angle(&mut self, start_angle: f64) { - self.fbb_.push_slot::(DucEllipseElement::VT_START_ANGLE, start_angle, 0.0); - } - #[inline] - pub fn add_end_angle(&mut self, end_angle: f64) { - self.fbb_.push_slot::(DucEllipseElement::VT_END_ANGLE, end_angle, 0.0); - } - #[inline] - pub fn add_show_aux_crosshair(&mut self, show_aux_crosshair: bool) { - self.fbb_.push_slot::(DucEllipseElement::VT_SHOW_AUX_CROSSHAIR, show_aux_crosshair, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucEllipseElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucEllipseElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucEllipseElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucEllipseElement"); - ds.field("base", &self.base()); - ds.field("ratio", &self.ratio()); - ds.field("start_angle", &self.start_angle()); - ds.field("end_angle", &self.end_angle()); - ds.field("show_aux_crosshair", &self.show_aux_crosshair()); - ds.finish() - } -} -pub enum DucEmbeddableElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucEmbeddableElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucEmbeddableElement<'a> { - type Inner = DucEmbeddableElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucEmbeddableElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucEmbeddableElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucEmbeddableElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucEmbeddableElementBuilder::new(_fbb); - if let Some(x) = args.base { builder.add_base(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucEmbeddableElement::VT_BASE, None)} - } -} - -impl flatbuffers::Verifiable for DucEmbeddableElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .finish(); - Ok(()) - } -} -pub struct DucEmbeddableElementArgs<'a> { - pub base: Option>>, -} -impl<'a> Default for DucEmbeddableElementArgs<'a> { - #[inline] - fn default() -> Self { - DucEmbeddableElementArgs { - base: None, - } - } -} - -pub struct DucEmbeddableElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucEmbeddableElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucEmbeddableElement::VT_BASE, base); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucEmbeddableElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucEmbeddableElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucEmbeddableElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucEmbeddableElement"); - ds.field("base", &self.base()); - ds.finish() - } -} -pub enum DocumentGridConfigOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DocumentGridConfig<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DocumentGridConfig<'a> { - type Inner = DocumentGridConfig<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DocumentGridConfig<'a> { - pub const VT_COLUMNS: flatbuffers::VOffsetT = 4; - pub const VT_GAP_X: flatbuffers::VOffsetT = 6; - pub const VT_GAP_Y: flatbuffers::VOffsetT = 8; - pub const VT_ALIGN_ITEMS: flatbuffers::VOffsetT = 10; - pub const VT_FIRST_PAGE_ALONE: flatbuffers::VOffsetT = 12; - pub const VT_SCALE: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DocumentGridConfig { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DocumentGridConfigArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DocumentGridConfigBuilder::new(_fbb); - builder.add_scale(args.scale); - builder.add_gap_y(args.gap_y); - builder.add_gap_x(args.gap_x); - builder.add_columns(args.columns); - builder.add_first_page_alone(args.first_page_alone); - if let Some(x) = args.align_items { builder.add_align_items(x); } - builder.finish() - } - - - #[inline] - pub fn columns(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DocumentGridConfig::VT_COLUMNS, Some(0)).unwrap()} - } - #[inline] - pub fn gap_x(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DocumentGridConfig::VT_GAP_X, Some(0.0)).unwrap()} - } - #[inline] - pub fn gap_y(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DocumentGridConfig::VT_GAP_Y, Some(0.0)).unwrap()} - } - #[inline] - pub fn align_items(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DocumentGridConfig::VT_ALIGN_ITEMS, None)} - } - #[inline] - pub fn first_page_alone(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DocumentGridConfig::VT_FIRST_PAGE_ALONE, Some(false)).unwrap()} - } - #[inline] - pub fn scale(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DocumentGridConfig::VT_SCALE, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DocumentGridConfig<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("columns", Self::VT_COLUMNS, false)? - .visit_field::("gap_x", Self::VT_GAP_X, false)? - .visit_field::("gap_y", Self::VT_GAP_Y, false)? - .visit_field::("align_items", Self::VT_ALIGN_ITEMS, false)? - .visit_field::("first_page_alone", Self::VT_FIRST_PAGE_ALONE, false)? - .visit_field::("scale", Self::VT_SCALE, false)? - .finish(); - Ok(()) - } -} -pub struct DocumentGridConfigArgs { - pub columns: i32, - pub gap_x: f64, - pub gap_y: f64, - pub align_items: Option, - pub first_page_alone: bool, - pub scale: f64, -} -impl<'a> Default for DocumentGridConfigArgs { - #[inline] - fn default() -> Self { - DocumentGridConfigArgs { - columns: 0, - gap_x: 0.0, - gap_y: 0.0, - align_items: None, - first_page_alone: false, - scale: 0.0, - } - } -} - -pub struct DocumentGridConfigBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DocumentGridConfigBuilder<'a, 'b, A> { - #[inline] - pub fn add_columns(&mut self, columns: i32) { - self.fbb_.push_slot::(DocumentGridConfig::VT_COLUMNS, columns, 0); - } - #[inline] - pub fn add_gap_x(&mut self, gap_x: f64) { - self.fbb_.push_slot::(DocumentGridConfig::VT_GAP_X, gap_x, 0.0); - } - #[inline] - pub fn add_gap_y(&mut self, gap_y: f64) { - self.fbb_.push_slot::(DocumentGridConfig::VT_GAP_Y, gap_y, 0.0); - } - #[inline] - pub fn add_align_items(&mut self, align_items: DOCUMENT_GRID_ALIGN_ITEMS) { - self.fbb_.push_slot_always::(DocumentGridConfig::VT_ALIGN_ITEMS, align_items); - } - #[inline] - pub fn add_first_page_alone(&mut self, first_page_alone: bool) { - self.fbb_.push_slot::(DocumentGridConfig::VT_FIRST_PAGE_ALONE, first_page_alone, false); - } - #[inline] - pub fn add_scale(&mut self, scale: f64) { - self.fbb_.push_slot::(DocumentGridConfig::VT_SCALE, scale, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DocumentGridConfigBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DocumentGridConfigBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DocumentGridConfig<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DocumentGridConfig"); - ds.field("columns", &self.columns()); - ds.field("gap_x", &self.gap_x()); - ds.field("gap_y", &self.gap_y()); - ds.field("align_items", &self.align_items()); - ds.field("first_page_alone", &self.first_page_alone()); - ds.field("scale", &self.scale()); - ds.finish() - } -} -pub enum DucPdfElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucPdfElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucPdfElement<'a> { - type Inner = DucPdfElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucPdfElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_FILE_ID: flatbuffers::VOffsetT = 6; - pub const VT_GRID_CONFIG: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucPdfElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucPdfElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucPdfElementBuilder::new(_fbb); - if let Some(x) = args.grid_config { builder.add_grid_config(x); } - if let Some(x) = args.file_id { builder.add_file_id(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucPdfElement::VT_BASE, None)} - } - #[inline] - pub fn file_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucPdfElement::VT_FILE_ID, None)} - } - #[inline] - pub fn grid_config(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucPdfElement::VT_GRID_CONFIG, None)} - } -} - -impl flatbuffers::Verifiable for DucPdfElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>("file_id", Self::VT_FILE_ID, false)? - .visit_field::>("grid_config", Self::VT_GRID_CONFIG, false)? - .finish(); - Ok(()) - } -} -pub struct DucPdfElementArgs<'a> { - pub base: Option>>, - pub file_id: Option>, - pub grid_config: Option>>, -} -impl<'a> Default for DucPdfElementArgs<'a> { - #[inline] - fn default() -> Self { - DucPdfElementArgs { - base: None, - file_id: None, - grid_config: None, - } - } -} - -pub struct DucPdfElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucPdfElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucPdfElement::VT_BASE, base); - } - #[inline] - pub fn add_file_id(&mut self, file_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucPdfElement::VT_FILE_ID, file_id); - } - #[inline] - pub fn add_grid_config(&mut self, grid_config: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucPdfElement::VT_GRID_CONFIG, grid_config); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucPdfElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucPdfElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucPdfElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucPdfElement"); - ds.field("base", &self.base()); - ds.field("file_id", &self.file_id()); - ds.field("grid_config", &self.grid_config()); - ds.finish() - } -} -pub enum DucMermaidElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucMermaidElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucMermaidElement<'a> { - type Inner = DucMermaidElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucMermaidElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_SOURCE: flatbuffers::VOffsetT = 6; - pub const VT_THEME: flatbuffers::VOffsetT = 8; - pub const VT_SVG_PATH: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucMermaidElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucMermaidElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucMermaidElementBuilder::new(_fbb); - if let Some(x) = args.svg_path { builder.add_svg_path(x); } - if let Some(x) = args.theme { builder.add_theme(x); } - if let Some(x) = args.source { builder.add_source(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucMermaidElement::VT_BASE, None)} - } - #[inline] - pub fn source(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucMermaidElement::VT_SOURCE, None)} - } - #[inline] - pub fn theme(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucMermaidElement::VT_THEME, None)} - } - #[inline] - pub fn svg_path(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucMermaidElement::VT_SVG_PATH, None)} - } -} - -impl flatbuffers::Verifiable for DucMermaidElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>("source", Self::VT_SOURCE, false)? - .visit_field::>("theme", Self::VT_THEME, false)? - .visit_field::>("svg_path", Self::VT_SVG_PATH, false)? - .finish(); - Ok(()) - } -} -pub struct DucMermaidElementArgs<'a> { - pub base: Option>>, - pub source: Option>, - pub theme: Option>, - pub svg_path: Option>, -} -impl<'a> Default for DucMermaidElementArgs<'a> { - #[inline] - fn default() -> Self { - DucMermaidElementArgs { - base: None, - source: None, - theme: None, - svg_path: None, - } - } -} - -pub struct DucMermaidElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucMermaidElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucMermaidElement::VT_BASE, base); - } - #[inline] - pub fn add_source(&mut self, source: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucMermaidElement::VT_SOURCE, source); - } - #[inline] - pub fn add_theme(&mut self, theme: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucMermaidElement::VT_THEME, theme); - } - #[inline] - pub fn add_svg_path(&mut self, svg_path: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucMermaidElement::VT_SVG_PATH, svg_path); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucMermaidElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucMermaidElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucMermaidElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucMermaidElement"); - ds.field("base", &self.base()); - ds.field("source", &self.source()); - ds.field("theme", &self.theme()); - ds.field("svg_path", &self.svg_path()); - ds.finish() - } -} -pub enum DucTableColumnOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTableColumn<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTableColumn<'a> { - type Inner = DucTableColumn<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTableColumn<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_WIDTH: flatbuffers::VOffsetT = 6; - pub const VT_STYLE_OVERRIDES: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTableColumn { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTableColumnArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTableColumnBuilder::new(_fbb); - builder.add_width(args.width); - if let Some(x) = args.style_overrides { builder.add_style_overrides(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableColumn::VT_ID, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DucTableColumn) -> bool { - self.id() < o.id() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.id(); - key.cmp(val) - } - #[inline] - pub fn width(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTableColumn::VT_WIDTH, Some(0.0)).unwrap()} - } - #[inline] - pub fn style_overrides(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableColumn::VT_STYLE_OVERRIDES, None)} - } -} - -impl flatbuffers::Verifiable for DucTableColumn<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, true)? - .visit_field::("width", Self::VT_WIDTH, false)? - .visit_field::>("style_overrides", Self::VT_STYLE_OVERRIDES, false)? - .finish(); - Ok(()) - } -} -pub struct DucTableColumnArgs<'a> { - pub id: Option>, - pub width: f64, - pub style_overrides: Option>>, -} -impl<'a> Default for DucTableColumnArgs<'a> { - #[inline] - fn default() -> Self { - DucTableColumnArgs { - id: None, // required field - width: 0.0, - style_overrides: None, - } - } -} - -pub struct DucTableColumnBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTableColumnBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTableColumn::VT_ID, id); - } - #[inline] - pub fn add_width(&mut self, width: f64) { - self.fbb_.push_slot::(DucTableColumn::VT_WIDTH, width, 0.0); - } - #[inline] - pub fn add_style_overrides(&mut self, style_overrides: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableColumn::VT_STYLE_OVERRIDES, style_overrides); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTableColumnBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTableColumnBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DucTableColumn::VT_ID,"id"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTableColumn<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTableColumn"); - ds.field("id", &self.id()); - ds.field("width", &self.width()); - ds.field("style_overrides", &self.style_overrides()); - ds.finish() - } -} -pub enum DucTableRowOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTableRow<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTableRow<'a> { - type Inner = DucTableRow<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTableRow<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_HEIGHT: flatbuffers::VOffsetT = 6; - pub const VT_STYLE_OVERRIDES: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTableRow { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTableRowArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTableRowBuilder::new(_fbb); - builder.add_height(args.height); - if let Some(x) = args.style_overrides { builder.add_style_overrides(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableRow::VT_ID, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DucTableRow) -> bool { - self.id() < o.id() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.id(); - key.cmp(val) - } - #[inline] - pub fn height(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTableRow::VT_HEIGHT, Some(0.0)).unwrap()} - } - #[inline] - pub fn style_overrides(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableRow::VT_STYLE_OVERRIDES, None)} - } -} - -impl flatbuffers::Verifiable for DucTableRow<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, true)? - .visit_field::("height", Self::VT_HEIGHT, false)? - .visit_field::>("style_overrides", Self::VT_STYLE_OVERRIDES, false)? - .finish(); - Ok(()) - } -} -pub struct DucTableRowArgs<'a> { - pub id: Option>, - pub height: f64, - pub style_overrides: Option>>, -} -impl<'a> Default for DucTableRowArgs<'a> { - #[inline] - fn default() -> Self { - DucTableRowArgs { - id: None, // required field - height: 0.0, - style_overrides: None, - } - } -} - -pub struct DucTableRowBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTableRowBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTableRow::VT_ID, id); - } - #[inline] - pub fn add_height(&mut self, height: f64) { - self.fbb_.push_slot::(DucTableRow::VT_HEIGHT, height, 0.0); - } - #[inline] - pub fn add_style_overrides(&mut self, style_overrides: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableRow::VT_STYLE_OVERRIDES, style_overrides); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTableRowBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTableRowBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DucTableRow::VT_ID,"id"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTableRow<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTableRow"); - ds.field("id", &self.id()); - ds.field("height", &self.height()); - ds.field("style_overrides", &self.style_overrides()); - ds.finish() - } -} -pub enum DucTableCellSpanOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTableCellSpan<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTableCellSpan<'a> { - type Inner = DucTableCellSpan<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTableCellSpan<'a> { - pub const VT_COLUMNS: flatbuffers::VOffsetT = 4; - pub const VT_ROWS: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTableCellSpan { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTableCellSpanArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTableCellSpanBuilder::new(_fbb); - builder.add_rows(args.rows); - builder.add_columns(args.columns); - builder.finish() - } - - - #[inline] - pub fn columns(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTableCellSpan::VT_COLUMNS, Some(0)).unwrap()} - } - #[inline] - pub fn rows(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTableCellSpan::VT_ROWS, Some(0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucTableCellSpan<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("columns", Self::VT_COLUMNS, false)? - .visit_field::("rows", Self::VT_ROWS, false)? - .finish(); - Ok(()) - } -} -pub struct DucTableCellSpanArgs { - pub columns: i32, - pub rows: i32, -} -impl<'a> Default for DucTableCellSpanArgs { - #[inline] - fn default() -> Self { - DucTableCellSpanArgs { - columns: 0, - rows: 0, - } - } -} - -pub struct DucTableCellSpanBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTableCellSpanBuilder<'a, 'b, A> { - #[inline] - pub fn add_columns(&mut self, columns: i32) { - self.fbb_.push_slot::(DucTableCellSpan::VT_COLUMNS, columns, 0); - } - #[inline] - pub fn add_rows(&mut self, rows: i32) { - self.fbb_.push_slot::(DucTableCellSpan::VT_ROWS, rows, 0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTableCellSpanBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTableCellSpanBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTableCellSpan<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTableCellSpan"); - ds.field("columns", &self.columns()); - ds.field("rows", &self.rows()); - ds.finish() - } -} -pub enum DucTableCellOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTableCell<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTableCell<'a> { - type Inner = DucTableCell<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTableCell<'a> { - pub const VT_ROW_ID: flatbuffers::VOffsetT = 4; - pub const VT_COLUMN_ID: flatbuffers::VOffsetT = 6; - pub const VT_DATA: flatbuffers::VOffsetT = 8; - pub const VT_SPAN: flatbuffers::VOffsetT = 10; - pub const VT_LOCKED: flatbuffers::VOffsetT = 12; - pub const VT_STYLE_OVERRIDES: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTableCell { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTableCellArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTableCellBuilder::new(_fbb); - if let Some(x) = args.style_overrides { builder.add_style_overrides(x); } - if let Some(x) = args.span { builder.add_span(x); } - if let Some(x) = args.data { builder.add_data(x); } - if let Some(x) = args.column_id { builder.add_column_id(x); } - if let Some(x) = args.row_id { builder.add_row_id(x); } - builder.add_locked(args.locked); - builder.finish() - } - - - #[inline] - pub fn row_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableCell::VT_ROW_ID, None)} - } - #[inline] - pub fn column_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableCell::VT_COLUMN_ID, None)} - } - #[inline] - pub fn data(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableCell::VT_DATA, None)} - } - #[inline] - pub fn span(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableCell::VT_SPAN, None)} - } - #[inline] - pub fn locked(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTableCell::VT_LOCKED, Some(false)).unwrap()} - } - #[inline] - pub fn style_overrides(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableCell::VT_STYLE_OVERRIDES, None)} - } -} - -impl flatbuffers::Verifiable for DucTableCell<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("row_id", Self::VT_ROW_ID, false)? - .visit_field::>("column_id", Self::VT_COLUMN_ID, false)? - .visit_field::>("data", Self::VT_DATA, false)? - .visit_field::>("span", Self::VT_SPAN, false)? - .visit_field::("locked", Self::VT_LOCKED, false)? - .visit_field::>("style_overrides", Self::VT_STYLE_OVERRIDES, false)? - .finish(); - Ok(()) - } -} -pub struct DucTableCellArgs<'a> { - pub row_id: Option>, - pub column_id: Option>, - pub data: Option>, - pub span: Option>>, - pub locked: bool, - pub style_overrides: Option>>, -} -impl<'a> Default for DucTableCellArgs<'a> { - #[inline] - fn default() -> Self { - DucTableCellArgs { - row_id: None, - column_id: None, - data: None, - span: None, - locked: false, - style_overrides: None, - } - } -} - -pub struct DucTableCellBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTableCellBuilder<'a, 'b, A> { - #[inline] - pub fn add_row_id(&mut self, row_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTableCell::VT_ROW_ID, row_id); - } - #[inline] - pub fn add_column_id(&mut self, column_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTableCell::VT_COLUMN_ID, column_id); - } - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTableCell::VT_DATA, data); - } - #[inline] - pub fn add_span(&mut self, span: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableCell::VT_SPAN, span); - } - #[inline] - pub fn add_locked(&mut self, locked: bool) { - self.fbb_.push_slot::(DucTableCell::VT_LOCKED, locked, false); - } - #[inline] - pub fn add_style_overrides(&mut self, style_overrides: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableCell::VT_STYLE_OVERRIDES, style_overrides); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTableCellBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTableCellBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTableCell<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTableCell"); - ds.field("row_id", &self.row_id()); - ds.field("column_id", &self.column_id()); - ds.field("data", &self.data()); - ds.field("span", &self.span()); - ds.field("locked", &self.locked()); - ds.field("style_overrides", &self.style_overrides()); - ds.finish() - } -} -pub enum DucTableColumnEntryOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTableColumnEntry<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTableColumnEntry<'a> { - type Inner = DucTableColumnEntry<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTableColumnEntry<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_VALUE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTableColumnEntry { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTableColumnEntryArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTableColumnEntryBuilder::new(_fbb); - if let Some(x) = args.value { builder.add_value(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableColumnEntry::VT_KEY, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DucTableColumnEntry) -> bool { - self.key() < o.key() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.key(); - key.cmp(val) - } - #[inline] - pub fn value(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableColumnEntry::VT_VALUE, None)} - } -} - -impl flatbuffers::Verifiable for DucTableColumnEntry<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>("value", Self::VT_VALUE, false)? - .finish(); - Ok(()) - } -} -pub struct DucTableColumnEntryArgs<'a> { - pub key: Option>, - pub value: Option>>, -} -impl<'a> Default for DucTableColumnEntryArgs<'a> { - #[inline] - fn default() -> Self { - DucTableColumnEntryArgs { - key: None, // required field - value: None, - } - } -} - -pub struct DucTableColumnEntryBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTableColumnEntryBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTableColumnEntry::VT_KEY, key); - } - #[inline] - pub fn add_value(&mut self, value: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableColumnEntry::VT_VALUE, value); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTableColumnEntryBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTableColumnEntryBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DucTableColumnEntry::VT_KEY,"key"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTableColumnEntry<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTableColumnEntry"); - ds.field("key", &self.key()); - ds.field("value", &self.value()); - ds.finish() - } -} -pub enum DucTableRowEntryOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTableRowEntry<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTableRowEntry<'a> { - type Inner = DucTableRowEntry<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTableRowEntry<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_VALUE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTableRowEntry { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTableRowEntryArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTableRowEntryBuilder::new(_fbb); - if let Some(x) = args.value { builder.add_value(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableRowEntry::VT_KEY, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DucTableRowEntry) -> bool { - self.key() < o.key() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.key(); - key.cmp(val) - } - #[inline] - pub fn value(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableRowEntry::VT_VALUE, None)} - } -} - -impl flatbuffers::Verifiable for DucTableRowEntry<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>("value", Self::VT_VALUE, false)? - .finish(); - Ok(()) - } -} -pub struct DucTableRowEntryArgs<'a> { - pub key: Option>, - pub value: Option>>, -} -impl<'a> Default for DucTableRowEntryArgs<'a> { - #[inline] - fn default() -> Self { - DucTableRowEntryArgs { - key: None, // required field - value: None, - } - } -} - -pub struct DucTableRowEntryBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTableRowEntryBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTableRowEntry::VT_KEY, key); - } - #[inline] - pub fn add_value(&mut self, value: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableRowEntry::VT_VALUE, value); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTableRowEntryBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTableRowEntryBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DucTableRowEntry::VT_KEY,"key"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTableRowEntry<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTableRowEntry"); - ds.field("key", &self.key()); - ds.field("value", &self.value()); - ds.finish() - } -} -pub enum DucTableCellEntryOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTableCellEntry<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTableCellEntry<'a> { - type Inner = DucTableCellEntry<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTableCellEntry<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_VALUE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTableCellEntry { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTableCellEntryArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTableCellEntryBuilder::new(_fbb); - if let Some(x) = args.value { builder.add_value(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableCellEntry::VT_KEY, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DucTableCellEntry) -> bool { - self.key() < o.key() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.key(); - key.cmp(val) - } - #[inline] - pub fn value(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableCellEntry::VT_VALUE, None)} - } -} - -impl flatbuffers::Verifiable for DucTableCellEntry<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>("value", Self::VT_VALUE, false)? - .finish(); - Ok(()) - } -} -pub struct DucTableCellEntryArgs<'a> { - pub key: Option>, - pub value: Option>>, -} -impl<'a> Default for DucTableCellEntryArgs<'a> { - #[inline] - fn default() -> Self { - DucTableCellEntryArgs { - key: None, // required field - value: None, - } - } -} - -pub struct DucTableCellEntryBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTableCellEntryBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTableCellEntry::VT_KEY, key); - } - #[inline] - pub fn add_value(&mut self, value: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableCellEntry::VT_VALUE, value); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTableCellEntryBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTableCellEntryBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DucTableCellEntry::VT_KEY,"key"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTableCellEntry<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTableCellEntry"); - ds.field("key", &self.key()); - ds.field("value", &self.value()); - ds.finish() - } -} -pub enum DucTableAutoSizeOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTableAutoSize<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTableAutoSize<'a> { - type Inner = DucTableAutoSize<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTableAutoSize<'a> { - pub const VT_COLUMNS: flatbuffers::VOffsetT = 4; - pub const VT_ROWS: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTableAutoSize { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTableAutoSizeArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTableAutoSizeBuilder::new(_fbb); - builder.add_rows(args.rows); - builder.add_columns(args.columns); - builder.finish() - } - - - #[inline] - pub fn columns(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTableAutoSize::VT_COLUMNS, Some(false)).unwrap()} - } - #[inline] - pub fn rows(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTableAutoSize::VT_ROWS, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucTableAutoSize<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("columns", Self::VT_COLUMNS, false)? - .visit_field::("rows", Self::VT_ROWS, false)? - .finish(); - Ok(()) - } -} -pub struct DucTableAutoSizeArgs { - pub columns: bool, - pub rows: bool, -} -impl<'a> Default for DucTableAutoSizeArgs { - #[inline] - fn default() -> Self { - DucTableAutoSizeArgs { - columns: false, - rows: false, - } - } -} - -pub struct DucTableAutoSizeBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTableAutoSizeBuilder<'a, 'b, A> { - #[inline] - pub fn add_columns(&mut self, columns: bool) { - self.fbb_.push_slot::(DucTableAutoSize::VT_COLUMNS, columns, false); - } - #[inline] - pub fn add_rows(&mut self, rows: bool) { - self.fbb_.push_slot::(DucTableAutoSize::VT_ROWS, rows, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTableAutoSizeBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTableAutoSizeBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTableAutoSize<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTableAutoSize"); - ds.field("columns", &self.columns()); - ds.field("rows", &self.rows()); - ds.finish() - } -} -pub enum DucTableElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTableElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTableElement<'a> { - type Inner = DucTableElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTableElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - pub const VT_COLUMN_ORDER: flatbuffers::VOffsetT = 8; - pub const VT_ROW_ORDER: flatbuffers::VOffsetT = 10; - pub const VT_COLUMNS: flatbuffers::VOffsetT = 12; - pub const VT_ROWS: flatbuffers::VOffsetT = 14; - pub const VT_CELLS: flatbuffers::VOffsetT = 16; - pub const VT_HEADER_ROW_COUNT: flatbuffers::VOffsetT = 18; - pub const VT_AUTO_SIZE: flatbuffers::VOffsetT = 20; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTableElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTableElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTableElementBuilder::new(_fbb); - if let Some(x) = args.auto_size { builder.add_auto_size(x); } - builder.add_header_row_count(args.header_row_count); - if let Some(x) = args.cells { builder.add_cells(x); } - if let Some(x) = args.rows { builder.add_rows(x); } - if let Some(x) = args.columns { builder.add_columns(x); } - if let Some(x) = args.row_order { builder.add_row_order(x); } - if let Some(x) = args.column_order { builder.add_column_order(x); } - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableElement::VT_BASE, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableElement::VT_STYLE, None)} - } - #[inline] - pub fn column_order(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucTableElement::VT_COLUMN_ORDER, None)} - } - #[inline] - pub fn row_order(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucTableElement::VT_ROW_ORDER, None)} - } - #[inline] - pub fn columns(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucTableElement::VT_COLUMNS, None)} - } - #[inline] - pub fn rows(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucTableElement::VT_ROWS, None)} - } - #[inline] - pub fn cells(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucTableElement::VT_CELLS, None)} - } - #[inline] - pub fn header_row_count(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTableElement::VT_HEADER_ROW_COUNT, Some(0)).unwrap()} - } - #[inline] - pub fn auto_size(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTableElement::VT_AUTO_SIZE, None)} - } -} - -impl flatbuffers::Verifiable for DucTableElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .visit_field::>>>("column_order", Self::VT_COLUMN_ORDER, false)? - .visit_field::>>>("row_order", Self::VT_ROW_ORDER, false)? - .visit_field::>>>("columns", Self::VT_COLUMNS, false)? - .visit_field::>>>("rows", Self::VT_ROWS, false)? - .visit_field::>>>("cells", Self::VT_CELLS, false)? - .visit_field::("header_row_count", Self::VT_HEADER_ROW_COUNT, false)? - .visit_field::>("auto_size", Self::VT_AUTO_SIZE, false)? - .finish(); - Ok(()) - } -} -pub struct DucTableElementArgs<'a> { - pub base: Option>>, - pub style: Option>>, - pub column_order: Option>>>, - pub row_order: Option>>>, - pub columns: Option>>>>, - pub rows: Option>>>>, - pub cells: Option>>>>, - pub header_row_count: i32, - pub auto_size: Option>>, -} -impl<'a> Default for DucTableElementArgs<'a> { - #[inline] - fn default() -> Self { - DucTableElementArgs { - base: None, - style: None, - column_order: None, - row_order: None, - columns: None, - rows: None, - cells: None, - header_row_count: 0, - auto_size: None, - } - } -} - -pub struct DucTableElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTableElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucTableElement::VT_BASE, base); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableElement::VT_STYLE, style); - } - #[inline] - pub fn add_column_order(&mut self, column_order: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(DucTableElement::VT_COLUMN_ORDER, column_order); - } - #[inline] - pub fn add_row_order(&mut self, row_order: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(DucTableElement::VT_ROW_ORDER, row_order); - } - #[inline] - pub fn add_columns(&mut self, columns: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DucTableElement::VT_COLUMNS, columns); - } - #[inline] - pub fn add_rows(&mut self, rows: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DucTableElement::VT_ROWS, rows); - } - #[inline] - pub fn add_cells(&mut self, cells: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DucTableElement::VT_CELLS, cells); - } - #[inline] - pub fn add_header_row_count(&mut self, header_row_count: i32) { - self.fbb_.push_slot::(DucTableElement::VT_HEADER_ROW_COUNT, header_row_count, 0); - } - #[inline] - pub fn add_auto_size(&mut self, auto_size: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTableElement::VT_AUTO_SIZE, auto_size); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTableElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTableElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTableElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTableElement"); - ds.field("base", &self.base()); - ds.field("style", &self.style()); - ds.field("column_order", &self.column_order()); - ds.field("row_order", &self.row_order()); - ds.field("columns", &self.columns()); - ds.field("rows", &self.rows()); - ds.field("cells", &self.cells()); - ds.field("header_row_count", &self.header_row_count()); - ds.field("auto_size", &self.auto_size()); - ds.finish() - } -} -pub enum ImageCropOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ImageCrop<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ImageCrop<'a> { - type Inner = ImageCrop<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ImageCrop<'a> { - pub const VT_X: flatbuffers::VOffsetT = 4; - pub const VT_Y: flatbuffers::VOffsetT = 6; - pub const VT_WIDTH: flatbuffers::VOffsetT = 8; - pub const VT_HEIGHT: flatbuffers::VOffsetT = 10; - pub const VT_NATURAL_WIDTH: flatbuffers::VOffsetT = 12; - pub const VT_NATURAL_HEIGHT: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ImageCrop { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args ImageCropArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = ImageCropBuilder::new(_fbb); - builder.add_natural_height(args.natural_height); - builder.add_natural_width(args.natural_width); - builder.add_height(args.height); - builder.add_width(args.width); - builder.add_y(args.y); - builder.add_x(args.x); - builder.finish() - } - - - #[inline] - pub fn x(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ImageCrop::VT_X, Some(0.0)).unwrap()} - } - #[inline] - pub fn y(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ImageCrop::VT_Y, Some(0.0)).unwrap()} - } - #[inline] - pub fn width(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ImageCrop::VT_WIDTH, Some(0.0)).unwrap()} - } - #[inline] - pub fn height(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ImageCrop::VT_HEIGHT, Some(0.0)).unwrap()} - } - #[inline] - pub fn natural_width(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ImageCrop::VT_NATURAL_WIDTH, Some(0.0)).unwrap()} - } - #[inline] - pub fn natural_height(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ImageCrop::VT_NATURAL_HEIGHT, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for ImageCrop<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("x", Self::VT_X, false)? - .visit_field::("y", Self::VT_Y, false)? - .visit_field::("width", Self::VT_WIDTH, false)? - .visit_field::("height", Self::VT_HEIGHT, false)? - .visit_field::("natural_width", Self::VT_NATURAL_WIDTH, false)? - .visit_field::("natural_height", Self::VT_NATURAL_HEIGHT, false)? - .finish(); - Ok(()) - } -} -pub struct ImageCropArgs { - pub x: f64, - pub y: f64, - pub width: f64, - pub height: f64, - pub natural_width: f64, - pub natural_height: f64, -} -impl<'a> Default for ImageCropArgs { - #[inline] - fn default() -> Self { - ImageCropArgs { - x: 0.0, - y: 0.0, - width: 0.0, - height: 0.0, - natural_width: 0.0, - natural_height: 0.0, - } - } -} - -pub struct ImageCropBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ImageCropBuilder<'a, 'b, A> { - #[inline] - pub fn add_x(&mut self, x: f64) { - self.fbb_.push_slot::(ImageCrop::VT_X, x, 0.0); - } - #[inline] - pub fn add_y(&mut self, y: f64) { - self.fbb_.push_slot::(ImageCrop::VT_Y, y, 0.0); - } - #[inline] - pub fn add_width(&mut self, width: f64) { - self.fbb_.push_slot::(ImageCrop::VT_WIDTH, width, 0.0); - } - #[inline] - pub fn add_height(&mut self, height: f64) { - self.fbb_.push_slot::(ImageCrop::VT_HEIGHT, height, 0.0); - } - #[inline] - pub fn add_natural_width(&mut self, natural_width: f64) { - self.fbb_.push_slot::(ImageCrop::VT_NATURAL_WIDTH, natural_width, 0.0); - } - #[inline] - pub fn add_natural_height(&mut self, natural_height: f64) { - self.fbb_.push_slot::(ImageCrop::VT_NATURAL_HEIGHT, natural_height, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ImageCropBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - ImageCropBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ImageCrop<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ImageCrop"); - ds.field("x", &self.x()); - ds.field("y", &self.y()); - ds.field("width", &self.width()); - ds.field("height", &self.height()); - ds.field("natural_width", &self.natural_width()); - ds.field("natural_height", &self.natural_height()); - ds.finish() - } -} -pub enum DucImageElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucImageElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucImageElement<'a> { - type Inner = DucImageElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucImageElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_FILE_ID: flatbuffers::VOffsetT = 6; - pub const VT_STATUS: flatbuffers::VOffsetT = 8; - pub const VT_SCALE: flatbuffers::VOffsetT = 10; - pub const VT_CROP: flatbuffers::VOffsetT = 12; - pub const VT_FILTER: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucImageElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucImageElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucImageElementBuilder::new(_fbb); - if let Some(x) = args.filter { builder.add_filter(x); } - if let Some(x) = args.crop { builder.add_crop(x); } - if let Some(x) = args.scale { builder.add_scale(x); } - if let Some(x) = args.file_id { builder.add_file_id(x); } - if let Some(x) = args.base { builder.add_base(x); } - if let Some(x) = args.status { builder.add_status(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucImageElement::VT_BASE, None)} - } - #[inline] - pub fn file_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucImageElement::VT_FILE_ID, None)} - } - #[inline] - pub fn status(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucImageElement::VT_STATUS, None)} - } - #[inline] - pub fn scale(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DucImageElement::VT_SCALE, None)} - } - #[inline] - pub fn crop(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucImageElement::VT_CROP, None)} - } - #[inline] - pub fn filter(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucImageElement::VT_FILTER, None)} - } -} - -impl flatbuffers::Verifiable for DucImageElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>("file_id", Self::VT_FILE_ID, false)? - .visit_field::("status", Self::VT_STATUS, false)? - .visit_field::>>("scale", Self::VT_SCALE, false)? - .visit_field::>("crop", Self::VT_CROP, false)? - .visit_field::>("filter", Self::VT_FILTER, false)? - .finish(); - Ok(()) - } -} -pub struct DucImageElementArgs<'a> { - pub base: Option>>, - pub file_id: Option>, - pub status: Option, - pub scale: Option>>, - pub crop: Option>>, - pub filter: Option>>, -} -impl<'a> Default for DucImageElementArgs<'a> { - #[inline] - fn default() -> Self { - DucImageElementArgs { - base: None, - file_id: None, - status: None, - scale: None, - crop: None, - filter: None, - } - } -} - -pub struct DucImageElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucImageElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucImageElement::VT_BASE, base); - } - #[inline] - pub fn add_file_id(&mut self, file_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucImageElement::VT_FILE_ID, file_id); - } - #[inline] - pub fn add_status(&mut self, status: IMAGE_STATUS) { - self.fbb_.push_slot_always::(DucImageElement::VT_STATUS, status); - } - #[inline] - pub fn add_scale(&mut self, scale: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucImageElement::VT_SCALE, scale); - } - #[inline] - pub fn add_crop(&mut self, crop: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucImageElement::VT_CROP, crop); - } - #[inline] - pub fn add_filter(&mut self, filter: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucImageElement::VT_FILTER, filter); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucImageElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucImageElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucImageElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucImageElement"); - ds.field("base", &self.base()); - ds.field("file_id", &self.file_id()); - ds.field("status", &self.status()); - ds.field("scale", &self.scale()); - ds.field("crop", &self.crop()); - ds.field("filter", &self.filter()); - ds.finish() - } -} -pub enum DucTextDynamicElementSourceOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTextDynamicElementSource<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTextDynamicElementSource<'a> { - type Inner = DucTextDynamicElementSource<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTextDynamicElementSource<'a> { - pub const VT_ELEMENT_ID: flatbuffers::VOffsetT = 4; - pub const VT_PROPERTY: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTextDynamicElementSource { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTextDynamicElementSourceArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTextDynamicElementSourceBuilder::new(_fbb); - if let Some(x) = args.element_id { builder.add_element_id(x); } - if let Some(x) = args.property { builder.add_property(x); } - builder.finish() - } - - - #[inline] - pub fn element_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextDynamicElementSource::VT_ELEMENT_ID, None)} - } - #[inline] - pub fn property(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextDynamicElementSource::VT_PROPERTY, None)} - } -} - -impl flatbuffers::Verifiable for DucTextDynamicElementSource<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("element_id", Self::VT_ELEMENT_ID, false)? - .visit_field::("property", Self::VT_PROPERTY, false)? - .finish(); - Ok(()) - } -} -pub struct DucTextDynamicElementSourceArgs<'a> { - pub element_id: Option>, - pub property: Option, -} -impl<'a> Default for DucTextDynamicElementSourceArgs<'a> { - #[inline] - fn default() -> Self { - DucTextDynamicElementSourceArgs { - element_id: None, - property: None, - } - } -} - -pub struct DucTextDynamicElementSourceBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTextDynamicElementSourceBuilder<'a, 'b, A> { - #[inline] - pub fn add_element_id(&mut self, element_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTextDynamicElementSource::VT_ELEMENT_ID, element_id); - } - #[inline] - pub fn add_property(&mut self, property: TEXT_FIELD_SOURCE_PROPERTY) { - self.fbb_.push_slot_always::(DucTextDynamicElementSource::VT_PROPERTY, property); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTextDynamicElementSourceBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTextDynamicElementSourceBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTextDynamicElementSource<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTextDynamicElementSource"); - ds.field("element_id", &self.element_id()); - ds.field("property", &self.property()); - ds.finish() - } -} -pub enum DucTextDynamicDictionarySourceOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTextDynamicDictionarySource<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTextDynamicDictionarySource<'a> { - type Inner = DucTextDynamicDictionarySource<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTextDynamicDictionarySource<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTextDynamicDictionarySource { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTextDynamicDictionarySourceArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTextDynamicDictionarySourceBuilder::new(_fbb); - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextDynamicDictionarySource::VT_KEY, None)} - } -} - -impl flatbuffers::Verifiable for DucTextDynamicDictionarySource<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, false)? - .finish(); - Ok(()) - } -} -pub struct DucTextDynamicDictionarySourceArgs<'a> { - pub key: Option>, -} -impl<'a> Default for DucTextDynamicDictionarySourceArgs<'a> { - #[inline] - fn default() -> Self { - DucTextDynamicDictionarySourceArgs { - key: None, - } - } -} - -pub struct DucTextDynamicDictionarySourceBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTextDynamicDictionarySourceBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTextDynamicDictionarySource::VT_KEY, key); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTextDynamicDictionarySourceBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTextDynamicDictionarySourceBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTextDynamicDictionarySource<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTextDynamicDictionarySource"); - ds.field("key", &self.key()); - ds.finish() - } -} -pub enum DucTextDynamicSourceOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTextDynamicSource<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTextDynamicSource<'a> { - type Inner = DucTextDynamicSource<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTextDynamicSource<'a> { - pub const VT_TEXT_SOURCE_TYPE: flatbuffers::VOffsetT = 4; - pub const VT_SOURCE_TYPE: flatbuffers::VOffsetT = 6; - pub const VT_SOURCE: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTextDynamicSource { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTextDynamicSourceArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTextDynamicSourceBuilder::new(_fbb); - if let Some(x) = args.source { builder.add_source(x); } - builder.add_source_type(args.source_type); - if let Some(x) = args.text_source_type { builder.add_text_source_type(x); } - builder.finish() - } - - - #[inline] - pub fn text_source_type(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextDynamicSource::VT_TEXT_SOURCE_TYPE, None)} - } - #[inline] - pub fn source_type(&self) -> DucTextDynamicSourceData { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextDynamicSource::VT_SOURCE_TYPE, Some(DucTextDynamicSourceData::NONE)).unwrap()} - } - #[inline] - pub fn source(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DucTextDynamicSource::VT_SOURCE, None)} - } - #[inline] - #[allow(non_snake_case)] - pub fn source_as_duc_text_dynamic_element_source(&self) -> Option> { - if self.source_type() == DucTextDynamicSourceData::DucTextDynamicElementSource { - self.source().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucTextDynamicElementSource::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn source_as_duc_text_dynamic_dictionary_source(&self) -> Option> { - if self.source_type() == DucTextDynamicSourceData::DucTextDynamicDictionarySource { - self.source().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucTextDynamicDictionarySource::init_from_table(t) } - }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for DucTextDynamicSource<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("text_source_type", Self::VT_TEXT_SOURCE_TYPE, false)? - .visit_union::("source_type", Self::VT_SOURCE_TYPE, "source", Self::VT_SOURCE, false, |key, v, pos| { - match key { - DucTextDynamicSourceData::DucTextDynamicElementSource => v.verify_union_variant::>("DucTextDynamicSourceData::DucTextDynamicElementSource", pos), - DucTextDynamicSourceData::DucTextDynamicDictionarySource => v.verify_union_variant::>("DucTextDynamicSourceData::DucTextDynamicDictionarySource", pos), - _ => Ok(()), - } - })? - .finish(); - Ok(()) - } -} -pub struct DucTextDynamicSourceArgs { - pub text_source_type: Option, - pub source_type: DucTextDynamicSourceData, - pub source: Option>, -} -impl<'a> Default for DucTextDynamicSourceArgs { - #[inline] - fn default() -> Self { - DucTextDynamicSourceArgs { - text_source_type: None, - source_type: DucTextDynamicSourceData::NONE, - source: None, - } - } -} - -pub struct DucTextDynamicSourceBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTextDynamicSourceBuilder<'a, 'b, A> { - #[inline] - pub fn add_text_source_type(&mut self, text_source_type: TEXT_FIELD_SOURCE_TYPE) { - self.fbb_.push_slot_always::(DucTextDynamicSource::VT_TEXT_SOURCE_TYPE, text_source_type); - } - #[inline] - pub fn add_source_type(&mut self, source_type: DucTextDynamicSourceData) { - self.fbb_.push_slot::(DucTextDynamicSource::VT_SOURCE_TYPE, source_type, DucTextDynamicSourceData::NONE); - } - #[inline] - pub fn add_source(&mut self, source: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(DucTextDynamicSource::VT_SOURCE, source); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTextDynamicSourceBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTextDynamicSourceBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTextDynamicSource<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTextDynamicSource"); - ds.field("text_source_type", &self.text_source_type()); - ds.field("source_type", &self.source_type()); - match self.source_type() { - DucTextDynamicSourceData::DucTextDynamicElementSource => { - if let Some(x) = self.source_as_duc_text_dynamic_element_source() { - ds.field("source", &x) - } else { - ds.field("source", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - DucTextDynamicSourceData::DucTextDynamicDictionarySource => { - if let Some(x) = self.source_as_duc_text_dynamic_dictionary_source() { - ds.field("source", &x) - } else { - ds.field("source", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - _ => { - let x: Option<()> = None; - ds.field("source", &x) - }, - }; - ds.finish() - } -} -pub enum DucTextDynamicPartOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTextDynamicPart<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTextDynamicPart<'a> { - type Inner = DucTextDynamicPart<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTextDynamicPart<'a> { - pub const VT_TAG: flatbuffers::VOffsetT = 4; - pub const VT_SOURCE: flatbuffers::VOffsetT = 6; - pub const VT_FORMATTING: flatbuffers::VOffsetT = 8; - pub const VT_CACHED_VALUE: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTextDynamicPart { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTextDynamicPartArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTextDynamicPartBuilder::new(_fbb); - if let Some(x) = args.cached_value { builder.add_cached_value(x); } - if let Some(x) = args.formatting { builder.add_formatting(x); } - if let Some(x) = args.source { builder.add_source(x); } - if let Some(x) = args.tag { builder.add_tag(x); } - builder.finish() - } - - - #[inline] - pub fn tag(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextDynamicPart::VT_TAG, None)} - } - #[inline] - pub fn source(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextDynamicPart::VT_SOURCE, None)} - } - #[inline] - pub fn formatting(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextDynamicPart::VT_FORMATTING, None)} - } - #[inline] - pub fn cached_value(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextDynamicPart::VT_CACHED_VALUE, None)} - } -} - -impl flatbuffers::Verifiable for DucTextDynamicPart<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("tag", Self::VT_TAG, false)? - .visit_field::>("source", Self::VT_SOURCE, false)? - .visit_field::>("formatting", Self::VT_FORMATTING, false)? - .visit_field::>("cached_value", Self::VT_CACHED_VALUE, false)? - .finish(); - Ok(()) - } -} -pub struct DucTextDynamicPartArgs<'a> { - pub tag: Option>, - pub source: Option>>, - pub formatting: Option>>, - pub cached_value: Option>, -} -impl<'a> Default for DucTextDynamicPartArgs<'a> { - #[inline] - fn default() -> Self { - DucTextDynamicPartArgs { - tag: None, - source: None, - formatting: None, - cached_value: None, - } - } -} - -pub struct DucTextDynamicPartBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTextDynamicPartBuilder<'a, 'b, A> { - #[inline] - pub fn add_tag(&mut self, tag: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTextDynamicPart::VT_TAG, tag); - } - #[inline] - pub fn add_source(&mut self, source: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTextDynamicPart::VT_SOURCE, source); - } - #[inline] - pub fn add_formatting(&mut self, formatting: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTextDynamicPart::VT_FORMATTING, formatting); - } - #[inline] - pub fn add_cached_value(&mut self, cached_value: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTextDynamicPart::VT_CACHED_VALUE, cached_value); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTextDynamicPartBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTextDynamicPartBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTextDynamicPart<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTextDynamicPart"); - ds.field("tag", &self.tag()); - ds.field("source", &self.source()); - ds.field("formatting", &self.formatting()); - ds.field("cached_value", &self.cached_value()); - ds.finish() - } -} -pub enum DucTextElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucTextElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucTextElement<'a> { - type Inner = DucTextElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucTextElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - pub const VT_TEXT: flatbuffers::VOffsetT = 8; - pub const VT_DYNAMIC: flatbuffers::VOffsetT = 10; - pub const VT_AUTO_RESIZE: flatbuffers::VOffsetT = 12; - pub const VT_CONTAINER_ID: flatbuffers::VOffsetT = 14; - pub const VT_ORIGINAL_TEXT: flatbuffers::VOffsetT = 16; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucTextElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucTextElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucTextElementBuilder::new(_fbb); - if let Some(x) = args.original_text { builder.add_original_text(x); } - if let Some(x) = args.container_id { builder.add_container_id(x); } - if let Some(x) = args.dynamic { builder.add_dynamic(x); } - if let Some(x) = args.text { builder.add_text(x); } - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.add_auto_resize(args.auto_resize); - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextElement::VT_BASE, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextElement::VT_STYLE, None)} - } - #[inline] - pub fn text(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextElement::VT_TEXT, None)} - } - #[inline] - pub fn dynamic(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucTextElement::VT_DYNAMIC, None)} - } - #[inline] - pub fn auto_resize(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucTextElement::VT_AUTO_RESIZE, Some(false)).unwrap()} - } - #[inline] - pub fn container_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextElement::VT_CONTAINER_ID, None)} - } - #[inline] - pub fn original_text(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucTextElement::VT_ORIGINAL_TEXT, None)} - } -} - -impl flatbuffers::Verifiable for DucTextElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .visit_field::>("text", Self::VT_TEXT, false)? - .visit_field::>>>("dynamic", Self::VT_DYNAMIC, false)? - .visit_field::("auto_resize", Self::VT_AUTO_RESIZE, false)? - .visit_field::>("container_id", Self::VT_CONTAINER_ID, false)? - .visit_field::>("original_text", Self::VT_ORIGINAL_TEXT, false)? - .finish(); - Ok(()) - } -} -pub struct DucTextElementArgs<'a> { - pub base: Option>>, - pub style: Option>>, - pub text: Option>, - pub dynamic: Option>>>>, - pub auto_resize: bool, - pub container_id: Option>, - pub original_text: Option>, -} -impl<'a> Default for DucTextElementArgs<'a> { - #[inline] - fn default() -> Self { - DucTextElementArgs { - base: None, - style: None, - text: None, - dynamic: None, - auto_resize: false, - container_id: None, - original_text: None, - } - } -} - -pub struct DucTextElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucTextElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucTextElement::VT_BASE, base); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucTextElement::VT_STYLE, style); - } - #[inline] - pub fn add_text(&mut self, text: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTextElement::VT_TEXT, text); - } - #[inline] - pub fn add_dynamic(&mut self, dynamic: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DucTextElement::VT_DYNAMIC, dynamic); - } - #[inline] - pub fn add_auto_resize(&mut self, auto_resize: bool) { - self.fbb_.push_slot::(DucTextElement::VT_AUTO_RESIZE, auto_resize, false); - } - #[inline] - pub fn add_container_id(&mut self, container_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTextElement::VT_CONTAINER_ID, container_id); - } - #[inline] - pub fn add_original_text(&mut self, original_text: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucTextElement::VT_ORIGINAL_TEXT, original_text); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucTextElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucTextElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucTextElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucTextElement"); - ds.field("base", &self.base()); - ds.field("style", &self.style()); - ds.field("text", &self.text()); - ds.field("dynamic", &self.dynamic()); - ds.field("auto_resize", &self.auto_resize()); - ds.field("container_id", &self.container_id()); - ds.field("original_text", &self.original_text()); - ds.finish() - } -} -pub enum DucLinearElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucLinearElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucLinearElement<'a> { - type Inner = DucLinearElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucLinearElement<'a> { - pub const VT_LINEAR_BASE: flatbuffers::VOffsetT = 4; - pub const VT_WIPEOUT_BELOW: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucLinearElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucLinearElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucLinearElementBuilder::new(_fbb); - if let Some(x) = args.linear_base { builder.add_linear_base(x); } - builder.add_wipeout_below(args.wipeout_below); - builder.finish() - } - - - #[inline] - pub fn linear_base(&self) -> Option<_DucLinearElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLinearElement::VT_LINEAR_BASE, None)} - } - #[inline] - pub fn wipeout_below(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLinearElement::VT_WIPEOUT_BELOW, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucLinearElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("linear_base", Self::VT_LINEAR_BASE, false)? - .visit_field::("wipeout_below", Self::VT_WIPEOUT_BELOW, false)? - .finish(); - Ok(()) - } -} -pub struct DucLinearElementArgs<'a> { - pub linear_base: Option>>, - pub wipeout_below: bool, -} -impl<'a> Default for DucLinearElementArgs<'a> { - #[inline] - fn default() -> Self { - DucLinearElementArgs { - linear_base: None, - wipeout_below: false, - } - } -} - -pub struct DucLinearElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucLinearElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_linear_base(&mut self, linear_base: flatbuffers::WIPOffset<_DucLinearElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucLinearElement::VT_LINEAR_BASE, linear_base); - } - #[inline] - pub fn add_wipeout_below(&mut self, wipeout_below: bool) { - self.fbb_.push_slot::(DucLinearElement::VT_WIPEOUT_BELOW, wipeout_below, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucLinearElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucLinearElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucLinearElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucLinearElement"); - ds.field("linear_base", &self.linear_base()); - ds.field("wipeout_below", &self.wipeout_below()); - ds.finish() - } -} -pub enum DucArrowElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucArrowElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucArrowElement<'a> { - type Inner = DucArrowElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucArrowElement<'a> { - pub const VT_LINEAR_BASE: flatbuffers::VOffsetT = 4; - pub const VT_ELBOWED: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucArrowElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucArrowElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucArrowElementBuilder::new(_fbb); - if let Some(x) = args.linear_base { builder.add_linear_base(x); } - builder.add_elbowed(args.elbowed); - builder.finish() - } - - - #[inline] - pub fn linear_base(&self) -> Option<_DucLinearElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucArrowElement::VT_LINEAR_BASE, None)} - } - #[inline] - pub fn elbowed(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucArrowElement::VT_ELBOWED, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucArrowElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("linear_base", Self::VT_LINEAR_BASE, false)? - .visit_field::("elbowed", Self::VT_ELBOWED, false)? - .finish(); - Ok(()) - } -} -pub struct DucArrowElementArgs<'a> { - pub linear_base: Option>>, - pub elbowed: bool, -} -impl<'a> Default for DucArrowElementArgs<'a> { - #[inline] - fn default() -> Self { - DucArrowElementArgs { - linear_base: None, - elbowed: false, - } - } -} - -pub struct DucArrowElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucArrowElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_linear_base(&mut self, linear_base: flatbuffers::WIPOffset<_DucLinearElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucArrowElement::VT_LINEAR_BASE, linear_base); - } - #[inline] - pub fn add_elbowed(&mut self, elbowed: bool) { - self.fbb_.push_slot::(DucArrowElement::VT_ELBOWED, elbowed, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucArrowElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucArrowElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucArrowElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucArrowElement"); - ds.field("linear_base", &self.linear_base()); - ds.field("elbowed", &self.elbowed()); - ds.finish() - } -} -pub enum DucFreeDrawEndsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucFreeDrawEnds<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucFreeDrawEnds<'a> { - type Inner = DucFreeDrawEnds<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucFreeDrawEnds<'a> { - pub const VT_CAP: flatbuffers::VOffsetT = 4; - pub const VT_TAPER: flatbuffers::VOffsetT = 6; - pub const VT_EASING: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucFreeDrawEnds { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucFreeDrawEndsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucFreeDrawEndsBuilder::new(_fbb); - if let Some(x) = args.easing { builder.add_easing(x); } - builder.add_taper(args.taper); - builder.add_cap(args.cap); - builder.finish() - } - - - #[inline] - pub fn cap(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucFreeDrawEnds::VT_CAP, Some(false)).unwrap()} - } - #[inline] - pub fn taper(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucFreeDrawEnds::VT_TAPER, Some(0.0)).unwrap()} - } - #[inline] - pub fn easing(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFreeDrawEnds::VT_EASING, None)} - } -} - -impl flatbuffers::Verifiable for DucFreeDrawEnds<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("cap", Self::VT_CAP, false)? - .visit_field::("taper", Self::VT_TAPER, false)? - .visit_field::>("easing", Self::VT_EASING, false)? - .finish(); - Ok(()) - } -} -pub struct DucFreeDrawEndsArgs<'a> { - pub cap: bool, - pub taper: f32, - pub easing: Option>, -} -impl<'a> Default for DucFreeDrawEndsArgs<'a> { - #[inline] - fn default() -> Self { - DucFreeDrawEndsArgs { - cap: false, - taper: 0.0, - easing: None, - } - } -} - -pub struct DucFreeDrawEndsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucFreeDrawEndsBuilder<'a, 'b, A> { - #[inline] - pub fn add_cap(&mut self, cap: bool) { - self.fbb_.push_slot::(DucFreeDrawEnds::VT_CAP, cap, false); - } - #[inline] - pub fn add_taper(&mut self, taper: f32) { - self.fbb_.push_slot::(DucFreeDrawEnds::VT_TAPER, taper, 0.0); - } - #[inline] - pub fn add_easing(&mut self, easing: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucFreeDrawEnds::VT_EASING, easing); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucFreeDrawEndsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucFreeDrawEndsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucFreeDrawEnds<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucFreeDrawEnds"); - ds.field("cap", &self.cap()); - ds.field("taper", &self.taper()); - ds.field("easing", &self.easing()); - ds.finish() - } -} -pub enum DucFreeDrawElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucFreeDrawElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucFreeDrawElement<'a> { - type Inner = DucFreeDrawElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucFreeDrawElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_POINTS: flatbuffers::VOffsetT = 6; - pub const VT_SIZE: flatbuffers::VOffsetT = 8; - pub const VT_THINNING: flatbuffers::VOffsetT = 10; - pub const VT_SMOOTHING: flatbuffers::VOffsetT = 12; - pub const VT_STREAMLINE: flatbuffers::VOffsetT = 14; - pub const VT_EASING: flatbuffers::VOffsetT = 16; - pub const VT_START: flatbuffers::VOffsetT = 18; - pub const VT_END: flatbuffers::VOffsetT = 20; - pub const VT_PRESSURES: flatbuffers::VOffsetT = 22; - pub const VT_SIMULATE_PRESSURE: flatbuffers::VOffsetT = 24; - pub const VT_LAST_COMMITTED_POINT: flatbuffers::VOffsetT = 26; - pub const VT_SVG_PATH: flatbuffers::VOffsetT = 28; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucFreeDrawElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucFreeDrawElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucFreeDrawElementBuilder::new(_fbb); - builder.add_size(args.size); - if let Some(x) = args.svg_path { builder.add_svg_path(x); } - if let Some(x) = args.last_committed_point { builder.add_last_committed_point(x); } - if let Some(x) = args.pressures { builder.add_pressures(x); } - if let Some(x) = args.end { builder.add_end(x); } - if let Some(x) = args.start { builder.add_start(x); } - if let Some(x) = args.easing { builder.add_easing(x); } - builder.add_streamline(args.streamline); - builder.add_smoothing(args.smoothing); - builder.add_thinning(args.thinning); - if let Some(x) = args.points { builder.add_points(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.add_simulate_pressure(args.simulate_pressure); - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFreeDrawElement::VT_BASE, None)} - } - #[inline] - pub fn points(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucFreeDrawElement::VT_POINTS, None)} - } - #[inline] - pub fn size(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucFreeDrawElement::VT_SIZE, Some(0.0)).unwrap()} - } - #[inline] - pub fn thinning(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucFreeDrawElement::VT_THINNING, Some(0.0)).unwrap()} - } - #[inline] - pub fn smoothing(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucFreeDrawElement::VT_SMOOTHING, Some(0.0)).unwrap()} - } - #[inline] - pub fn streamline(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucFreeDrawElement::VT_STREAMLINE, Some(0.0)).unwrap()} - } - #[inline] - pub fn easing(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFreeDrawElement::VT_EASING, None)} - } - #[inline] - pub fn start(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFreeDrawElement::VT_START, None)} - } - #[inline] - pub fn end(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFreeDrawElement::VT_END, None)} - } - #[inline] - pub fn pressures(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DucFreeDrawElement::VT_PRESSURES, None)} - } - #[inline] - pub fn simulate_pressure(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucFreeDrawElement::VT_SIMULATE_PRESSURE, Some(false)).unwrap()} - } - #[inline] - pub fn last_committed_point(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFreeDrawElement::VT_LAST_COMMITTED_POINT, None)} - } - #[inline] - pub fn svg_path(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFreeDrawElement::VT_SVG_PATH, None)} - } -} - -impl flatbuffers::Verifiable for DucFreeDrawElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>>>("points", Self::VT_POINTS, false)? - .visit_field::("size", Self::VT_SIZE, false)? - .visit_field::("thinning", Self::VT_THINNING, false)? - .visit_field::("smoothing", Self::VT_SMOOTHING, false)? - .visit_field::("streamline", Self::VT_STREAMLINE, false)? - .visit_field::>("easing", Self::VT_EASING, false)? - .visit_field::>("start", Self::VT_START, false)? - .visit_field::>("end", Self::VT_END, false)? - .visit_field::>>("pressures", Self::VT_PRESSURES, false)? - .visit_field::("simulate_pressure", Self::VT_SIMULATE_PRESSURE, false)? - .visit_field::>("last_committed_point", Self::VT_LAST_COMMITTED_POINT, false)? - .visit_field::>("svg_path", Self::VT_SVG_PATH, false)? - .finish(); - Ok(()) - } -} -pub struct DucFreeDrawElementArgs<'a> { - pub base: Option>>, - pub points: Option>>>>, - pub size: f64, - pub thinning: f32, - pub smoothing: f32, - pub streamline: f32, - pub easing: Option>, - pub start: Option>>, - pub end: Option>>, - pub pressures: Option>>, - pub simulate_pressure: bool, - pub last_committed_point: Option>>, - pub svg_path: Option>, -} -impl<'a> Default for DucFreeDrawElementArgs<'a> { - #[inline] - fn default() -> Self { - DucFreeDrawElementArgs { - base: None, - points: None, - size: 0.0, - thinning: 0.0, - smoothing: 0.0, - streamline: 0.0, - easing: None, - start: None, - end: None, - pressures: None, - simulate_pressure: false, - last_committed_point: None, - svg_path: None, - } - } -} - -pub struct DucFreeDrawElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucFreeDrawElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucFreeDrawElement::VT_BASE, base); - } - #[inline] - pub fn add_points(&mut self, points: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DucFreeDrawElement::VT_POINTS, points); - } - #[inline] - pub fn add_size(&mut self, size: f64) { - self.fbb_.push_slot::(DucFreeDrawElement::VT_SIZE, size, 0.0); - } - #[inline] - pub fn add_thinning(&mut self, thinning: f32) { - self.fbb_.push_slot::(DucFreeDrawElement::VT_THINNING, thinning, 0.0); - } - #[inline] - pub fn add_smoothing(&mut self, smoothing: f32) { - self.fbb_.push_slot::(DucFreeDrawElement::VT_SMOOTHING, smoothing, 0.0); - } - #[inline] - pub fn add_streamline(&mut self, streamline: f32) { - self.fbb_.push_slot::(DucFreeDrawElement::VT_STREAMLINE, streamline, 0.0); - } - #[inline] - pub fn add_easing(&mut self, easing: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucFreeDrawElement::VT_EASING, easing); - } - #[inline] - pub fn add_start(&mut self, start: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucFreeDrawElement::VT_START, start); - } - #[inline] - pub fn add_end(&mut self, end: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucFreeDrawElement::VT_END, end); - } - #[inline] - pub fn add_pressures(&mut self, pressures: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucFreeDrawElement::VT_PRESSURES, pressures); - } - #[inline] - pub fn add_simulate_pressure(&mut self, simulate_pressure: bool) { - self.fbb_.push_slot::(DucFreeDrawElement::VT_SIMULATE_PRESSURE, simulate_pressure, false); - } - #[inline] - pub fn add_last_committed_point(&mut self, last_committed_point: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucFreeDrawElement::VT_LAST_COMMITTED_POINT, last_committed_point); - } - #[inline] - pub fn add_svg_path(&mut self, svg_path: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucFreeDrawElement::VT_SVG_PATH, svg_path); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucFreeDrawElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucFreeDrawElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucFreeDrawElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucFreeDrawElement"); - ds.field("base", &self.base()); - ds.field("points", &self.points()); - ds.field("size", &self.size()); - ds.field("thinning", &self.thinning()); - ds.field("smoothing", &self.smoothing()); - ds.field("streamline", &self.streamline()); - ds.field("easing", &self.easing()); - ds.field("start", &self.start()); - ds.field("end", &self.end()); - ds.field("pressures", &self.pressures()); - ds.field("simulate_pressure", &self.simulate_pressure()); - ds.field("last_committed_point", &self.last_committed_point()); - ds.field("svg_path", &self.svg_path()); - ds.finish() - } -} -pub enum DucBlockAttributeDefinitionOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucBlockAttributeDefinition<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucBlockAttributeDefinition<'a> { - type Inner = DucBlockAttributeDefinition<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucBlockAttributeDefinition<'a> { - pub const VT_TAG: flatbuffers::VOffsetT = 4; - pub const VT_PROMPT: flatbuffers::VOffsetT = 6; - pub const VT_DEFAULT_VALUE: flatbuffers::VOffsetT = 8; - pub const VT_IS_CONSTANT: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucBlockAttributeDefinition { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucBlockAttributeDefinitionArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucBlockAttributeDefinitionBuilder::new(_fbb); - if let Some(x) = args.default_value { builder.add_default_value(x); } - if let Some(x) = args.prompt { builder.add_prompt(x); } - if let Some(x) = args.tag { builder.add_tag(x); } - builder.add_is_constant(args.is_constant); - builder.finish() - } - - - #[inline] - pub fn tag(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockAttributeDefinition::VT_TAG, None)} - } - #[inline] - pub fn prompt(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockAttributeDefinition::VT_PROMPT, None)} - } - #[inline] - pub fn default_value(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockAttributeDefinition::VT_DEFAULT_VALUE, None)} - } - #[inline] - pub fn is_constant(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucBlockAttributeDefinition::VT_IS_CONSTANT, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucBlockAttributeDefinition<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("tag", Self::VT_TAG, false)? - .visit_field::>("prompt", Self::VT_PROMPT, false)? - .visit_field::>("default_value", Self::VT_DEFAULT_VALUE, false)? - .visit_field::("is_constant", Self::VT_IS_CONSTANT, false)? - .finish(); - Ok(()) - } -} -pub struct DucBlockAttributeDefinitionArgs<'a> { - pub tag: Option>, - pub prompt: Option>, - pub default_value: Option>, - pub is_constant: bool, -} -impl<'a> Default for DucBlockAttributeDefinitionArgs<'a> { - #[inline] - fn default() -> Self { - DucBlockAttributeDefinitionArgs { - tag: None, - prompt: None, - default_value: None, - is_constant: false, - } - } -} - -pub struct DucBlockAttributeDefinitionBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucBlockAttributeDefinitionBuilder<'a, 'b, A> { - #[inline] - pub fn add_tag(&mut self, tag: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlockAttributeDefinition::VT_TAG, tag); - } - #[inline] - pub fn add_prompt(&mut self, prompt: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlockAttributeDefinition::VT_PROMPT, prompt); - } - #[inline] - pub fn add_default_value(&mut self, default_value: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlockAttributeDefinition::VT_DEFAULT_VALUE, default_value); - } - #[inline] - pub fn add_is_constant(&mut self, is_constant: bool) { - self.fbb_.push_slot::(DucBlockAttributeDefinition::VT_IS_CONSTANT, is_constant, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucBlockAttributeDefinitionBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucBlockAttributeDefinitionBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucBlockAttributeDefinition<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucBlockAttributeDefinition"); - ds.field("tag", &self.tag()); - ds.field("prompt", &self.prompt()); - ds.field("default_value", &self.default_value()); - ds.field("is_constant", &self.is_constant()); - ds.finish() - } -} -pub enum DucBlockAttributeDefinitionEntryOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucBlockAttributeDefinitionEntry<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucBlockAttributeDefinitionEntry<'a> { - type Inner = DucBlockAttributeDefinitionEntry<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucBlockAttributeDefinitionEntry<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_VALUE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucBlockAttributeDefinitionEntry { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucBlockAttributeDefinitionEntryArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucBlockAttributeDefinitionEntryBuilder::new(_fbb); - if let Some(x) = args.value { builder.add_value(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockAttributeDefinitionEntry::VT_KEY, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DucBlockAttributeDefinitionEntry) -> bool { - self.key() < o.key() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.key(); - key.cmp(val) - } - #[inline] - pub fn value(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockAttributeDefinitionEntry::VT_VALUE, None)} - } -} - -impl flatbuffers::Verifiable for DucBlockAttributeDefinitionEntry<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>("value", Self::VT_VALUE, false)? - .finish(); - Ok(()) - } -} -pub struct DucBlockAttributeDefinitionEntryArgs<'a> { - pub key: Option>, - pub value: Option>>, -} -impl<'a> Default for DucBlockAttributeDefinitionEntryArgs<'a> { - #[inline] - fn default() -> Self { - DucBlockAttributeDefinitionEntryArgs { - key: None, // required field - value: None, - } - } -} - -pub struct DucBlockAttributeDefinitionEntryBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucBlockAttributeDefinitionEntryBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlockAttributeDefinitionEntry::VT_KEY, key); - } - #[inline] - pub fn add_value(&mut self, value: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucBlockAttributeDefinitionEntry::VT_VALUE, value); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucBlockAttributeDefinitionEntryBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucBlockAttributeDefinitionEntryBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DucBlockAttributeDefinitionEntry::VT_KEY,"key"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucBlockAttributeDefinitionEntry<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucBlockAttributeDefinitionEntry"); - ds.field("key", &self.key()); - ds.field("value", &self.value()); - ds.finish() - } -} -pub enum DucBlockOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucBlock<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucBlock<'a> { - type Inner = DucBlock<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucBlock<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_LABEL: flatbuffers::VOffsetT = 6; - pub const VT_DESCRIPTION: flatbuffers::VOffsetT = 8; - pub const VT_VERSION: flatbuffers::VOffsetT = 10; - pub const VT_ATTRIBUTE_DEFINITIONS: flatbuffers::VOffsetT = 12; - pub const VT_METADATA: flatbuffers::VOffsetT = 14; - pub const VT_THUMBNAIL: flatbuffers::VOffsetT = 16; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucBlock { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucBlockArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucBlockBuilder::new(_fbb); - if let Some(x) = args.thumbnail { builder.add_thumbnail(x); } - if let Some(x) = args.metadata { builder.add_metadata(x); } - if let Some(x) = args.attribute_definitions { builder.add_attribute_definitions(x); } - builder.add_version(args.version); - if let Some(x) = args.description { builder.add_description(x); } - if let Some(x) = args.label { builder.add_label(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlock::VT_ID, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DucBlock) -> bool { - self.id() < o.id() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.id(); - key.cmp(val) - } - #[inline] - pub fn label(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlock::VT_LABEL, None)} - } - #[inline] - pub fn description(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlock::VT_DESCRIPTION, None)} - } - #[inline] - pub fn version(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucBlock::VT_VERSION, Some(0)).unwrap()} - } - #[inline] - pub fn attribute_definitions(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucBlock::VT_ATTRIBUTE_DEFINITIONS, None)} - } - #[inline] - pub fn metadata(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlock::VT_METADATA, None)} - } - #[inline] - pub fn thumbnail(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DucBlock::VT_THUMBNAIL, None)} - } -} - -impl flatbuffers::Verifiable for DucBlock<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, true)? - .visit_field::>("label", Self::VT_LABEL, false)? - .visit_field::>("description", Self::VT_DESCRIPTION, false)? - .visit_field::("version", Self::VT_VERSION, false)? - .visit_field::>>>("attribute_definitions", Self::VT_ATTRIBUTE_DEFINITIONS, false)? - .visit_field::>("metadata", Self::VT_METADATA, false)? - .visit_field::>>("thumbnail", Self::VT_THUMBNAIL, false)? - .finish(); - Ok(()) - } -} -pub struct DucBlockArgs<'a> { - pub id: Option>, - pub label: Option>, - pub description: Option>, - pub version: i32, - pub attribute_definitions: Option>>>>, - pub metadata: Option>>, - pub thumbnail: Option>>, -} -impl<'a> Default for DucBlockArgs<'a> { - #[inline] - fn default() -> Self { - DucBlockArgs { - id: None, // required field - label: None, - description: None, - version: 0, - attribute_definitions: None, - metadata: None, - thumbnail: None, - } - } -} - -pub struct DucBlockBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucBlockBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlock::VT_ID, id); - } - #[inline] - pub fn add_label(&mut self, label: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlock::VT_LABEL, label); - } - #[inline] - pub fn add_description(&mut self, description: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlock::VT_DESCRIPTION, description); - } - #[inline] - pub fn add_version(&mut self, version: i32) { - self.fbb_.push_slot::(DucBlock::VT_VERSION, version, 0); - } - #[inline] - pub fn add_attribute_definitions(&mut self, attribute_definitions: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DucBlock::VT_ATTRIBUTE_DEFINITIONS, attribute_definitions); - } - #[inline] - pub fn add_metadata(&mut self, metadata: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucBlock::VT_METADATA, metadata); - } - #[inline] - pub fn add_thumbnail(&mut self, thumbnail: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucBlock::VT_THUMBNAIL, thumbnail); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucBlockBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucBlockBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DucBlock::VT_ID,"id"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucBlock<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucBlock"); - ds.field("id", &self.id()); - ds.field("label", &self.label()); - ds.field("description", &self.description()); - ds.field("version", &self.version()); - ds.field("attribute_definitions", &self.attribute_definitions()); - ds.field("metadata", &self.metadata()); - ds.field("thumbnail", &self.thumbnail()); - ds.finish() - } -} -pub enum DucBlockMetadataOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucBlockMetadata<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucBlockMetadata<'a> { - type Inner = DucBlockMetadata<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucBlockMetadata<'a> { - pub const VT_SOURCE: flatbuffers::VOffsetT = 4; - pub const VT_USAGE_COUNT: flatbuffers::VOffsetT = 6; - pub const VT_CREATED_AT: flatbuffers::VOffsetT = 8; - pub const VT_UPDATED_AT: flatbuffers::VOffsetT = 10; - pub const VT_LOCALIZATION: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucBlockMetadata { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucBlockMetadataArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucBlockMetadataBuilder::new(_fbb); - builder.add_updated_at(args.updated_at); - builder.add_created_at(args.created_at); - if let Some(x) = args.localization { builder.add_localization(x); } - builder.add_usage_count(args.usage_count); - if let Some(x) = args.source { builder.add_source(x); } - builder.finish() - } - - - #[inline] - pub fn source(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockMetadata::VT_SOURCE, None)} - } - #[inline] - pub fn usage_count(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucBlockMetadata::VT_USAGE_COUNT, Some(0)).unwrap()} - } - #[inline] - pub fn created_at(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucBlockMetadata::VT_CREATED_AT, Some(0)).unwrap()} - } - #[inline] - pub fn updated_at(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucBlockMetadata::VT_UPDATED_AT, Some(0)).unwrap()} - } - #[inline] - pub fn localization(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DucBlockMetadata::VT_LOCALIZATION, None)} - } -} - -impl flatbuffers::Verifiable for DucBlockMetadata<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("source", Self::VT_SOURCE, false)? - .visit_field::("usage_count", Self::VT_USAGE_COUNT, false)? - .visit_field::("created_at", Self::VT_CREATED_AT, false)? - .visit_field::("updated_at", Self::VT_UPDATED_AT, false)? - .visit_field::>>("localization", Self::VT_LOCALIZATION, false)? - .finish(); - Ok(()) - } -} -pub struct DucBlockMetadataArgs<'a> { - pub source: Option>, - pub usage_count: i32, - pub created_at: i64, - pub updated_at: i64, - pub localization: Option>>, -} -impl<'a> Default for DucBlockMetadataArgs<'a> { - #[inline] - fn default() -> Self { - DucBlockMetadataArgs { - source: None, - usage_count: 0, - created_at: 0, - updated_at: 0, - localization: None, - } - } -} - -pub struct DucBlockMetadataBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucBlockMetadataBuilder<'a, 'b, A> { - #[inline] - pub fn add_source(&mut self, source: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlockMetadata::VT_SOURCE, source); - } - #[inline] - pub fn add_usage_count(&mut self, usage_count: i32) { - self.fbb_.push_slot::(DucBlockMetadata::VT_USAGE_COUNT, usage_count, 0); - } - #[inline] - pub fn add_created_at(&mut self, created_at: i64) { - self.fbb_.push_slot::(DucBlockMetadata::VT_CREATED_AT, created_at, 0); - } - #[inline] - pub fn add_updated_at(&mut self, updated_at: i64) { - self.fbb_.push_slot::(DucBlockMetadata::VT_UPDATED_AT, updated_at, 0); - } - #[inline] - pub fn add_localization(&mut self, localization: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucBlockMetadata::VT_LOCALIZATION, localization); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucBlockMetadataBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucBlockMetadataBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucBlockMetadata<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucBlockMetadata"); - ds.field("source", &self.source()); - ds.field("usage_count", &self.usage_count()); - ds.field("created_at", &self.created_at()); - ds.field("updated_at", &self.updated_at()); - ds.field("localization", &self.localization()); - ds.finish() - } -} -pub enum DucBlockDuplicationArrayOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucBlockDuplicationArray<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucBlockDuplicationArray<'a> { - type Inner = DucBlockDuplicationArray<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucBlockDuplicationArray<'a> { - pub const VT_ROWS: flatbuffers::VOffsetT = 4; - pub const VT_COLS: flatbuffers::VOffsetT = 6; - pub const VT_ROW_SPACING: flatbuffers::VOffsetT = 8; - pub const VT_COL_SPACING: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucBlockDuplicationArray { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucBlockDuplicationArrayArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DucBlockDuplicationArrayBuilder::new(_fbb); - builder.add_col_spacing(args.col_spacing); - builder.add_row_spacing(args.row_spacing); - builder.add_cols(args.cols); - builder.add_rows(args.rows); - builder.finish() - } - - - #[inline] - pub fn rows(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucBlockDuplicationArray::VT_ROWS, Some(0)).unwrap()} - } - #[inline] - pub fn cols(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucBlockDuplicationArray::VT_COLS, Some(0)).unwrap()} - } - #[inline] - pub fn row_spacing(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucBlockDuplicationArray::VT_ROW_SPACING, Some(0.0)).unwrap()} - } - #[inline] - pub fn col_spacing(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucBlockDuplicationArray::VT_COL_SPACING, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucBlockDuplicationArray<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("rows", Self::VT_ROWS, false)? - .visit_field::("cols", Self::VT_COLS, false)? - .visit_field::("row_spacing", Self::VT_ROW_SPACING, false)? - .visit_field::("col_spacing", Self::VT_COL_SPACING, false)? - .finish(); - Ok(()) - } -} -pub struct DucBlockDuplicationArrayArgs { - pub rows: i32, - pub cols: i32, - pub row_spacing: f64, - pub col_spacing: f64, -} -impl<'a> Default for DucBlockDuplicationArrayArgs { - #[inline] - fn default() -> Self { - DucBlockDuplicationArrayArgs { - rows: 0, - cols: 0, - row_spacing: 0.0, - col_spacing: 0.0, - } - } -} - -pub struct DucBlockDuplicationArrayBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucBlockDuplicationArrayBuilder<'a, 'b, A> { - #[inline] - pub fn add_rows(&mut self, rows: i32) { - self.fbb_.push_slot::(DucBlockDuplicationArray::VT_ROWS, rows, 0); - } - #[inline] - pub fn add_cols(&mut self, cols: i32) { - self.fbb_.push_slot::(DucBlockDuplicationArray::VT_COLS, cols, 0); - } - #[inline] - pub fn add_row_spacing(&mut self, row_spacing: f64) { - self.fbb_.push_slot::(DucBlockDuplicationArray::VT_ROW_SPACING, row_spacing, 0.0); - } - #[inline] - pub fn add_col_spacing(&mut self, col_spacing: f64) { - self.fbb_.push_slot::(DucBlockDuplicationArray::VT_COL_SPACING, col_spacing, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucBlockDuplicationArrayBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucBlockDuplicationArrayBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucBlockDuplicationArray<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucBlockDuplicationArray"); - ds.field("rows", &self.rows()); - ds.field("cols", &self.cols()); - ds.field("row_spacing", &self.row_spacing()); - ds.field("col_spacing", &self.col_spacing()); - ds.finish() - } -} -pub enum DucBlockInstanceElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucBlockInstanceElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucBlockInstanceElement<'a> { - type Inner = DucBlockInstanceElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucBlockInstanceElement<'a> { - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucBlockInstanceElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucBlockInstanceElementArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DucBlockInstanceElementBuilder::new(_fbb); - builder.finish() - } - - -} - -impl flatbuffers::Verifiable for DucBlockInstanceElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .finish(); - Ok(()) - } -} -pub struct DucBlockInstanceElementArgs { -} -impl<'a> Default for DucBlockInstanceElementArgs { - #[inline] - fn default() -> Self { - DucBlockInstanceElementArgs { - } - } -} - -pub struct DucBlockInstanceElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucBlockInstanceElementBuilder<'a, 'b, A> { - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucBlockInstanceElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucBlockInstanceElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucBlockInstanceElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucBlockInstanceElement"); - ds.finish() - } -} -pub enum DucBlockInstanceOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucBlockInstance<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucBlockInstance<'a> { - type Inner = DucBlockInstance<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucBlockInstance<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_BLOCK_ID: flatbuffers::VOffsetT = 6; - pub const VT_ELEMENT_OVERRIDES: flatbuffers::VOffsetT = 8; - pub const VT_ATTRIBUTE_VALUES: flatbuffers::VOffsetT = 10; - pub const VT_DUPLICATION_ARRAY: flatbuffers::VOffsetT = 12; - pub const VT_VERSION: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucBlockInstance { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucBlockInstanceArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucBlockInstanceBuilder::new(_fbb); - builder.add_version(args.version); - if let Some(x) = args.duplication_array { builder.add_duplication_array(x); } - if let Some(x) = args.attribute_values { builder.add_attribute_values(x); } - if let Some(x) = args.element_overrides { builder.add_element_overrides(x); } - if let Some(x) = args.block_id { builder.add_block_id(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockInstance::VT_ID, None)} - } - #[inline] - pub fn block_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockInstance::VT_BLOCK_ID, None)} - } - #[inline] - pub fn element_overrides(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucBlockInstance::VT_ELEMENT_OVERRIDES, None)} - } - #[inline] - pub fn attribute_values(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucBlockInstance::VT_ATTRIBUTE_VALUES, None)} - } - #[inline] - pub fn duplication_array(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockInstance::VT_DUPLICATION_ARRAY, None)} - } - #[inline] - pub fn version(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucBlockInstance::VT_VERSION, Some(0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucBlockInstance<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("block_id", Self::VT_BLOCK_ID, false)? - .visit_field::>>>("element_overrides", Self::VT_ELEMENT_OVERRIDES, false)? - .visit_field::>>>("attribute_values", Self::VT_ATTRIBUTE_VALUES, false)? - .visit_field::>("duplication_array", Self::VT_DUPLICATION_ARRAY, false)? - .visit_field::("version", Self::VT_VERSION, false)? - .finish(); - Ok(()) - } -} -pub struct DucBlockInstanceArgs<'a> { - pub id: Option>, - pub block_id: Option>, - pub element_overrides: Option>>>>, - pub attribute_values: Option>>>>, - pub duplication_array: Option>>, - pub version: i32, -} -impl<'a> Default for DucBlockInstanceArgs<'a> { - #[inline] - fn default() -> Self { - DucBlockInstanceArgs { - id: None, - block_id: None, - element_overrides: None, - attribute_values: None, - duplication_array: None, - version: 0, - } - } -} - -pub struct DucBlockInstanceBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucBlockInstanceBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlockInstance::VT_ID, id); - } - #[inline] - pub fn add_block_id(&mut self, block_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlockInstance::VT_BLOCK_ID, block_id); - } - #[inline] - pub fn add_element_overrides(&mut self, element_overrides: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DucBlockInstance::VT_ELEMENT_OVERRIDES, element_overrides); - } - #[inline] - pub fn add_attribute_values(&mut self, attribute_values: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DucBlockInstance::VT_ATTRIBUTE_VALUES, attribute_values); - } - #[inline] - pub fn add_duplication_array(&mut self, duplication_array: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucBlockInstance::VT_DUPLICATION_ARRAY, duplication_array); - } - #[inline] - pub fn add_version(&mut self, version: i32) { - self.fbb_.push_slot::(DucBlockInstance::VT_VERSION, version, 0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucBlockInstanceBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucBlockInstanceBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucBlockInstance<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucBlockInstance"); - ds.field("id", &self.id()); - ds.field("block_id", &self.block_id()); - ds.field("element_overrides", &self.element_overrides()); - ds.field("attribute_values", &self.attribute_values()); - ds.field("duplication_array", &self.duplication_array()); - ds.field("version", &self.version()); - ds.finish() - } -} -pub enum DucBlockCollectionOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucBlockCollection<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucBlockCollection<'a> { - type Inner = DucBlockCollection<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucBlockCollection<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_LABEL: flatbuffers::VOffsetT = 6; - pub const VT_CHILDREN: flatbuffers::VOffsetT = 8; - pub const VT_METADATA: flatbuffers::VOffsetT = 10; - pub const VT_THUMBNAIL: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucBlockCollection { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucBlockCollectionArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucBlockCollectionBuilder::new(_fbb); - if let Some(x) = args.thumbnail { builder.add_thumbnail(x); } - if let Some(x) = args.metadata { builder.add_metadata(x); } - if let Some(x) = args.children { builder.add_children(x); } - if let Some(x) = args.label { builder.add_label(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockCollection::VT_ID, None)} - } - #[inline] - pub fn label(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockCollection::VT_LABEL, None)} - } - #[inline] - pub fn children(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucBlockCollection::VT_CHILDREN, None)} - } - #[inline] - pub fn metadata(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockCollection::VT_METADATA, None)} - } - #[inline] - pub fn thumbnail(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DucBlockCollection::VT_THUMBNAIL, None)} - } -} - -impl flatbuffers::Verifiable for DucBlockCollection<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("label", Self::VT_LABEL, false)? - .visit_field::>>>("children", Self::VT_CHILDREN, false)? - .visit_field::>("metadata", Self::VT_METADATA, false)? - .visit_field::>>("thumbnail", Self::VT_THUMBNAIL, false)? - .finish(); - Ok(()) - } -} -pub struct DucBlockCollectionArgs<'a> { - pub id: Option>, - pub label: Option>, - pub children: Option>>>>, - pub metadata: Option>>, - pub thumbnail: Option>>, -} -impl<'a> Default for DucBlockCollectionArgs<'a> { - #[inline] - fn default() -> Self { - DucBlockCollectionArgs { - id: None, - label: None, - children: None, - metadata: None, - thumbnail: None, - } - } -} - -pub struct DucBlockCollectionBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucBlockCollectionBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlockCollection::VT_ID, id); - } - #[inline] - pub fn add_label(&mut self, label: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlockCollection::VT_LABEL, label); - } - #[inline] - pub fn add_children(&mut self, children: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DucBlockCollection::VT_CHILDREN, children); - } - #[inline] - pub fn add_metadata(&mut self, metadata: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucBlockCollection::VT_METADATA, metadata); - } - #[inline] - pub fn add_thumbnail(&mut self, thumbnail: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucBlockCollection::VT_THUMBNAIL, thumbnail); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucBlockCollectionBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucBlockCollectionBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucBlockCollection<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucBlockCollection"); - ds.field("id", &self.id()); - ds.field("label", &self.label()); - ds.field("children", &self.children()); - ds.field("metadata", &self.metadata()); - ds.field("thumbnail", &self.thumbnail()); - ds.finish() - } -} -pub enum DucBlockCollectionEntryOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucBlockCollectionEntry<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucBlockCollectionEntry<'a> { - type Inner = DucBlockCollectionEntry<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucBlockCollectionEntry<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_IS_COLLECTION: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucBlockCollectionEntry { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucBlockCollectionEntryArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucBlockCollectionEntryBuilder::new(_fbb); - if let Some(x) = args.id { builder.add_id(x); } - builder.add_is_collection(args.is_collection); - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucBlockCollectionEntry::VT_ID, None)} - } - #[inline] - pub fn is_collection(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucBlockCollectionEntry::VT_IS_COLLECTION, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucBlockCollectionEntry<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::("is_collection", Self::VT_IS_COLLECTION, false)? - .finish(); - Ok(()) - } -} -pub struct DucBlockCollectionEntryArgs<'a> { - pub id: Option>, - pub is_collection: bool, -} -impl<'a> Default for DucBlockCollectionEntryArgs<'a> { - #[inline] - fn default() -> Self { - DucBlockCollectionEntryArgs { - id: None, - is_collection: false, - } - } -} - -pub struct DucBlockCollectionEntryBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucBlockCollectionEntryBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucBlockCollectionEntry::VT_ID, id); - } - #[inline] - pub fn add_is_collection(&mut self, is_collection: bool) { - self.fbb_.push_slot::(DucBlockCollectionEntry::VT_IS_COLLECTION, is_collection, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucBlockCollectionEntryBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucBlockCollectionEntryBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucBlockCollectionEntry<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucBlockCollectionEntry"); - ds.field("id", &self.id()); - ds.field("is_collection", &self.is_collection()); - ds.finish() - } -} -pub enum DucFrameElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucFrameElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucFrameElement<'a> { - type Inner = DucFrameElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucFrameElement<'a> { - pub const VT_STACK_ELEMENT_BASE: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucFrameElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucFrameElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucFrameElementBuilder::new(_fbb); - if let Some(x) = args.stack_element_base { builder.add_stack_element_base(x); } - builder.finish() - } - - - #[inline] - pub fn stack_element_base(&self) -> Option<_DucStackElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFrameElement::VT_STACK_ELEMENT_BASE, None)} - } -} - -impl flatbuffers::Verifiable for DucFrameElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("stack_element_base", Self::VT_STACK_ELEMENT_BASE, false)? - .finish(); - Ok(()) - } -} -pub struct DucFrameElementArgs<'a> { - pub stack_element_base: Option>>, -} -impl<'a> Default for DucFrameElementArgs<'a> { - #[inline] - fn default() -> Self { - DucFrameElementArgs { - stack_element_base: None, - } - } -} - -pub struct DucFrameElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucFrameElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_stack_element_base(&mut self, stack_element_base: flatbuffers::WIPOffset<_DucStackElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucFrameElement::VT_STACK_ELEMENT_BASE, stack_element_base); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucFrameElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucFrameElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucFrameElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucFrameElement"); - ds.field("stack_element_base", &self.stack_element_base()); - ds.finish() - } -} -pub enum PlotLayoutOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct PlotLayout<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for PlotLayout<'a> { - type Inner = PlotLayout<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> PlotLayout<'a> { - pub const VT_MARGINS: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - PlotLayout { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args PlotLayoutArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = PlotLayoutBuilder::new(_fbb); - if let Some(x) = args.margins { builder.add_margins(x); } - builder.finish() - } - - - #[inline] - pub fn margins(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(PlotLayout::VT_MARGINS, None)} - } -} - -impl flatbuffers::Verifiable for PlotLayout<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("margins", Self::VT_MARGINS, false)? - .finish(); - Ok(()) - } -} -pub struct PlotLayoutArgs<'a> { - pub margins: Option>>, -} -impl<'a> Default for PlotLayoutArgs<'a> { - #[inline] - fn default() -> Self { - PlotLayoutArgs { - margins: None, - } - } -} - -pub struct PlotLayoutBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PlotLayoutBuilder<'a, 'b, A> { - #[inline] - pub fn add_margins(&mut self, margins: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(PlotLayout::VT_MARGINS, margins); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PlotLayoutBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - PlotLayoutBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for PlotLayout<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("PlotLayout"); - ds.field("margins", &self.margins()); - ds.finish() - } -} -pub enum DucPlotElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucPlotElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucPlotElement<'a> { - type Inner = DucPlotElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucPlotElement<'a> { - pub const VT_STACK_ELEMENT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - pub const VT_LAYOUT: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucPlotElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucPlotElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucPlotElementBuilder::new(_fbb); - if let Some(x) = args.layout { builder.add_layout(x); } - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.stack_element_base { builder.add_stack_element_base(x); } - builder.finish() - } - - - #[inline] - pub fn stack_element_base(&self) -> Option<_DucStackElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucPlotElement::VT_STACK_ELEMENT_BASE, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucPlotElement::VT_STYLE, None)} - } - #[inline] - pub fn layout(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucPlotElement::VT_LAYOUT, None)} - } -} - -impl flatbuffers::Verifiable for DucPlotElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("stack_element_base", Self::VT_STACK_ELEMENT_BASE, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .visit_field::>("layout", Self::VT_LAYOUT, false)? - .finish(); - Ok(()) - } -} -pub struct DucPlotElementArgs<'a> { - pub stack_element_base: Option>>, - pub style: Option>>, - pub layout: Option>>, -} -impl<'a> Default for DucPlotElementArgs<'a> { - #[inline] - fn default() -> Self { - DucPlotElementArgs { - stack_element_base: None, - style: None, - layout: None, - } - } -} - -pub struct DucPlotElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucPlotElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_stack_element_base(&mut self, stack_element_base: flatbuffers::WIPOffset<_DucStackElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucPlotElement::VT_STACK_ELEMENT_BASE, stack_element_base); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucPlotElement::VT_STYLE, style); - } - #[inline] - pub fn add_layout(&mut self, layout: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucPlotElement::VT_LAYOUT, layout); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucPlotElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucPlotElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucPlotElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucPlotElement"); - ds.field("stack_element_base", &self.stack_element_base()); - ds.field("style", &self.style()); - ds.field("layout", &self.layout()); - ds.finish() - } -} -pub enum DucViewportElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucViewportElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucViewportElement<'a> { - type Inner = DucViewportElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucViewportElement<'a> { - pub const VT_LINEAR_BASE: flatbuffers::VOffsetT = 4; - pub const VT_STACK_BASE: flatbuffers::VOffsetT = 6; - pub const VT_STYLE: flatbuffers::VOffsetT = 8; - pub const VT_VIEW: flatbuffers::VOffsetT = 10; - pub const VT_SCALE: flatbuffers::VOffsetT = 12; - pub const VT_SHADE_PLOT: flatbuffers::VOffsetT = 14; - pub const VT_FROZEN_GROUP_IDS: flatbuffers::VOffsetT = 16; - pub const VT_STANDARD_OVERRIDE: flatbuffers::VOffsetT = 18; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucViewportElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucViewportElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucViewportElementBuilder::new(_fbb); - if let Some(x) = args.standard_override { builder.add_standard_override(x); } - if let Some(x) = args.frozen_group_ids { builder.add_frozen_group_ids(x); } - builder.add_scale(args.scale); - if let Some(x) = args.view { builder.add_view(x); } - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.stack_base { builder.add_stack_base(x); } - if let Some(x) = args.linear_base { builder.add_linear_base(x); } - if let Some(x) = args.shade_plot { builder.add_shade_plot(x); } - builder.finish() - } - - - #[inline] - pub fn linear_base(&self) -> Option<_DucLinearElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucViewportElement::VT_LINEAR_BASE, None)} - } - #[inline] - pub fn stack_base(&self) -> Option<_DucStackBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucViewportElement::VT_STACK_BASE, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucViewportElement::VT_STYLE, None)} - } - #[inline] - pub fn view(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucViewportElement::VT_VIEW, None)} - } - #[inline] - pub fn scale(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucViewportElement::VT_SCALE, Some(0.0)).unwrap()} - } - #[inline] - pub fn shade_plot(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucViewportElement::VT_SHADE_PLOT, None)} - } - #[inline] - pub fn frozen_group_ids(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucViewportElement::VT_FROZEN_GROUP_IDS, None)} - } - #[inline] - pub fn standard_override(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucViewportElement::VT_STANDARD_OVERRIDE, None)} - } -} - -impl flatbuffers::Verifiable for DucViewportElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("linear_base", Self::VT_LINEAR_BASE, false)? - .visit_field::>("stack_base", Self::VT_STACK_BASE, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .visit_field::>("view", Self::VT_VIEW, false)? - .visit_field::("scale", Self::VT_SCALE, false)? - .visit_field::("shade_plot", Self::VT_SHADE_PLOT, false)? - .visit_field::>>>("frozen_group_ids", Self::VT_FROZEN_GROUP_IDS, false)? - .visit_field::>("standard_override", Self::VT_STANDARD_OVERRIDE, false)? - .finish(); - Ok(()) - } -} -pub struct DucViewportElementArgs<'a> { - pub linear_base: Option>>, - pub stack_base: Option>>, - pub style: Option>>, - pub view: Option>>, - pub scale: f32, - pub shade_plot: Option, - pub frozen_group_ids: Option>>>, - pub standard_override: Option>, -} -impl<'a> Default for DucViewportElementArgs<'a> { - #[inline] - fn default() -> Self { - DucViewportElementArgs { - linear_base: None, - stack_base: None, - style: None, - view: None, - scale: 0.0, - shade_plot: None, - frozen_group_ids: None, - standard_override: None, - } - } -} - -pub struct DucViewportElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucViewportElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_linear_base(&mut self, linear_base: flatbuffers::WIPOffset<_DucLinearElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucViewportElement::VT_LINEAR_BASE, linear_base); - } - #[inline] - pub fn add_stack_base(&mut self, stack_base: flatbuffers::WIPOffset<_DucStackBase<'b >>) { - self.fbb_.push_slot_always::>(DucViewportElement::VT_STACK_BASE, stack_base); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucViewportElement::VT_STYLE, style); - } - #[inline] - pub fn add_view(&mut self, view: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucViewportElement::VT_VIEW, view); - } - #[inline] - pub fn add_scale(&mut self, scale: f32) { - self.fbb_.push_slot::(DucViewportElement::VT_SCALE, scale, 0.0); - } - #[inline] - pub fn add_shade_plot(&mut self, shade_plot: VIEWPORT_SHADE_PLOT) { - self.fbb_.push_slot_always::(DucViewportElement::VT_SHADE_PLOT, shade_plot); - } - #[inline] - pub fn add_frozen_group_ids(&mut self, frozen_group_ids: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(DucViewportElement::VT_FROZEN_GROUP_IDS, frozen_group_ids); - } - #[inline] - pub fn add_standard_override(&mut self, standard_override: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucViewportElement::VT_STANDARD_OVERRIDE, standard_override); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucViewportElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucViewportElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucViewportElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucViewportElement"); - ds.field("linear_base", &self.linear_base()); - ds.field("stack_base", &self.stack_base()); - ds.field("style", &self.style()); - ds.field("view", &self.view()); - ds.field("scale", &self.scale()); - ds.field("shade_plot", &self.shade_plot()); - ds.field("frozen_group_ids", &self.frozen_group_ids()); - ds.field("standard_override", &self.standard_override()); - ds.finish() - } -} -pub enum DucXRayElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucXRayElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucXRayElement<'a> { - type Inner = DucXRayElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucXRayElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - pub const VT_ORIGIN: flatbuffers::VOffsetT = 8; - pub const VT_DIRECTION: flatbuffers::VOffsetT = 10; - pub const VT_START_FROM_ORIGIN: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucXRayElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucXRayElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucXRayElementBuilder::new(_fbb); - if let Some(x) = args.direction { builder.add_direction(x); } - if let Some(x) = args.origin { builder.add_origin(x); } - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.add_start_from_origin(args.start_from_origin); - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucXRayElement::VT_BASE, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucXRayElement::VT_STYLE, None)} - } - #[inline] - pub fn origin(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucXRayElement::VT_ORIGIN, None)} - } - #[inline] - pub fn direction(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucXRayElement::VT_DIRECTION, None)} - } - #[inline] - pub fn start_from_origin(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucXRayElement::VT_START_FROM_ORIGIN, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucXRayElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .visit_field::>("origin", Self::VT_ORIGIN, false)? - .visit_field::>("direction", Self::VT_DIRECTION, false)? - .visit_field::("start_from_origin", Self::VT_START_FROM_ORIGIN, false)? - .finish(); - Ok(()) - } -} -pub struct DucXRayElementArgs<'a> { - pub base: Option>>, - pub style: Option>>, - pub origin: Option>>, - pub direction: Option>>, - pub start_from_origin: bool, -} -impl<'a> Default for DucXRayElementArgs<'a> { - #[inline] - fn default() -> Self { - DucXRayElementArgs { - base: None, - style: None, - origin: None, - direction: None, - start_from_origin: false, - } - } -} - -pub struct DucXRayElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucXRayElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucXRayElement::VT_BASE, base); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucXRayElement::VT_STYLE, style); - } - #[inline] - pub fn add_origin(&mut self, origin: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucXRayElement::VT_ORIGIN, origin); - } - #[inline] - pub fn add_direction(&mut self, direction: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucXRayElement::VT_DIRECTION, direction); - } - #[inline] - pub fn add_start_from_origin(&mut self, start_from_origin: bool) { - self.fbb_.push_slot::(DucXRayElement::VT_START_FROM_ORIGIN, start_from_origin, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucXRayElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucXRayElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucXRayElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucXRayElement"); - ds.field("base", &self.base()); - ds.field("style", &self.style()); - ds.field("origin", &self.origin()); - ds.field("direction", &self.direction()); - ds.field("start_from_origin", &self.start_from_origin()); - ds.finish() - } -} -pub enum LeaderTextBlockContentOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct LeaderTextBlockContent<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for LeaderTextBlockContent<'a> { - type Inner = LeaderTextBlockContent<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> LeaderTextBlockContent<'a> { - pub const VT_TEXT: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - LeaderTextBlockContent { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args LeaderTextBlockContentArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = LeaderTextBlockContentBuilder::new(_fbb); - if let Some(x) = args.text { builder.add_text(x); } - builder.finish() - } - - - #[inline] - pub fn text(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(LeaderTextBlockContent::VT_TEXT, None)} - } -} - -impl flatbuffers::Verifiable for LeaderTextBlockContent<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("text", Self::VT_TEXT, false)? - .finish(); - Ok(()) - } -} -pub struct LeaderTextBlockContentArgs<'a> { - pub text: Option>, -} -impl<'a> Default for LeaderTextBlockContentArgs<'a> { - #[inline] - fn default() -> Self { - LeaderTextBlockContentArgs { - text: None, - } - } -} - -pub struct LeaderTextBlockContentBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> LeaderTextBlockContentBuilder<'a, 'b, A> { - #[inline] - pub fn add_text(&mut self, text: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(LeaderTextBlockContent::VT_TEXT, text); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> LeaderTextBlockContentBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - LeaderTextBlockContentBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for LeaderTextBlockContent<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("LeaderTextBlockContent"); - ds.field("text", &self.text()); - ds.finish() - } -} -pub enum LeaderBlockContentOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct LeaderBlockContent<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for LeaderBlockContent<'a> { - type Inner = LeaderBlockContent<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> LeaderBlockContent<'a> { - pub const VT_BLOCK_ID: flatbuffers::VOffsetT = 4; - pub const VT_ATTRIBUTE_VALUES: flatbuffers::VOffsetT = 6; - pub const VT_ELEMENT_OVERRIDES: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - LeaderBlockContent { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args LeaderBlockContentArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = LeaderBlockContentBuilder::new(_fbb); - if let Some(x) = args.element_overrides { builder.add_element_overrides(x); } - if let Some(x) = args.attribute_values { builder.add_attribute_values(x); } - if let Some(x) = args.block_id { builder.add_block_id(x); } - builder.finish() - } - - - #[inline] - pub fn block_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(LeaderBlockContent::VT_BLOCK_ID, None)} - } - #[inline] - pub fn attribute_values(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(LeaderBlockContent::VT_ATTRIBUTE_VALUES, None)} - } - #[inline] - pub fn element_overrides(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(LeaderBlockContent::VT_ELEMENT_OVERRIDES, None)} - } -} - -impl flatbuffers::Verifiable for LeaderBlockContent<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("block_id", Self::VT_BLOCK_ID, false)? - .visit_field::>>>("attribute_values", Self::VT_ATTRIBUTE_VALUES, false)? - .visit_field::>>>("element_overrides", Self::VT_ELEMENT_OVERRIDES, false)? - .finish(); - Ok(()) - } -} -pub struct LeaderBlockContentArgs<'a> { - pub block_id: Option>, - pub attribute_values: Option>>>>, - pub element_overrides: Option>>>>, -} -impl<'a> Default for LeaderBlockContentArgs<'a> { - #[inline] - fn default() -> Self { - LeaderBlockContentArgs { - block_id: None, - attribute_values: None, - element_overrides: None, - } - } -} - -pub struct LeaderBlockContentBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> LeaderBlockContentBuilder<'a, 'b, A> { - #[inline] - pub fn add_block_id(&mut self, block_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(LeaderBlockContent::VT_BLOCK_ID, block_id); - } - #[inline] - pub fn add_attribute_values(&mut self, attribute_values: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(LeaderBlockContent::VT_ATTRIBUTE_VALUES, attribute_values); - } - #[inline] - pub fn add_element_overrides(&mut self, element_overrides: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(LeaderBlockContent::VT_ELEMENT_OVERRIDES, element_overrides); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> LeaderBlockContentBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - LeaderBlockContentBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for LeaderBlockContent<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("LeaderBlockContent"); - ds.field("block_id", &self.block_id()); - ds.field("attribute_values", &self.attribute_values()); - ds.field("element_overrides", &self.element_overrides()); - ds.finish() - } -} -pub enum LeaderContentOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct LeaderContent<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for LeaderContent<'a> { - type Inner = LeaderContent<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> LeaderContent<'a> { - pub const VT_LEADER_CONTENT_TYPE: flatbuffers::VOffsetT = 4; - pub const VT_CONTENT_TYPE: flatbuffers::VOffsetT = 6; - pub const VT_CONTENT: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - LeaderContent { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args LeaderContentArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = LeaderContentBuilder::new(_fbb); - if let Some(x) = args.content { builder.add_content(x); } - builder.add_content_type(args.content_type); - if let Some(x) = args.leader_content_type { builder.add_leader_content_type(x); } - builder.finish() - } - - - #[inline] - pub fn leader_content_type(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(LeaderContent::VT_LEADER_CONTENT_TYPE, None)} - } - #[inline] - pub fn content_type(&self) -> LeaderContentData { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(LeaderContent::VT_CONTENT_TYPE, Some(LeaderContentData::NONE)).unwrap()} - } - #[inline] - pub fn content(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(LeaderContent::VT_CONTENT, None)} - } - #[inline] - #[allow(non_snake_case)] - pub fn content_as_leader_text_block_content(&self) -> Option> { - if self.content_type() == LeaderContentData::LeaderTextBlockContent { - self.content().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { LeaderTextBlockContent::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn content_as_leader_block_content(&self) -> Option> { - if self.content_type() == LeaderContentData::LeaderBlockContent { - self.content().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { LeaderBlockContent::init_from_table(t) } - }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for LeaderContent<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("leader_content_type", Self::VT_LEADER_CONTENT_TYPE, false)? - .visit_union::("content_type", Self::VT_CONTENT_TYPE, "content", Self::VT_CONTENT, false, |key, v, pos| { - match key { - LeaderContentData::LeaderTextBlockContent => v.verify_union_variant::>("LeaderContentData::LeaderTextBlockContent", pos), - LeaderContentData::LeaderBlockContent => v.verify_union_variant::>("LeaderContentData::LeaderBlockContent", pos), - _ => Ok(()), - } - })? - .finish(); - Ok(()) - } -} -pub struct LeaderContentArgs { - pub leader_content_type: Option, - pub content_type: LeaderContentData, - pub content: Option>, -} -impl<'a> Default for LeaderContentArgs { - #[inline] - fn default() -> Self { - LeaderContentArgs { - leader_content_type: None, - content_type: LeaderContentData::NONE, - content: None, - } - } -} - -pub struct LeaderContentBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> LeaderContentBuilder<'a, 'b, A> { - #[inline] - pub fn add_leader_content_type(&mut self, leader_content_type: LEADER_CONTENT_TYPE) { - self.fbb_.push_slot_always::(LeaderContent::VT_LEADER_CONTENT_TYPE, leader_content_type); - } - #[inline] - pub fn add_content_type(&mut self, content_type: LeaderContentData) { - self.fbb_.push_slot::(LeaderContent::VT_CONTENT_TYPE, content_type, LeaderContentData::NONE); - } - #[inline] - pub fn add_content(&mut self, content: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(LeaderContent::VT_CONTENT, content); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> LeaderContentBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - LeaderContentBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for LeaderContent<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("LeaderContent"); - ds.field("leader_content_type", &self.leader_content_type()); - ds.field("content_type", &self.content_type()); - match self.content_type() { - LeaderContentData::LeaderTextBlockContent => { - if let Some(x) = self.content_as_leader_text_block_content() { - ds.field("content", &x) - } else { - ds.field("content", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - LeaderContentData::LeaderBlockContent => { - if let Some(x) = self.content_as_leader_block_content() { - ds.field("content", &x) - } else { - ds.field("content", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - _ => { - let x: Option<()> = None; - ds.field("content", &x) - }, - }; - ds.finish() - } -} -pub enum DucLeaderElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucLeaderElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucLeaderElement<'a> { - type Inner = DucLeaderElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucLeaderElement<'a> { - pub const VT_LINEAR_BASE: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - pub const VT_CONTENT: flatbuffers::VOffsetT = 8; - pub const VT_CONTENT_ANCHOR: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucLeaderElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucLeaderElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucLeaderElementBuilder::new(_fbb); - if let Some(x) = args.content_anchor { builder.add_content_anchor(x); } - if let Some(x) = args.content { builder.add_content(x); } - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.linear_base { builder.add_linear_base(x); } - builder.finish() - } - - - #[inline] - pub fn linear_base(&self) -> Option<_DucLinearElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLeaderElement::VT_LINEAR_BASE, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLeaderElement::VT_STYLE, None)} - } - #[inline] - pub fn content(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLeaderElement::VT_CONTENT, None)} - } - #[inline] - pub fn content_anchor(&self) -> Option<&'a GeometricPoint> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLeaderElement::VT_CONTENT_ANCHOR, None)} - } -} - -impl flatbuffers::Verifiable for DucLeaderElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("linear_base", Self::VT_LINEAR_BASE, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .visit_field::>("content", Self::VT_CONTENT, false)? - .visit_field::("content_anchor", Self::VT_CONTENT_ANCHOR, false)? - .finish(); - Ok(()) - } -} -pub struct DucLeaderElementArgs<'a> { - pub linear_base: Option>>, - pub style: Option>>, - pub content: Option>>, - pub content_anchor: Option<&'a GeometricPoint>, -} -impl<'a> Default for DucLeaderElementArgs<'a> { - #[inline] - fn default() -> Self { - DucLeaderElementArgs { - linear_base: None, - style: None, - content: None, - content_anchor: None, - } - } -} - -pub struct DucLeaderElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucLeaderElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_linear_base(&mut self, linear_base: flatbuffers::WIPOffset<_DucLinearElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucLeaderElement::VT_LINEAR_BASE, linear_base); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucLeaderElement::VT_STYLE, style); - } - #[inline] - pub fn add_content(&mut self, content: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucLeaderElement::VT_CONTENT, content); - } - #[inline] - pub fn add_content_anchor(&mut self, content_anchor: &GeometricPoint) { - self.fbb_.push_slot_always::<&GeometricPoint>(DucLeaderElement::VT_CONTENT_ANCHOR, content_anchor); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucLeaderElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucLeaderElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucLeaderElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucLeaderElement"); - ds.field("linear_base", &self.linear_base()); - ds.field("style", &self.style()); - ds.field("content", &self.content()); - ds.field("content_anchor", &self.content_anchor()); - ds.finish() - } -} -pub enum DimensionDefinitionPointsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DimensionDefinitionPoints<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DimensionDefinitionPoints<'a> { - type Inner = DimensionDefinitionPoints<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DimensionDefinitionPoints<'a> { - pub const VT_ORIGIN1: flatbuffers::VOffsetT = 4; - pub const VT_ORIGIN2: flatbuffers::VOffsetT = 6; - pub const VT_LOCATION: flatbuffers::VOffsetT = 8; - pub const VT_CENTER: flatbuffers::VOffsetT = 10; - pub const VT_JOG: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DimensionDefinitionPoints { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DimensionDefinitionPointsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DimensionDefinitionPointsBuilder::new(_fbb); - if let Some(x) = args.jog { builder.add_jog(x); } - if let Some(x) = args.center { builder.add_center(x); } - if let Some(x) = args.location { builder.add_location(x); } - if let Some(x) = args.origin2 { builder.add_origin2(x); } - if let Some(x) = args.origin1 { builder.add_origin1(x); } - builder.finish() - } - - - #[inline] - pub fn origin1(&self) -> Option<&'a GeometricPoint> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionDefinitionPoints::VT_ORIGIN1, None)} - } - #[inline] - pub fn origin2(&self) -> Option<&'a GeometricPoint> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionDefinitionPoints::VT_ORIGIN2, None)} - } - #[inline] - pub fn location(&self) -> Option<&'a GeometricPoint> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionDefinitionPoints::VT_LOCATION, None)} - } - #[inline] - pub fn center(&self) -> Option<&'a GeometricPoint> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionDefinitionPoints::VT_CENTER, None)} - } - #[inline] - pub fn jog(&self) -> Option<&'a GeometricPoint> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionDefinitionPoints::VT_JOG, None)} - } -} - -impl flatbuffers::Verifiable for DimensionDefinitionPoints<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("origin1", Self::VT_ORIGIN1, false)? - .visit_field::("origin2", Self::VT_ORIGIN2, false)? - .visit_field::("location", Self::VT_LOCATION, false)? - .visit_field::("center", Self::VT_CENTER, false)? - .visit_field::("jog", Self::VT_JOG, false)? - .finish(); - Ok(()) - } -} -pub struct DimensionDefinitionPointsArgs<'a> { - pub origin1: Option<&'a GeometricPoint>, - pub origin2: Option<&'a GeometricPoint>, - pub location: Option<&'a GeometricPoint>, - pub center: Option<&'a GeometricPoint>, - pub jog: Option<&'a GeometricPoint>, -} -impl<'a> Default for DimensionDefinitionPointsArgs<'a> { - #[inline] - fn default() -> Self { - DimensionDefinitionPointsArgs { - origin1: None, - origin2: None, - location: None, - center: None, - jog: None, - } - } -} - -pub struct DimensionDefinitionPointsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DimensionDefinitionPointsBuilder<'a, 'b, A> { - #[inline] - pub fn add_origin1(&mut self, origin1: &GeometricPoint) { - self.fbb_.push_slot_always::<&GeometricPoint>(DimensionDefinitionPoints::VT_ORIGIN1, origin1); - } - #[inline] - pub fn add_origin2(&mut self, origin2: &GeometricPoint) { - self.fbb_.push_slot_always::<&GeometricPoint>(DimensionDefinitionPoints::VT_ORIGIN2, origin2); - } - #[inline] - pub fn add_location(&mut self, location: &GeometricPoint) { - self.fbb_.push_slot_always::<&GeometricPoint>(DimensionDefinitionPoints::VT_LOCATION, location); - } - #[inline] - pub fn add_center(&mut self, center: &GeometricPoint) { - self.fbb_.push_slot_always::<&GeometricPoint>(DimensionDefinitionPoints::VT_CENTER, center); - } - #[inline] - pub fn add_jog(&mut self, jog: &GeometricPoint) { - self.fbb_.push_slot_always::<&GeometricPoint>(DimensionDefinitionPoints::VT_JOG, jog); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DimensionDefinitionPointsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DimensionDefinitionPointsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DimensionDefinitionPoints<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DimensionDefinitionPoints"); - ds.field("origin1", &self.origin1()); - ds.field("origin2", &self.origin2()); - ds.field("location", &self.location()); - ds.field("center", &self.center()); - ds.field("jog", &self.jog()); - ds.finish() - } -} -pub enum DimensionBindingsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DimensionBindings<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DimensionBindings<'a> { - type Inner = DimensionBindings<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DimensionBindings<'a> { - pub const VT_ORIGIN1: flatbuffers::VOffsetT = 4; - pub const VT_ORIGIN2: flatbuffers::VOffsetT = 6; - pub const VT_CENTER: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DimensionBindings { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DimensionBindingsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DimensionBindingsBuilder::new(_fbb); - if let Some(x) = args.center { builder.add_center(x); } - if let Some(x) = args.origin2 { builder.add_origin2(x); } - if let Some(x) = args.origin1 { builder.add_origin1(x); } - builder.finish() - } - - - #[inline] - pub fn origin1(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DimensionBindings::VT_ORIGIN1, None)} - } - #[inline] - pub fn origin2(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DimensionBindings::VT_ORIGIN2, None)} - } - #[inline] - pub fn center(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DimensionBindings::VT_CENTER, None)} - } -} - -impl flatbuffers::Verifiable for DimensionBindings<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("origin1", Self::VT_ORIGIN1, false)? - .visit_field::>("origin2", Self::VT_ORIGIN2, false)? - .visit_field::>("center", Self::VT_CENTER, false)? - .finish(); - Ok(()) - } -} -pub struct DimensionBindingsArgs<'a> { - pub origin1: Option>>, - pub origin2: Option>>, - pub center: Option>>, -} -impl<'a> Default for DimensionBindingsArgs<'a> { - #[inline] - fn default() -> Self { - DimensionBindingsArgs { - origin1: None, - origin2: None, - center: None, - } - } -} - -pub struct DimensionBindingsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DimensionBindingsBuilder<'a, 'b, A> { - #[inline] - pub fn add_origin1(&mut self, origin1: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DimensionBindings::VT_ORIGIN1, origin1); - } - #[inline] - pub fn add_origin2(&mut self, origin2: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DimensionBindings::VT_ORIGIN2, origin2); - } - #[inline] - pub fn add_center(&mut self, center: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DimensionBindings::VT_CENTER, center); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DimensionBindingsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DimensionBindingsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DimensionBindings<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DimensionBindings"); - ds.field("origin1", &self.origin1()); - ds.field("origin2", &self.origin2()); - ds.field("center", &self.center()); - ds.finish() - } -} -pub enum DimensionBaselineDataOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DimensionBaselineData<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DimensionBaselineData<'a> { - type Inner = DimensionBaselineData<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DimensionBaselineData<'a> { - pub const VT_BASE_DIMENSION_ID: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DimensionBaselineData { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DimensionBaselineDataArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DimensionBaselineDataBuilder::new(_fbb); - if let Some(x) = args.base_dimension_id { builder.add_base_dimension_id(x); } - builder.finish() - } - - - #[inline] - pub fn base_dimension_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DimensionBaselineData::VT_BASE_DIMENSION_ID, None)} - } -} - -impl flatbuffers::Verifiable for DimensionBaselineData<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base_dimension_id", Self::VT_BASE_DIMENSION_ID, false)? - .finish(); - Ok(()) - } -} -pub struct DimensionBaselineDataArgs<'a> { - pub base_dimension_id: Option>, -} -impl<'a> Default for DimensionBaselineDataArgs<'a> { - #[inline] - fn default() -> Self { - DimensionBaselineDataArgs { - base_dimension_id: None, - } - } -} - -pub struct DimensionBaselineDataBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DimensionBaselineDataBuilder<'a, 'b, A> { - #[inline] - pub fn add_base_dimension_id(&mut self, base_dimension_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DimensionBaselineData::VT_BASE_DIMENSION_ID, base_dimension_id); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DimensionBaselineDataBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DimensionBaselineDataBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DimensionBaselineData<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DimensionBaselineData"); - ds.field("base_dimension_id", &self.base_dimension_id()); - ds.finish() - } -} -pub enum DimensionContinueDataOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DimensionContinueData<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DimensionContinueData<'a> { - type Inner = DimensionContinueData<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DimensionContinueData<'a> { - pub const VT_CONTINUE_FROM_DIMENSION_ID: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DimensionContinueData { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DimensionContinueDataArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DimensionContinueDataBuilder::new(_fbb); - if let Some(x) = args.continue_from_dimension_id { builder.add_continue_from_dimension_id(x); } - builder.finish() - } - - - #[inline] - pub fn continue_from_dimension_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DimensionContinueData::VT_CONTINUE_FROM_DIMENSION_ID, None)} - } -} - -impl flatbuffers::Verifiable for DimensionContinueData<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("continue_from_dimension_id", Self::VT_CONTINUE_FROM_DIMENSION_ID, false)? - .finish(); - Ok(()) - } -} -pub struct DimensionContinueDataArgs<'a> { - pub continue_from_dimension_id: Option>, -} -impl<'a> Default for DimensionContinueDataArgs<'a> { - #[inline] - fn default() -> Self { - DimensionContinueDataArgs { - continue_from_dimension_id: None, - } - } -} - -pub struct DimensionContinueDataBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DimensionContinueDataBuilder<'a, 'b, A> { - #[inline] - pub fn add_continue_from_dimension_id(&mut self, continue_from_dimension_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DimensionContinueData::VT_CONTINUE_FROM_DIMENSION_ID, continue_from_dimension_id); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DimensionContinueDataBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DimensionContinueDataBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DimensionContinueData<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DimensionContinueData"); - ds.field("continue_from_dimension_id", &self.continue_from_dimension_id()); - ds.finish() - } -} -pub enum DucDimensionElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucDimensionElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucDimensionElement<'a> { - type Inner = DucDimensionElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucDimensionElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - pub const VT_DIMENSION_TYPE: flatbuffers::VOffsetT = 8; - pub const VT_DEFINITION_POINTS: flatbuffers::VOffsetT = 10; - pub const VT_OBLIQUE_ANGLE: flatbuffers::VOffsetT = 12; - pub const VT_ORDINATE_AXIS: flatbuffers::VOffsetT = 14; - pub const VT_BINDINGS: flatbuffers::VOffsetT = 16; - pub const VT_TEXT_OVERRIDE: flatbuffers::VOffsetT = 18; - pub const VT_TEXT_POSITION: flatbuffers::VOffsetT = 20; - pub const VT_TOLERANCE_OVERRIDE: flatbuffers::VOffsetT = 22; - pub const VT_BASELINE_DATA: flatbuffers::VOffsetT = 24; - pub const VT_CONTINUE_DATA: flatbuffers::VOffsetT = 26; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucDimensionElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucDimensionElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucDimensionElementBuilder::new(_fbb); - if let Some(x) = args.continue_data { builder.add_continue_data(x); } - if let Some(x) = args.baseline_data { builder.add_baseline_data(x); } - if let Some(x) = args.tolerance_override { builder.add_tolerance_override(x); } - if let Some(x) = args.text_position { builder.add_text_position(x); } - if let Some(x) = args.text_override { builder.add_text_override(x); } - if let Some(x) = args.bindings { builder.add_bindings(x); } - builder.add_oblique_angle(args.oblique_angle); - if let Some(x) = args.definition_points { builder.add_definition_points(x); } - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.base { builder.add_base(x); } - if let Some(x) = args.ordinate_axis { builder.add_ordinate_axis(x); } - if let Some(x) = args.dimension_type { builder.add_dimension_type(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionElement::VT_BASE, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionElement::VT_STYLE, None)} - } - #[inline] - pub fn dimension_type(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucDimensionElement::VT_DIMENSION_TYPE, None)} - } - #[inline] - pub fn definition_points(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionElement::VT_DEFINITION_POINTS, None)} - } - #[inline] - pub fn oblique_angle(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucDimensionElement::VT_OBLIQUE_ANGLE, Some(0.0)).unwrap()} - } - #[inline] - pub fn ordinate_axis(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucDimensionElement::VT_ORDINATE_AXIS, None)} - } - #[inline] - pub fn bindings(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionElement::VT_BINDINGS, None)} - } - #[inline] - pub fn text_override(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionElement::VT_TEXT_OVERRIDE, None)} - } - #[inline] - pub fn text_position(&self) -> Option<&'a GeometricPoint> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucDimensionElement::VT_TEXT_POSITION, None)} - } - #[inline] - pub fn tolerance_override(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionElement::VT_TOLERANCE_OVERRIDE, None)} - } - #[inline] - pub fn baseline_data(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionElement::VT_BASELINE_DATA, None)} - } - #[inline] - pub fn continue_data(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDimensionElement::VT_CONTINUE_DATA, None)} - } -} - -impl flatbuffers::Verifiable for DucDimensionElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .visit_field::("dimension_type", Self::VT_DIMENSION_TYPE, false)? - .visit_field::>("definition_points", Self::VT_DEFINITION_POINTS, false)? - .visit_field::("oblique_angle", Self::VT_OBLIQUE_ANGLE, false)? - .visit_field::("ordinate_axis", Self::VT_ORDINATE_AXIS, false)? - .visit_field::>("bindings", Self::VT_BINDINGS, false)? - .visit_field::>("text_override", Self::VT_TEXT_OVERRIDE, false)? - .visit_field::("text_position", Self::VT_TEXT_POSITION, false)? - .visit_field::>("tolerance_override", Self::VT_TOLERANCE_OVERRIDE, false)? - .visit_field::>("baseline_data", Self::VT_BASELINE_DATA, false)? - .visit_field::>("continue_data", Self::VT_CONTINUE_DATA, false)? - .finish(); - Ok(()) - } -} -pub struct DucDimensionElementArgs<'a> { - pub base: Option>>, - pub style: Option>>, - pub dimension_type: Option, - pub definition_points: Option>>, - pub oblique_angle: f32, - pub ordinate_axis: Option, - pub bindings: Option>>, - pub text_override: Option>, - pub text_position: Option<&'a GeometricPoint>, - pub tolerance_override: Option>>, - pub baseline_data: Option>>, - pub continue_data: Option>>, -} -impl<'a> Default for DucDimensionElementArgs<'a> { - #[inline] - fn default() -> Self { - DucDimensionElementArgs { - base: None, - style: None, - dimension_type: None, - definition_points: None, - oblique_angle: 0.0, - ordinate_axis: None, - bindings: None, - text_override: None, - text_position: None, - tolerance_override: None, - baseline_data: None, - continue_data: None, - } - } -} - -pub struct DucDimensionElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucDimensionElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucDimensionElement::VT_BASE, base); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDimensionElement::VT_STYLE, style); - } - #[inline] - pub fn add_dimension_type(&mut self, dimension_type: DIMENSION_TYPE) { - self.fbb_.push_slot_always::(DucDimensionElement::VT_DIMENSION_TYPE, dimension_type); - } - #[inline] - pub fn add_definition_points(&mut self, definition_points: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDimensionElement::VT_DEFINITION_POINTS, definition_points); - } - #[inline] - pub fn add_oblique_angle(&mut self, oblique_angle: f32) { - self.fbb_.push_slot::(DucDimensionElement::VT_OBLIQUE_ANGLE, oblique_angle, 0.0); - } - #[inline] - pub fn add_ordinate_axis(&mut self, ordinate_axis: AXIS) { - self.fbb_.push_slot_always::(DucDimensionElement::VT_ORDINATE_AXIS, ordinate_axis); - } - #[inline] - pub fn add_bindings(&mut self, bindings: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDimensionElement::VT_BINDINGS, bindings); - } - #[inline] - pub fn add_text_override(&mut self, text_override: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucDimensionElement::VT_TEXT_OVERRIDE, text_override); - } - #[inline] - pub fn add_text_position(&mut self, text_position: &GeometricPoint) { - self.fbb_.push_slot_always::<&GeometricPoint>(DucDimensionElement::VT_TEXT_POSITION, text_position); - } - #[inline] - pub fn add_tolerance_override(&mut self, tolerance_override: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDimensionElement::VT_TOLERANCE_OVERRIDE, tolerance_override); - } - #[inline] - pub fn add_baseline_data(&mut self, baseline_data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDimensionElement::VT_BASELINE_DATA, baseline_data); - } - #[inline] - pub fn add_continue_data(&mut self, continue_data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDimensionElement::VT_CONTINUE_DATA, continue_data); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucDimensionElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucDimensionElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucDimensionElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucDimensionElement"); - ds.field("base", &self.base()); - ds.field("style", &self.style()); - ds.field("dimension_type", &self.dimension_type()); - ds.field("definition_points", &self.definition_points()); - ds.field("oblique_angle", &self.oblique_angle()); - ds.field("ordinate_axis", &self.ordinate_axis()); - ds.field("bindings", &self.bindings()); - ds.field("text_override", &self.text_override()); - ds.field("text_position", &self.text_position()); - ds.field("tolerance_override", &self.tolerance_override()); - ds.field("baseline_data", &self.baseline_data()); - ds.field("continue_data", &self.continue_data()); - ds.finish() - } -} -pub enum DatumReferenceOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DatumReference<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DatumReference<'a> { - type Inner = DatumReference<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DatumReference<'a> { - pub const VT_LETTERS: flatbuffers::VOffsetT = 4; - pub const VT_MODIFIER: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DatumReference { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DatumReferenceArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DatumReferenceBuilder::new(_fbb); - if let Some(x) = args.letters { builder.add_letters(x); } - if let Some(x) = args.modifier { builder.add_modifier(x); } - builder.finish() - } - - - #[inline] - pub fn letters(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DatumReference::VT_LETTERS, None)} - } - #[inline] - pub fn modifier(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DatumReference::VT_MODIFIER, None)} - } -} - -impl flatbuffers::Verifiable for DatumReference<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("letters", Self::VT_LETTERS, false)? - .visit_field::("modifier", Self::VT_MODIFIER, false)? - .finish(); - Ok(()) - } -} -pub struct DatumReferenceArgs<'a> { - pub letters: Option>, - pub modifier: Option, -} -impl<'a> Default for DatumReferenceArgs<'a> { - #[inline] - fn default() -> Self { - DatumReferenceArgs { - letters: None, - modifier: None, - } - } -} - -pub struct DatumReferenceBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DatumReferenceBuilder<'a, 'b, A> { - #[inline] - pub fn add_letters(&mut self, letters: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DatumReference::VT_LETTERS, letters); - } - #[inline] - pub fn add_modifier(&mut self, modifier: MATERIAL_CONDITION) { - self.fbb_.push_slot_always::(DatumReference::VT_MODIFIER, modifier); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DatumReferenceBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DatumReferenceBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DatumReference<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DatumReference"); - ds.field("letters", &self.letters()); - ds.field("modifier", &self.modifier()); - ds.finish() - } -} -pub enum ToleranceClauseOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ToleranceClause<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ToleranceClause<'a> { - type Inner = ToleranceClause<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ToleranceClause<'a> { - pub const VT_VALUE: flatbuffers::VOffsetT = 4; - pub const VT_ZONE_TYPE: flatbuffers::VOffsetT = 6; - pub const VT_FEATURE_MODIFIERS: flatbuffers::VOffsetT = 8; - pub const VT_MATERIAL_CONDITION: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ToleranceClause { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args ToleranceClauseArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ToleranceClauseBuilder::new(_fbb); - if let Some(x) = args.feature_modifiers { builder.add_feature_modifiers(x); } - if let Some(x) = args.value { builder.add_value(x); } - if let Some(x) = args.material_condition { builder.add_material_condition(x); } - if let Some(x) = args.zone_type { builder.add_zone_type(x); } - builder.finish() - } - - - #[inline] - pub fn value(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ToleranceClause::VT_VALUE, None)} - } - #[inline] - pub fn zone_type(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ToleranceClause::VT_ZONE_TYPE, None)} - } - #[inline] - pub fn feature_modifiers(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ToleranceClause::VT_FEATURE_MODIFIERS, None)} - } - #[inline] - pub fn material_condition(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ToleranceClause::VT_MATERIAL_CONDITION, None)} - } -} - -impl flatbuffers::Verifiable for ToleranceClause<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("value", Self::VT_VALUE, false)? - .visit_field::("zone_type", Self::VT_ZONE_TYPE, false)? - .visit_field::>>("feature_modifiers", Self::VT_FEATURE_MODIFIERS, false)? - .visit_field::("material_condition", Self::VT_MATERIAL_CONDITION, false)? - .finish(); - Ok(()) - } -} -pub struct ToleranceClauseArgs<'a> { - pub value: Option>, - pub zone_type: Option, - pub feature_modifiers: Option>>, - pub material_condition: Option, -} -impl<'a> Default for ToleranceClauseArgs<'a> { - #[inline] - fn default() -> Self { - ToleranceClauseArgs { - value: None, - zone_type: None, - feature_modifiers: None, - material_condition: None, - } - } -} - -pub struct ToleranceClauseBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ToleranceClauseBuilder<'a, 'b, A> { - #[inline] - pub fn add_value(&mut self, value: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(ToleranceClause::VT_VALUE, value); - } - #[inline] - pub fn add_zone_type(&mut self, zone_type: TOLERANCE_ZONE_TYPE) { - self.fbb_.push_slot_always::(ToleranceClause::VT_ZONE_TYPE, zone_type); - } - #[inline] - pub fn add_feature_modifiers(&mut self, feature_modifiers: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ToleranceClause::VT_FEATURE_MODIFIERS, feature_modifiers); - } - #[inline] - pub fn add_material_condition(&mut self, material_condition: MATERIAL_CONDITION) { - self.fbb_.push_slot_always::(ToleranceClause::VT_MATERIAL_CONDITION, material_condition); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ToleranceClauseBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - ToleranceClauseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ToleranceClause<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ToleranceClause"); - ds.field("value", &self.value()); - ds.field("zone_type", &self.zone_type()); - ds.field("feature_modifiers", &self.feature_modifiers()); - ds.field("material_condition", &self.material_condition()); - ds.finish() - } -} -pub enum FeatureControlFrameSegmentOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct FeatureControlFrameSegment<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for FeatureControlFrameSegment<'a> { - type Inner = FeatureControlFrameSegment<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> FeatureControlFrameSegment<'a> { - pub const VT_SYMBOL: flatbuffers::VOffsetT = 4; - pub const VT_TOLERANCE: flatbuffers::VOffsetT = 6; - pub const VT_DATUMS: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - FeatureControlFrameSegment { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args FeatureControlFrameSegmentArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = FeatureControlFrameSegmentBuilder::new(_fbb); - if let Some(x) = args.datums { builder.add_datums(x); } - if let Some(x) = args.tolerance { builder.add_tolerance(x); } - if let Some(x) = args.symbol { builder.add_symbol(x); } - builder.finish() - } - - - #[inline] - pub fn symbol(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(FeatureControlFrameSegment::VT_SYMBOL, None)} - } - #[inline] - pub fn tolerance(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(FeatureControlFrameSegment::VT_TOLERANCE, None)} - } - #[inline] - pub fn datums(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(FeatureControlFrameSegment::VT_DATUMS, None)} - } -} - -impl flatbuffers::Verifiable for FeatureControlFrameSegment<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("symbol", Self::VT_SYMBOL, false)? - .visit_field::>("tolerance", Self::VT_TOLERANCE, false)? - .visit_field::>>>("datums", Self::VT_DATUMS, false)? - .finish(); - Ok(()) - } -} -pub struct FeatureControlFrameSegmentArgs<'a> { - pub symbol: Option, - pub tolerance: Option>>, - pub datums: Option>>>>, -} -impl<'a> Default for FeatureControlFrameSegmentArgs<'a> { - #[inline] - fn default() -> Self { - FeatureControlFrameSegmentArgs { - symbol: None, - tolerance: None, - datums: None, - } - } -} - -pub struct FeatureControlFrameSegmentBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FeatureControlFrameSegmentBuilder<'a, 'b, A> { - #[inline] - pub fn add_symbol(&mut self, symbol: GDT_SYMBOL) { - self.fbb_.push_slot_always::(FeatureControlFrameSegment::VT_SYMBOL, symbol); - } - #[inline] - pub fn add_tolerance(&mut self, tolerance: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(FeatureControlFrameSegment::VT_TOLERANCE, tolerance); - } - #[inline] - pub fn add_datums(&mut self, datums: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(FeatureControlFrameSegment::VT_DATUMS, datums); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FeatureControlFrameSegmentBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - FeatureControlFrameSegmentBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for FeatureControlFrameSegment<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("FeatureControlFrameSegment"); - ds.field("symbol", &self.symbol()); - ds.field("tolerance", &self.tolerance()); - ds.field("datums", &self.datums()); - ds.finish() - } -} -pub enum FCFBetweenModifierOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct FCFBetweenModifier<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for FCFBetweenModifier<'a> { - type Inner = FCFBetweenModifier<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> FCFBetweenModifier<'a> { - pub const VT_START: flatbuffers::VOffsetT = 4; - pub const VT_END: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - FCFBetweenModifier { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args FCFBetweenModifierArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = FCFBetweenModifierBuilder::new(_fbb); - if let Some(x) = args.end { builder.add_end(x); } - if let Some(x) = args.start { builder.add_start(x); } - builder.finish() - } - - - #[inline] - pub fn start(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(FCFBetweenModifier::VT_START, None)} - } - #[inline] - pub fn end(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(FCFBetweenModifier::VT_END, None)} - } -} - -impl flatbuffers::Verifiable for FCFBetweenModifier<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("start", Self::VT_START, false)? - .visit_field::>("end", Self::VT_END, false)? - .finish(); - Ok(()) - } -} -pub struct FCFBetweenModifierArgs<'a> { - pub start: Option>, - pub end: Option>, -} -impl<'a> Default for FCFBetweenModifierArgs<'a> { - #[inline] - fn default() -> Self { - FCFBetweenModifierArgs { - start: None, - end: None, - } - } -} - -pub struct FCFBetweenModifierBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FCFBetweenModifierBuilder<'a, 'b, A> { - #[inline] - pub fn add_start(&mut self, start: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(FCFBetweenModifier::VT_START, start); - } - #[inline] - pub fn add_end(&mut self, end: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(FCFBetweenModifier::VT_END, end); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FCFBetweenModifierBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - FCFBetweenModifierBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for FCFBetweenModifier<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("FCFBetweenModifier"); - ds.field("start", &self.start()); - ds.field("end", &self.end()); - ds.finish() - } -} -pub enum FCFProjectedZoneModifierOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct FCFProjectedZoneModifier<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for FCFProjectedZoneModifier<'a> { - type Inner = FCFProjectedZoneModifier<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> FCFProjectedZoneModifier<'a> { - pub const VT_VALUE: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - FCFProjectedZoneModifier { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args FCFProjectedZoneModifierArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = FCFProjectedZoneModifierBuilder::new(_fbb); - builder.add_value(args.value); - builder.finish() - } - - - #[inline] - pub fn value(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(FCFProjectedZoneModifier::VT_VALUE, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for FCFProjectedZoneModifier<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("value", Self::VT_VALUE, false)? - .finish(); - Ok(()) - } -} -pub struct FCFProjectedZoneModifierArgs { - pub value: f64, -} -impl<'a> Default for FCFProjectedZoneModifierArgs { - #[inline] - fn default() -> Self { - FCFProjectedZoneModifierArgs { - value: 0.0, - } - } -} - -pub struct FCFProjectedZoneModifierBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FCFProjectedZoneModifierBuilder<'a, 'b, A> { - #[inline] - pub fn add_value(&mut self, value: f64) { - self.fbb_.push_slot::(FCFProjectedZoneModifier::VT_VALUE, value, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FCFProjectedZoneModifierBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - FCFProjectedZoneModifierBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for FCFProjectedZoneModifier<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("FCFProjectedZoneModifier"); - ds.field("value", &self.value()); - ds.finish() - } -} -pub enum FCFFrameModifiersOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct FCFFrameModifiers<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for FCFFrameModifiers<'a> { - type Inner = FCFFrameModifiers<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> FCFFrameModifiers<'a> { - pub const VT_ALL_AROUND: flatbuffers::VOffsetT = 4; - pub const VT_ALL_OVER: flatbuffers::VOffsetT = 6; - pub const VT_CONTINUOUS_FEATURE: flatbuffers::VOffsetT = 8; - pub const VT_BETWEEN: flatbuffers::VOffsetT = 10; - pub const VT_PROJECTED_TOLERANCE_ZONE: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - FCFFrameModifiers { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args FCFFrameModifiersArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = FCFFrameModifiersBuilder::new(_fbb); - if let Some(x) = args.projected_tolerance_zone { builder.add_projected_tolerance_zone(x); } - if let Some(x) = args.between { builder.add_between(x); } - builder.add_continuous_feature(args.continuous_feature); - builder.add_all_over(args.all_over); - builder.add_all_around(args.all_around); - builder.finish() - } - - - #[inline] - pub fn all_around(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(FCFFrameModifiers::VT_ALL_AROUND, Some(false)).unwrap()} - } - #[inline] - pub fn all_over(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(FCFFrameModifiers::VT_ALL_OVER, Some(false)).unwrap()} - } - #[inline] - pub fn continuous_feature(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(FCFFrameModifiers::VT_CONTINUOUS_FEATURE, Some(false)).unwrap()} - } - #[inline] - pub fn between(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(FCFFrameModifiers::VT_BETWEEN, None)} - } - #[inline] - pub fn projected_tolerance_zone(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(FCFFrameModifiers::VT_PROJECTED_TOLERANCE_ZONE, None)} - } -} - -impl flatbuffers::Verifiable for FCFFrameModifiers<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("all_around", Self::VT_ALL_AROUND, false)? - .visit_field::("all_over", Self::VT_ALL_OVER, false)? - .visit_field::("continuous_feature", Self::VT_CONTINUOUS_FEATURE, false)? - .visit_field::>("between", Self::VT_BETWEEN, false)? - .visit_field::>("projected_tolerance_zone", Self::VT_PROJECTED_TOLERANCE_ZONE, false)? - .finish(); - Ok(()) - } -} -pub struct FCFFrameModifiersArgs<'a> { - pub all_around: bool, - pub all_over: bool, - pub continuous_feature: bool, - pub between: Option>>, - pub projected_tolerance_zone: Option>>, -} -impl<'a> Default for FCFFrameModifiersArgs<'a> { - #[inline] - fn default() -> Self { - FCFFrameModifiersArgs { - all_around: false, - all_over: false, - continuous_feature: false, - between: None, - projected_tolerance_zone: None, - } - } -} - -pub struct FCFFrameModifiersBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FCFFrameModifiersBuilder<'a, 'b, A> { - #[inline] - pub fn add_all_around(&mut self, all_around: bool) { - self.fbb_.push_slot::(FCFFrameModifiers::VT_ALL_AROUND, all_around, false); - } - #[inline] - pub fn add_all_over(&mut self, all_over: bool) { - self.fbb_.push_slot::(FCFFrameModifiers::VT_ALL_OVER, all_over, false); - } - #[inline] - pub fn add_continuous_feature(&mut self, continuous_feature: bool) { - self.fbb_.push_slot::(FCFFrameModifiers::VT_CONTINUOUS_FEATURE, continuous_feature, false); - } - #[inline] - pub fn add_between(&mut self, between: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(FCFFrameModifiers::VT_BETWEEN, between); - } - #[inline] - pub fn add_projected_tolerance_zone(&mut self, projected_tolerance_zone: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(FCFFrameModifiers::VT_PROJECTED_TOLERANCE_ZONE, projected_tolerance_zone); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FCFFrameModifiersBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - FCFFrameModifiersBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for FCFFrameModifiers<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("FCFFrameModifiers"); - ds.field("all_around", &self.all_around()); - ds.field("all_over", &self.all_over()); - ds.field("continuous_feature", &self.continuous_feature()); - ds.field("between", &self.between()); - ds.field("projected_tolerance_zone", &self.projected_tolerance_zone()); - ds.finish() - } -} -pub enum FCFDatumDefinitionOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct FCFDatumDefinition<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for FCFDatumDefinition<'a> { - type Inner = FCFDatumDefinition<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> FCFDatumDefinition<'a> { - pub const VT_LETTER: flatbuffers::VOffsetT = 4; - pub const VT_FEATURE_BINDING: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - FCFDatumDefinition { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args FCFDatumDefinitionArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = FCFDatumDefinitionBuilder::new(_fbb); - if let Some(x) = args.feature_binding { builder.add_feature_binding(x); } - if let Some(x) = args.letter { builder.add_letter(x); } - builder.finish() - } - - - #[inline] - pub fn letter(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(FCFDatumDefinition::VT_LETTER, None)} - } - #[inline] - pub fn feature_binding(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(FCFDatumDefinition::VT_FEATURE_BINDING, None)} - } -} - -impl flatbuffers::Verifiable for FCFDatumDefinition<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("letter", Self::VT_LETTER, false)? - .visit_field::>("feature_binding", Self::VT_FEATURE_BINDING, false)? - .finish(); - Ok(()) - } -} -pub struct FCFDatumDefinitionArgs<'a> { - pub letter: Option>, - pub feature_binding: Option>>, -} -impl<'a> Default for FCFDatumDefinitionArgs<'a> { - #[inline] - fn default() -> Self { - FCFDatumDefinitionArgs { - letter: None, - feature_binding: None, - } - } -} - -pub struct FCFDatumDefinitionBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FCFDatumDefinitionBuilder<'a, 'b, A> { - #[inline] - pub fn add_letter(&mut self, letter: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(FCFDatumDefinition::VT_LETTER, letter); - } - #[inline] - pub fn add_feature_binding(&mut self, feature_binding: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(FCFDatumDefinition::VT_FEATURE_BINDING, feature_binding); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FCFDatumDefinitionBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - FCFDatumDefinitionBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for FCFDatumDefinition<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("FCFDatumDefinition"); - ds.field("letter", &self.letter()); - ds.field("feature_binding", &self.feature_binding()); - ds.finish() - } -} -pub enum FCFSegmentRowOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct FCFSegmentRow<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for FCFSegmentRow<'a> { - type Inner = FCFSegmentRow<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> FCFSegmentRow<'a> { - pub const VT_SEGMENTS: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - FCFSegmentRow { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args FCFSegmentRowArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = FCFSegmentRowBuilder::new(_fbb); - if let Some(x) = args.segments { builder.add_segments(x); } - builder.finish() - } - - - #[inline] - pub fn segments(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(FCFSegmentRow::VT_SEGMENTS, None)} - } -} - -impl flatbuffers::Verifiable for FCFSegmentRow<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>>("segments", Self::VT_SEGMENTS, false)? - .finish(); - Ok(()) - } -} -pub struct FCFSegmentRowArgs<'a> { - pub segments: Option>>>>, -} -impl<'a> Default for FCFSegmentRowArgs<'a> { - #[inline] - fn default() -> Self { - FCFSegmentRowArgs { - segments: None, - } - } -} - -pub struct FCFSegmentRowBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FCFSegmentRowBuilder<'a, 'b, A> { - #[inline] - pub fn add_segments(&mut self, segments: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(FCFSegmentRow::VT_SEGMENTS, segments); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FCFSegmentRowBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - FCFSegmentRowBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for FCFSegmentRow<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("FCFSegmentRow"); - ds.field("segments", &self.segments()); - ds.finish() - } -} -pub enum DucFeatureControlFrameElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucFeatureControlFrameElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucFeatureControlFrameElement<'a> { - type Inner = DucFeatureControlFrameElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucFeatureControlFrameElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - pub const VT_ROWS: flatbuffers::VOffsetT = 8; - pub const VT_FRAME_MODIFIERS: flatbuffers::VOffsetT = 10; - pub const VT_LEADER_ELEMENT_ID: flatbuffers::VOffsetT = 12; - pub const VT_DATUM_DEFINITION: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucFeatureControlFrameElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucFeatureControlFrameElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucFeatureControlFrameElementBuilder::new(_fbb); - if let Some(x) = args.datum_definition { builder.add_datum_definition(x); } - if let Some(x) = args.leader_element_id { builder.add_leader_element_id(x); } - if let Some(x) = args.frame_modifiers { builder.add_frame_modifiers(x); } - if let Some(x) = args.rows { builder.add_rows(x); } - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFeatureControlFrameElement::VT_BASE, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFeatureControlFrameElement::VT_STYLE, None)} - } - #[inline] - pub fn rows(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucFeatureControlFrameElement::VT_ROWS, None)} - } - #[inline] - pub fn frame_modifiers(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFeatureControlFrameElement::VT_FRAME_MODIFIERS, None)} - } - #[inline] - pub fn leader_element_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFeatureControlFrameElement::VT_LEADER_ELEMENT_ID, None)} - } - #[inline] - pub fn datum_definition(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucFeatureControlFrameElement::VT_DATUM_DEFINITION, None)} - } -} - -impl flatbuffers::Verifiable for DucFeatureControlFrameElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .visit_field::>>>("rows", Self::VT_ROWS, false)? - .visit_field::>("frame_modifiers", Self::VT_FRAME_MODIFIERS, false)? - .visit_field::>("leader_element_id", Self::VT_LEADER_ELEMENT_ID, false)? - .visit_field::>("datum_definition", Self::VT_DATUM_DEFINITION, false)? - .finish(); - Ok(()) - } -} -pub struct DucFeatureControlFrameElementArgs<'a> { - pub base: Option>>, - pub style: Option>>, - pub rows: Option>>>>, - pub frame_modifiers: Option>>, - pub leader_element_id: Option>, - pub datum_definition: Option>>, -} -impl<'a> Default for DucFeatureControlFrameElementArgs<'a> { - #[inline] - fn default() -> Self { - DucFeatureControlFrameElementArgs { - base: None, - style: None, - rows: None, - frame_modifiers: None, - leader_element_id: None, - datum_definition: None, - } - } -} - -pub struct DucFeatureControlFrameElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucFeatureControlFrameElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucFeatureControlFrameElement::VT_BASE, base); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucFeatureControlFrameElement::VT_STYLE, style); - } - #[inline] - pub fn add_rows(&mut self, rows: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DucFeatureControlFrameElement::VT_ROWS, rows); - } - #[inline] - pub fn add_frame_modifiers(&mut self, frame_modifiers: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucFeatureControlFrameElement::VT_FRAME_MODIFIERS, frame_modifiers); - } - #[inline] - pub fn add_leader_element_id(&mut self, leader_element_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucFeatureControlFrameElement::VT_LEADER_ELEMENT_ID, leader_element_id); - } - #[inline] - pub fn add_datum_definition(&mut self, datum_definition: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucFeatureControlFrameElement::VT_DATUM_DEFINITION, datum_definition); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucFeatureControlFrameElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucFeatureControlFrameElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucFeatureControlFrameElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucFeatureControlFrameElement"); - ds.field("base", &self.base()); - ds.field("style", &self.style()); - ds.field("rows", &self.rows()); - ds.field("frame_modifiers", &self.frame_modifiers()); - ds.field("leader_element_id", &self.leader_element_id()); - ds.field("datum_definition", &self.datum_definition()); - ds.finish() - } -} -pub enum TextColumnOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct TextColumn<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for TextColumn<'a> { - type Inner = TextColumn<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> TextColumn<'a> { - pub const VT_WIDTH: flatbuffers::VOffsetT = 4; - pub const VT_GUTTER: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - TextColumn { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args TextColumnArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = TextColumnBuilder::new(_fbb); - builder.add_gutter(args.gutter); - builder.add_width(args.width); - builder.finish() - } - - - #[inline] - pub fn width(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(TextColumn::VT_WIDTH, Some(0.0)).unwrap()} - } - #[inline] - pub fn gutter(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(TextColumn::VT_GUTTER, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for TextColumn<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("width", Self::VT_WIDTH, false)? - .visit_field::("gutter", Self::VT_GUTTER, false)? - .finish(); - Ok(()) - } -} -pub struct TextColumnArgs { - pub width: f64, - pub gutter: f64, -} -impl<'a> Default for TextColumnArgs { - #[inline] - fn default() -> Self { - TextColumnArgs { - width: 0.0, - gutter: 0.0, - } - } -} - -pub struct TextColumnBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TextColumnBuilder<'a, 'b, A> { - #[inline] - pub fn add_width(&mut self, width: f64) { - self.fbb_.push_slot::(TextColumn::VT_WIDTH, width, 0.0); - } - #[inline] - pub fn add_gutter(&mut self, gutter: f64) { - self.fbb_.push_slot::(TextColumn::VT_GUTTER, gutter, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TextColumnBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - TextColumnBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for TextColumn<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("TextColumn"); - ds.field("width", &self.width()); - ds.field("gutter", &self.gutter()); - ds.finish() - } -} -pub enum ColumnLayoutOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ColumnLayout<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ColumnLayout<'a> { - type Inner = ColumnLayout<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ColumnLayout<'a> { - pub const VT_TYPE_: flatbuffers::VOffsetT = 4; - pub const VT_DEFINITIONS: flatbuffers::VOffsetT = 6; - pub const VT_AUTO_HEIGHT: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ColumnLayout { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args ColumnLayoutArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ColumnLayoutBuilder::new(_fbb); - if let Some(x) = args.definitions { builder.add_definitions(x); } - builder.add_auto_height(args.auto_height); - if let Some(x) = args.type_ { builder.add_type_(x); } - builder.finish() - } - - - #[inline] - pub fn type_(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ColumnLayout::VT_TYPE_, None)} - } - #[inline] - pub fn definitions(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(ColumnLayout::VT_DEFINITIONS, None)} - } - #[inline] - pub fn auto_height(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ColumnLayout::VT_AUTO_HEIGHT, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for ColumnLayout<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("type_", Self::VT_TYPE_, false)? - .visit_field::>>>("definitions", Self::VT_DEFINITIONS, false)? - .visit_field::("auto_height", Self::VT_AUTO_HEIGHT, false)? - .finish(); - Ok(()) - } -} -pub struct ColumnLayoutArgs<'a> { - pub type_: Option, - pub definitions: Option>>>>, - pub auto_height: bool, -} -impl<'a> Default for ColumnLayoutArgs<'a> { - #[inline] - fn default() -> Self { - ColumnLayoutArgs { - type_: None, - definitions: None, - auto_height: false, - } - } -} - -pub struct ColumnLayoutBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ColumnLayoutBuilder<'a, 'b, A> { - #[inline] - pub fn add_type_(&mut self, type_: COLUMN_TYPE) { - self.fbb_.push_slot_always::(ColumnLayout::VT_TYPE_, type_); - } - #[inline] - pub fn add_definitions(&mut self, definitions: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(ColumnLayout::VT_DEFINITIONS, definitions); - } - #[inline] - pub fn add_auto_height(&mut self, auto_height: bool) { - self.fbb_.push_slot::(ColumnLayout::VT_AUTO_HEIGHT, auto_height, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ColumnLayoutBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - ColumnLayoutBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ColumnLayout<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ColumnLayout"); - ds.field("type_", &self.type_()); - ds.field("definitions", &self.definitions()); - ds.field("auto_height", &self.auto_height()); - ds.finish() - } -} -pub enum DucDocElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucDocElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucDocElement<'a> { - type Inner = DucDocElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucDocElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - pub const VT_TEXT: flatbuffers::VOffsetT = 8; - pub const VT_DYNAMIC: flatbuffers::VOffsetT = 10; - pub const VT_FLOW_DIRECTION: flatbuffers::VOffsetT = 12; - pub const VT_COLUMNS: flatbuffers::VOffsetT = 14; - pub const VT_AUTO_RESIZE: flatbuffers::VOffsetT = 16; - pub const VT_GRID_CONFIG: flatbuffers::VOffsetT = 18; - pub const VT_FILE_ID: flatbuffers::VOffsetT = 20; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucDocElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucDocElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucDocElementBuilder::new(_fbb); - if let Some(x) = args.file_id { builder.add_file_id(x); } - if let Some(x) = args.grid_config { builder.add_grid_config(x); } - if let Some(x) = args.columns { builder.add_columns(x); } - if let Some(x) = args.dynamic { builder.add_dynamic(x); } - if let Some(x) = args.text { builder.add_text(x); } - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.add_auto_resize(args.auto_resize); - if let Some(x) = args.flow_direction { builder.add_flow_direction(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDocElement::VT_BASE, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDocElement::VT_STYLE, None)} - } - #[inline] - pub fn text(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDocElement::VT_TEXT, None)} - } - #[inline] - pub fn dynamic(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucDocElement::VT_DYNAMIC, None)} - } - #[inline] - pub fn flow_direction(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucDocElement::VT_FLOW_DIRECTION, None)} - } - #[inline] - pub fn columns(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDocElement::VT_COLUMNS, None)} - } - #[inline] - pub fn auto_resize(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucDocElement::VT_AUTO_RESIZE, Some(false)).unwrap()} - } - #[inline] - pub fn grid_config(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDocElement::VT_GRID_CONFIG, None)} - } - #[inline] - pub fn file_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucDocElement::VT_FILE_ID, None)} - } -} - -impl flatbuffers::Verifiable for DucDocElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .visit_field::>("text", Self::VT_TEXT, false)? - .visit_field::>>>("dynamic", Self::VT_DYNAMIC, false)? - .visit_field::("flow_direction", Self::VT_FLOW_DIRECTION, false)? - .visit_field::>("columns", Self::VT_COLUMNS, false)? - .visit_field::("auto_resize", Self::VT_AUTO_RESIZE, false)? - .visit_field::>("grid_config", Self::VT_GRID_CONFIG, false)? - .visit_field::>("file_id", Self::VT_FILE_ID, false)? - .finish(); - Ok(()) - } -} -pub struct DucDocElementArgs<'a> { - pub base: Option>>, - pub style: Option>>, - pub text: Option>, - pub dynamic: Option>>>>, - pub flow_direction: Option, - pub columns: Option>>, - pub auto_resize: bool, - pub grid_config: Option>>, - pub file_id: Option>, -} -impl<'a> Default for DucDocElementArgs<'a> { - #[inline] - fn default() -> Self { - DucDocElementArgs { - base: None, - style: None, - text: None, - dynamic: None, - flow_direction: None, - columns: None, - auto_resize: false, - grid_config: None, - file_id: None, - } - } -} - -pub struct DucDocElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucDocElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucDocElement::VT_BASE, base); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDocElement::VT_STYLE, style); - } - #[inline] - pub fn add_text(&mut self, text: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucDocElement::VT_TEXT, text); - } - #[inline] - pub fn add_dynamic(&mut self, dynamic: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(DucDocElement::VT_DYNAMIC, dynamic); - } - #[inline] - pub fn add_flow_direction(&mut self, flow_direction: TEXT_FLOW_DIRECTION) { - self.fbb_.push_slot_always::(DucDocElement::VT_FLOW_DIRECTION, flow_direction); - } - #[inline] - pub fn add_columns(&mut self, columns: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDocElement::VT_COLUMNS, columns); - } - #[inline] - pub fn add_auto_resize(&mut self, auto_resize: bool) { - self.fbb_.push_slot::(DucDocElement::VT_AUTO_RESIZE, auto_resize, false); - } - #[inline] - pub fn add_grid_config(&mut self, grid_config: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucDocElement::VT_GRID_CONFIG, grid_config); - } - #[inline] - pub fn add_file_id(&mut self, file_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucDocElement::VT_FILE_ID, file_id); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucDocElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucDocElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucDocElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucDocElement"); - ds.field("base", &self.base()); - ds.field("style", &self.style()); - ds.field("text", &self.text()); - ds.field("dynamic", &self.dynamic()); - ds.field("flow_direction", &self.flow_direction()); - ds.field("columns", &self.columns()); - ds.field("auto_resize", &self.auto_resize()); - ds.field("grid_config", &self.grid_config()); - ds.field("file_id", &self.file_id()); - ds.finish() - } -} -pub enum ParametricSourceOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ParametricSource<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ParametricSource<'a> { - type Inner = ParametricSource<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ParametricSource<'a> { - pub const VT_TYPE_: flatbuffers::VOffsetT = 4; - pub const VT_CODE: flatbuffers::VOffsetT = 6; - pub const VT_FILE_ID: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ParametricSource { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args ParametricSourceArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ParametricSourceBuilder::new(_fbb); - if let Some(x) = args.file_id { builder.add_file_id(x); } - if let Some(x) = args.code { builder.add_code(x); } - if let Some(x) = args.type_ { builder.add_type_(x); } - builder.finish() - } - - - #[inline] - pub fn type_(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ParametricSource::VT_TYPE_, None)} - } - #[inline] - pub fn code(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ParametricSource::VT_CODE, None)} - } - #[inline] - pub fn file_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ParametricSource::VT_FILE_ID, None)} - } -} - -impl flatbuffers::Verifiable for ParametricSource<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("type_", Self::VT_TYPE_, false)? - .visit_field::>("code", Self::VT_CODE, false)? - .visit_field::>("file_id", Self::VT_FILE_ID, false)? - .finish(); - Ok(()) - } -} -pub struct ParametricSourceArgs<'a> { - pub type_: Option, - pub code: Option>, - pub file_id: Option>, -} -impl<'a> Default for ParametricSourceArgs<'a> { - #[inline] - fn default() -> Self { - ParametricSourceArgs { - type_: None, - code: None, - file_id: None, - } - } -} - -pub struct ParametricSourceBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ParametricSourceBuilder<'a, 'b, A> { - #[inline] - pub fn add_type_(&mut self, type_: PARAMETRIC_SOURCE_TYPE) { - self.fbb_.push_slot_always::(ParametricSource::VT_TYPE_, type_); - } - #[inline] - pub fn add_code(&mut self, code: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(ParametricSource::VT_CODE, code); - } - #[inline] - pub fn add_file_id(&mut self, file_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(ParametricSource::VT_FILE_ID, file_id); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ParametricSourceBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - ParametricSourceBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ParametricSource<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ParametricSource"); - ds.field("type_", &self.type_()); - ds.field("code", &self.code()); - ds.field("file_id", &self.file_id()); - ds.finish() - } -} -pub enum DucParametricElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucParametricElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucParametricElement<'a> { - type Inner = DucParametricElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucParametricElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_SOURCE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucParametricElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucParametricElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucParametricElementBuilder::new(_fbb); - if let Some(x) = args.source { builder.add_source(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucParametricElement::VT_BASE, None)} - } - #[inline] - pub fn source(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucParametricElement::VT_SOURCE, None)} - } -} - -impl flatbuffers::Verifiable for DucParametricElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>("source", Self::VT_SOURCE, false)? - .finish(); - Ok(()) - } -} -pub struct DucParametricElementArgs<'a> { - pub base: Option>>, - pub source: Option>>, -} -impl<'a> Default for DucParametricElementArgs<'a> { - #[inline] - fn default() -> Self { - DucParametricElementArgs { - base: None, - source: None, - } - } -} - -pub struct DucParametricElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucParametricElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucParametricElement::VT_BASE, base); - } - #[inline] - pub fn add_source(&mut self, source: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucParametricElement::VT_SOURCE, source); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucParametricElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucParametricElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucParametricElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucParametricElement"); - ds.field("base", &self.base()); - ds.field("source", &self.source()); - ds.finish() - } -} -pub enum DucModelElementOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucModelElement<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucModelElement<'a> { - type Inner = DucModelElement<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucModelElement<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_SOURCE: flatbuffers::VOffsetT = 6; - pub const VT_SVG_PATH: flatbuffers::VOffsetT = 8; - pub const VT_FILE_IDS: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucModelElement { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucModelElementArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucModelElementBuilder::new(_fbb); - if let Some(x) = args.file_ids { builder.add_file_ids(x); } - if let Some(x) = args.svg_path { builder.add_svg_path(x); } - if let Some(x) = args.source { builder.add_source(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_DucElementBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucModelElement::VT_BASE, None)} - } - #[inline] - pub fn source(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucModelElement::VT_SOURCE, None)} - } - #[inline] - pub fn svg_path(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucModelElement::VT_SVG_PATH, None)} - } - #[inline] - pub fn file_ids(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucModelElement::VT_FILE_IDS, None)} - } -} - -impl flatbuffers::Verifiable for DucModelElement<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>("source", Self::VT_SOURCE, false)? - .visit_field::>("svg_path", Self::VT_SVG_PATH, false)? - .visit_field::>>>("file_ids", Self::VT_FILE_IDS, false)? - .finish(); - Ok(()) - } -} -pub struct DucModelElementArgs<'a> { - pub base: Option>>, - pub source: Option>, - pub svg_path: Option>, - pub file_ids: Option>>>, -} -impl<'a> Default for DucModelElementArgs<'a> { - #[inline] - fn default() -> Self { - DucModelElementArgs { - base: None, - source: None, - svg_path: None, - file_ids: None, - } - } -} - -pub struct DucModelElementBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucModelElementBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_DucElementBase<'b >>) { - self.fbb_.push_slot_always::>(DucModelElement::VT_BASE, base); - } - #[inline] - pub fn add_source(&mut self, source: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucModelElement::VT_SOURCE, source); - } - #[inline] - pub fn add_svg_path(&mut self, svg_path: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucModelElement::VT_SVG_PATH, svg_path); - } - #[inline] - pub fn add_file_ids(&mut self, file_ids: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(DucModelElement::VT_FILE_IDS, file_ids); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucModelElementBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucModelElementBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucModelElement<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucModelElement"); - ds.field("base", &self.base()); - ds.field("source", &self.source()); - ds.field("svg_path", &self.svg_path()); - ds.field("file_ids", &self.file_ids()); - ds.finish() - } -} -pub enum ElementWrapperOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ElementWrapper<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ElementWrapper<'a> { - type Inner = ElementWrapper<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ElementWrapper<'a> { - pub const VT_ELEMENT_TYPE: flatbuffers::VOffsetT = 4; - pub const VT_ELEMENT: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ElementWrapper { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args ElementWrapperArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = ElementWrapperBuilder::new(_fbb); - if let Some(x) = args.element { builder.add_element(x); } - builder.add_element_type(args.element_type); - builder.finish() - } - - - #[inline] - pub fn element_type(&self) -> Element { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ElementWrapper::VT_ELEMENT_TYPE, Some(Element::NONE)).unwrap()} - } - #[inline] - pub fn element(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ElementWrapper::VT_ELEMENT, None)} - } - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_rectangle_element(&self) -> Option> { - if self.element_type() == Element::DucRectangleElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucRectangleElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_polygon_element(&self) -> Option> { - if self.element_type() == Element::DucPolygonElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucPolygonElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_ellipse_element(&self) -> Option> { - if self.element_type() == Element::DucEllipseElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucEllipseElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_embeddable_element(&self) -> Option> { - if self.element_type() == Element::DucEmbeddableElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucEmbeddableElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_pdf_element(&self) -> Option> { - if self.element_type() == Element::DucPdfElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucPdfElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_mermaid_element(&self) -> Option> { - if self.element_type() == Element::DucMermaidElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucMermaidElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_table_element(&self) -> Option> { - if self.element_type() == Element::DucTableElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucTableElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_image_element(&self) -> Option> { - if self.element_type() == Element::DucImageElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucImageElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_text_element(&self) -> Option> { - if self.element_type() == Element::DucTextElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucTextElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_linear_element(&self) -> Option> { - if self.element_type() == Element::DucLinearElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucLinearElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_arrow_element(&self) -> Option> { - if self.element_type() == Element::DucArrowElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucArrowElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_free_draw_element(&self) -> Option> { - if self.element_type() == Element::DucFreeDrawElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucFreeDrawElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_block_instance_element(&self) -> Option> { - if self.element_type() == Element::DucBlockInstanceElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucBlockInstanceElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_frame_element(&self) -> Option> { - if self.element_type() == Element::DucFrameElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucFrameElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_plot_element(&self) -> Option> { - if self.element_type() == Element::DucPlotElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucPlotElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_viewport_element(&self) -> Option> { - if self.element_type() == Element::DucViewportElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucViewportElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_xray_element(&self) -> Option> { - if self.element_type() == Element::DucXRayElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucXRayElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_leader_element(&self) -> Option> { - if self.element_type() == Element::DucLeaderElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucLeaderElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_dimension_element(&self) -> Option> { - if self.element_type() == Element::DucDimensionElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucDimensionElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_feature_control_frame_element(&self) -> Option> { - if self.element_type() == Element::DucFeatureControlFrameElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucFeatureControlFrameElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_doc_element(&self) -> Option> { - if self.element_type() == Element::DucDocElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucDocElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_parametric_element(&self) -> Option> { - if self.element_type() == Element::DucParametricElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucParametricElement::init_from_table(t) } - }) - } else { - None - } - } - - #[inline] - #[allow(non_snake_case)] - pub fn element_as_duc_model_element(&self) -> Option> { - if self.element_type() == Element::DucModelElement { - self.element().map(|t| { - // Safety: - // Created from a valid Table for this object - // Which contains a valid union in this slot - unsafe { DucModelElement::init_from_table(t) } - }) - } else { - None - } - } - -} - -impl flatbuffers::Verifiable for ElementWrapper<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_union::("element_type", Self::VT_ELEMENT_TYPE, "element", Self::VT_ELEMENT, false, |key, v, pos| { - match key { - Element::DucRectangleElement => v.verify_union_variant::>("Element::DucRectangleElement", pos), - Element::DucPolygonElement => v.verify_union_variant::>("Element::DucPolygonElement", pos), - Element::DucEllipseElement => v.verify_union_variant::>("Element::DucEllipseElement", pos), - Element::DucEmbeddableElement => v.verify_union_variant::>("Element::DucEmbeddableElement", pos), - Element::DucPdfElement => v.verify_union_variant::>("Element::DucPdfElement", pos), - Element::DucMermaidElement => v.verify_union_variant::>("Element::DucMermaidElement", pos), - Element::DucTableElement => v.verify_union_variant::>("Element::DucTableElement", pos), - Element::DucImageElement => v.verify_union_variant::>("Element::DucImageElement", pos), - Element::DucTextElement => v.verify_union_variant::>("Element::DucTextElement", pos), - Element::DucLinearElement => v.verify_union_variant::>("Element::DucLinearElement", pos), - Element::DucArrowElement => v.verify_union_variant::>("Element::DucArrowElement", pos), - Element::DucFreeDrawElement => v.verify_union_variant::>("Element::DucFreeDrawElement", pos), - Element::DucBlockInstanceElement => v.verify_union_variant::>("Element::DucBlockInstanceElement", pos), - Element::DucFrameElement => v.verify_union_variant::>("Element::DucFrameElement", pos), - Element::DucPlotElement => v.verify_union_variant::>("Element::DucPlotElement", pos), - Element::DucViewportElement => v.verify_union_variant::>("Element::DucViewportElement", pos), - Element::DucXRayElement => v.verify_union_variant::>("Element::DucXRayElement", pos), - Element::DucLeaderElement => v.verify_union_variant::>("Element::DucLeaderElement", pos), - Element::DucDimensionElement => v.verify_union_variant::>("Element::DucDimensionElement", pos), - Element::DucFeatureControlFrameElement => v.verify_union_variant::>("Element::DucFeatureControlFrameElement", pos), - Element::DucDocElement => v.verify_union_variant::>("Element::DucDocElement", pos), - Element::DucParametricElement => v.verify_union_variant::>("Element::DucParametricElement", pos), - Element::DucModelElement => v.verify_union_variant::>("Element::DucModelElement", pos), - _ => Ok(()), - } - })? - .finish(); - Ok(()) - } -} -pub struct ElementWrapperArgs { - pub element_type: Element, - pub element: Option>, -} -impl<'a> Default for ElementWrapperArgs { - #[inline] - fn default() -> Self { - ElementWrapperArgs { - element_type: Element::NONE, - element: None, - } - } -} - -pub struct ElementWrapperBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ElementWrapperBuilder<'a, 'b, A> { - #[inline] - pub fn add_element_type(&mut self, element_type: Element) { - self.fbb_.push_slot::(ElementWrapper::VT_ELEMENT_TYPE, element_type, Element::NONE); - } - #[inline] - pub fn add_element(&mut self, element: flatbuffers::WIPOffset) { - self.fbb_.push_slot_always::>(ElementWrapper::VT_ELEMENT, element); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ElementWrapperBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - ElementWrapperBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ElementWrapper<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ElementWrapper"); - ds.field("element_type", &self.element_type()); - match self.element_type() { - Element::DucRectangleElement => { - if let Some(x) = self.element_as_duc_rectangle_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucPolygonElement => { - if let Some(x) = self.element_as_duc_polygon_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucEllipseElement => { - if let Some(x) = self.element_as_duc_ellipse_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucEmbeddableElement => { - if let Some(x) = self.element_as_duc_embeddable_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucPdfElement => { - if let Some(x) = self.element_as_duc_pdf_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucMermaidElement => { - if let Some(x) = self.element_as_duc_mermaid_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucTableElement => { - if let Some(x) = self.element_as_duc_table_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucImageElement => { - if let Some(x) = self.element_as_duc_image_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucTextElement => { - if let Some(x) = self.element_as_duc_text_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucLinearElement => { - if let Some(x) = self.element_as_duc_linear_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucArrowElement => { - if let Some(x) = self.element_as_duc_arrow_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucFreeDrawElement => { - if let Some(x) = self.element_as_duc_free_draw_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucBlockInstanceElement => { - if let Some(x) = self.element_as_duc_block_instance_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucFrameElement => { - if let Some(x) = self.element_as_duc_frame_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucPlotElement => { - if let Some(x) = self.element_as_duc_plot_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucViewportElement => { - if let Some(x) = self.element_as_duc_viewport_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucXRayElement => { - if let Some(x) = self.element_as_duc_xray_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucLeaderElement => { - if let Some(x) = self.element_as_duc_leader_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucDimensionElement => { - if let Some(x) = self.element_as_duc_dimension_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucFeatureControlFrameElement => { - if let Some(x) = self.element_as_duc_feature_control_frame_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucDocElement => { - if let Some(x) = self.element_as_duc_doc_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucParametricElement => { - if let Some(x) = self.element_as_duc_parametric_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - Element::DucModelElement => { - if let Some(x) = self.element_as_duc_model_element() { - ds.field("element", &x) - } else { - ds.field("element", &"InvalidFlatbuffer: Union discriminant does not match value.") - } - }, - _ => { - let x: Option<()> = None; - ds.field("element", &x) - }, - }; - ds.finish() - } -} -pub enum DucGlobalStateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucGlobalState<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucGlobalState<'a> { - type Inner = DucGlobalState<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucGlobalState<'a> { - pub const VT_NAME: flatbuffers::VOffsetT = 4; - pub const VT_VIEW_BACKGROUND_COLOR: flatbuffers::VOffsetT = 6; - pub const VT_MAIN_SCOPE: flatbuffers::VOffsetT = 8; - pub const VT_DASH_SPACING_SCALE: flatbuffers::VOffsetT = 10; - pub const VT_IS_DASH_SPACING_AFFECTED_BY_VIEWPORT_SCALE: flatbuffers::VOffsetT = 12; - pub const VT_SCOPE_EXPONENT_THRESHOLD: flatbuffers::VOffsetT = 14; - pub const VT_DIMENSIONS_ASSOCIATIVE_BY_DEFAULT: flatbuffers::VOffsetT = 16; - pub const VT_USE_ANNOTATIVE_SCALING: flatbuffers::VOffsetT = 18; - pub const VT_DISPLAY_PRECISION_LINEAR: flatbuffers::VOffsetT = 20; - pub const VT_DISPLAY_PRECISION_ANGULAR: flatbuffers::VOffsetT = 22; - pub const VT_PRUNING_LEVEL: flatbuffers::VOffsetT = 24; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucGlobalState { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucGlobalStateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucGlobalStateBuilder::new(_fbb); - builder.add_display_precision_angular(args.display_precision_angular); - builder.add_display_precision_linear(args.display_precision_linear); - builder.add_dash_spacing_scale(args.dash_spacing_scale); - if let Some(x) = args.main_scope { builder.add_main_scope(x); } - if let Some(x) = args.view_background_color { builder.add_view_background_color(x); } - if let Some(x) = args.name { builder.add_name(x); } - if let Some(x) = args.pruning_level { builder.add_pruning_level(x); } - builder.add_use_annotative_scaling(args.use_annotative_scaling); - builder.add_dimensions_associative_by_default(args.dimensions_associative_by_default); - builder.add_scope_exponent_threshold(args.scope_exponent_threshold); - builder.add_is_dash_spacing_affected_by_viewport_scale(args.is_dash_spacing_affected_by_viewport_scale); - builder.finish() - } - - - #[inline] - pub fn name(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucGlobalState::VT_NAME, None)} - } - #[inline] - pub fn view_background_color(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucGlobalState::VT_VIEW_BACKGROUND_COLOR, None)} - } - #[inline] - pub fn main_scope(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucGlobalState::VT_MAIN_SCOPE, None)} - } - #[inline] - pub fn dash_spacing_scale(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucGlobalState::VT_DASH_SPACING_SCALE, Some(0.0)).unwrap()} - } - #[inline] - pub fn is_dash_spacing_affected_by_viewport_scale(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucGlobalState::VT_IS_DASH_SPACING_AFFECTED_BY_VIEWPORT_SCALE, Some(false)).unwrap()} - } - #[inline] - pub fn scope_exponent_threshold(&self) -> i8 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucGlobalState::VT_SCOPE_EXPONENT_THRESHOLD, Some(0)).unwrap()} - } - #[inline] - pub fn dimensions_associative_by_default(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucGlobalState::VT_DIMENSIONS_ASSOCIATIVE_BY_DEFAULT, Some(false)).unwrap()} - } - #[inline] - pub fn use_annotative_scaling(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucGlobalState::VT_USE_ANNOTATIVE_SCALING, Some(false)).unwrap()} - } - #[inline] - pub fn display_precision_linear(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucGlobalState::VT_DISPLAY_PRECISION_LINEAR, Some(0)).unwrap()} - } - #[inline] - pub fn display_precision_angular(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucGlobalState::VT_DISPLAY_PRECISION_ANGULAR, Some(0)).unwrap()} - } - #[inline] - pub fn pruning_level(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucGlobalState::VT_PRUNING_LEVEL, None)} - } -} - -impl flatbuffers::Verifiable for DucGlobalState<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("name", Self::VT_NAME, false)? - .visit_field::>("view_background_color", Self::VT_VIEW_BACKGROUND_COLOR, false)? - .visit_field::>("main_scope", Self::VT_MAIN_SCOPE, false)? - .visit_field::("dash_spacing_scale", Self::VT_DASH_SPACING_SCALE, false)? - .visit_field::("is_dash_spacing_affected_by_viewport_scale", Self::VT_IS_DASH_SPACING_AFFECTED_BY_VIEWPORT_SCALE, false)? - .visit_field::("scope_exponent_threshold", Self::VT_SCOPE_EXPONENT_THRESHOLD, false)? - .visit_field::("dimensions_associative_by_default", Self::VT_DIMENSIONS_ASSOCIATIVE_BY_DEFAULT, false)? - .visit_field::("use_annotative_scaling", Self::VT_USE_ANNOTATIVE_SCALING, false)? - .visit_field::("display_precision_linear", Self::VT_DISPLAY_PRECISION_LINEAR, false)? - .visit_field::("display_precision_angular", Self::VT_DISPLAY_PRECISION_ANGULAR, false)? - .visit_field::("pruning_level", Self::VT_PRUNING_LEVEL, false)? - .finish(); - Ok(()) - } -} -pub struct DucGlobalStateArgs<'a> { - pub name: Option>, - pub view_background_color: Option>, - pub main_scope: Option>, - pub dash_spacing_scale: f32, - pub is_dash_spacing_affected_by_viewport_scale: bool, - pub scope_exponent_threshold: i8, - pub dimensions_associative_by_default: bool, - pub use_annotative_scaling: bool, - pub display_precision_linear: i32, - pub display_precision_angular: i32, - pub pruning_level: Option, -} -impl<'a> Default for DucGlobalStateArgs<'a> { - #[inline] - fn default() -> Self { - DucGlobalStateArgs { - name: None, - view_background_color: None, - main_scope: None, - dash_spacing_scale: 0.0, - is_dash_spacing_affected_by_viewport_scale: false, - scope_exponent_threshold: 0, - dimensions_associative_by_default: false, - use_annotative_scaling: false, - display_precision_linear: 0, - display_precision_angular: 0, - pruning_level: None, - } - } -} - -pub struct DucGlobalStateBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucGlobalStateBuilder<'a, 'b, A> { - #[inline] - pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucGlobalState::VT_NAME, name); - } - #[inline] - pub fn add_view_background_color(&mut self, view_background_color: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucGlobalState::VT_VIEW_BACKGROUND_COLOR, view_background_color); - } - #[inline] - pub fn add_main_scope(&mut self, main_scope: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucGlobalState::VT_MAIN_SCOPE, main_scope); - } - #[inline] - pub fn add_dash_spacing_scale(&mut self, dash_spacing_scale: f32) { - self.fbb_.push_slot::(DucGlobalState::VT_DASH_SPACING_SCALE, dash_spacing_scale, 0.0); - } - #[inline] - pub fn add_is_dash_spacing_affected_by_viewport_scale(&mut self, is_dash_spacing_affected_by_viewport_scale: bool) { - self.fbb_.push_slot::(DucGlobalState::VT_IS_DASH_SPACING_AFFECTED_BY_VIEWPORT_SCALE, is_dash_spacing_affected_by_viewport_scale, false); - } - #[inline] - pub fn add_scope_exponent_threshold(&mut self, scope_exponent_threshold: i8) { - self.fbb_.push_slot::(DucGlobalState::VT_SCOPE_EXPONENT_THRESHOLD, scope_exponent_threshold, 0); - } - #[inline] - pub fn add_dimensions_associative_by_default(&mut self, dimensions_associative_by_default: bool) { - self.fbb_.push_slot::(DucGlobalState::VT_DIMENSIONS_ASSOCIATIVE_BY_DEFAULT, dimensions_associative_by_default, false); - } - #[inline] - pub fn add_use_annotative_scaling(&mut self, use_annotative_scaling: bool) { - self.fbb_.push_slot::(DucGlobalState::VT_USE_ANNOTATIVE_SCALING, use_annotative_scaling, false); - } - #[inline] - pub fn add_display_precision_linear(&mut self, display_precision_linear: i32) { - self.fbb_.push_slot::(DucGlobalState::VT_DISPLAY_PRECISION_LINEAR, display_precision_linear, 0); - } - #[inline] - pub fn add_display_precision_angular(&mut self, display_precision_angular: i32) { - self.fbb_.push_slot::(DucGlobalState::VT_DISPLAY_PRECISION_ANGULAR, display_precision_angular, 0); - } - #[inline] - pub fn add_pruning_level(&mut self, pruning_level: PRUNING_LEVEL) { - self.fbb_.push_slot_always::(DucGlobalState::VT_PRUNING_LEVEL, pruning_level); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucGlobalStateBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucGlobalStateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucGlobalState<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucGlobalState"); - ds.field("name", &self.name()); - ds.field("view_background_color", &self.view_background_color()); - ds.field("main_scope", &self.main_scope()); - ds.field("dash_spacing_scale", &self.dash_spacing_scale()); - ds.field("is_dash_spacing_affected_by_viewport_scale", &self.is_dash_spacing_affected_by_viewport_scale()); - ds.field("scope_exponent_threshold", &self.scope_exponent_threshold()); - ds.field("dimensions_associative_by_default", &self.dimensions_associative_by_default()); - ds.field("use_annotative_scaling", &self.use_annotative_scaling()); - ds.field("display_precision_linear", &self.display_precision_linear()); - ds.field("display_precision_angular", &self.display_precision_angular()); - ds.field("pruning_level", &self.pruning_level()); - ds.finish() - } -} -pub enum DucLocalStateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucLocalState<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucLocalState<'a> { - type Inner = DucLocalState<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucLocalState<'a> { - pub const VT_SCOPE: flatbuffers::VOffsetT = 4; - pub const VT_ACTIVE_STANDARD_ID: flatbuffers::VOffsetT = 6; - pub const VT_SCROLL_X: flatbuffers::VOffsetT = 8; - pub const VT_SCROLL_Y: flatbuffers::VOffsetT = 10; - pub const VT_ZOOM: flatbuffers::VOffsetT = 12; - pub const VT_ACTIVE_GRID_SETTINGS: flatbuffers::VOffsetT = 14; - pub const VT_ACTIVE_SNAP_SETTINGS: flatbuffers::VOffsetT = 16; - pub const VT_IS_BINDING_ENABLED: flatbuffers::VOffsetT = 18; - pub const VT_CURRENT_ITEM_STROKE: flatbuffers::VOffsetT = 20; - pub const VT_CURRENT_ITEM_BACKGROUND: flatbuffers::VOffsetT = 22; - pub const VT_CURRENT_ITEM_OPACITY: flatbuffers::VOffsetT = 24; - pub const VT_CURRENT_ITEM_FONT_FAMILY: flatbuffers::VOffsetT = 26; - pub const VT_CURRENT_ITEM_FONT_SIZE: flatbuffers::VOffsetT = 28; - pub const VT_CURRENT_ITEM_TEXT_ALIGN: flatbuffers::VOffsetT = 30; - pub const VT_CURRENT_ITEM_START_LINE_HEAD: flatbuffers::VOffsetT = 32; - pub const VT_CURRENT_ITEM_END_LINE_HEAD: flatbuffers::VOffsetT = 34; - pub const VT_CURRENT_ITEM_ROUNDNESS: flatbuffers::VOffsetT = 36; - pub const VT_PEN_MODE: flatbuffers::VOffsetT = 38; - pub const VT_VIEW_MODE_ENABLED: flatbuffers::VOffsetT = 40; - pub const VT_OBJECTS_SNAP_MODE_ENABLED: flatbuffers::VOffsetT = 42; - pub const VT_GRID_MODE_ENABLED: flatbuffers::VOffsetT = 44; - pub const VT_OUTLINE_MODE_ENABLED: flatbuffers::VOffsetT = 46; - pub const VT_MANUAL_SAVE_MODE: flatbuffers::VOffsetT = 48; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucLocalState { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucLocalStateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucLocalStateBuilder::new(_fbb); - builder.add_current_item_roundness(args.current_item_roundness); - builder.add_current_item_font_size(args.current_item_font_size); - builder.add_zoom(args.zoom); - builder.add_scroll_y(args.scroll_y); - builder.add_scroll_x(args.scroll_x); - if let Some(x) = args.current_item_end_line_head { builder.add_current_item_end_line_head(x); } - if let Some(x) = args.current_item_start_line_head { builder.add_current_item_start_line_head(x); } - if let Some(x) = args.current_item_font_family { builder.add_current_item_font_family(x); } - builder.add_current_item_opacity(args.current_item_opacity); - if let Some(x) = args.current_item_background { builder.add_current_item_background(x); } - if let Some(x) = args.current_item_stroke { builder.add_current_item_stroke(x); } - if let Some(x) = args.active_snap_settings { builder.add_active_snap_settings(x); } - if let Some(x) = args.active_grid_settings { builder.add_active_grid_settings(x); } - if let Some(x) = args.active_standard_id { builder.add_active_standard_id(x); } - if let Some(x) = args.scope { builder.add_scope(x); } - builder.add_manual_save_mode(args.manual_save_mode); - builder.add_outline_mode_enabled(args.outline_mode_enabled); - builder.add_grid_mode_enabled(args.grid_mode_enabled); - builder.add_objects_snap_mode_enabled(args.objects_snap_mode_enabled); - builder.add_view_mode_enabled(args.view_mode_enabled); - builder.add_pen_mode(args.pen_mode); - if let Some(x) = args.current_item_text_align { builder.add_current_item_text_align(x); } - builder.add_is_binding_enabled(args.is_binding_enabled); - builder.finish() - } - - - #[inline] - pub fn scope(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLocalState::VT_SCOPE, None)} - } - #[inline] - pub fn active_standard_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLocalState::VT_ACTIVE_STANDARD_ID, None)} - } - #[inline] - pub fn scroll_x(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_SCROLL_X, Some(0.0)).unwrap()} - } - #[inline] - pub fn scroll_y(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_SCROLL_Y, Some(0.0)).unwrap()} - } - #[inline] - pub fn zoom(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_ZOOM, Some(0.0)).unwrap()} - } - #[inline] - pub fn active_grid_settings(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(DucLocalState::VT_ACTIVE_GRID_SETTINGS, None)} - } - #[inline] - pub fn active_snap_settings(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLocalState::VT_ACTIVE_SNAP_SETTINGS, None)} - } - #[inline] - pub fn is_binding_enabled(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_IS_BINDING_ENABLED, Some(false)).unwrap()} - } - #[inline] - pub fn current_item_stroke(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLocalState::VT_CURRENT_ITEM_STROKE, None)} - } - #[inline] - pub fn current_item_background(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLocalState::VT_CURRENT_ITEM_BACKGROUND, None)} - } - #[inline] - pub fn current_item_opacity(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_CURRENT_ITEM_OPACITY, Some(0.0)).unwrap()} - } - #[inline] - pub fn current_item_font_family(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLocalState::VT_CURRENT_ITEM_FONT_FAMILY, None)} - } - #[inline] - pub fn current_item_font_size(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_CURRENT_ITEM_FONT_SIZE, Some(0.0)).unwrap()} - } - #[inline] - pub fn current_item_text_align(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_CURRENT_ITEM_TEXT_ALIGN, None)} - } - #[inline] - pub fn current_item_start_line_head(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLocalState::VT_CURRENT_ITEM_START_LINE_HEAD, None)} - } - #[inline] - pub fn current_item_end_line_head(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLocalState::VT_CURRENT_ITEM_END_LINE_HEAD, None)} - } - #[inline] - pub fn current_item_roundness(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_CURRENT_ITEM_ROUNDNESS, Some(0.0)).unwrap()} - } - #[inline] - pub fn pen_mode(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_PEN_MODE, Some(false)).unwrap()} - } - #[inline] - pub fn view_mode_enabled(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_VIEW_MODE_ENABLED, Some(false)).unwrap()} - } - #[inline] - pub fn objects_snap_mode_enabled(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_OBJECTS_SNAP_MODE_ENABLED, Some(false)).unwrap()} - } - #[inline] - pub fn grid_mode_enabled(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_GRID_MODE_ENABLED, Some(false)).unwrap()} - } - #[inline] - pub fn outline_mode_enabled(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_OUTLINE_MODE_ENABLED, Some(false)).unwrap()} - } - #[inline] - pub fn manual_save_mode(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLocalState::VT_MANUAL_SAVE_MODE, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DucLocalState<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("scope", Self::VT_SCOPE, false)? - .visit_field::>("active_standard_id", Self::VT_ACTIVE_STANDARD_ID, false)? - .visit_field::("scroll_x", Self::VT_SCROLL_X, false)? - .visit_field::("scroll_y", Self::VT_SCROLL_Y, false)? - .visit_field::("zoom", Self::VT_ZOOM, false)? - .visit_field::>>>("active_grid_settings", Self::VT_ACTIVE_GRID_SETTINGS, false)? - .visit_field::>("active_snap_settings", Self::VT_ACTIVE_SNAP_SETTINGS, false)? - .visit_field::("is_binding_enabled", Self::VT_IS_BINDING_ENABLED, false)? - .visit_field::>("current_item_stroke", Self::VT_CURRENT_ITEM_STROKE, false)? - .visit_field::>("current_item_background", Self::VT_CURRENT_ITEM_BACKGROUND, false)? - .visit_field::("current_item_opacity", Self::VT_CURRENT_ITEM_OPACITY, false)? - .visit_field::>("current_item_font_family", Self::VT_CURRENT_ITEM_FONT_FAMILY, false)? - .visit_field::("current_item_font_size", Self::VT_CURRENT_ITEM_FONT_SIZE, false)? - .visit_field::("current_item_text_align", Self::VT_CURRENT_ITEM_TEXT_ALIGN, false)? - .visit_field::>("current_item_start_line_head", Self::VT_CURRENT_ITEM_START_LINE_HEAD, false)? - .visit_field::>("current_item_end_line_head", Self::VT_CURRENT_ITEM_END_LINE_HEAD, false)? - .visit_field::("current_item_roundness", Self::VT_CURRENT_ITEM_ROUNDNESS, false)? - .visit_field::("pen_mode", Self::VT_PEN_MODE, false)? - .visit_field::("view_mode_enabled", Self::VT_VIEW_MODE_ENABLED, false)? - .visit_field::("objects_snap_mode_enabled", Self::VT_OBJECTS_SNAP_MODE_ENABLED, false)? - .visit_field::("grid_mode_enabled", Self::VT_GRID_MODE_ENABLED, false)? - .visit_field::("outline_mode_enabled", Self::VT_OUTLINE_MODE_ENABLED, false)? - .visit_field::("manual_save_mode", Self::VT_MANUAL_SAVE_MODE, false)? - .finish(); - Ok(()) - } -} -pub struct DucLocalStateArgs<'a> { - pub scope: Option>, - pub active_standard_id: Option>, - pub scroll_x: f64, - pub scroll_y: f64, - pub zoom: f64, - pub active_grid_settings: Option>>>, - pub active_snap_settings: Option>, - pub is_binding_enabled: bool, - pub current_item_stroke: Option>>, - pub current_item_background: Option>>, - pub current_item_opacity: f32, - pub current_item_font_family: Option>, - pub current_item_font_size: f64, - pub current_item_text_align: Option, - pub current_item_start_line_head: Option>>, - pub current_item_end_line_head: Option>>, - pub current_item_roundness: f64, - pub pen_mode: bool, - pub view_mode_enabled: bool, - pub objects_snap_mode_enabled: bool, - pub grid_mode_enabled: bool, - pub outline_mode_enabled: bool, - pub manual_save_mode: bool, -} -impl<'a> Default for DucLocalStateArgs<'a> { - #[inline] - fn default() -> Self { - DucLocalStateArgs { - scope: None, - active_standard_id: None, - scroll_x: 0.0, - scroll_y: 0.0, - zoom: 0.0, - active_grid_settings: None, - active_snap_settings: None, - is_binding_enabled: false, - current_item_stroke: None, - current_item_background: None, - current_item_opacity: 0.0, - current_item_font_family: None, - current_item_font_size: 0.0, - current_item_text_align: None, - current_item_start_line_head: None, - current_item_end_line_head: None, - current_item_roundness: 0.0, - pen_mode: false, - view_mode_enabled: false, - objects_snap_mode_enabled: false, - grid_mode_enabled: false, - outline_mode_enabled: false, - manual_save_mode: false, - } - } -} - -pub struct DucLocalStateBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucLocalStateBuilder<'a, 'b, A> { - #[inline] - pub fn add_scope(&mut self, scope: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucLocalState::VT_SCOPE, scope); - } - #[inline] - pub fn add_active_standard_id(&mut self, active_standard_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucLocalState::VT_ACTIVE_STANDARD_ID, active_standard_id); - } - #[inline] - pub fn add_scroll_x(&mut self, scroll_x: f64) { - self.fbb_.push_slot::(DucLocalState::VT_SCROLL_X, scroll_x, 0.0); - } - #[inline] - pub fn add_scroll_y(&mut self, scroll_y: f64) { - self.fbb_.push_slot::(DucLocalState::VT_SCROLL_Y, scroll_y, 0.0); - } - #[inline] - pub fn add_zoom(&mut self, zoom: f64) { - self.fbb_.push_slot::(DucLocalState::VT_ZOOM, zoom, 0.0); - } - #[inline] - pub fn add_active_grid_settings(&mut self, active_grid_settings: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(DucLocalState::VT_ACTIVE_GRID_SETTINGS, active_grid_settings); - } - #[inline] - pub fn add_active_snap_settings(&mut self, active_snap_settings: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucLocalState::VT_ACTIVE_SNAP_SETTINGS, active_snap_settings); - } - #[inline] - pub fn add_is_binding_enabled(&mut self, is_binding_enabled: bool) { - self.fbb_.push_slot::(DucLocalState::VT_IS_BINDING_ENABLED, is_binding_enabled, false); - } - #[inline] - pub fn add_current_item_stroke(&mut self, current_item_stroke: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucLocalState::VT_CURRENT_ITEM_STROKE, current_item_stroke); - } - #[inline] - pub fn add_current_item_background(&mut self, current_item_background: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucLocalState::VT_CURRENT_ITEM_BACKGROUND, current_item_background); - } - #[inline] - pub fn add_current_item_opacity(&mut self, current_item_opacity: f32) { - self.fbb_.push_slot::(DucLocalState::VT_CURRENT_ITEM_OPACITY, current_item_opacity, 0.0); - } - #[inline] - pub fn add_current_item_font_family(&mut self, current_item_font_family: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucLocalState::VT_CURRENT_ITEM_FONT_FAMILY, current_item_font_family); - } - #[inline] - pub fn add_current_item_font_size(&mut self, current_item_font_size: f64) { - self.fbb_.push_slot::(DucLocalState::VT_CURRENT_ITEM_FONT_SIZE, current_item_font_size, 0.0); - } - #[inline] - pub fn add_current_item_text_align(&mut self, current_item_text_align: TEXT_ALIGN) { - self.fbb_.push_slot_always::(DucLocalState::VT_CURRENT_ITEM_TEXT_ALIGN, current_item_text_align); - } - #[inline] - pub fn add_current_item_start_line_head(&mut self, current_item_start_line_head: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucLocalState::VT_CURRENT_ITEM_START_LINE_HEAD, current_item_start_line_head); - } - #[inline] - pub fn add_current_item_end_line_head(&mut self, current_item_end_line_head: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucLocalState::VT_CURRENT_ITEM_END_LINE_HEAD, current_item_end_line_head); - } - #[inline] - pub fn add_current_item_roundness(&mut self, current_item_roundness: f64) { - self.fbb_.push_slot::(DucLocalState::VT_CURRENT_ITEM_ROUNDNESS, current_item_roundness, 0.0); - } - #[inline] - pub fn add_pen_mode(&mut self, pen_mode: bool) { - self.fbb_.push_slot::(DucLocalState::VT_PEN_MODE, pen_mode, false); - } - #[inline] - pub fn add_view_mode_enabled(&mut self, view_mode_enabled: bool) { - self.fbb_.push_slot::(DucLocalState::VT_VIEW_MODE_ENABLED, view_mode_enabled, false); - } - #[inline] - pub fn add_objects_snap_mode_enabled(&mut self, objects_snap_mode_enabled: bool) { - self.fbb_.push_slot::(DucLocalState::VT_OBJECTS_SNAP_MODE_ENABLED, objects_snap_mode_enabled, false); - } - #[inline] - pub fn add_grid_mode_enabled(&mut self, grid_mode_enabled: bool) { - self.fbb_.push_slot::(DucLocalState::VT_GRID_MODE_ENABLED, grid_mode_enabled, false); - } - #[inline] - pub fn add_outline_mode_enabled(&mut self, outline_mode_enabled: bool) { - self.fbb_.push_slot::(DucLocalState::VT_OUTLINE_MODE_ENABLED, outline_mode_enabled, false); - } - #[inline] - pub fn add_manual_save_mode(&mut self, manual_save_mode: bool) { - self.fbb_.push_slot::(DucLocalState::VT_MANUAL_SAVE_MODE, manual_save_mode, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucLocalStateBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucLocalStateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucLocalState<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucLocalState"); - ds.field("scope", &self.scope()); - ds.field("active_standard_id", &self.active_standard_id()); - ds.field("scroll_x", &self.scroll_x()); - ds.field("scroll_y", &self.scroll_y()); - ds.field("zoom", &self.zoom()); - ds.field("active_grid_settings", &self.active_grid_settings()); - ds.field("active_snap_settings", &self.active_snap_settings()); - ds.field("is_binding_enabled", &self.is_binding_enabled()); - ds.field("current_item_stroke", &self.current_item_stroke()); - ds.field("current_item_background", &self.current_item_background()); - ds.field("current_item_opacity", &self.current_item_opacity()); - ds.field("current_item_font_family", &self.current_item_font_family()); - ds.field("current_item_font_size", &self.current_item_font_size()); - ds.field("current_item_text_align", &self.current_item_text_align()); - ds.field("current_item_start_line_head", &self.current_item_start_line_head()); - ds.field("current_item_end_line_head", &self.current_item_end_line_head()); - ds.field("current_item_roundness", &self.current_item_roundness()); - ds.field("pen_mode", &self.pen_mode()); - ds.field("view_mode_enabled", &self.view_mode_enabled()); - ds.field("objects_snap_mode_enabled", &self.objects_snap_mode_enabled()); - ds.field("grid_mode_enabled", &self.grid_mode_enabled()); - ds.field("outline_mode_enabled", &self.outline_mode_enabled()); - ds.field("manual_save_mode", &self.manual_save_mode()); - ds.finish() - } -} -pub enum DucGroupOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucGroup<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucGroup<'a> { - type Inner = DucGroup<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucGroup<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STACK_BASE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucGroup { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucGroupArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucGroupBuilder::new(_fbb); - if let Some(x) = args.stack_base { builder.add_stack_base(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucGroup::VT_ID, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DucGroup) -> bool { - self.id() < o.id() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.id(); - key.cmp(val) - } - #[inline] - pub fn stack_base(&self) -> Option<_DucStackBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucGroup::VT_STACK_BASE, None)} - } -} - -impl flatbuffers::Verifiable for DucGroup<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, true)? - .visit_field::>("stack_base", Self::VT_STACK_BASE, false)? - .finish(); - Ok(()) - } -} -pub struct DucGroupArgs<'a> { - pub id: Option>, - pub stack_base: Option>>, -} -impl<'a> Default for DucGroupArgs<'a> { - #[inline] - fn default() -> Self { - DucGroupArgs { - id: None, // required field - stack_base: None, - } - } -} - -pub struct DucGroupBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucGroupBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucGroup::VT_ID, id); - } - #[inline] - pub fn add_stack_base(&mut self, stack_base: flatbuffers::WIPOffset<_DucStackBase<'b >>) { - self.fbb_.push_slot_always::>(DucGroup::VT_STACK_BASE, stack_base); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucGroupBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucGroupBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DucGroup::VT_ID,"id"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucGroup<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucGroup"); - ds.field("id", &self.id()); - ds.field("stack_base", &self.stack_base()); - ds.finish() - } -} -pub enum DucRegionOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucRegion<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucRegion<'a> { - type Inner = DucRegion<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucRegion<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STACK_BASE: flatbuffers::VOffsetT = 6; - pub const VT_BOOLEAN_OPERATION: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucRegion { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucRegionArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucRegionBuilder::new(_fbb); - if let Some(x) = args.stack_base { builder.add_stack_base(x); } - if let Some(x) = args.id { builder.add_id(x); } - if let Some(x) = args.boolean_operation { builder.add_boolean_operation(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucRegion::VT_ID, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DucRegion) -> bool { - self.id() < o.id() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.id(); - key.cmp(val) - } - #[inline] - pub fn stack_base(&self) -> Option<_DucStackBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucRegion::VT_STACK_BASE, None)} - } - #[inline] - pub fn boolean_operation(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucRegion::VT_BOOLEAN_OPERATION, None)} - } -} - -impl flatbuffers::Verifiable for DucRegion<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, true)? - .visit_field::>("stack_base", Self::VT_STACK_BASE, false)? - .visit_field::("boolean_operation", Self::VT_BOOLEAN_OPERATION, false)? - .finish(); - Ok(()) - } -} -pub struct DucRegionArgs<'a> { - pub id: Option>, - pub stack_base: Option>>, - pub boolean_operation: Option, -} -impl<'a> Default for DucRegionArgs<'a> { - #[inline] - fn default() -> Self { - DucRegionArgs { - id: None, // required field - stack_base: None, - boolean_operation: None, - } - } -} - -pub struct DucRegionBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucRegionBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucRegion::VT_ID, id); - } - #[inline] - pub fn add_stack_base(&mut self, stack_base: flatbuffers::WIPOffset<_DucStackBase<'b >>) { - self.fbb_.push_slot_always::>(DucRegion::VT_STACK_BASE, stack_base); - } - #[inline] - pub fn add_boolean_operation(&mut self, boolean_operation: BOOLEAN_OPERATION) { - self.fbb_.push_slot_always::(DucRegion::VT_BOOLEAN_OPERATION, boolean_operation); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucRegionBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucRegionBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DucRegion::VT_ID,"id"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucRegion<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucRegion"); - ds.field("id", &self.id()); - ds.field("stack_base", &self.stack_base()); - ds.field("boolean_operation", &self.boolean_operation()); - ds.finish() - } -} -pub enum DucLayerOverridesOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucLayerOverrides<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucLayerOverrides<'a> { - type Inner = DucLayerOverrides<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucLayerOverrides<'a> { - pub const VT_STROKE: flatbuffers::VOffsetT = 4; - pub const VT_BACKGROUND: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucLayerOverrides { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucLayerOverridesArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucLayerOverridesBuilder::new(_fbb); - if let Some(x) = args.background { builder.add_background(x); } - if let Some(x) = args.stroke { builder.add_stroke(x); } - builder.finish() - } - - - #[inline] - pub fn stroke(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLayerOverrides::VT_STROKE, None)} - } - #[inline] - pub fn background(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLayerOverrides::VT_BACKGROUND, None)} - } -} - -impl flatbuffers::Verifiable for DucLayerOverrides<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("stroke", Self::VT_STROKE, false)? - .visit_field::>("background", Self::VT_BACKGROUND, false)? - .finish(); - Ok(()) - } -} -pub struct DucLayerOverridesArgs<'a> { - pub stroke: Option>>, - pub background: Option>>, -} -impl<'a> Default for DucLayerOverridesArgs<'a> { - #[inline] - fn default() -> Self { - DucLayerOverridesArgs { - stroke: None, - background: None, - } - } -} - -pub struct DucLayerOverridesBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucLayerOverridesBuilder<'a, 'b, A> { - #[inline] - pub fn add_stroke(&mut self, stroke: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucLayerOverrides::VT_STROKE, stroke); - } - #[inline] - pub fn add_background(&mut self, background: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucLayerOverrides::VT_BACKGROUND, background); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucLayerOverridesBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucLayerOverridesBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucLayerOverrides<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucLayerOverrides"); - ds.field("stroke", &self.stroke()); - ds.field("background", &self.background()); - ds.finish() - } -} -pub enum DucLayerOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucLayer<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucLayer<'a> { - type Inner = DucLayer<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucLayer<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STACK_BASE: flatbuffers::VOffsetT = 6; - pub const VT_READONLY: flatbuffers::VOffsetT = 8; - pub const VT_OVERRIDES: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucLayer { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucLayerArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucLayerBuilder::new(_fbb); - if let Some(x) = args.overrides { builder.add_overrides(x); } - if let Some(x) = args.stack_base { builder.add_stack_base(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.add_readonly(args.readonly); - builder.finish() - } - - - #[inline] - pub fn id(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLayer::VT_ID, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DucLayer) -> bool { - self.id() < o.id() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.id(); - key.cmp(val) - } - #[inline] - pub fn stack_base(&self) -> Option<_DucStackBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLayer::VT_STACK_BASE, None)} - } - #[inline] - pub fn readonly(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucLayer::VT_READONLY, Some(false)).unwrap()} - } - #[inline] - pub fn overrides(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucLayer::VT_OVERRIDES, None)} - } -} - -impl flatbuffers::Verifiable for DucLayer<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, true)? - .visit_field::>("stack_base", Self::VT_STACK_BASE, false)? - .visit_field::("readonly", Self::VT_READONLY, false)? - .visit_field::>("overrides", Self::VT_OVERRIDES, false)? - .finish(); - Ok(()) - } -} -pub struct DucLayerArgs<'a> { - pub id: Option>, - pub stack_base: Option>>, - pub readonly: bool, - pub overrides: Option>>, -} -impl<'a> Default for DucLayerArgs<'a> { - #[inline] - fn default() -> Self { - DucLayerArgs { - id: None, // required field - stack_base: None, - readonly: false, - overrides: None, - } - } -} - -pub struct DucLayerBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucLayerBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucLayer::VT_ID, id); - } - #[inline] - pub fn add_stack_base(&mut self, stack_base: flatbuffers::WIPOffset<_DucStackBase<'b >>) { - self.fbb_.push_slot_always::>(DucLayer::VT_STACK_BASE, stack_base); - } - #[inline] - pub fn add_readonly(&mut self, readonly: bool) { - self.fbb_.push_slot::(DucLayer::VT_READONLY, readonly, false); - } - #[inline] - pub fn add_overrides(&mut self, overrides: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucLayer::VT_OVERRIDES, overrides); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucLayerBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucLayerBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DucLayer::VT_ID,"id"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucLayer<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucLayer"); - ds.field("id", &self.id()); - ds.field("stack_base", &self.stack_base()); - ds.field("readonly", &self.readonly()); - ds.field("overrides", &self.overrides()); - ds.finish() - } -} -pub enum _UnitSystemBaseOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct _UnitSystemBase<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for _UnitSystemBase<'a> { - type Inner = _UnitSystemBase<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> _UnitSystemBase<'a> { - pub const VT_SYSTEM: flatbuffers::VOffsetT = 4; - pub const VT_PRECISION: flatbuffers::VOffsetT = 6; - pub const VT_SUPPRESS_LEADING_ZEROS: flatbuffers::VOffsetT = 8; - pub const VT_SUPPRESS_TRAILING_ZEROS: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - _UnitSystemBase { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args _UnitSystemBaseArgs - ) -> flatbuffers::WIPOffset<_UnitSystemBase<'bldr>> { - let mut builder = _UnitSystemBaseBuilder::new(_fbb); - builder.add_precision(args.precision); - builder.add_suppress_trailing_zeros(args.suppress_trailing_zeros); - builder.add_suppress_leading_zeros(args.suppress_leading_zeros); - if let Some(x) = args.system { builder.add_system(x); } - builder.finish() - } - - - #[inline] - pub fn system(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_UnitSystemBase::VT_SYSTEM, None)} - } - #[inline] - pub fn precision(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_UnitSystemBase::VT_PRECISION, Some(0)).unwrap()} - } - #[inline] - pub fn suppress_leading_zeros(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_UnitSystemBase::VT_SUPPRESS_LEADING_ZEROS, Some(false)).unwrap()} - } - #[inline] - pub fn suppress_trailing_zeros(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(_UnitSystemBase::VT_SUPPRESS_TRAILING_ZEROS, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for _UnitSystemBase<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("system", Self::VT_SYSTEM, false)? - .visit_field::("precision", Self::VT_PRECISION, false)? - .visit_field::("suppress_leading_zeros", Self::VT_SUPPRESS_LEADING_ZEROS, false)? - .visit_field::("suppress_trailing_zeros", Self::VT_SUPPRESS_TRAILING_ZEROS, false)? - .finish(); - Ok(()) - } -} -pub struct _UnitSystemBaseArgs { - pub system: Option, - pub precision: i32, - pub suppress_leading_zeros: bool, - pub suppress_trailing_zeros: bool, -} -impl<'a> Default for _UnitSystemBaseArgs { - #[inline] - fn default() -> Self { - _UnitSystemBaseArgs { - system: None, - precision: 0, - suppress_leading_zeros: false, - suppress_trailing_zeros: false, - } - } -} - -pub struct _UnitSystemBaseBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> _UnitSystemBaseBuilder<'a, 'b, A> { - #[inline] - pub fn add_system(&mut self, system: UNIT_SYSTEM) { - self.fbb_.push_slot_always::(_UnitSystemBase::VT_SYSTEM, system); - } - #[inline] - pub fn add_precision(&mut self, precision: i32) { - self.fbb_.push_slot::(_UnitSystemBase::VT_PRECISION, precision, 0); - } - #[inline] - pub fn add_suppress_leading_zeros(&mut self, suppress_leading_zeros: bool) { - self.fbb_.push_slot::(_UnitSystemBase::VT_SUPPRESS_LEADING_ZEROS, suppress_leading_zeros, false); - } - #[inline] - pub fn add_suppress_trailing_zeros(&mut self, suppress_trailing_zeros: bool) { - self.fbb_.push_slot::(_UnitSystemBase::VT_SUPPRESS_TRAILING_ZEROS, suppress_trailing_zeros, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> _UnitSystemBaseBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - _UnitSystemBaseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset<_UnitSystemBase<'a>> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for _UnitSystemBase<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("_UnitSystemBase"); - ds.field("system", &self.system()); - ds.field("precision", &self.precision()); - ds.field("suppress_leading_zeros", &self.suppress_leading_zeros()); - ds.field("suppress_trailing_zeros", &self.suppress_trailing_zeros()); - ds.finish() - } -} -pub enum LinearUnitSystemOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct LinearUnitSystem<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for LinearUnitSystem<'a> { - type Inner = LinearUnitSystem<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> LinearUnitSystem<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_FORMAT: flatbuffers::VOffsetT = 6; - pub const VT_DECIMAL_SEPARATOR: flatbuffers::VOffsetT = 8; - pub const VT_SUPPRESS_ZERO_FEET: flatbuffers::VOffsetT = 10; - pub const VT_SUPPRESS_ZERO_INCHES: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - LinearUnitSystem { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args LinearUnitSystemArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = LinearUnitSystemBuilder::new(_fbb); - if let Some(x) = args.base { builder.add_base(x); } - builder.add_suppress_zero_inches(args.suppress_zero_inches); - builder.add_suppress_zero_feet(args.suppress_zero_feet); - if let Some(x) = args.decimal_separator { builder.add_decimal_separator(x); } - if let Some(x) = args.format { builder.add_format(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_UnitSystemBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(LinearUnitSystem::VT_BASE, None)} - } - #[inline] - pub fn format(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(LinearUnitSystem::VT_FORMAT, None)} - } - #[inline] - pub fn decimal_separator(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(LinearUnitSystem::VT_DECIMAL_SEPARATOR, None)} - } - #[inline] - pub fn suppress_zero_feet(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(LinearUnitSystem::VT_SUPPRESS_ZERO_FEET, Some(false)).unwrap()} - } - #[inline] - pub fn suppress_zero_inches(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(LinearUnitSystem::VT_SUPPRESS_ZERO_INCHES, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for LinearUnitSystem<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::("format", Self::VT_FORMAT, false)? - .visit_field::("decimal_separator", Self::VT_DECIMAL_SEPARATOR, false)? - .visit_field::("suppress_zero_feet", Self::VT_SUPPRESS_ZERO_FEET, false)? - .visit_field::("suppress_zero_inches", Self::VT_SUPPRESS_ZERO_INCHES, false)? - .finish(); - Ok(()) - } -} -pub struct LinearUnitSystemArgs<'a> { - pub base: Option>>, - pub format: Option, - pub decimal_separator: Option, - pub suppress_zero_feet: bool, - pub suppress_zero_inches: bool, -} -impl<'a> Default for LinearUnitSystemArgs<'a> { - #[inline] - fn default() -> Self { - LinearUnitSystemArgs { - base: None, - format: None, - decimal_separator: None, - suppress_zero_feet: false, - suppress_zero_inches: false, - } - } -} - -pub struct LinearUnitSystemBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> LinearUnitSystemBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_UnitSystemBase<'b >>) { - self.fbb_.push_slot_always::>(LinearUnitSystem::VT_BASE, base); - } - #[inline] - pub fn add_format(&mut self, format: DIMENSION_UNITS_FORMAT) { - self.fbb_.push_slot_always::(LinearUnitSystem::VT_FORMAT, format); - } - #[inline] - pub fn add_decimal_separator(&mut self, decimal_separator: DECIMAL_SEPARATOR) { - self.fbb_.push_slot_always::(LinearUnitSystem::VT_DECIMAL_SEPARATOR, decimal_separator); - } - #[inline] - pub fn add_suppress_zero_feet(&mut self, suppress_zero_feet: bool) { - self.fbb_.push_slot::(LinearUnitSystem::VT_SUPPRESS_ZERO_FEET, suppress_zero_feet, false); - } - #[inline] - pub fn add_suppress_zero_inches(&mut self, suppress_zero_inches: bool) { - self.fbb_.push_slot::(LinearUnitSystem::VT_SUPPRESS_ZERO_INCHES, suppress_zero_inches, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> LinearUnitSystemBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - LinearUnitSystemBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for LinearUnitSystem<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("LinearUnitSystem"); - ds.field("base", &self.base()); - ds.field("format", &self.format()); - ds.field("decimal_separator", &self.decimal_separator()); - ds.field("suppress_zero_feet", &self.suppress_zero_feet()); - ds.field("suppress_zero_inches", &self.suppress_zero_inches()); - ds.finish() - } -} -pub enum AngularUnitSystemOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct AngularUnitSystem<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for AngularUnitSystem<'a> { - type Inner = AngularUnitSystem<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> AngularUnitSystem<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_FORMAT: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - AngularUnitSystem { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args AngularUnitSystemArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = AngularUnitSystemBuilder::new(_fbb); - if let Some(x) = args.base { builder.add_base(x); } - if let Some(x) = args.format { builder.add_format(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_UnitSystemBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(AngularUnitSystem::VT_BASE, None)} - } - #[inline] - pub fn format(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AngularUnitSystem::VT_FORMAT, None)} - } -} - -impl flatbuffers::Verifiable for AngularUnitSystem<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::("format", Self::VT_FORMAT, false)? - .finish(); - Ok(()) - } -} -pub struct AngularUnitSystemArgs<'a> { - pub base: Option>>, - pub format: Option, -} -impl<'a> Default for AngularUnitSystemArgs<'a> { - #[inline] - fn default() -> Self { - AngularUnitSystemArgs { - base: None, - format: None, - } - } -} - -pub struct AngularUnitSystemBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> AngularUnitSystemBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_UnitSystemBase<'b >>) { - self.fbb_.push_slot_always::>(AngularUnitSystem::VT_BASE, base); - } - #[inline] - pub fn add_format(&mut self, format: ANGULAR_UNITS_FORMAT) { - self.fbb_.push_slot_always::(AngularUnitSystem::VT_FORMAT, format); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> AngularUnitSystemBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - AngularUnitSystemBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for AngularUnitSystem<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("AngularUnitSystem"); - ds.field("base", &self.base()); - ds.field("format", &self.format()); - ds.finish() - } -} -pub enum AlternateUnitsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct AlternateUnits<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for AlternateUnits<'a> { - type Inner = AlternateUnits<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> AlternateUnits<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_FORMAT: flatbuffers::VOffsetT = 6; - pub const VT_IS_VISIBLE: flatbuffers::VOffsetT = 8; - pub const VT_MULTIPLIER: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - AlternateUnits { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args AlternateUnitsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = AlternateUnitsBuilder::new(_fbb); - builder.add_multiplier(args.multiplier); - if let Some(x) = args.base { builder.add_base(x); } - builder.add_is_visible(args.is_visible); - if let Some(x) = args.format { builder.add_format(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option<_UnitSystemBase<'a>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(AlternateUnits::VT_BASE, None)} - } - #[inline] - pub fn format(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AlternateUnits::VT_FORMAT, None)} - } - #[inline] - pub fn is_visible(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AlternateUnits::VT_IS_VISIBLE, Some(false)).unwrap()} - } - #[inline] - pub fn multiplier(&self) -> f32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(AlternateUnits::VT_MULTIPLIER, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for AlternateUnits<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::("format", Self::VT_FORMAT, false)? - .visit_field::("is_visible", Self::VT_IS_VISIBLE, false)? - .visit_field::("multiplier", Self::VT_MULTIPLIER, false)? - .finish(); - Ok(()) - } -} -pub struct AlternateUnitsArgs<'a> { - pub base: Option>>, - pub format: Option, - pub is_visible: bool, - pub multiplier: f32, -} -impl<'a> Default for AlternateUnitsArgs<'a> { - #[inline] - fn default() -> Self { - AlternateUnitsArgs { - base: None, - format: None, - is_visible: false, - multiplier: 0.0, - } - } -} - -pub struct AlternateUnitsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> AlternateUnitsBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset<_UnitSystemBase<'b >>) { - self.fbb_.push_slot_always::>(AlternateUnits::VT_BASE, base); - } - #[inline] - pub fn add_format(&mut self, format: DIMENSION_UNITS_FORMAT) { - self.fbb_.push_slot_always::(AlternateUnits::VT_FORMAT, format); - } - #[inline] - pub fn add_is_visible(&mut self, is_visible: bool) { - self.fbb_.push_slot::(AlternateUnits::VT_IS_VISIBLE, is_visible, false); - } - #[inline] - pub fn add_multiplier(&mut self, multiplier: f32) { - self.fbb_.push_slot::(AlternateUnits::VT_MULTIPLIER, multiplier, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> AlternateUnitsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - AlternateUnitsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for AlternateUnits<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("AlternateUnits"); - ds.field("base", &self.base()); - ds.field("format", &self.format()); - ds.field("is_visible", &self.is_visible()); - ds.field("multiplier", &self.multiplier()); - ds.finish() - } -} -pub enum PrimaryUnitsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct PrimaryUnits<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for PrimaryUnits<'a> { - type Inner = PrimaryUnits<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> PrimaryUnits<'a> { - pub const VT_LINEAR: flatbuffers::VOffsetT = 4; - pub const VT_ANGULAR: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - PrimaryUnits { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args PrimaryUnitsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = PrimaryUnitsBuilder::new(_fbb); - if let Some(x) = args.angular { builder.add_angular(x); } - if let Some(x) = args.linear { builder.add_linear(x); } - builder.finish() - } - - - #[inline] - pub fn linear(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(PrimaryUnits::VT_LINEAR, None)} - } - #[inline] - pub fn angular(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(PrimaryUnits::VT_ANGULAR, None)} - } -} - -impl flatbuffers::Verifiable for PrimaryUnits<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("linear", Self::VT_LINEAR, false)? - .visit_field::>("angular", Self::VT_ANGULAR, false)? - .finish(); - Ok(()) - } -} -pub struct PrimaryUnitsArgs<'a> { - pub linear: Option>>, - pub angular: Option>>, -} -impl<'a> Default for PrimaryUnitsArgs<'a> { - #[inline] - fn default() -> Self { - PrimaryUnitsArgs { - linear: None, - angular: None, - } - } -} - -pub struct PrimaryUnitsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PrimaryUnitsBuilder<'a, 'b, A> { - #[inline] - pub fn add_linear(&mut self, linear: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(PrimaryUnits::VT_LINEAR, linear); - } - #[inline] - pub fn add_angular(&mut self, angular: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(PrimaryUnits::VT_ANGULAR, angular); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PrimaryUnitsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - PrimaryUnitsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for PrimaryUnits<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("PrimaryUnits"); - ds.field("linear", &self.linear()); - ds.field("angular", &self.angular()); - ds.finish() - } -} -pub enum StandardUnitsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct StandardUnits<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for StandardUnits<'a> { - type Inner = StandardUnits<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> StandardUnits<'a> { - pub const VT_PRIMARY_UNITS: flatbuffers::VOffsetT = 4; - pub const VT_ALTERNATE_UNITS: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - StandardUnits { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args StandardUnitsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = StandardUnitsBuilder::new(_fbb); - if let Some(x) = args.alternate_units { builder.add_alternate_units(x); } - if let Some(x) = args.primary_units { builder.add_primary_units(x); } - builder.finish() - } - - - #[inline] - pub fn primary_units(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardUnits::VT_PRIMARY_UNITS, None)} - } - #[inline] - pub fn alternate_units(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardUnits::VT_ALTERNATE_UNITS, None)} - } -} - -impl flatbuffers::Verifiable for StandardUnits<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("primary_units", Self::VT_PRIMARY_UNITS, false)? - .visit_field::>("alternate_units", Self::VT_ALTERNATE_UNITS, false)? - .finish(); - Ok(()) - } -} -pub struct StandardUnitsArgs<'a> { - pub primary_units: Option>>, - pub alternate_units: Option>>, -} -impl<'a> Default for StandardUnitsArgs<'a> { - #[inline] - fn default() -> Self { - StandardUnitsArgs { - primary_units: None, - alternate_units: None, - } - } -} - -pub struct StandardUnitsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StandardUnitsBuilder<'a, 'b, A> { - #[inline] - pub fn add_primary_units(&mut self, primary_units: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(StandardUnits::VT_PRIMARY_UNITS, primary_units); - } - #[inline] - pub fn add_alternate_units(&mut self, alternate_units: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(StandardUnits::VT_ALTERNATE_UNITS, alternate_units); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StandardUnitsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - StandardUnitsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for StandardUnits<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("StandardUnits"); - ds.field("primary_units", &self.primary_units()); - ds.field("alternate_units", &self.alternate_units()); - ds.finish() - } -} -pub enum UnitPrecisionOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct UnitPrecision<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for UnitPrecision<'a> { - type Inner = UnitPrecision<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> UnitPrecision<'a> { - pub const VT_LINEAR: flatbuffers::VOffsetT = 4; - pub const VT_ANGULAR: flatbuffers::VOffsetT = 6; - pub const VT_AREA: flatbuffers::VOffsetT = 8; - pub const VT_VOLUME: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - UnitPrecision { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args UnitPrecisionArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = UnitPrecisionBuilder::new(_fbb); - builder.add_volume(args.volume); - builder.add_area(args.area); - builder.add_angular(args.angular); - builder.add_linear(args.linear); - builder.finish() - } - - - #[inline] - pub fn linear(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(UnitPrecision::VT_LINEAR, Some(0)).unwrap()} - } - #[inline] - pub fn angular(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(UnitPrecision::VT_ANGULAR, Some(0)).unwrap()} - } - #[inline] - pub fn area(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(UnitPrecision::VT_AREA, Some(0)).unwrap()} - } - #[inline] - pub fn volume(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(UnitPrecision::VT_VOLUME, Some(0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for UnitPrecision<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("linear", Self::VT_LINEAR, false)? - .visit_field::("angular", Self::VT_ANGULAR, false)? - .visit_field::("area", Self::VT_AREA, false)? - .visit_field::("volume", Self::VT_VOLUME, false)? - .finish(); - Ok(()) - } -} -pub struct UnitPrecisionArgs { - pub linear: i32, - pub angular: i32, - pub area: i32, - pub volume: i32, -} -impl<'a> Default for UnitPrecisionArgs { - #[inline] - fn default() -> Self { - UnitPrecisionArgs { - linear: 0, - angular: 0, - area: 0, - volume: 0, - } - } -} - -pub struct UnitPrecisionBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> UnitPrecisionBuilder<'a, 'b, A> { - #[inline] - pub fn add_linear(&mut self, linear: i32) { - self.fbb_.push_slot::(UnitPrecision::VT_LINEAR, linear, 0); - } - #[inline] - pub fn add_angular(&mut self, angular: i32) { - self.fbb_.push_slot::(UnitPrecision::VT_ANGULAR, angular, 0); - } - #[inline] - pub fn add_area(&mut self, area: i32) { - self.fbb_.push_slot::(UnitPrecision::VT_AREA, area, 0); - } - #[inline] - pub fn add_volume(&mut self, volume: i32) { - self.fbb_.push_slot::(UnitPrecision::VT_VOLUME, volume, 0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> UnitPrecisionBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - UnitPrecisionBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for UnitPrecision<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("UnitPrecision"); - ds.field("linear", &self.linear()); - ds.field("angular", &self.angular()); - ds.field("area", &self.area()); - ds.field("volume", &self.volume()); - ds.finish() - } -} -pub enum StandardOverridesOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct StandardOverrides<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for StandardOverrides<'a> { - type Inner = StandardOverrides<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> StandardOverrides<'a> { - pub const VT_MAIN_SCOPE: flatbuffers::VOffsetT = 4; - pub const VT_ELEMENTS_STROKE_WIDTH_OVERRIDE: flatbuffers::VOffsetT = 6; - pub const VT_COMMON_STYLE_ID: flatbuffers::VOffsetT = 8; - pub const VT_STACK_LIKE_STYLE_ID: flatbuffers::VOffsetT = 10; - pub const VT_TEXT_STYLE_ID: flatbuffers::VOffsetT = 12; - pub const VT_DIMENSION_STYLE_ID: flatbuffers::VOffsetT = 14; - pub const VT_LEADER_STYLE_ID: flatbuffers::VOffsetT = 16; - pub const VT_FEATURE_CONTROL_FRAME_STYLE_ID: flatbuffers::VOffsetT = 18; - pub const VT_TABLE_STYLE_ID: flatbuffers::VOffsetT = 20; - pub const VT_DOC_STYLE_ID: flatbuffers::VOffsetT = 22; - pub const VT_VIEWPORT_STYLE_ID: flatbuffers::VOffsetT = 24; - pub const VT_PLOT_STYLE_ID: flatbuffers::VOffsetT = 26; - pub const VT_HATCH_STYLE_ID: flatbuffers::VOffsetT = 28; - pub const VT_ACTIVE_GRID_SETTINGS_ID: flatbuffers::VOffsetT = 30; - pub const VT_ACTIVE_SNAP_SETTINGS_ID: flatbuffers::VOffsetT = 32; - pub const VT_DASH_LINE_OVERRIDE: flatbuffers::VOffsetT = 34; - pub const VT_UNIT_PRECISION: flatbuffers::VOffsetT = 36; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - StandardOverrides { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args StandardOverridesArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = StandardOverridesBuilder::new(_fbb); - builder.add_elements_stroke_width_override(args.elements_stroke_width_override); - if let Some(x) = args.unit_precision { builder.add_unit_precision(x); } - if let Some(x) = args.dash_line_override { builder.add_dash_line_override(x); } - if let Some(x) = args.active_snap_settings_id { builder.add_active_snap_settings_id(x); } - if let Some(x) = args.active_grid_settings_id { builder.add_active_grid_settings_id(x); } - if let Some(x) = args.hatch_style_id { builder.add_hatch_style_id(x); } - if let Some(x) = args.plot_style_id { builder.add_plot_style_id(x); } - if let Some(x) = args.viewport_style_id { builder.add_viewport_style_id(x); } - if let Some(x) = args.doc_style_id { builder.add_doc_style_id(x); } - if let Some(x) = args.table_style_id { builder.add_table_style_id(x); } - if let Some(x) = args.feature_control_frame_style_id { builder.add_feature_control_frame_style_id(x); } - if let Some(x) = args.leader_style_id { builder.add_leader_style_id(x); } - if let Some(x) = args.dimension_style_id { builder.add_dimension_style_id(x); } - if let Some(x) = args.text_style_id { builder.add_text_style_id(x); } - if let Some(x) = args.stack_like_style_id { builder.add_stack_like_style_id(x); } - if let Some(x) = args.common_style_id { builder.add_common_style_id(x); } - if let Some(x) = args.main_scope { builder.add_main_scope(x); } - builder.finish() - } - - - #[inline] - pub fn main_scope(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_MAIN_SCOPE, None)} - } - #[inline] - pub fn elements_stroke_width_override(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(StandardOverrides::VT_ELEMENTS_STROKE_WIDTH_OVERRIDE, Some(0.0)).unwrap()} - } - #[inline] - pub fn common_style_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_COMMON_STYLE_ID, None)} - } - #[inline] - pub fn stack_like_style_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_STACK_LIKE_STYLE_ID, None)} - } - #[inline] - pub fn text_style_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_TEXT_STYLE_ID, None)} - } - #[inline] - pub fn dimension_style_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_DIMENSION_STYLE_ID, None)} - } - #[inline] - pub fn leader_style_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_LEADER_STYLE_ID, None)} - } - #[inline] - pub fn feature_control_frame_style_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_FEATURE_CONTROL_FRAME_STYLE_ID, None)} - } - #[inline] - pub fn table_style_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_TABLE_STYLE_ID, None)} - } - #[inline] - pub fn doc_style_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_DOC_STYLE_ID, None)} - } - #[inline] - pub fn viewport_style_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_VIEWPORT_STYLE_ID, None)} - } - #[inline] - pub fn plot_style_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_PLOT_STYLE_ID, None)} - } - #[inline] - pub fn hatch_style_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_HATCH_STYLE_ID, None)} - } - #[inline] - pub fn active_grid_settings_id(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardOverrides::VT_ACTIVE_GRID_SETTINGS_ID, None)} - } - #[inline] - pub fn active_snap_settings_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_ACTIVE_SNAP_SETTINGS_ID, None)} - } - #[inline] - pub fn dash_line_override(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_DASH_LINE_OVERRIDE, None)} - } - #[inline] - pub fn unit_precision(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardOverrides::VT_UNIT_PRECISION, None)} - } -} - -impl flatbuffers::Verifiable for StandardOverrides<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("main_scope", Self::VT_MAIN_SCOPE, false)? - .visit_field::("elements_stroke_width_override", Self::VT_ELEMENTS_STROKE_WIDTH_OVERRIDE, false)? - .visit_field::>("common_style_id", Self::VT_COMMON_STYLE_ID, false)? - .visit_field::>("stack_like_style_id", Self::VT_STACK_LIKE_STYLE_ID, false)? - .visit_field::>("text_style_id", Self::VT_TEXT_STYLE_ID, false)? - .visit_field::>("dimension_style_id", Self::VT_DIMENSION_STYLE_ID, false)? - .visit_field::>("leader_style_id", Self::VT_LEADER_STYLE_ID, false)? - .visit_field::>("feature_control_frame_style_id", Self::VT_FEATURE_CONTROL_FRAME_STYLE_ID, false)? - .visit_field::>("table_style_id", Self::VT_TABLE_STYLE_ID, false)? - .visit_field::>("doc_style_id", Self::VT_DOC_STYLE_ID, false)? - .visit_field::>("viewport_style_id", Self::VT_VIEWPORT_STYLE_ID, false)? - .visit_field::>("plot_style_id", Self::VT_PLOT_STYLE_ID, false)? - .visit_field::>("hatch_style_id", Self::VT_HATCH_STYLE_ID, false)? - .visit_field::>>>("active_grid_settings_id", Self::VT_ACTIVE_GRID_SETTINGS_ID, false)? - .visit_field::>("active_snap_settings_id", Self::VT_ACTIVE_SNAP_SETTINGS_ID, false)? - .visit_field::>("dash_line_override", Self::VT_DASH_LINE_OVERRIDE, false)? - .visit_field::>("unit_precision", Self::VT_UNIT_PRECISION, false)? - .finish(); - Ok(()) - } -} -pub struct StandardOverridesArgs<'a> { - pub main_scope: Option>, - pub elements_stroke_width_override: f64, - pub common_style_id: Option>, - pub stack_like_style_id: Option>, - pub text_style_id: Option>, - pub dimension_style_id: Option>, - pub leader_style_id: Option>, - pub feature_control_frame_style_id: Option>, - pub table_style_id: Option>, - pub doc_style_id: Option>, - pub viewport_style_id: Option>, - pub plot_style_id: Option>, - pub hatch_style_id: Option>, - pub active_grid_settings_id: Option>>>, - pub active_snap_settings_id: Option>, - pub dash_line_override: Option>, - pub unit_precision: Option>>, -} -impl<'a> Default for StandardOverridesArgs<'a> { - #[inline] - fn default() -> Self { - StandardOverridesArgs { - main_scope: None, - elements_stroke_width_override: 0.0, - common_style_id: None, - stack_like_style_id: None, - text_style_id: None, - dimension_style_id: None, - leader_style_id: None, - feature_control_frame_style_id: None, - table_style_id: None, - doc_style_id: None, - viewport_style_id: None, - plot_style_id: None, - hatch_style_id: None, - active_grid_settings_id: None, - active_snap_settings_id: None, - dash_line_override: None, - unit_precision: None, - } - } -} - -pub struct StandardOverridesBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StandardOverridesBuilder<'a, 'b, A> { - #[inline] - pub fn add_main_scope(&mut self, main_scope: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_MAIN_SCOPE, main_scope); - } - #[inline] - pub fn add_elements_stroke_width_override(&mut self, elements_stroke_width_override: f64) { - self.fbb_.push_slot::(StandardOverrides::VT_ELEMENTS_STROKE_WIDTH_OVERRIDE, elements_stroke_width_override, 0.0); - } - #[inline] - pub fn add_common_style_id(&mut self, common_style_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_COMMON_STYLE_ID, common_style_id); - } - #[inline] - pub fn add_stack_like_style_id(&mut self, stack_like_style_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_STACK_LIKE_STYLE_ID, stack_like_style_id); - } - #[inline] - pub fn add_text_style_id(&mut self, text_style_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_TEXT_STYLE_ID, text_style_id); - } - #[inline] - pub fn add_dimension_style_id(&mut self, dimension_style_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_DIMENSION_STYLE_ID, dimension_style_id); - } - #[inline] - pub fn add_leader_style_id(&mut self, leader_style_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_LEADER_STYLE_ID, leader_style_id); - } - #[inline] - pub fn add_feature_control_frame_style_id(&mut self, feature_control_frame_style_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_FEATURE_CONTROL_FRAME_STYLE_ID, feature_control_frame_style_id); - } - #[inline] - pub fn add_table_style_id(&mut self, table_style_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_TABLE_STYLE_ID, table_style_id); - } - #[inline] - pub fn add_doc_style_id(&mut self, doc_style_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_DOC_STYLE_ID, doc_style_id); - } - #[inline] - pub fn add_viewport_style_id(&mut self, viewport_style_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_VIEWPORT_STYLE_ID, viewport_style_id); - } - #[inline] - pub fn add_plot_style_id(&mut self, plot_style_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_PLOT_STYLE_ID, plot_style_id); - } - #[inline] - pub fn add_hatch_style_id(&mut self, hatch_style_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_HATCH_STYLE_ID, hatch_style_id); - } - #[inline] - pub fn add_active_grid_settings_id(&mut self, active_grid_settings_id: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_ACTIVE_GRID_SETTINGS_ID, active_grid_settings_id); - } - #[inline] - pub fn add_active_snap_settings_id(&mut self, active_snap_settings_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_ACTIVE_SNAP_SETTINGS_ID, active_snap_settings_id); - } - #[inline] - pub fn add_dash_line_override(&mut self, dash_line_override: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_DASH_LINE_OVERRIDE, dash_line_override); - } - #[inline] - pub fn add_unit_precision(&mut self, unit_precision: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(StandardOverrides::VT_UNIT_PRECISION, unit_precision); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StandardOverridesBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - StandardOverridesBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for StandardOverrides<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("StandardOverrides"); - ds.field("main_scope", &self.main_scope()); - ds.field("elements_stroke_width_override", &self.elements_stroke_width_override()); - ds.field("common_style_id", &self.common_style_id()); - ds.field("stack_like_style_id", &self.stack_like_style_id()); - ds.field("text_style_id", &self.text_style_id()); - ds.field("dimension_style_id", &self.dimension_style_id()); - ds.field("leader_style_id", &self.leader_style_id()); - ds.field("feature_control_frame_style_id", &self.feature_control_frame_style_id()); - ds.field("table_style_id", &self.table_style_id()); - ds.field("doc_style_id", &self.doc_style_id()); - ds.field("viewport_style_id", &self.viewport_style_id()); - ds.field("plot_style_id", &self.plot_style_id()); - ds.field("hatch_style_id", &self.hatch_style_id()); - ds.field("active_grid_settings_id", &self.active_grid_settings_id()); - ds.field("active_snap_settings_id", &self.active_snap_settings_id()); - ds.field("dash_line_override", &self.dash_line_override()); - ds.field("unit_precision", &self.unit_precision()); - ds.finish() - } -} -pub enum DucCommonStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucCommonStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucCommonStyle<'a> { - type Inner = DucCommonStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucCommonStyle<'a> { - pub const VT_BACKGROUND: flatbuffers::VOffsetT = 4; - pub const VT_STROKE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucCommonStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucCommonStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucCommonStyleBuilder::new(_fbb); - if let Some(x) = args.stroke { builder.add_stroke(x); } - if let Some(x) = args.background { builder.add_background(x); } - builder.finish() - } - - - #[inline] - pub fn background(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucCommonStyle::VT_BACKGROUND, None)} - } - #[inline] - pub fn stroke(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucCommonStyle::VT_STROKE, None)} - } -} - -impl flatbuffers::Verifiable for DucCommonStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("background", Self::VT_BACKGROUND, false)? - .visit_field::>("stroke", Self::VT_STROKE, false)? - .finish(); - Ok(()) - } -} -pub struct DucCommonStyleArgs<'a> { - pub background: Option>>, - pub stroke: Option>>, -} -impl<'a> Default for DucCommonStyleArgs<'a> { - #[inline] - fn default() -> Self { - DucCommonStyleArgs { - background: None, - stroke: None, - } - } -} - -pub struct DucCommonStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucCommonStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_background(&mut self, background: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucCommonStyle::VT_BACKGROUND, background); - } - #[inline] - pub fn add_stroke(&mut self, stroke: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucCommonStyle::VT_STROKE, stroke); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucCommonStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucCommonStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucCommonStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucCommonStyle"); - ds.field("background", &self.background()); - ds.field("stroke", &self.stroke()); - ds.finish() - } -} -pub enum IdentifiedCommonStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedCommonStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedCommonStyle<'a> { - type Inner = IdentifiedCommonStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedCommonStyle<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedCommonStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedCommonStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedCommonStyleBuilder::new(_fbb); - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedCommonStyle::VT_ID, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedCommonStyle::VT_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedCommonStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedCommonStyleArgs<'a> { - pub id: Option>>, - pub style: Option>>, -} -impl<'a> Default for IdentifiedCommonStyleArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedCommonStyleArgs { - id: None, - style: None, - } - } -} - -pub struct IdentifiedCommonStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedCommonStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedCommonStyle::VT_ID, id); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedCommonStyle::VT_STYLE, style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedCommonStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedCommonStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedCommonStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedCommonStyle"); - ds.field("id", &self.id()); - ds.field("style", &self.style()); - ds.finish() - } -} -pub enum IdentifiedStackLikeStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedStackLikeStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedStackLikeStyle<'a> { - type Inner = IdentifiedStackLikeStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedStackLikeStyle<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedStackLikeStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedStackLikeStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedStackLikeStyleBuilder::new(_fbb); - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedStackLikeStyle::VT_ID, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedStackLikeStyle::VT_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedStackLikeStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedStackLikeStyleArgs<'a> { - pub id: Option>>, - pub style: Option>>, -} -impl<'a> Default for IdentifiedStackLikeStyleArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedStackLikeStyleArgs { - id: None, - style: None, - } - } -} - -pub struct IdentifiedStackLikeStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedStackLikeStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedStackLikeStyle::VT_ID, id); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedStackLikeStyle::VT_STYLE, style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedStackLikeStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedStackLikeStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedStackLikeStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedStackLikeStyle"); - ds.field("id", &self.id()); - ds.field("style", &self.style()); - ds.finish() - } -} -pub enum IdentifiedTextStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedTextStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedTextStyle<'a> { - type Inner = IdentifiedTextStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedTextStyle<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedTextStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedTextStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedTextStyleBuilder::new(_fbb); - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedTextStyle::VT_ID, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedTextStyle::VT_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedTextStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedTextStyleArgs<'a> { - pub id: Option>>, - pub style: Option>>, -} -impl<'a> Default for IdentifiedTextStyleArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedTextStyleArgs { - id: None, - style: None, - } - } -} - -pub struct IdentifiedTextStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedTextStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedTextStyle::VT_ID, id); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedTextStyle::VT_STYLE, style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedTextStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedTextStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedTextStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedTextStyle"); - ds.field("id", &self.id()); - ds.field("style", &self.style()); - ds.finish() - } -} -pub enum IdentifiedDimensionStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedDimensionStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedDimensionStyle<'a> { - type Inner = IdentifiedDimensionStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedDimensionStyle<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedDimensionStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedDimensionStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedDimensionStyleBuilder::new(_fbb); - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedDimensionStyle::VT_ID, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedDimensionStyle::VT_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedDimensionStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedDimensionStyleArgs<'a> { - pub id: Option>>, - pub style: Option>>, -} -impl<'a> Default for IdentifiedDimensionStyleArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedDimensionStyleArgs { - id: None, - style: None, - } - } -} - -pub struct IdentifiedDimensionStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedDimensionStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedDimensionStyle::VT_ID, id); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedDimensionStyle::VT_STYLE, style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedDimensionStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedDimensionStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedDimensionStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedDimensionStyle"); - ds.field("id", &self.id()); - ds.field("style", &self.style()); - ds.finish() - } -} -pub enum IdentifiedLeaderStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedLeaderStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedLeaderStyle<'a> { - type Inner = IdentifiedLeaderStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedLeaderStyle<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedLeaderStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedLeaderStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedLeaderStyleBuilder::new(_fbb); - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedLeaderStyle::VT_ID, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedLeaderStyle::VT_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedLeaderStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedLeaderStyleArgs<'a> { - pub id: Option>>, - pub style: Option>>, -} -impl<'a> Default for IdentifiedLeaderStyleArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedLeaderStyleArgs { - id: None, - style: None, - } - } -} - -pub struct IdentifiedLeaderStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedLeaderStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedLeaderStyle::VT_ID, id); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedLeaderStyle::VT_STYLE, style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedLeaderStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedLeaderStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedLeaderStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedLeaderStyle"); - ds.field("id", &self.id()); - ds.field("style", &self.style()); - ds.finish() - } -} -pub enum IdentifiedFCFStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedFCFStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedFCFStyle<'a> { - type Inner = IdentifiedFCFStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedFCFStyle<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedFCFStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedFCFStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedFCFStyleBuilder::new(_fbb); - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedFCFStyle::VT_ID, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedFCFStyle::VT_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedFCFStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedFCFStyleArgs<'a> { - pub id: Option>>, - pub style: Option>>, -} -impl<'a> Default for IdentifiedFCFStyleArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedFCFStyleArgs { - id: None, - style: None, - } - } -} - -pub struct IdentifiedFCFStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedFCFStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedFCFStyle::VT_ID, id); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedFCFStyle::VT_STYLE, style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedFCFStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedFCFStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedFCFStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedFCFStyle"); - ds.field("id", &self.id()); - ds.field("style", &self.style()); - ds.finish() - } -} -pub enum IdentifiedTableStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedTableStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedTableStyle<'a> { - type Inner = IdentifiedTableStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedTableStyle<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedTableStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedTableStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedTableStyleBuilder::new(_fbb); - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedTableStyle::VT_ID, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedTableStyle::VT_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedTableStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedTableStyleArgs<'a> { - pub id: Option>>, - pub style: Option>>, -} -impl<'a> Default for IdentifiedTableStyleArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedTableStyleArgs { - id: None, - style: None, - } - } -} - -pub struct IdentifiedTableStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedTableStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedTableStyle::VT_ID, id); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedTableStyle::VT_STYLE, style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedTableStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedTableStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedTableStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedTableStyle"); - ds.field("id", &self.id()); - ds.field("style", &self.style()); - ds.finish() - } -} -pub enum IdentifiedDocStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedDocStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedDocStyle<'a> { - type Inner = IdentifiedDocStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedDocStyle<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedDocStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedDocStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedDocStyleBuilder::new(_fbb); - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedDocStyle::VT_ID, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedDocStyle::VT_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedDocStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedDocStyleArgs<'a> { - pub id: Option>>, - pub style: Option>>, -} -impl<'a> Default for IdentifiedDocStyleArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedDocStyleArgs { - id: None, - style: None, - } - } -} - -pub struct IdentifiedDocStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedDocStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedDocStyle::VT_ID, id); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedDocStyle::VT_STYLE, style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedDocStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedDocStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedDocStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedDocStyle"); - ds.field("id", &self.id()); - ds.field("style", &self.style()); - ds.finish() - } -} -pub enum IdentifiedViewportStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedViewportStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedViewportStyle<'a> { - type Inner = IdentifiedViewportStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedViewportStyle<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedViewportStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedViewportStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedViewportStyleBuilder::new(_fbb); - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedViewportStyle::VT_ID, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedViewportStyle::VT_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedViewportStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedViewportStyleArgs<'a> { - pub id: Option>>, - pub style: Option>>, -} -impl<'a> Default for IdentifiedViewportStyleArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedViewportStyleArgs { - id: None, - style: None, - } - } -} - -pub struct IdentifiedViewportStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedViewportStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedViewportStyle::VT_ID, id); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedViewportStyle::VT_STYLE, style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedViewportStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedViewportStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedViewportStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedViewportStyle"); - ds.field("id", &self.id()); - ds.field("style", &self.style()); - ds.finish() - } -} -pub enum IdentifiedHatchStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedHatchStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedHatchStyle<'a> { - type Inner = IdentifiedHatchStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedHatchStyle<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedHatchStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedHatchStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedHatchStyleBuilder::new(_fbb); - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedHatchStyle::VT_ID, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedHatchStyle::VT_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedHatchStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedHatchStyleArgs<'a> { - pub id: Option>>, - pub style: Option>>, -} -impl<'a> Default for IdentifiedHatchStyleArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedHatchStyleArgs { - id: None, - style: None, - } - } -} - -pub struct IdentifiedHatchStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedHatchStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedHatchStyle::VT_ID, id); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedHatchStyle::VT_STYLE, style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedHatchStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedHatchStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedHatchStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedHatchStyle"); - ds.field("id", &self.id()); - ds.field("style", &self.style()); - ds.finish() - } -} -pub enum IdentifiedXRayStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedXRayStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedXRayStyle<'a> { - type Inner = IdentifiedXRayStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedXRayStyle<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_STYLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedXRayStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedXRayStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedXRayStyleBuilder::new(_fbb); - if let Some(x) = args.style { builder.add_style(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedXRayStyle::VT_ID, None)} - } - #[inline] - pub fn style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedXRayStyle::VT_STYLE, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedXRayStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("style", Self::VT_STYLE, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedXRayStyleArgs<'a> { - pub id: Option>>, - pub style: Option>>, -} -impl<'a> Default for IdentifiedXRayStyleArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedXRayStyleArgs { - id: None, - style: None, - } - } -} - -pub struct IdentifiedXRayStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedXRayStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedXRayStyle::VT_ID, id); - } - #[inline] - pub fn add_style(&mut self, style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedXRayStyle::VT_STYLE, style); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedXRayStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedXRayStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedXRayStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedXRayStyle"); - ds.field("id", &self.id()); - ds.field("style", &self.style()); - ds.finish() - } -} -pub enum StandardStylesOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct StandardStyles<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for StandardStyles<'a> { - type Inner = StandardStyles<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> StandardStyles<'a> { - pub const VT_COMMON_STYLES: flatbuffers::VOffsetT = 4; - pub const VT_STACK_LIKE_STYLES: flatbuffers::VOffsetT = 6; - pub const VT_TEXT_STYLES: flatbuffers::VOffsetT = 8; - pub const VT_DIMENSION_STYLES: flatbuffers::VOffsetT = 10; - pub const VT_LEADER_STYLES: flatbuffers::VOffsetT = 12; - pub const VT_FEATURE_CONTROL_FRAME_STYLES: flatbuffers::VOffsetT = 14; - pub const VT_TABLE_STYLES: flatbuffers::VOffsetT = 16; - pub const VT_DOC_STYLES: flatbuffers::VOffsetT = 18; - pub const VT_VIEWPORT_STYLES: flatbuffers::VOffsetT = 20; - pub const VT_HATCH_STYLES: flatbuffers::VOffsetT = 22; - pub const VT_XRAY_STYLES: flatbuffers::VOffsetT = 24; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - StandardStyles { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args StandardStylesArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = StandardStylesBuilder::new(_fbb); - if let Some(x) = args.xray_styles { builder.add_xray_styles(x); } - if let Some(x) = args.hatch_styles { builder.add_hatch_styles(x); } - if let Some(x) = args.viewport_styles { builder.add_viewport_styles(x); } - if let Some(x) = args.doc_styles { builder.add_doc_styles(x); } - if let Some(x) = args.table_styles { builder.add_table_styles(x); } - if let Some(x) = args.feature_control_frame_styles { builder.add_feature_control_frame_styles(x); } - if let Some(x) = args.leader_styles { builder.add_leader_styles(x); } - if let Some(x) = args.dimension_styles { builder.add_dimension_styles(x); } - if let Some(x) = args.text_styles { builder.add_text_styles(x); } - if let Some(x) = args.stack_like_styles { builder.add_stack_like_styles(x); } - if let Some(x) = args.common_styles { builder.add_common_styles(x); } - builder.finish() - } - - - #[inline] - pub fn common_styles(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardStyles::VT_COMMON_STYLES, None)} - } - #[inline] - pub fn stack_like_styles(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardStyles::VT_STACK_LIKE_STYLES, None)} - } - #[inline] - pub fn text_styles(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardStyles::VT_TEXT_STYLES, None)} - } - #[inline] - pub fn dimension_styles(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardStyles::VT_DIMENSION_STYLES, None)} - } - #[inline] - pub fn leader_styles(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardStyles::VT_LEADER_STYLES, None)} - } - #[inline] - pub fn feature_control_frame_styles(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardStyles::VT_FEATURE_CONTROL_FRAME_STYLES, None)} - } - #[inline] - pub fn table_styles(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardStyles::VT_TABLE_STYLES, None)} - } - #[inline] - pub fn doc_styles(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardStyles::VT_DOC_STYLES, None)} - } - #[inline] - pub fn viewport_styles(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardStyles::VT_VIEWPORT_STYLES, None)} - } - #[inline] - pub fn hatch_styles(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardStyles::VT_HATCH_STYLES, None)} - } - #[inline] - pub fn xray_styles(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardStyles::VT_XRAY_STYLES, None)} - } -} - -impl flatbuffers::Verifiable for StandardStyles<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>>("common_styles", Self::VT_COMMON_STYLES, false)? - .visit_field::>>>("stack_like_styles", Self::VT_STACK_LIKE_STYLES, false)? - .visit_field::>>>("text_styles", Self::VT_TEXT_STYLES, false)? - .visit_field::>>>("dimension_styles", Self::VT_DIMENSION_STYLES, false)? - .visit_field::>>>("leader_styles", Self::VT_LEADER_STYLES, false)? - .visit_field::>>>("feature_control_frame_styles", Self::VT_FEATURE_CONTROL_FRAME_STYLES, false)? - .visit_field::>>>("table_styles", Self::VT_TABLE_STYLES, false)? - .visit_field::>>>("doc_styles", Self::VT_DOC_STYLES, false)? - .visit_field::>>>("viewport_styles", Self::VT_VIEWPORT_STYLES, false)? - .visit_field::>>>("hatch_styles", Self::VT_HATCH_STYLES, false)? - .visit_field::>>>("xray_styles", Self::VT_XRAY_STYLES, false)? - .finish(); - Ok(()) - } -} -pub struct StandardStylesArgs<'a> { - pub common_styles: Option>>>>, - pub stack_like_styles: Option>>>>, - pub text_styles: Option>>>>, - pub dimension_styles: Option>>>>, - pub leader_styles: Option>>>>, - pub feature_control_frame_styles: Option>>>>, - pub table_styles: Option>>>>, - pub doc_styles: Option>>>>, - pub viewport_styles: Option>>>>, - pub hatch_styles: Option>>>>, - pub xray_styles: Option>>>>, -} -impl<'a> Default for StandardStylesArgs<'a> { - #[inline] - fn default() -> Self { - StandardStylesArgs { - common_styles: None, - stack_like_styles: None, - text_styles: None, - dimension_styles: None, - leader_styles: None, - feature_control_frame_styles: None, - table_styles: None, - doc_styles: None, - viewport_styles: None, - hatch_styles: None, - xray_styles: None, - } - } -} - -pub struct StandardStylesBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StandardStylesBuilder<'a, 'b, A> { - #[inline] - pub fn add_common_styles(&mut self, common_styles: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardStyles::VT_COMMON_STYLES, common_styles); - } - #[inline] - pub fn add_stack_like_styles(&mut self, stack_like_styles: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardStyles::VT_STACK_LIKE_STYLES, stack_like_styles); - } - #[inline] - pub fn add_text_styles(&mut self, text_styles: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardStyles::VT_TEXT_STYLES, text_styles); - } - #[inline] - pub fn add_dimension_styles(&mut self, dimension_styles: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardStyles::VT_DIMENSION_STYLES, dimension_styles); - } - #[inline] - pub fn add_leader_styles(&mut self, leader_styles: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardStyles::VT_LEADER_STYLES, leader_styles); - } - #[inline] - pub fn add_feature_control_frame_styles(&mut self, feature_control_frame_styles: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardStyles::VT_FEATURE_CONTROL_FRAME_STYLES, feature_control_frame_styles); - } - #[inline] - pub fn add_table_styles(&mut self, table_styles: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardStyles::VT_TABLE_STYLES, table_styles); - } - #[inline] - pub fn add_doc_styles(&mut self, doc_styles: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardStyles::VT_DOC_STYLES, doc_styles); - } - #[inline] - pub fn add_viewport_styles(&mut self, viewport_styles: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardStyles::VT_VIEWPORT_STYLES, viewport_styles); - } - #[inline] - pub fn add_hatch_styles(&mut self, hatch_styles: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardStyles::VT_HATCH_STYLES, hatch_styles); - } - #[inline] - pub fn add_xray_styles(&mut self, xray_styles: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardStyles::VT_XRAY_STYLES, xray_styles); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StandardStylesBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - StandardStylesBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for StandardStyles<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("StandardStyles"); - ds.field("common_styles", &self.common_styles()); - ds.field("stack_like_styles", &self.stack_like_styles()); - ds.field("text_styles", &self.text_styles()); - ds.field("dimension_styles", &self.dimension_styles()); - ds.field("leader_styles", &self.leader_styles()); - ds.field("feature_control_frame_styles", &self.feature_control_frame_styles()); - ds.field("table_styles", &self.table_styles()); - ds.field("doc_styles", &self.doc_styles()); - ds.field("viewport_styles", &self.viewport_styles()); - ds.field("hatch_styles", &self.hatch_styles()); - ds.field("xray_styles", &self.xray_styles()); - ds.finish() - } -} -pub enum GridStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct GridStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for GridStyle<'a> { - type Inner = GridStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> GridStyle<'a> { - pub const VT_COLOR: flatbuffers::VOffsetT = 4; - pub const VT_OPACITY: flatbuffers::VOffsetT = 6; - pub const VT_DASH_PATTERN: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - GridStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args GridStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = GridStyleBuilder::new(_fbb); - builder.add_opacity(args.opacity); - if let Some(x) = args.dash_pattern { builder.add_dash_pattern(x); } - if let Some(x) = args.color { builder.add_color(x); } - builder.finish() - } - - - #[inline] - pub fn color(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(GridStyle::VT_COLOR, None)} - } - #[inline] - pub fn opacity(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridStyle::VT_OPACITY, Some(0.0)).unwrap()} - } - #[inline] - pub fn dash_pattern(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(GridStyle::VT_DASH_PATTERN, None)} - } -} - -impl flatbuffers::Verifiable for GridStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("color", Self::VT_COLOR, false)? - .visit_field::("opacity", Self::VT_OPACITY, false)? - .visit_field::>>("dash_pattern", Self::VT_DASH_PATTERN, false)? - .finish(); - Ok(()) - } -} -pub struct GridStyleArgs<'a> { - pub color: Option>, - pub opacity: f64, - pub dash_pattern: Option>>, -} -impl<'a> Default for GridStyleArgs<'a> { - #[inline] - fn default() -> Self { - GridStyleArgs { - color: None, - opacity: 0.0, - dash_pattern: None, - } - } -} - -pub struct GridStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> GridStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_color(&mut self, color: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(GridStyle::VT_COLOR, color); - } - #[inline] - pub fn add_opacity(&mut self, opacity: f64) { - self.fbb_.push_slot::(GridStyle::VT_OPACITY, opacity, 0.0); - } - #[inline] - pub fn add_dash_pattern(&mut self, dash_pattern: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GridStyle::VT_DASH_PATTERN, dash_pattern); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> GridStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - GridStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for GridStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("GridStyle"); - ds.field("color", &self.color()); - ds.field("opacity", &self.opacity()); - ds.field("dash_pattern", &self.dash_pattern()); - ds.finish() - } -} -pub enum PolarGridSettingsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct PolarGridSettings<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for PolarGridSettings<'a> { - type Inner = PolarGridSettings<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> PolarGridSettings<'a> { - pub const VT_RADIAL_DIVISIONS: flatbuffers::VOffsetT = 4; - pub const VT_RADIAL_SPACING: flatbuffers::VOffsetT = 6; - pub const VT_SHOW_LABELS: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - PolarGridSettings { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args PolarGridSettingsArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = PolarGridSettingsBuilder::new(_fbb); - builder.add_radial_spacing(args.radial_spacing); - builder.add_radial_divisions(args.radial_divisions); - builder.add_show_labels(args.show_labels); - builder.finish() - } - - - #[inline] - pub fn radial_divisions(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(PolarGridSettings::VT_RADIAL_DIVISIONS, Some(0)).unwrap()} - } - #[inline] - pub fn radial_spacing(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(PolarGridSettings::VT_RADIAL_SPACING, Some(0.0)).unwrap()} - } - #[inline] - pub fn show_labels(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(PolarGridSettings::VT_SHOW_LABELS, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for PolarGridSettings<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("radial_divisions", Self::VT_RADIAL_DIVISIONS, false)? - .visit_field::("radial_spacing", Self::VT_RADIAL_SPACING, false)? - .visit_field::("show_labels", Self::VT_SHOW_LABELS, false)? - .finish(); - Ok(()) - } -} -pub struct PolarGridSettingsArgs { - pub radial_divisions: i32, - pub radial_spacing: f64, - pub show_labels: bool, -} -impl<'a> Default for PolarGridSettingsArgs { - #[inline] - fn default() -> Self { - PolarGridSettingsArgs { - radial_divisions: 0, - radial_spacing: 0.0, - show_labels: false, - } - } -} - -pub struct PolarGridSettingsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PolarGridSettingsBuilder<'a, 'b, A> { - #[inline] - pub fn add_radial_divisions(&mut self, radial_divisions: i32) { - self.fbb_.push_slot::(PolarGridSettings::VT_RADIAL_DIVISIONS, radial_divisions, 0); - } - #[inline] - pub fn add_radial_spacing(&mut self, radial_spacing: f64) { - self.fbb_.push_slot::(PolarGridSettings::VT_RADIAL_SPACING, radial_spacing, 0.0); - } - #[inline] - pub fn add_show_labels(&mut self, show_labels: bool) { - self.fbb_.push_slot::(PolarGridSettings::VT_SHOW_LABELS, show_labels, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PolarGridSettingsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - PolarGridSettingsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for PolarGridSettings<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("PolarGridSettings"); - ds.field("radial_divisions", &self.radial_divisions()); - ds.field("radial_spacing", &self.radial_spacing()); - ds.field("show_labels", &self.show_labels()); - ds.finish() - } -} -pub enum IsometricGridSettingsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IsometricGridSettings<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IsometricGridSettings<'a> { - type Inner = IsometricGridSettings<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IsometricGridSettings<'a> { - pub const VT_LEFT_ANGLE: flatbuffers::VOffsetT = 4; - pub const VT_RIGHT_ANGLE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IsometricGridSettings { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IsometricGridSettingsArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = IsometricGridSettingsBuilder::new(_fbb); - builder.add_right_angle(args.right_angle); - builder.add_left_angle(args.left_angle); - builder.finish() - } - - - #[inline] - pub fn left_angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(IsometricGridSettings::VT_LEFT_ANGLE, Some(0.0)).unwrap()} - } - #[inline] - pub fn right_angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(IsometricGridSettings::VT_RIGHT_ANGLE, Some(0.0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for IsometricGridSettings<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("left_angle", Self::VT_LEFT_ANGLE, false)? - .visit_field::("right_angle", Self::VT_RIGHT_ANGLE, false)? - .finish(); - Ok(()) - } -} -pub struct IsometricGridSettingsArgs { - pub left_angle: f64, - pub right_angle: f64, -} -impl<'a> Default for IsometricGridSettingsArgs { - #[inline] - fn default() -> Self { - IsometricGridSettingsArgs { - left_angle: 0.0, - right_angle: 0.0, - } - } -} - -pub struct IsometricGridSettingsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IsometricGridSettingsBuilder<'a, 'b, A> { - #[inline] - pub fn add_left_angle(&mut self, left_angle: f64) { - self.fbb_.push_slot::(IsometricGridSettings::VT_LEFT_ANGLE, left_angle, 0.0); - } - #[inline] - pub fn add_right_angle(&mut self, right_angle: f64) { - self.fbb_.push_slot::(IsometricGridSettings::VT_RIGHT_ANGLE, right_angle, 0.0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IsometricGridSettingsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IsometricGridSettingsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IsometricGridSettings<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IsometricGridSettings"); - ds.field("left_angle", &self.left_angle()); - ds.field("right_angle", &self.right_angle()); - ds.finish() - } -} -pub enum GridSettingsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct GridSettings<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for GridSettings<'a> { - type Inner = GridSettings<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> GridSettings<'a> { - pub const VT_TYPE_: flatbuffers::VOffsetT = 4; - pub const VT_READONLY: flatbuffers::VOffsetT = 6; - pub const VT_DISPLAY_TYPE: flatbuffers::VOffsetT = 8; - pub const VT_IS_ADAPTIVE: flatbuffers::VOffsetT = 10; - pub const VT_X_SPACING: flatbuffers::VOffsetT = 12; - pub const VT_Y_SPACING: flatbuffers::VOffsetT = 14; - pub const VT_SUBDIVISIONS: flatbuffers::VOffsetT = 16; - pub const VT_ORIGIN: flatbuffers::VOffsetT = 18; - pub const VT_ROTATION: flatbuffers::VOffsetT = 20; - pub const VT_FOLLOW_UCS: flatbuffers::VOffsetT = 22; - pub const VT_MAJOR_STYLE: flatbuffers::VOffsetT = 24; - pub const VT_MINOR_STYLE: flatbuffers::VOffsetT = 26; - pub const VT_SHOW_MINOR: flatbuffers::VOffsetT = 28; - pub const VT_MIN_ZOOM: flatbuffers::VOffsetT = 30; - pub const VT_MAX_ZOOM: flatbuffers::VOffsetT = 32; - pub const VT_AUTO_HIDE: flatbuffers::VOffsetT = 34; - pub const VT_POLAR_SETTINGS: flatbuffers::VOffsetT = 36; - pub const VT_ISOMETRIC_SETTINGS: flatbuffers::VOffsetT = 38; - pub const VT_ENABLE_SNAPPING: flatbuffers::VOffsetT = 40; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - GridSettings { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args GridSettingsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = GridSettingsBuilder::new(_fbb); - builder.add_max_zoom(args.max_zoom); - builder.add_min_zoom(args.min_zoom); - builder.add_rotation(args.rotation); - builder.add_y_spacing(args.y_spacing); - builder.add_x_spacing(args.x_spacing); - if let Some(x) = args.isometric_settings { builder.add_isometric_settings(x); } - if let Some(x) = args.polar_settings { builder.add_polar_settings(x); } - if let Some(x) = args.minor_style { builder.add_minor_style(x); } - if let Some(x) = args.major_style { builder.add_major_style(x); } - if let Some(x) = args.origin { builder.add_origin(x); } - builder.add_subdivisions(args.subdivisions); - builder.add_enable_snapping(args.enable_snapping); - builder.add_auto_hide(args.auto_hide); - builder.add_show_minor(args.show_minor); - builder.add_follow_ucs(args.follow_ucs); - builder.add_is_adaptive(args.is_adaptive); - if let Some(x) = args.display_type { builder.add_display_type(x); } - builder.add_readonly(args.readonly); - if let Some(x) = args.type_ { builder.add_type_(x); } - builder.finish() - } - - - #[inline] - pub fn type_(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_TYPE_, None)} - } - #[inline] - pub fn readonly(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_READONLY, Some(false)).unwrap()} - } - #[inline] - pub fn display_type(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_DISPLAY_TYPE, None)} - } - #[inline] - pub fn is_adaptive(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_IS_ADAPTIVE, Some(false)).unwrap()} - } - #[inline] - pub fn x_spacing(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_X_SPACING, Some(0.0)).unwrap()} - } - #[inline] - pub fn y_spacing(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_Y_SPACING, Some(0.0)).unwrap()} - } - #[inline] - pub fn subdivisions(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_SUBDIVISIONS, Some(0)).unwrap()} - } - #[inline] - pub fn origin(&self) -> Option<&'a GeometricPoint> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_ORIGIN, None)} - } - #[inline] - pub fn rotation(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_ROTATION, Some(0.0)).unwrap()} - } - #[inline] - pub fn follow_ucs(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_FOLLOW_UCS, Some(false)).unwrap()} - } - #[inline] - pub fn major_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(GridSettings::VT_MAJOR_STYLE, None)} - } - #[inline] - pub fn minor_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(GridSettings::VT_MINOR_STYLE, None)} - } - #[inline] - pub fn show_minor(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_SHOW_MINOR, Some(false)).unwrap()} - } - #[inline] - pub fn min_zoom(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_MIN_ZOOM, Some(0.0)).unwrap()} - } - #[inline] - pub fn max_zoom(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_MAX_ZOOM, Some(0.0)).unwrap()} - } - #[inline] - pub fn auto_hide(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_AUTO_HIDE, Some(false)).unwrap()} - } - #[inline] - pub fn polar_settings(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(GridSettings::VT_POLAR_SETTINGS, None)} - } - #[inline] - pub fn isometric_settings(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(GridSettings::VT_ISOMETRIC_SETTINGS, None)} - } - #[inline] - pub fn enable_snapping(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(GridSettings::VT_ENABLE_SNAPPING, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for GridSettings<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("type_", Self::VT_TYPE_, false)? - .visit_field::("readonly", Self::VT_READONLY, false)? - .visit_field::("display_type", Self::VT_DISPLAY_TYPE, false)? - .visit_field::("is_adaptive", Self::VT_IS_ADAPTIVE, false)? - .visit_field::("x_spacing", Self::VT_X_SPACING, false)? - .visit_field::("y_spacing", Self::VT_Y_SPACING, false)? - .visit_field::("subdivisions", Self::VT_SUBDIVISIONS, false)? - .visit_field::("origin", Self::VT_ORIGIN, false)? - .visit_field::("rotation", Self::VT_ROTATION, false)? - .visit_field::("follow_ucs", Self::VT_FOLLOW_UCS, false)? - .visit_field::>("major_style", Self::VT_MAJOR_STYLE, false)? - .visit_field::>("minor_style", Self::VT_MINOR_STYLE, false)? - .visit_field::("show_minor", Self::VT_SHOW_MINOR, false)? - .visit_field::("min_zoom", Self::VT_MIN_ZOOM, false)? - .visit_field::("max_zoom", Self::VT_MAX_ZOOM, false)? - .visit_field::("auto_hide", Self::VT_AUTO_HIDE, false)? - .visit_field::>("polar_settings", Self::VT_POLAR_SETTINGS, false)? - .visit_field::>("isometric_settings", Self::VT_ISOMETRIC_SETTINGS, false)? - .visit_field::("enable_snapping", Self::VT_ENABLE_SNAPPING, false)? - .finish(); - Ok(()) - } -} -pub struct GridSettingsArgs<'a> { - pub type_: Option, - pub readonly: bool, - pub display_type: Option, - pub is_adaptive: bool, - pub x_spacing: f64, - pub y_spacing: f64, - pub subdivisions: i32, - pub origin: Option<&'a GeometricPoint>, - pub rotation: f64, - pub follow_ucs: bool, - pub major_style: Option>>, - pub minor_style: Option>>, - pub show_minor: bool, - pub min_zoom: f64, - pub max_zoom: f64, - pub auto_hide: bool, - pub polar_settings: Option>>, - pub isometric_settings: Option>>, - pub enable_snapping: bool, -} -impl<'a> Default for GridSettingsArgs<'a> { - #[inline] - fn default() -> Self { - GridSettingsArgs { - type_: None, - readonly: false, - display_type: None, - is_adaptive: false, - x_spacing: 0.0, - y_spacing: 0.0, - subdivisions: 0, - origin: None, - rotation: 0.0, - follow_ucs: false, - major_style: None, - minor_style: None, - show_minor: false, - min_zoom: 0.0, - max_zoom: 0.0, - auto_hide: false, - polar_settings: None, - isometric_settings: None, - enable_snapping: false, - } - } -} - -pub struct GridSettingsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> GridSettingsBuilder<'a, 'b, A> { - #[inline] - pub fn add_type_(&mut self, type_: GRID_TYPE) { - self.fbb_.push_slot_always::(GridSettings::VT_TYPE_, type_); - } - #[inline] - pub fn add_readonly(&mut self, readonly: bool) { - self.fbb_.push_slot::(GridSettings::VT_READONLY, readonly, false); - } - #[inline] - pub fn add_display_type(&mut self, display_type: GRID_DISPLAY_TYPE) { - self.fbb_.push_slot_always::(GridSettings::VT_DISPLAY_TYPE, display_type); - } - #[inline] - pub fn add_is_adaptive(&mut self, is_adaptive: bool) { - self.fbb_.push_slot::(GridSettings::VT_IS_ADAPTIVE, is_adaptive, false); - } - #[inline] - pub fn add_x_spacing(&mut self, x_spacing: f64) { - self.fbb_.push_slot::(GridSettings::VT_X_SPACING, x_spacing, 0.0); - } - #[inline] - pub fn add_y_spacing(&mut self, y_spacing: f64) { - self.fbb_.push_slot::(GridSettings::VT_Y_SPACING, y_spacing, 0.0); - } - #[inline] - pub fn add_subdivisions(&mut self, subdivisions: i32) { - self.fbb_.push_slot::(GridSettings::VT_SUBDIVISIONS, subdivisions, 0); - } - #[inline] - pub fn add_origin(&mut self, origin: &GeometricPoint) { - self.fbb_.push_slot_always::<&GeometricPoint>(GridSettings::VT_ORIGIN, origin); - } - #[inline] - pub fn add_rotation(&mut self, rotation: f64) { - self.fbb_.push_slot::(GridSettings::VT_ROTATION, rotation, 0.0); - } - #[inline] - pub fn add_follow_ucs(&mut self, follow_ucs: bool) { - self.fbb_.push_slot::(GridSettings::VT_FOLLOW_UCS, follow_ucs, false); - } - #[inline] - pub fn add_major_style(&mut self, major_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GridSettings::VT_MAJOR_STYLE, major_style); - } - #[inline] - pub fn add_minor_style(&mut self, minor_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GridSettings::VT_MINOR_STYLE, minor_style); - } - #[inline] - pub fn add_show_minor(&mut self, show_minor: bool) { - self.fbb_.push_slot::(GridSettings::VT_SHOW_MINOR, show_minor, false); - } - #[inline] - pub fn add_min_zoom(&mut self, min_zoom: f64) { - self.fbb_.push_slot::(GridSettings::VT_MIN_ZOOM, min_zoom, 0.0); - } - #[inline] - pub fn add_max_zoom(&mut self, max_zoom: f64) { - self.fbb_.push_slot::(GridSettings::VT_MAX_ZOOM, max_zoom, 0.0); - } - #[inline] - pub fn add_auto_hide(&mut self, auto_hide: bool) { - self.fbb_.push_slot::(GridSettings::VT_AUTO_HIDE, auto_hide, false); - } - #[inline] - pub fn add_polar_settings(&mut self, polar_settings: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GridSettings::VT_POLAR_SETTINGS, polar_settings); - } - #[inline] - pub fn add_isometric_settings(&mut self, isometric_settings: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(GridSettings::VT_ISOMETRIC_SETTINGS, isometric_settings); - } - #[inline] - pub fn add_enable_snapping(&mut self, enable_snapping: bool) { - self.fbb_.push_slot::(GridSettings::VT_ENABLE_SNAPPING, enable_snapping, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> GridSettingsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - GridSettingsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for GridSettings<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("GridSettings"); - ds.field("type_", &self.type_()); - ds.field("readonly", &self.readonly()); - ds.field("display_type", &self.display_type()); - ds.field("is_adaptive", &self.is_adaptive()); - ds.field("x_spacing", &self.x_spacing()); - ds.field("y_spacing", &self.y_spacing()); - ds.field("subdivisions", &self.subdivisions()); - ds.field("origin", &self.origin()); - ds.field("rotation", &self.rotation()); - ds.field("follow_ucs", &self.follow_ucs()); - ds.field("major_style", &self.major_style()); - ds.field("minor_style", &self.minor_style()); - ds.field("show_minor", &self.show_minor()); - ds.field("min_zoom", &self.min_zoom()); - ds.field("max_zoom", &self.max_zoom()); - ds.field("auto_hide", &self.auto_hide()); - ds.field("polar_settings", &self.polar_settings()); - ds.field("isometric_settings", &self.isometric_settings()); - ds.field("enable_snapping", &self.enable_snapping()); - ds.finish() - } -} -pub enum SnapOverrideOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct SnapOverride<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for SnapOverride<'a> { - type Inner = SnapOverride<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> SnapOverride<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_BEHAVIOR: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - SnapOverride { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args SnapOverrideArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = SnapOverrideBuilder::new(_fbb); - if let Some(x) = args.key { builder.add_key(x); } - if let Some(x) = args.behavior { builder.add_behavior(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(SnapOverride::VT_KEY, None)} - } - #[inline] - pub fn behavior(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapOverride::VT_BEHAVIOR, None)} - } -} - -impl flatbuffers::Verifiable for SnapOverride<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, false)? - .visit_field::("behavior", Self::VT_BEHAVIOR, false)? - .finish(); - Ok(()) - } -} -pub struct SnapOverrideArgs<'a> { - pub key: Option>, - pub behavior: Option, -} -impl<'a> Default for SnapOverrideArgs<'a> { - #[inline] - fn default() -> Self { - SnapOverrideArgs { - key: None, - behavior: None, - } - } -} - -pub struct SnapOverrideBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> SnapOverrideBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(SnapOverride::VT_KEY, key); - } - #[inline] - pub fn add_behavior(&mut self, behavior: SNAP_OVERRIDE_BEHAVIOR) { - self.fbb_.push_slot_always::(SnapOverride::VT_BEHAVIOR, behavior); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> SnapOverrideBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - SnapOverrideBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for SnapOverride<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("SnapOverride"); - ds.field("key", &self.key()); - ds.field("behavior", &self.behavior()); - ds.finish() - } -} -pub enum DynamicSnapSettingsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DynamicSnapSettings<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DynamicSnapSettings<'a> { - type Inner = DynamicSnapSettings<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DynamicSnapSettings<'a> { - pub const VT_ENABLED_DURING_DRAG: flatbuffers::VOffsetT = 4; - pub const VT_ENABLED_DURING_ROTATION: flatbuffers::VOffsetT = 6; - pub const VT_ENABLED_DURING_SCALE: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DynamicSnapSettings { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DynamicSnapSettingsArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = DynamicSnapSettingsBuilder::new(_fbb); - builder.add_enabled_during_scale(args.enabled_during_scale); - builder.add_enabled_during_rotation(args.enabled_during_rotation); - builder.add_enabled_during_drag(args.enabled_during_drag); - builder.finish() - } - - - #[inline] - pub fn enabled_during_drag(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DynamicSnapSettings::VT_ENABLED_DURING_DRAG, Some(false)).unwrap()} - } - #[inline] - pub fn enabled_during_rotation(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DynamicSnapSettings::VT_ENABLED_DURING_ROTATION, Some(false)).unwrap()} - } - #[inline] - pub fn enabled_during_scale(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DynamicSnapSettings::VT_ENABLED_DURING_SCALE, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for DynamicSnapSettings<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("enabled_during_drag", Self::VT_ENABLED_DURING_DRAG, false)? - .visit_field::("enabled_during_rotation", Self::VT_ENABLED_DURING_ROTATION, false)? - .visit_field::("enabled_during_scale", Self::VT_ENABLED_DURING_SCALE, false)? - .finish(); - Ok(()) - } -} -pub struct DynamicSnapSettingsArgs { - pub enabled_during_drag: bool, - pub enabled_during_rotation: bool, - pub enabled_during_scale: bool, -} -impl<'a> Default for DynamicSnapSettingsArgs { - #[inline] - fn default() -> Self { - DynamicSnapSettingsArgs { - enabled_during_drag: false, - enabled_during_rotation: false, - enabled_during_scale: false, - } - } -} - -pub struct DynamicSnapSettingsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DynamicSnapSettingsBuilder<'a, 'b, A> { - #[inline] - pub fn add_enabled_during_drag(&mut self, enabled_during_drag: bool) { - self.fbb_.push_slot::(DynamicSnapSettings::VT_ENABLED_DURING_DRAG, enabled_during_drag, false); - } - #[inline] - pub fn add_enabled_during_rotation(&mut self, enabled_during_rotation: bool) { - self.fbb_.push_slot::(DynamicSnapSettings::VT_ENABLED_DURING_ROTATION, enabled_during_rotation, false); - } - #[inline] - pub fn add_enabled_during_scale(&mut self, enabled_during_scale: bool) { - self.fbb_.push_slot::(DynamicSnapSettings::VT_ENABLED_DURING_SCALE, enabled_during_scale, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DynamicSnapSettingsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DynamicSnapSettingsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DynamicSnapSettings<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DynamicSnapSettings"); - ds.field("enabled_during_drag", &self.enabled_during_drag()); - ds.field("enabled_during_rotation", &self.enabled_during_rotation()); - ds.field("enabled_during_scale", &self.enabled_during_scale()); - ds.finish() - } -} -pub enum PolarTrackingSettingsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct PolarTrackingSettings<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for PolarTrackingSettings<'a> { - type Inner = PolarTrackingSettings<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> PolarTrackingSettings<'a> { - pub const VT_ENABLED: flatbuffers::VOffsetT = 4; - pub const VT_ANGLES: flatbuffers::VOffsetT = 6; - pub const VT_INCREMENT_ANGLE: flatbuffers::VOffsetT = 8; - pub const VT_TRACK_FROM_LAST_POINT: flatbuffers::VOffsetT = 10; - pub const VT_SHOW_POLAR_COORDINATES: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - PolarTrackingSettings { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args PolarTrackingSettingsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = PolarTrackingSettingsBuilder::new(_fbb); - builder.add_increment_angle(args.increment_angle); - if let Some(x) = args.angles { builder.add_angles(x); } - builder.add_show_polar_coordinates(args.show_polar_coordinates); - builder.add_track_from_last_point(args.track_from_last_point); - builder.add_enabled(args.enabled); - builder.finish() - } - - - #[inline] - pub fn enabled(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(PolarTrackingSettings::VT_ENABLED, Some(false)).unwrap()} - } - #[inline] - pub fn angles(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(PolarTrackingSettings::VT_ANGLES, None)} - } - #[inline] - pub fn increment_angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(PolarTrackingSettings::VT_INCREMENT_ANGLE, Some(0.0)).unwrap()} - } - #[inline] - pub fn track_from_last_point(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(PolarTrackingSettings::VT_TRACK_FROM_LAST_POINT, Some(false)).unwrap()} - } - #[inline] - pub fn show_polar_coordinates(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(PolarTrackingSettings::VT_SHOW_POLAR_COORDINATES, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for PolarTrackingSettings<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("enabled", Self::VT_ENABLED, false)? - .visit_field::>>("angles", Self::VT_ANGLES, false)? - .visit_field::("increment_angle", Self::VT_INCREMENT_ANGLE, false)? - .visit_field::("track_from_last_point", Self::VT_TRACK_FROM_LAST_POINT, false)? - .visit_field::("show_polar_coordinates", Self::VT_SHOW_POLAR_COORDINATES, false)? - .finish(); - Ok(()) - } -} -pub struct PolarTrackingSettingsArgs<'a> { - pub enabled: bool, - pub angles: Option>>, - pub increment_angle: f64, - pub track_from_last_point: bool, - pub show_polar_coordinates: bool, -} -impl<'a> Default for PolarTrackingSettingsArgs<'a> { - #[inline] - fn default() -> Self { - PolarTrackingSettingsArgs { - enabled: false, - angles: None, - increment_angle: 0.0, - track_from_last_point: false, - show_polar_coordinates: false, - } - } -} - -pub struct PolarTrackingSettingsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PolarTrackingSettingsBuilder<'a, 'b, A> { - #[inline] - pub fn add_enabled(&mut self, enabled: bool) { - self.fbb_.push_slot::(PolarTrackingSettings::VT_ENABLED, enabled, false); - } - #[inline] - pub fn add_angles(&mut self, angles: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(PolarTrackingSettings::VT_ANGLES, angles); - } - #[inline] - pub fn add_increment_angle(&mut self, increment_angle: f64) { - self.fbb_.push_slot::(PolarTrackingSettings::VT_INCREMENT_ANGLE, increment_angle, 0.0); - } - #[inline] - pub fn add_track_from_last_point(&mut self, track_from_last_point: bool) { - self.fbb_.push_slot::(PolarTrackingSettings::VT_TRACK_FROM_LAST_POINT, track_from_last_point, false); - } - #[inline] - pub fn add_show_polar_coordinates(&mut self, show_polar_coordinates: bool) { - self.fbb_.push_slot::(PolarTrackingSettings::VT_SHOW_POLAR_COORDINATES, show_polar_coordinates, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PolarTrackingSettingsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - PolarTrackingSettingsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for PolarTrackingSettings<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("PolarTrackingSettings"); - ds.field("enabled", &self.enabled()); - ds.field("angles", &self.angles()); - ds.field("increment_angle", &self.increment_angle()); - ds.field("track_from_last_point", &self.track_from_last_point()); - ds.field("show_polar_coordinates", &self.show_polar_coordinates()); - ds.finish() - } -} -pub enum TrackingLineStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct TrackingLineStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for TrackingLineStyle<'a> { - type Inner = TrackingLineStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> TrackingLineStyle<'a> { - pub const VT_COLOR: flatbuffers::VOffsetT = 4; - pub const VT_OPACITY: flatbuffers::VOffsetT = 6; - pub const VT_DASH_PATTERN: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - TrackingLineStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args TrackingLineStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = TrackingLineStyleBuilder::new(_fbb); - builder.add_opacity(args.opacity); - if let Some(x) = args.dash_pattern { builder.add_dash_pattern(x); } - if let Some(x) = args.color { builder.add_color(x); } - builder.finish() - } - - - #[inline] - pub fn color(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(TrackingLineStyle::VT_COLOR, None)} - } - #[inline] - pub fn opacity(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(TrackingLineStyle::VT_OPACITY, Some(0.0)).unwrap()} - } - #[inline] - pub fn dash_pattern(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(TrackingLineStyle::VT_DASH_PATTERN, None)} - } -} - -impl flatbuffers::Verifiable for TrackingLineStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("color", Self::VT_COLOR, false)? - .visit_field::("opacity", Self::VT_OPACITY, false)? - .visit_field::>>("dash_pattern", Self::VT_DASH_PATTERN, false)? - .finish(); - Ok(()) - } -} -pub struct TrackingLineStyleArgs<'a> { - pub color: Option>, - pub opacity: f64, - pub dash_pattern: Option>>, -} -impl<'a> Default for TrackingLineStyleArgs<'a> { - #[inline] - fn default() -> Self { - TrackingLineStyleArgs { - color: None, - opacity: 0.0, - dash_pattern: None, - } - } -} - -pub struct TrackingLineStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> TrackingLineStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_color(&mut self, color: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(TrackingLineStyle::VT_COLOR, color); - } - #[inline] - pub fn add_opacity(&mut self, opacity: f64) { - self.fbb_.push_slot::(TrackingLineStyle::VT_OPACITY, opacity, 0.0); - } - #[inline] - pub fn add_dash_pattern(&mut self, dash_pattern: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(TrackingLineStyle::VT_DASH_PATTERN, dash_pattern); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TrackingLineStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - TrackingLineStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for TrackingLineStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("TrackingLineStyle"); - ds.field("color", &self.color()); - ds.field("opacity", &self.opacity()); - ds.field("dash_pattern", &self.dash_pattern()); - ds.finish() - } -} -pub enum LayerSnapFiltersOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct LayerSnapFilters<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for LayerSnapFilters<'a> { - type Inner = LayerSnapFilters<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> LayerSnapFilters<'a> { - pub const VT_INCLUDE_LAYERS: flatbuffers::VOffsetT = 4; - pub const VT_EXCLUDE_LAYERS: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - LayerSnapFilters { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args LayerSnapFiltersArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = LayerSnapFiltersBuilder::new(_fbb); - if let Some(x) = args.exclude_layers { builder.add_exclude_layers(x); } - if let Some(x) = args.include_layers { builder.add_include_layers(x); } - builder.finish() - } - - - #[inline] - pub fn include_layers(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(LayerSnapFilters::VT_INCLUDE_LAYERS, None)} - } - #[inline] - pub fn exclude_layers(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(LayerSnapFilters::VT_EXCLUDE_LAYERS, None)} - } -} - -impl flatbuffers::Verifiable for LayerSnapFilters<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>>("include_layers", Self::VT_INCLUDE_LAYERS, false)? - .visit_field::>>>("exclude_layers", Self::VT_EXCLUDE_LAYERS, false)? - .finish(); - Ok(()) - } -} -pub struct LayerSnapFiltersArgs<'a> { - pub include_layers: Option>>>, - pub exclude_layers: Option>>>, -} -impl<'a> Default for LayerSnapFiltersArgs<'a> { - #[inline] - fn default() -> Self { - LayerSnapFiltersArgs { - include_layers: None, - exclude_layers: None, - } - } -} - -pub struct LayerSnapFiltersBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> LayerSnapFiltersBuilder<'a, 'b, A> { - #[inline] - pub fn add_include_layers(&mut self, include_layers: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(LayerSnapFilters::VT_INCLUDE_LAYERS, include_layers); - } - #[inline] - pub fn add_exclude_layers(&mut self, exclude_layers: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(LayerSnapFilters::VT_EXCLUDE_LAYERS, exclude_layers); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> LayerSnapFiltersBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - LayerSnapFiltersBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for LayerSnapFilters<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("LayerSnapFilters"); - ds.field("include_layers", &self.include_layers()); - ds.field("exclude_layers", &self.exclude_layers()); - ds.finish() - } -} -pub enum SnapMarkerStyleOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct SnapMarkerStyle<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for SnapMarkerStyle<'a> { - type Inner = SnapMarkerStyle<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> SnapMarkerStyle<'a> { - pub const VT_SHAPE: flatbuffers::VOffsetT = 4; - pub const VT_COLOR: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - SnapMarkerStyle { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args SnapMarkerStyleArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = SnapMarkerStyleBuilder::new(_fbb); - if let Some(x) = args.color { builder.add_color(x); } - if let Some(x) = args.shape { builder.add_shape(x); } - builder.finish() - } - - - #[inline] - pub fn shape(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapMarkerStyle::VT_SHAPE, None)} - } - #[inline] - pub fn color(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(SnapMarkerStyle::VT_COLOR, None)} - } -} - -impl flatbuffers::Verifiable for SnapMarkerStyle<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("shape", Self::VT_SHAPE, false)? - .visit_field::>("color", Self::VT_COLOR, false)? - .finish(); - Ok(()) - } -} -pub struct SnapMarkerStyleArgs<'a> { - pub shape: Option, - pub color: Option>, -} -impl<'a> Default for SnapMarkerStyleArgs<'a> { - #[inline] - fn default() -> Self { - SnapMarkerStyleArgs { - shape: None, - color: None, - } - } -} - -pub struct SnapMarkerStyleBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> SnapMarkerStyleBuilder<'a, 'b, A> { - #[inline] - pub fn add_shape(&mut self, shape: SNAP_MARKER_SHAPE) { - self.fbb_.push_slot_always::(SnapMarkerStyle::VT_SHAPE, shape); - } - #[inline] - pub fn add_color(&mut self, color: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(SnapMarkerStyle::VT_COLOR, color); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> SnapMarkerStyleBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - SnapMarkerStyleBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for SnapMarkerStyle<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("SnapMarkerStyle"); - ds.field("shape", &self.shape()); - ds.field("color", &self.color()); - ds.finish() - } -} -pub enum SnapMarkerStyleEntryOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct SnapMarkerStyleEntry<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for SnapMarkerStyleEntry<'a> { - type Inner = SnapMarkerStyleEntry<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> SnapMarkerStyleEntry<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_VALUE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - SnapMarkerStyleEntry { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args SnapMarkerStyleEntryArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = SnapMarkerStyleEntryBuilder::new(_fbb); - if let Some(x) = args.value { builder.add_value(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapMarkerStyleEntry::VT_KEY, None)} - } - #[inline] - pub fn value(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(SnapMarkerStyleEntry::VT_VALUE, None)} - } -} - -impl flatbuffers::Verifiable for SnapMarkerStyleEntry<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("key", Self::VT_KEY, false)? - .visit_field::>("value", Self::VT_VALUE, false)? - .finish(); - Ok(()) - } -} -pub struct SnapMarkerStyleEntryArgs<'a> { - pub key: Option, - pub value: Option>>, -} -impl<'a> Default for SnapMarkerStyleEntryArgs<'a> { - #[inline] - fn default() -> Self { - SnapMarkerStyleEntryArgs { - key: None, - value: None, - } - } -} - -pub struct SnapMarkerStyleEntryBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> SnapMarkerStyleEntryBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: OBJECT_SNAP_MODE) { - self.fbb_.push_slot_always::(SnapMarkerStyleEntry::VT_KEY, key); - } - #[inline] - pub fn add_value(&mut self, value: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(SnapMarkerStyleEntry::VT_VALUE, value); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> SnapMarkerStyleEntryBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - SnapMarkerStyleEntryBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for SnapMarkerStyleEntry<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("SnapMarkerStyleEntry"); - ds.field("key", &self.key()); - ds.field("value", &self.value()); - ds.finish() - } -} -pub enum SnapMarkerSettingsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct SnapMarkerSettings<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for SnapMarkerSettings<'a> { - type Inner = SnapMarkerSettings<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> SnapMarkerSettings<'a> { - pub const VT_ENABLED: flatbuffers::VOffsetT = 4; - pub const VT_SIZE: flatbuffers::VOffsetT = 6; - pub const VT_DURATION: flatbuffers::VOffsetT = 8; - pub const VT_STYLES: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - SnapMarkerSettings { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args SnapMarkerSettingsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = SnapMarkerSettingsBuilder::new(_fbb); - if let Some(x) = args.styles { builder.add_styles(x); } - builder.add_duration(args.duration); - builder.add_size(args.size); - builder.add_enabled(args.enabled); - builder.finish() - } - - - #[inline] - pub fn enabled(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapMarkerSettings::VT_ENABLED, Some(false)).unwrap()} - } - #[inline] - pub fn size(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapMarkerSettings::VT_SIZE, Some(0)).unwrap()} - } - #[inline] - pub fn duration(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapMarkerSettings::VT_DURATION, Some(0)).unwrap()} - } - #[inline] - pub fn styles(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(SnapMarkerSettings::VT_STYLES, None)} - } -} - -impl flatbuffers::Verifiable for SnapMarkerSettings<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("enabled", Self::VT_ENABLED, false)? - .visit_field::("size", Self::VT_SIZE, false)? - .visit_field::("duration", Self::VT_DURATION, false)? - .visit_field::>>>("styles", Self::VT_STYLES, false)? - .finish(); - Ok(()) - } -} -pub struct SnapMarkerSettingsArgs<'a> { - pub enabled: bool, - pub size: i32, - pub duration: i32, - pub styles: Option>>>>, -} -impl<'a> Default for SnapMarkerSettingsArgs<'a> { - #[inline] - fn default() -> Self { - SnapMarkerSettingsArgs { - enabled: false, - size: 0, - duration: 0, - styles: None, - } - } -} - -pub struct SnapMarkerSettingsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> SnapMarkerSettingsBuilder<'a, 'b, A> { - #[inline] - pub fn add_enabled(&mut self, enabled: bool) { - self.fbb_.push_slot::(SnapMarkerSettings::VT_ENABLED, enabled, false); - } - #[inline] - pub fn add_size(&mut self, size: i32) { - self.fbb_.push_slot::(SnapMarkerSettings::VT_SIZE, size, 0); - } - #[inline] - pub fn add_duration(&mut self, duration: i32) { - self.fbb_.push_slot::(SnapMarkerSettings::VT_DURATION, duration, 0); - } - #[inline] - pub fn add_styles(&mut self, styles: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(SnapMarkerSettings::VT_STYLES, styles); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> SnapMarkerSettingsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - SnapMarkerSettingsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for SnapMarkerSettings<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("SnapMarkerSettings"); - ds.field("enabled", &self.enabled()); - ds.field("size", &self.size()); - ds.field("duration", &self.duration()); - ds.field("styles", &self.styles()); - ds.finish() - } -} -pub enum SnapSettingsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct SnapSettings<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for SnapSettings<'a> { - type Inner = SnapSettings<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> SnapSettings<'a> { - pub const VT_READONLY: flatbuffers::VOffsetT = 4; - pub const VT_TWIST_ANGLE: flatbuffers::VOffsetT = 6; - pub const VT_SNAP_TOLERANCE: flatbuffers::VOffsetT = 8; - pub const VT_OBJECT_SNAP_APERTURE: flatbuffers::VOffsetT = 10; - pub const VT_IS_ORTHO_MODE_ON: flatbuffers::VOffsetT = 12; - pub const VT_POLAR_TRACKING: flatbuffers::VOffsetT = 14; - pub const VT_IS_OBJECT_SNAP_ON: flatbuffers::VOffsetT = 16; - pub const VT_ACTIVE_OBJECT_SNAP_MODES: flatbuffers::VOffsetT = 18; - pub const VT_SNAP_PRIORITY: flatbuffers::VOffsetT = 20; - pub const VT_SHOW_TRACKING_LINES: flatbuffers::VOffsetT = 22; - pub const VT_TRACKING_LINE_STYLE: flatbuffers::VOffsetT = 24; - pub const VT_DYNAMIC_SNAP: flatbuffers::VOffsetT = 26; - pub const VT_TEMPORARY_OVERRIDES: flatbuffers::VOffsetT = 28; - pub const VT_INCREMENTAL_DISTANCE: flatbuffers::VOffsetT = 30; - pub const VT_MAGNETIC_STRENGTH: flatbuffers::VOffsetT = 32; - pub const VT_LAYER_SNAP_FILTERS: flatbuffers::VOffsetT = 34; - pub const VT_ELEMENT_TYPE_FILTERS: flatbuffers::VOffsetT = 36; - pub const VT_SNAP_MODE: flatbuffers::VOffsetT = 38; - pub const VT_SNAP_MARKERS: flatbuffers::VOffsetT = 40; - pub const VT_CONSTRUCTION_SNAP_ENABLED: flatbuffers::VOffsetT = 42; - pub const VT_SNAP_TO_GRID_INTERSECTIONS: flatbuffers::VOffsetT = 44; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - SnapSettings { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args SnapSettingsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = SnapSettingsBuilder::new(_fbb); - builder.add_magnetic_strength(args.magnetic_strength); - builder.add_incremental_distance(args.incremental_distance); - builder.add_twist_angle(args.twist_angle); - if let Some(x) = args.snap_markers { builder.add_snap_markers(x); } - if let Some(x) = args.element_type_filters { builder.add_element_type_filters(x); } - if let Some(x) = args.layer_snap_filters { builder.add_layer_snap_filters(x); } - if let Some(x) = args.temporary_overrides { builder.add_temporary_overrides(x); } - if let Some(x) = args.dynamic_snap { builder.add_dynamic_snap(x); } - if let Some(x) = args.tracking_line_style { builder.add_tracking_line_style(x); } - if let Some(x) = args.snap_priority { builder.add_snap_priority(x); } - if let Some(x) = args.active_object_snap_modes { builder.add_active_object_snap_modes(x); } - if let Some(x) = args.polar_tracking { builder.add_polar_tracking(x); } - builder.add_object_snap_aperture(args.object_snap_aperture); - builder.add_snap_tolerance(args.snap_tolerance); - builder.add_snap_to_grid_intersections(args.snap_to_grid_intersections); - builder.add_construction_snap_enabled(args.construction_snap_enabled); - if let Some(x) = args.snap_mode { builder.add_snap_mode(x); } - builder.add_show_tracking_lines(args.show_tracking_lines); - builder.add_is_object_snap_on(args.is_object_snap_on); - builder.add_is_ortho_mode_on(args.is_ortho_mode_on); - builder.add_readonly(args.readonly); - builder.finish() - } - - - #[inline] - pub fn readonly(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapSettings::VT_READONLY, Some(false)).unwrap()} - } - #[inline] - pub fn twist_angle(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapSettings::VT_TWIST_ANGLE, Some(0.0)).unwrap()} - } - #[inline] - pub fn snap_tolerance(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapSettings::VT_SNAP_TOLERANCE, Some(0)).unwrap()} - } - #[inline] - pub fn object_snap_aperture(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapSettings::VT_OBJECT_SNAP_APERTURE, Some(0)).unwrap()} - } - #[inline] - pub fn is_ortho_mode_on(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapSettings::VT_IS_ORTHO_MODE_ON, Some(false)).unwrap()} - } - #[inline] - pub fn polar_tracking(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(SnapSettings::VT_POLAR_TRACKING, None)} - } - #[inline] - pub fn is_object_snap_on(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapSettings::VT_IS_OBJECT_SNAP_ON, Some(false)).unwrap()} - } - #[inline] - pub fn active_object_snap_modes(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(SnapSettings::VT_ACTIVE_OBJECT_SNAP_MODES, None)} - } - #[inline] - pub fn snap_priority(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(SnapSettings::VT_SNAP_PRIORITY, None)} - } - #[inline] - pub fn show_tracking_lines(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapSettings::VT_SHOW_TRACKING_LINES, Some(false)).unwrap()} - } - #[inline] - pub fn tracking_line_style(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(SnapSettings::VT_TRACKING_LINE_STYLE, None)} - } - #[inline] - pub fn dynamic_snap(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(SnapSettings::VT_DYNAMIC_SNAP, None)} - } - #[inline] - pub fn temporary_overrides(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(SnapSettings::VT_TEMPORARY_OVERRIDES, None)} - } - #[inline] - pub fn incremental_distance(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapSettings::VT_INCREMENTAL_DISTANCE, Some(0.0)).unwrap()} - } - #[inline] - pub fn magnetic_strength(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapSettings::VT_MAGNETIC_STRENGTH, Some(0.0)).unwrap()} - } - #[inline] - pub fn layer_snap_filters(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(SnapSettings::VT_LAYER_SNAP_FILTERS, None)} - } - #[inline] - pub fn element_type_filters(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(SnapSettings::VT_ELEMENT_TYPE_FILTERS, None)} - } - #[inline] - pub fn snap_mode(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapSettings::VT_SNAP_MODE, None)} - } - #[inline] - pub fn snap_markers(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(SnapSettings::VT_SNAP_MARKERS, None)} - } - #[inline] - pub fn construction_snap_enabled(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapSettings::VT_CONSTRUCTION_SNAP_ENABLED, Some(false)).unwrap()} - } - #[inline] - pub fn snap_to_grid_intersections(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(SnapSettings::VT_SNAP_TO_GRID_INTERSECTIONS, Some(false)).unwrap()} - } -} - -impl flatbuffers::Verifiable for SnapSettings<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("readonly", Self::VT_READONLY, false)? - .visit_field::("twist_angle", Self::VT_TWIST_ANGLE, false)? - .visit_field::("snap_tolerance", Self::VT_SNAP_TOLERANCE, false)? - .visit_field::("object_snap_aperture", Self::VT_OBJECT_SNAP_APERTURE, false)? - .visit_field::("is_ortho_mode_on", Self::VT_IS_ORTHO_MODE_ON, false)? - .visit_field::>("polar_tracking", Self::VT_POLAR_TRACKING, false)? - .visit_field::("is_object_snap_on", Self::VT_IS_OBJECT_SNAP_ON, false)? - .visit_field::>>("active_object_snap_modes", Self::VT_ACTIVE_OBJECT_SNAP_MODES, false)? - .visit_field::>>("snap_priority", Self::VT_SNAP_PRIORITY, false)? - .visit_field::("show_tracking_lines", Self::VT_SHOW_TRACKING_LINES, false)? - .visit_field::>("tracking_line_style", Self::VT_TRACKING_LINE_STYLE, false)? - .visit_field::>("dynamic_snap", Self::VT_DYNAMIC_SNAP, false)? - .visit_field::>>>("temporary_overrides", Self::VT_TEMPORARY_OVERRIDES, false)? - .visit_field::("incremental_distance", Self::VT_INCREMENTAL_DISTANCE, false)? - .visit_field::("magnetic_strength", Self::VT_MAGNETIC_STRENGTH, false)? - .visit_field::>("layer_snap_filters", Self::VT_LAYER_SNAP_FILTERS, false)? - .visit_field::>>>("element_type_filters", Self::VT_ELEMENT_TYPE_FILTERS, false)? - .visit_field::("snap_mode", Self::VT_SNAP_MODE, false)? - .visit_field::>("snap_markers", Self::VT_SNAP_MARKERS, false)? - .visit_field::("construction_snap_enabled", Self::VT_CONSTRUCTION_SNAP_ENABLED, false)? - .visit_field::("snap_to_grid_intersections", Self::VT_SNAP_TO_GRID_INTERSECTIONS, false)? - .finish(); - Ok(()) - } -} -pub struct SnapSettingsArgs<'a> { - pub readonly: bool, - pub twist_angle: f64, - pub snap_tolerance: i32, - pub object_snap_aperture: i32, - pub is_ortho_mode_on: bool, - pub polar_tracking: Option>>, - pub is_object_snap_on: bool, - pub active_object_snap_modes: Option>>, - pub snap_priority: Option>>, - pub show_tracking_lines: bool, - pub tracking_line_style: Option>>, - pub dynamic_snap: Option>>, - pub temporary_overrides: Option>>>>, - pub incremental_distance: f64, - pub magnetic_strength: f64, - pub layer_snap_filters: Option>>, - pub element_type_filters: Option>>>, - pub snap_mode: Option, - pub snap_markers: Option>>, - pub construction_snap_enabled: bool, - pub snap_to_grid_intersections: bool, -} -impl<'a> Default for SnapSettingsArgs<'a> { - #[inline] - fn default() -> Self { - SnapSettingsArgs { - readonly: false, - twist_angle: 0.0, - snap_tolerance: 0, - object_snap_aperture: 0, - is_ortho_mode_on: false, - polar_tracking: None, - is_object_snap_on: false, - active_object_snap_modes: None, - snap_priority: None, - show_tracking_lines: false, - tracking_line_style: None, - dynamic_snap: None, - temporary_overrides: None, - incremental_distance: 0.0, - magnetic_strength: 0.0, - layer_snap_filters: None, - element_type_filters: None, - snap_mode: None, - snap_markers: None, - construction_snap_enabled: false, - snap_to_grid_intersections: false, - } - } -} - -pub struct SnapSettingsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> SnapSettingsBuilder<'a, 'b, A> { - #[inline] - pub fn add_readonly(&mut self, readonly: bool) { - self.fbb_.push_slot::(SnapSettings::VT_READONLY, readonly, false); - } - #[inline] - pub fn add_twist_angle(&mut self, twist_angle: f64) { - self.fbb_.push_slot::(SnapSettings::VT_TWIST_ANGLE, twist_angle, 0.0); - } - #[inline] - pub fn add_snap_tolerance(&mut self, snap_tolerance: i32) { - self.fbb_.push_slot::(SnapSettings::VT_SNAP_TOLERANCE, snap_tolerance, 0); - } - #[inline] - pub fn add_object_snap_aperture(&mut self, object_snap_aperture: i32) { - self.fbb_.push_slot::(SnapSettings::VT_OBJECT_SNAP_APERTURE, object_snap_aperture, 0); - } - #[inline] - pub fn add_is_ortho_mode_on(&mut self, is_ortho_mode_on: bool) { - self.fbb_.push_slot::(SnapSettings::VT_IS_ORTHO_MODE_ON, is_ortho_mode_on, false); - } - #[inline] - pub fn add_polar_tracking(&mut self, polar_tracking: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(SnapSettings::VT_POLAR_TRACKING, polar_tracking); - } - #[inline] - pub fn add_is_object_snap_on(&mut self, is_object_snap_on: bool) { - self.fbb_.push_slot::(SnapSettings::VT_IS_OBJECT_SNAP_ON, is_object_snap_on, false); - } - #[inline] - pub fn add_active_object_snap_modes(&mut self, active_object_snap_modes: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(SnapSettings::VT_ACTIVE_OBJECT_SNAP_MODES, active_object_snap_modes); - } - #[inline] - pub fn add_snap_priority(&mut self, snap_priority: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(SnapSettings::VT_SNAP_PRIORITY, snap_priority); - } - #[inline] - pub fn add_show_tracking_lines(&mut self, show_tracking_lines: bool) { - self.fbb_.push_slot::(SnapSettings::VT_SHOW_TRACKING_LINES, show_tracking_lines, false); - } - #[inline] - pub fn add_tracking_line_style(&mut self, tracking_line_style: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(SnapSettings::VT_TRACKING_LINE_STYLE, tracking_line_style); - } - #[inline] - pub fn add_dynamic_snap(&mut self, dynamic_snap: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(SnapSettings::VT_DYNAMIC_SNAP, dynamic_snap); - } - #[inline] - pub fn add_temporary_overrides(&mut self, temporary_overrides: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(SnapSettings::VT_TEMPORARY_OVERRIDES, temporary_overrides); - } - #[inline] - pub fn add_incremental_distance(&mut self, incremental_distance: f64) { - self.fbb_.push_slot::(SnapSettings::VT_INCREMENTAL_DISTANCE, incremental_distance, 0.0); - } - #[inline] - pub fn add_magnetic_strength(&mut self, magnetic_strength: f64) { - self.fbb_.push_slot::(SnapSettings::VT_MAGNETIC_STRENGTH, magnetic_strength, 0.0); - } - #[inline] - pub fn add_layer_snap_filters(&mut self, layer_snap_filters: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(SnapSettings::VT_LAYER_SNAP_FILTERS, layer_snap_filters); - } - #[inline] - pub fn add_element_type_filters(&mut self, element_type_filters: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(SnapSettings::VT_ELEMENT_TYPE_FILTERS, element_type_filters); - } - #[inline] - pub fn add_snap_mode(&mut self, snap_mode: SNAP_MODE) { - self.fbb_.push_slot_always::(SnapSettings::VT_SNAP_MODE, snap_mode); - } - #[inline] - pub fn add_snap_markers(&mut self, snap_markers: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(SnapSettings::VT_SNAP_MARKERS, snap_markers); - } - #[inline] - pub fn add_construction_snap_enabled(&mut self, construction_snap_enabled: bool) { - self.fbb_.push_slot::(SnapSettings::VT_CONSTRUCTION_SNAP_ENABLED, construction_snap_enabled, false); - } - #[inline] - pub fn add_snap_to_grid_intersections(&mut self, snap_to_grid_intersections: bool) { - self.fbb_.push_slot::(SnapSettings::VT_SNAP_TO_GRID_INTERSECTIONS, snap_to_grid_intersections, false); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> SnapSettingsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - SnapSettingsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for SnapSettings<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("SnapSettings"); - ds.field("readonly", &self.readonly()); - ds.field("twist_angle", &self.twist_angle()); - ds.field("snap_tolerance", &self.snap_tolerance()); - ds.field("object_snap_aperture", &self.object_snap_aperture()); - ds.field("is_ortho_mode_on", &self.is_ortho_mode_on()); - ds.field("polar_tracking", &self.polar_tracking()); - ds.field("is_object_snap_on", &self.is_object_snap_on()); - ds.field("active_object_snap_modes", &self.active_object_snap_modes()); - ds.field("snap_priority", &self.snap_priority()); - ds.field("show_tracking_lines", &self.show_tracking_lines()); - ds.field("tracking_line_style", &self.tracking_line_style()); - ds.field("dynamic_snap", &self.dynamic_snap()); - ds.field("temporary_overrides", &self.temporary_overrides()); - ds.field("incremental_distance", &self.incremental_distance()); - ds.field("magnetic_strength", &self.magnetic_strength()); - ds.field("layer_snap_filters", &self.layer_snap_filters()); - ds.field("element_type_filters", &self.element_type_filters()); - ds.field("snap_mode", &self.snap_mode()); - ds.field("snap_markers", &self.snap_markers()); - ds.field("construction_snap_enabled", &self.construction_snap_enabled()); - ds.field("snap_to_grid_intersections", &self.snap_to_grid_intersections()); - ds.finish() - } -} -pub enum IdentifiedGridSettingsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedGridSettings<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedGridSettings<'a> { - type Inner = IdentifiedGridSettings<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedGridSettings<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_SETTINGS: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedGridSettings { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedGridSettingsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedGridSettingsBuilder::new(_fbb); - if let Some(x) = args.settings { builder.add_settings(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedGridSettings::VT_ID, None)} - } - #[inline] - pub fn settings(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedGridSettings::VT_SETTINGS, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedGridSettings<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("settings", Self::VT_SETTINGS, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedGridSettingsArgs<'a> { - pub id: Option>>, - pub settings: Option>>, -} -impl<'a> Default for IdentifiedGridSettingsArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedGridSettingsArgs { - id: None, - settings: None, - } - } -} - -pub struct IdentifiedGridSettingsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedGridSettingsBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedGridSettings::VT_ID, id); - } - #[inline] - pub fn add_settings(&mut self, settings: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedGridSettings::VT_SETTINGS, settings); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedGridSettingsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedGridSettingsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedGridSettings<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedGridSettings"); - ds.field("id", &self.id()); - ds.field("settings", &self.settings()); - ds.finish() - } -} -pub enum IdentifiedSnapSettingsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedSnapSettings<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedSnapSettings<'a> { - type Inner = IdentifiedSnapSettings<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedSnapSettings<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_SETTINGS: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedSnapSettings { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedSnapSettingsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedSnapSettingsBuilder::new(_fbb); - if let Some(x) = args.settings { builder.add_settings(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedSnapSettings::VT_ID, None)} - } - #[inline] - pub fn settings(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedSnapSettings::VT_SETTINGS, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedSnapSettings<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("settings", Self::VT_SETTINGS, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedSnapSettingsArgs<'a> { - pub id: Option>>, - pub settings: Option>>, -} -impl<'a> Default for IdentifiedSnapSettingsArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedSnapSettingsArgs { - id: None, - settings: None, - } - } -} - -pub struct IdentifiedSnapSettingsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedSnapSettingsBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedSnapSettings::VT_ID, id); - } - #[inline] - pub fn add_settings(&mut self, settings: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedSnapSettings::VT_SETTINGS, settings); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedSnapSettingsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedSnapSettingsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedSnapSettings<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedSnapSettings"); - ds.field("id", &self.id()); - ds.field("settings", &self.settings()); - ds.finish() - } -} -pub enum IdentifiedUcsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedUcs<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedUcs<'a> { - type Inner = IdentifiedUcs<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedUcs<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_UCS: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedUcs { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedUcsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedUcsBuilder::new(_fbb); - if let Some(x) = args.ucs { builder.add_ucs(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedUcs::VT_ID, None)} - } - #[inline] - pub fn ucs(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedUcs::VT_UCS, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedUcs<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("ucs", Self::VT_UCS, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedUcsArgs<'a> { - pub id: Option>>, - pub ucs: Option>>, -} -impl<'a> Default for IdentifiedUcsArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedUcsArgs { - id: None, - ucs: None, - } - } -} - -pub struct IdentifiedUcsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedUcsBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedUcs::VT_ID, id); - } - #[inline] - pub fn add_ucs(&mut self, ucs: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedUcs::VT_UCS, ucs); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedUcsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedUcsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedUcs<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedUcs"); - ds.field("id", &self.id()); - ds.field("ucs", &self.ucs()); - ds.finish() - } -} -pub enum IdentifiedViewOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct IdentifiedView<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for IdentifiedView<'a> { - type Inner = IdentifiedView<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> IdentifiedView<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_VIEW: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - IdentifiedView { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args IdentifiedViewArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = IdentifiedViewBuilder::new(_fbb); - if let Some(x) = args.view { builder.add_view(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedView::VT_ID, None)} - } - #[inline] - pub fn view(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(IdentifiedView::VT_VIEW, None)} - } -} - -impl flatbuffers::Verifiable for IdentifiedView<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("view", Self::VT_VIEW, false)? - .finish(); - Ok(()) - } -} -pub struct IdentifiedViewArgs<'a> { - pub id: Option>>, - pub view: Option>>, -} -impl<'a> Default for IdentifiedViewArgs<'a> { - #[inline] - fn default() -> Self { - IdentifiedViewArgs { - id: None, - view: None, - } - } -} - -pub struct IdentifiedViewBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IdentifiedViewBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedView::VT_ID, id); - } - #[inline] - pub fn add_view(&mut self, view: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(IdentifiedView::VT_VIEW, view); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IdentifiedViewBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - IdentifiedViewBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for IdentifiedView<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("IdentifiedView"); - ds.field("id", &self.id()); - ds.field("view", &self.view()); - ds.finish() - } -} -pub enum StandardViewSettingsOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct StandardViewSettings<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for StandardViewSettings<'a> { - type Inner = StandardViewSettings<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> StandardViewSettings<'a> { - pub const VT_VIEWS: flatbuffers::VOffsetT = 4; - pub const VT_UCS: flatbuffers::VOffsetT = 6; - pub const VT_GRID_SETTINGS: flatbuffers::VOffsetT = 8; - pub const VT_SNAP_SETTINGS: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - StandardViewSettings { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args StandardViewSettingsArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = StandardViewSettingsBuilder::new(_fbb); - if let Some(x) = args.snap_settings { builder.add_snap_settings(x); } - if let Some(x) = args.grid_settings { builder.add_grid_settings(x); } - if let Some(x) = args.ucs { builder.add_ucs(x); } - if let Some(x) = args.views { builder.add_views(x); } - builder.finish() - } - - - #[inline] - pub fn views(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardViewSettings::VT_VIEWS, None)} - } - #[inline] - pub fn ucs(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardViewSettings::VT_UCS, None)} - } - #[inline] - pub fn grid_settings(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardViewSettings::VT_GRID_SETTINGS, None)} - } - #[inline] - pub fn snap_settings(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(StandardViewSettings::VT_SNAP_SETTINGS, None)} - } -} - -impl flatbuffers::Verifiable for StandardViewSettings<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>>("views", Self::VT_VIEWS, false)? - .visit_field::>>>("ucs", Self::VT_UCS, false)? - .visit_field::>>>("grid_settings", Self::VT_GRID_SETTINGS, false)? - .visit_field::>>>("snap_settings", Self::VT_SNAP_SETTINGS, false)? - .finish(); - Ok(()) - } -} -pub struct StandardViewSettingsArgs<'a> { - pub views: Option>>>>, - pub ucs: Option>>>>, - pub grid_settings: Option>>>>, - pub snap_settings: Option>>>>, -} -impl<'a> Default for StandardViewSettingsArgs<'a> { - #[inline] - fn default() -> Self { - StandardViewSettingsArgs { - views: None, - ucs: None, - grid_settings: None, - snap_settings: None, - } - } -} - -pub struct StandardViewSettingsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StandardViewSettingsBuilder<'a, 'b, A> { - #[inline] - pub fn add_views(&mut self, views: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardViewSettings::VT_VIEWS, views); - } - #[inline] - pub fn add_ucs(&mut self, ucs: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardViewSettings::VT_UCS, ucs); - } - #[inline] - pub fn add_grid_settings(&mut self, grid_settings: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardViewSettings::VT_GRID_SETTINGS, grid_settings); - } - #[inline] - pub fn add_snap_settings(&mut self, snap_settings: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(StandardViewSettings::VT_SNAP_SETTINGS, snap_settings); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StandardViewSettingsBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - StandardViewSettingsBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for StandardViewSettings<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("StandardViewSettings"); - ds.field("views", &self.views()); - ds.field("ucs", &self.ucs()); - ds.field("grid_settings", &self.grid_settings()); - ds.field("snap_settings", &self.snap_settings()); - ds.finish() - } -} -pub enum DimensionValidationRulesOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DimensionValidationRules<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DimensionValidationRules<'a> { - type Inner = DimensionValidationRules<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DimensionValidationRules<'a> { - pub const VT_MIN_TEXT_HEIGHT: flatbuffers::VOffsetT = 4; - pub const VT_MAX_TEXT_HEIGHT: flatbuffers::VOffsetT = 6; - pub const VT_ALLOWED_PRECISIONS: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DimensionValidationRules { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DimensionValidationRulesArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DimensionValidationRulesBuilder::new(_fbb); - builder.add_max_text_height(args.max_text_height); - builder.add_min_text_height(args.min_text_height); - if let Some(x) = args.allowed_precisions { builder.add_allowed_precisions(x); } - builder.finish() - } - - - #[inline] - pub fn min_text_height(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionValidationRules::VT_MIN_TEXT_HEIGHT, Some(0.0)).unwrap()} - } - #[inline] - pub fn max_text_height(&self) -> f64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DimensionValidationRules::VT_MAX_TEXT_HEIGHT, Some(0.0)).unwrap()} - } - #[inline] - pub fn allowed_precisions(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DimensionValidationRules::VT_ALLOWED_PRECISIONS, None)} - } -} - -impl flatbuffers::Verifiable for DimensionValidationRules<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("min_text_height", Self::VT_MIN_TEXT_HEIGHT, false)? - .visit_field::("max_text_height", Self::VT_MAX_TEXT_HEIGHT, false)? - .visit_field::>>("allowed_precisions", Self::VT_ALLOWED_PRECISIONS, false)? - .finish(); - Ok(()) - } -} -pub struct DimensionValidationRulesArgs<'a> { - pub min_text_height: f64, - pub max_text_height: f64, - pub allowed_precisions: Option>>, -} -impl<'a> Default for DimensionValidationRulesArgs<'a> { - #[inline] - fn default() -> Self { - DimensionValidationRulesArgs { - min_text_height: 0.0, - max_text_height: 0.0, - allowed_precisions: None, - } - } -} - -pub struct DimensionValidationRulesBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DimensionValidationRulesBuilder<'a, 'b, A> { - #[inline] - pub fn add_min_text_height(&mut self, min_text_height: f64) { - self.fbb_.push_slot::(DimensionValidationRules::VT_MIN_TEXT_HEIGHT, min_text_height, 0.0); - } - #[inline] - pub fn add_max_text_height(&mut self, max_text_height: f64) { - self.fbb_.push_slot::(DimensionValidationRules::VT_MAX_TEXT_HEIGHT, max_text_height, 0.0); - } - #[inline] - pub fn add_allowed_precisions(&mut self, allowed_precisions: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DimensionValidationRules::VT_ALLOWED_PRECISIONS, allowed_precisions); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DimensionValidationRulesBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DimensionValidationRulesBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DimensionValidationRules<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DimensionValidationRules"); - ds.field("min_text_height", &self.min_text_height()); - ds.field("max_text_height", &self.max_text_height()); - ds.field("allowed_precisions", &self.allowed_precisions()); - ds.finish() - } -} -pub enum LayerValidationRulesOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct LayerValidationRules<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for LayerValidationRules<'a> { - type Inner = LayerValidationRules<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> LayerValidationRules<'a> { - pub const VT_PROHIBITED_LAYER_NAMES: flatbuffers::VOffsetT = 4; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - LayerValidationRules { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args LayerValidationRulesArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = LayerValidationRulesBuilder::new(_fbb); - if let Some(x) = args.prohibited_layer_names { builder.add_prohibited_layer_names(x); } - builder.finish() - } - - - #[inline] - pub fn prohibited_layer_names(&self) -> Option>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(LayerValidationRules::VT_PROHIBITED_LAYER_NAMES, None)} - } -} - -impl flatbuffers::Verifiable for LayerValidationRules<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>>>("prohibited_layer_names", Self::VT_PROHIBITED_LAYER_NAMES, false)? - .finish(); - Ok(()) - } -} -pub struct LayerValidationRulesArgs<'a> { - pub prohibited_layer_names: Option>>>, -} -impl<'a> Default for LayerValidationRulesArgs<'a> { - #[inline] - fn default() -> Self { - LayerValidationRulesArgs { - prohibited_layer_names: None, - } - } -} - -pub struct LayerValidationRulesBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> LayerValidationRulesBuilder<'a, 'b, A> { - #[inline] - pub fn add_prohibited_layer_names(&mut self, prohibited_layer_names: flatbuffers::WIPOffset>>) { - self.fbb_.push_slot_always::>(LayerValidationRules::VT_PROHIBITED_LAYER_NAMES, prohibited_layer_names); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> LayerValidationRulesBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - LayerValidationRulesBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for LayerValidationRules<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("LayerValidationRules"); - ds.field("prohibited_layer_names", &self.prohibited_layer_names()); - ds.finish() - } -} -pub enum StandardValidationOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct StandardValidation<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for StandardValidation<'a> { - type Inner = StandardValidation<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> StandardValidation<'a> { - pub const VT_DIMENSION_RULES: flatbuffers::VOffsetT = 4; - pub const VT_LAYER_RULES: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - StandardValidation { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args StandardValidationArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = StandardValidationBuilder::new(_fbb); - if let Some(x) = args.layer_rules { builder.add_layer_rules(x); } - if let Some(x) = args.dimension_rules { builder.add_dimension_rules(x); } - builder.finish() - } - - - #[inline] - pub fn dimension_rules(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardValidation::VT_DIMENSION_RULES, None)} - } - #[inline] - pub fn layer_rules(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(StandardValidation::VT_LAYER_RULES, None)} - } -} - -impl flatbuffers::Verifiable for StandardValidation<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("dimension_rules", Self::VT_DIMENSION_RULES, false)? - .visit_field::>("layer_rules", Self::VT_LAYER_RULES, false)? - .finish(); - Ok(()) - } -} -pub struct StandardValidationArgs<'a> { - pub dimension_rules: Option>>, - pub layer_rules: Option>>, -} -impl<'a> Default for StandardValidationArgs<'a> { - #[inline] - fn default() -> Self { - StandardValidationArgs { - dimension_rules: None, - layer_rules: None, - } - } -} - -pub struct StandardValidationBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StandardValidationBuilder<'a, 'b, A> { - #[inline] - pub fn add_dimension_rules(&mut self, dimension_rules: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(StandardValidation::VT_DIMENSION_RULES, dimension_rules); - } - #[inline] - pub fn add_layer_rules(&mut self, layer_rules: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(StandardValidation::VT_LAYER_RULES, layer_rules); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StandardValidationBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - StandardValidationBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for StandardValidation<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("StandardValidation"); - ds.field("dimension_rules", &self.dimension_rules()); - ds.field("layer_rules", &self.layer_rules()); - ds.finish() - } -} -pub enum StandardOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct Standard<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for Standard<'a> { - type Inner = Standard<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> Standard<'a> { - pub const VT_IDENTIFIER: flatbuffers::VOffsetT = 4; - pub const VT_VERSION: flatbuffers::VOffsetT = 6; - pub const VT_READONLY: flatbuffers::VOffsetT = 8; - pub const VT_OVERRIDES: flatbuffers::VOffsetT = 10; - pub const VT_STYLES: flatbuffers::VOffsetT = 12; - pub const VT_VIEW_SETTINGS: flatbuffers::VOffsetT = 14; - pub const VT_UNITS: flatbuffers::VOffsetT = 16; - pub const VT_VALIDATION: flatbuffers::VOffsetT = 18; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - Standard { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args StandardArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = StandardBuilder::new(_fbb); - if let Some(x) = args.validation { builder.add_validation(x); } - if let Some(x) = args.units { builder.add_units(x); } - if let Some(x) = args.view_settings { builder.add_view_settings(x); } - if let Some(x) = args.styles { builder.add_styles(x); } - if let Some(x) = args.overrides { builder.add_overrides(x); } - if let Some(x) = args.version { builder.add_version(x); } - if let Some(x) = args.identifier { builder.add_identifier(x); } - builder.add_readonly(args.readonly); - builder.finish() - } - - - #[inline] - pub fn identifier(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Standard::VT_IDENTIFIER, None)} - } - #[inline] - pub fn version(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Standard::VT_VERSION, None)} - } - #[inline] - pub fn readonly(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(Standard::VT_READONLY, Some(false)).unwrap()} - } - #[inline] - pub fn overrides(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Standard::VT_OVERRIDES, None)} - } - #[inline] - pub fn styles(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Standard::VT_STYLES, None)} - } - #[inline] - pub fn view_settings(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Standard::VT_VIEW_SETTINGS, None)} - } - #[inline] - pub fn units(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Standard::VT_UNITS, None)} - } - #[inline] - pub fn validation(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Standard::VT_VALIDATION, None)} - } -} - -impl flatbuffers::Verifiable for Standard<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("identifier", Self::VT_IDENTIFIER, false)? - .visit_field::>("version", Self::VT_VERSION, false)? - .visit_field::("readonly", Self::VT_READONLY, false)? - .visit_field::>("overrides", Self::VT_OVERRIDES, false)? - .visit_field::>("styles", Self::VT_STYLES, false)? - .visit_field::>("view_settings", Self::VT_VIEW_SETTINGS, false)? - .visit_field::>("units", Self::VT_UNITS, false)? - .visit_field::>("validation", Self::VT_VALIDATION, false)? - .finish(); - Ok(()) - } -} -pub struct StandardArgs<'a> { - pub identifier: Option>>, - pub version: Option>, - pub readonly: bool, - pub overrides: Option>>, - pub styles: Option>>, - pub view_settings: Option>>, - pub units: Option>>, - pub validation: Option>>, -} -impl<'a> Default for StandardArgs<'a> { - #[inline] - fn default() -> Self { - StandardArgs { - identifier: None, - version: None, - readonly: false, - overrides: None, - styles: None, - view_settings: None, - units: None, - validation: None, - } - } -} - -pub struct StandardBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StandardBuilder<'a, 'b, A> { - #[inline] - pub fn add_identifier(&mut self, identifier: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Standard::VT_IDENTIFIER, identifier); - } - #[inline] - pub fn add_version(&mut self, version: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(Standard::VT_VERSION, version); - } - #[inline] - pub fn add_readonly(&mut self, readonly: bool) { - self.fbb_.push_slot::(Standard::VT_READONLY, readonly, false); - } - #[inline] - pub fn add_overrides(&mut self, overrides: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Standard::VT_OVERRIDES, overrides); - } - #[inline] - pub fn add_styles(&mut self, styles: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Standard::VT_STYLES, styles); - } - #[inline] - pub fn add_view_settings(&mut self, view_settings: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Standard::VT_VIEW_SETTINGS, view_settings); - } - #[inline] - pub fn add_units(&mut self, units: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Standard::VT_UNITS, units); - } - #[inline] - pub fn add_validation(&mut self, validation: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Standard::VT_VALIDATION, validation); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StandardBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - StandardBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for Standard<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("Standard"); - ds.field("identifier", &self.identifier()); - ds.field("version", &self.version()); - ds.field("readonly", &self.readonly()); - ds.field("overrides", &self.overrides()); - ds.field("styles", &self.styles()); - ds.field("view_settings", &self.view_settings()); - ds.field("units", &self.units()); - ds.field("validation", &self.validation()); - ds.finish() - } -} -pub enum VersionBaseOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct VersionBase<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for VersionBase<'a> { - type Inner = VersionBase<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> VersionBase<'a> { - pub const VT_ID: flatbuffers::VOffsetT = 4; - pub const VT_PARENT_ID: flatbuffers::VOffsetT = 6; - pub const VT_TIMESTAMP: flatbuffers::VOffsetT = 8; - pub const VT_DESCRIPTION: flatbuffers::VOffsetT = 10; - pub const VT_IS_MANUAL_SAVE: flatbuffers::VOffsetT = 12; - pub const VT_USER_ID: flatbuffers::VOffsetT = 14; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - VersionBase { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args VersionBaseArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = VersionBaseBuilder::new(_fbb); - builder.add_timestamp(args.timestamp); - if let Some(x) = args.user_id { builder.add_user_id(x); } - if let Some(x) = args.description { builder.add_description(x); } - if let Some(x) = args.parent_id { builder.add_parent_id(x); } - if let Some(x) = args.id { builder.add_id(x); } - builder.add_is_manual_save(args.is_manual_save); - builder.finish() - } - - - #[inline] - pub fn id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(VersionBase::VT_ID, None)} - } - #[inline] - pub fn parent_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(VersionBase::VT_PARENT_ID, None)} - } - #[inline] - pub fn timestamp(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(VersionBase::VT_TIMESTAMP, Some(0)).unwrap()} - } - #[inline] - pub fn description(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(VersionBase::VT_DESCRIPTION, None)} - } - #[inline] - pub fn is_manual_save(&self) -> bool { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(VersionBase::VT_IS_MANUAL_SAVE, Some(false)).unwrap()} - } - #[inline] - pub fn user_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(VersionBase::VT_USER_ID, None)} - } -} - -impl flatbuffers::Verifiable for VersionBase<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>("parent_id", Self::VT_PARENT_ID, false)? - .visit_field::("timestamp", Self::VT_TIMESTAMP, false)? - .visit_field::>("description", Self::VT_DESCRIPTION, false)? - .visit_field::("is_manual_save", Self::VT_IS_MANUAL_SAVE, false)? - .visit_field::>("user_id", Self::VT_USER_ID, false)? - .finish(); - Ok(()) - } -} -pub struct VersionBaseArgs<'a> { - pub id: Option>, - pub parent_id: Option>, - pub timestamp: i64, - pub description: Option>, - pub is_manual_save: bool, - pub user_id: Option>, -} -impl<'a> Default for VersionBaseArgs<'a> { - #[inline] - fn default() -> Self { - VersionBaseArgs { - id: None, - parent_id: None, - timestamp: 0, - description: None, - is_manual_save: false, - user_id: None, - } - } -} - -pub struct VersionBaseBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> VersionBaseBuilder<'a, 'b, A> { - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(VersionBase::VT_ID, id); - } - #[inline] - pub fn add_parent_id(&mut self, parent_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(VersionBase::VT_PARENT_ID, parent_id); - } - #[inline] - pub fn add_timestamp(&mut self, timestamp: i64) { - self.fbb_.push_slot::(VersionBase::VT_TIMESTAMP, timestamp, 0); - } - #[inline] - pub fn add_description(&mut self, description: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(VersionBase::VT_DESCRIPTION, description); - } - #[inline] - pub fn add_is_manual_save(&mut self, is_manual_save: bool) { - self.fbb_.push_slot::(VersionBase::VT_IS_MANUAL_SAVE, is_manual_save, false); - } - #[inline] - pub fn add_user_id(&mut self, user_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(VersionBase::VT_USER_ID, user_id); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> VersionBaseBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - VersionBaseBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for VersionBase<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("VersionBase"); - ds.field("id", &self.id()); - ds.field("parent_id", &self.parent_id()); - ds.field("timestamp", &self.timestamp()); - ds.field("description", &self.description()); - ds.field("is_manual_save", &self.is_manual_save()); - ds.field("user_id", &self.user_id()); - ds.finish() - } -} -pub enum CheckpointOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct Checkpoint<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for Checkpoint<'a> { - type Inner = Checkpoint<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> Checkpoint<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_DATA: flatbuffers::VOffsetT = 6; - pub const VT_SIZE_BYTES: flatbuffers::VOffsetT = 8; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - Checkpoint { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args CheckpointArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = CheckpointBuilder::new(_fbb); - builder.add_size_bytes(args.size_bytes); - if let Some(x) = args.data { builder.add_data(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Checkpoint::VT_BASE, None)} - } - #[inline] - pub fn data(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(Checkpoint::VT_DATA, None)} - } - #[inline] - pub fn size_bytes(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(Checkpoint::VT_SIZE_BYTES, Some(0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for Checkpoint<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::>>("data", Self::VT_DATA, false)? - .visit_field::("size_bytes", Self::VT_SIZE_BYTES, false)? - .finish(); - Ok(()) - } -} -pub struct CheckpointArgs<'a> { - pub base: Option>>, - pub data: Option>>, - pub size_bytes: i64, -} -impl<'a> Default for CheckpointArgs<'a> { - #[inline] - fn default() -> Self { - CheckpointArgs { - base: None, - data: None, - size_bytes: 0, - } - } -} - -pub struct CheckpointBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> CheckpointBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Checkpoint::VT_BASE, base); - } - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Checkpoint::VT_DATA, data); - } - #[inline] - pub fn add_size_bytes(&mut self, size_bytes: i64) { - self.fbb_.push_slot::(Checkpoint::VT_SIZE_BYTES, size_bytes, 0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> CheckpointBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - CheckpointBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for Checkpoint<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("Checkpoint"); - ds.field("base", &self.base()); - ds.field("data", &self.data()); - ds.field("size_bytes", &self.size_bytes()); - ds.finish() - } -} -pub enum JSONPatchOperationOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct JSONPatchOperation<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for JSONPatchOperation<'a> { - type Inner = JSONPatchOperation<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> JSONPatchOperation<'a> { - pub const VT_OP: flatbuffers::VOffsetT = 4; - pub const VT_PATH: flatbuffers::VOffsetT = 6; - pub const VT_FROM: flatbuffers::VOffsetT = 8; - pub const VT_VALUE: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - JSONPatchOperation { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args JSONPatchOperationArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = JSONPatchOperationBuilder::new(_fbb); - if let Some(x) = args.value { builder.add_value(x); } - if let Some(x) = args.from { builder.add_from(x); } - if let Some(x) = args.path { builder.add_path(x); } - if let Some(x) = args.op { builder.add_op(x); } - builder.finish() - } - - - #[inline] - pub fn op(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(JSONPatchOperation::VT_OP, None)} - } - #[inline] - pub fn path(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(JSONPatchOperation::VT_PATH, None)} - } - #[inline] - pub fn from(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(JSONPatchOperation::VT_FROM, None)} - } - #[inline] - pub fn value(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(JSONPatchOperation::VT_VALUE, None)} - } -} - -impl flatbuffers::Verifiable for JSONPatchOperation<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("op", Self::VT_OP, false)? - .visit_field::>("path", Self::VT_PATH, false)? - .visit_field::>("from", Self::VT_FROM, false)? - .visit_field::>("value", Self::VT_VALUE, false)? - .finish(); - Ok(()) - } -} -pub struct JSONPatchOperationArgs<'a> { - pub op: Option>, - pub path: Option>, - pub from: Option>, - pub value: Option>, -} -impl<'a> Default for JSONPatchOperationArgs<'a> { - #[inline] - fn default() -> Self { - JSONPatchOperationArgs { - op: None, - path: None, - from: None, - value: None, - } - } -} - -pub struct JSONPatchOperationBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> JSONPatchOperationBuilder<'a, 'b, A> { - #[inline] - pub fn add_op(&mut self, op: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(JSONPatchOperation::VT_OP, op); - } - #[inline] - pub fn add_path(&mut self, path: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(JSONPatchOperation::VT_PATH, path); - } - #[inline] - pub fn add_from(&mut self, from: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(JSONPatchOperation::VT_FROM, from); - } - #[inline] - pub fn add_value(&mut self, value: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(JSONPatchOperation::VT_VALUE, value); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> JSONPatchOperationBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - JSONPatchOperationBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for JSONPatchOperation<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("JSONPatchOperation"); - ds.field("op", &self.op()); - ds.field("path", &self.path()); - ds.field("from", &self.from()); - ds.field("value", &self.value()); - ds.finish() - } -} -pub enum DeltaOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct Delta<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for Delta<'a> { - type Inner = Delta<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> Delta<'a> { - pub const VT_BASE: flatbuffers::VOffsetT = 4; - pub const VT_SIZE_BYTES: flatbuffers::VOffsetT = 8; - pub const VT_PATCH: flatbuffers::VOffsetT = 10; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - Delta { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DeltaArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DeltaBuilder::new(_fbb); - builder.add_size_bytes(args.size_bytes); - if let Some(x) = args.patch { builder.add_patch(x); } - if let Some(x) = args.base { builder.add_base(x); } - builder.finish() - } - - - #[inline] - pub fn base(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(Delta::VT_BASE, None)} - } - #[inline] - pub fn size_bytes(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(Delta::VT_SIZE_BYTES, Some(0)).unwrap()} - } - #[inline] - pub fn patch(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(Delta::VT_PATCH, None)} - } -} - -impl flatbuffers::Verifiable for Delta<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("base", Self::VT_BASE, false)? - .visit_field::("size_bytes", Self::VT_SIZE_BYTES, false)? - .visit_field::>>("patch", Self::VT_PATCH, false)? - .finish(); - Ok(()) - } -} -pub struct DeltaArgs<'a> { - pub base: Option>>, - pub size_bytes: i64, - pub patch: Option>>, -} -impl<'a> Default for DeltaArgs<'a> { - #[inline] - fn default() -> Self { - DeltaArgs { - base: None, - size_bytes: 0, - patch: None, - } - } -} - -pub struct DeltaBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DeltaBuilder<'a, 'b, A> { - #[inline] - pub fn add_base(&mut self, base: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Delta::VT_BASE, base); - } - #[inline] - pub fn add_size_bytes(&mut self, size_bytes: i64) { - self.fbb_.push_slot::(Delta::VT_SIZE_BYTES, size_bytes, 0); - } - #[inline] - pub fn add_patch(&mut self, patch: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(Delta::VT_PATCH, patch); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DeltaBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DeltaBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for Delta<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("Delta"); - ds.field("base", &self.base()); - ds.field("size_bytes", &self.size_bytes()); - ds.field("patch", &self.patch()); - ds.finish() - } -} -pub enum VersionGraphMetadataOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct VersionGraphMetadata<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for VersionGraphMetadata<'a> { - type Inner = VersionGraphMetadata<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> VersionGraphMetadata<'a> { - pub const VT_LAST_PRUNED: flatbuffers::VOffsetT = 4; - pub const VT_TOTAL_SIZE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - VersionGraphMetadata { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args VersionGraphMetadataArgs - ) -> flatbuffers::WIPOffset> { - let mut builder = VersionGraphMetadataBuilder::new(_fbb); - builder.add_total_size(args.total_size); - builder.add_last_pruned(args.last_pruned); - builder.finish() - } - - - #[inline] - pub fn last_pruned(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(VersionGraphMetadata::VT_LAST_PRUNED, Some(0)).unwrap()} - } - #[inline] - pub fn total_size(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(VersionGraphMetadata::VT_TOTAL_SIZE, Some(0)).unwrap()} - } -} - -impl flatbuffers::Verifiable for VersionGraphMetadata<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::("last_pruned", Self::VT_LAST_PRUNED, false)? - .visit_field::("total_size", Self::VT_TOTAL_SIZE, false)? - .finish(); - Ok(()) - } -} -pub struct VersionGraphMetadataArgs { - pub last_pruned: i64, - pub total_size: i64, -} -impl<'a> Default for VersionGraphMetadataArgs { - #[inline] - fn default() -> Self { - VersionGraphMetadataArgs { - last_pruned: 0, - total_size: 0, - } - } -} - -pub struct VersionGraphMetadataBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> VersionGraphMetadataBuilder<'a, 'b, A> { - #[inline] - pub fn add_last_pruned(&mut self, last_pruned: i64) { - self.fbb_.push_slot::(VersionGraphMetadata::VT_LAST_PRUNED, last_pruned, 0); - } - #[inline] - pub fn add_total_size(&mut self, total_size: i64) { - self.fbb_.push_slot::(VersionGraphMetadata::VT_TOTAL_SIZE, total_size, 0); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> VersionGraphMetadataBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - VersionGraphMetadataBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for VersionGraphMetadata<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("VersionGraphMetadata"); - ds.field("last_pruned", &self.last_pruned()); - ds.field("total_size", &self.total_size()); - ds.finish() - } -} -pub enum VersionGraphOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct VersionGraph<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for VersionGraph<'a> { - type Inner = VersionGraph<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> VersionGraph<'a> { - pub const VT_USER_CHECKPOINT_VERSION_ID: flatbuffers::VOffsetT = 4; - pub const VT_LATEST_VERSION_ID: flatbuffers::VOffsetT = 6; - pub const VT_CHECKPOINTS: flatbuffers::VOffsetT = 8; - pub const VT_DELTAS: flatbuffers::VOffsetT = 10; - pub const VT_METADATA: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - VersionGraph { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args VersionGraphArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = VersionGraphBuilder::new(_fbb); - if let Some(x) = args.metadata { builder.add_metadata(x); } - if let Some(x) = args.deltas { builder.add_deltas(x); } - if let Some(x) = args.checkpoints { builder.add_checkpoints(x); } - if let Some(x) = args.latest_version_id { builder.add_latest_version_id(x); } - if let Some(x) = args.user_checkpoint_version_id { builder.add_user_checkpoint_version_id(x); } - builder.finish() - } - - - #[inline] - pub fn user_checkpoint_version_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(VersionGraph::VT_USER_CHECKPOINT_VERSION_ID, None)} - } - #[inline] - pub fn latest_version_id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(VersionGraph::VT_LATEST_VERSION_ID, None)} - } - #[inline] - pub fn checkpoints(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(VersionGraph::VT_CHECKPOINTS, None)} - } - #[inline] - pub fn deltas(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(VersionGraph::VT_DELTAS, None)} - } - #[inline] - pub fn metadata(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(VersionGraph::VT_METADATA, None)} - } -} - -impl flatbuffers::Verifiable for VersionGraph<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("user_checkpoint_version_id", Self::VT_USER_CHECKPOINT_VERSION_ID, false)? - .visit_field::>("latest_version_id", Self::VT_LATEST_VERSION_ID, false)? - .visit_field::>>>("checkpoints", Self::VT_CHECKPOINTS, false)? - .visit_field::>>>("deltas", Self::VT_DELTAS, false)? - .visit_field::>("metadata", Self::VT_METADATA, false)? - .finish(); - Ok(()) - } -} -pub struct VersionGraphArgs<'a> { - pub user_checkpoint_version_id: Option>, - pub latest_version_id: Option>, - pub checkpoints: Option>>>>, - pub deltas: Option>>>>, - pub metadata: Option>>, -} -impl<'a> Default for VersionGraphArgs<'a> { - #[inline] - fn default() -> Self { - VersionGraphArgs { - user_checkpoint_version_id: None, - latest_version_id: None, - checkpoints: None, - deltas: None, - metadata: None, - } - } -} - -pub struct VersionGraphBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> VersionGraphBuilder<'a, 'b, A> { - #[inline] - pub fn add_user_checkpoint_version_id(&mut self, user_checkpoint_version_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(VersionGraph::VT_USER_CHECKPOINT_VERSION_ID, user_checkpoint_version_id); - } - #[inline] - pub fn add_latest_version_id(&mut self, latest_version_id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(VersionGraph::VT_LATEST_VERSION_ID, latest_version_id); - } - #[inline] - pub fn add_checkpoints(&mut self, checkpoints: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(VersionGraph::VT_CHECKPOINTS, checkpoints); - } - #[inline] - pub fn add_deltas(&mut self, deltas: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(VersionGraph::VT_DELTAS, deltas); - } - #[inline] - pub fn add_metadata(&mut self, metadata: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(VersionGraph::VT_METADATA, metadata); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> VersionGraphBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - VersionGraphBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for VersionGraph<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("VersionGraph"); - ds.field("user_checkpoint_version_id", &self.user_checkpoint_version_id()); - ds.field("latest_version_id", &self.latest_version_id()); - ds.field("checkpoints", &self.checkpoints()); - ds.field("deltas", &self.deltas()); - ds.field("metadata", &self.metadata()); - ds.finish() - } -} -pub enum DucExternalFileDataOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucExternalFileData<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucExternalFileData<'a> { - type Inner = DucExternalFileData<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucExternalFileData<'a> { - pub const VT_MIME_TYPE: flatbuffers::VOffsetT = 4; - pub const VT_ID: flatbuffers::VOffsetT = 6; - pub const VT_DATA: flatbuffers::VOffsetT = 8; - pub const VT_CREATED: flatbuffers::VOffsetT = 10; - pub const VT_LAST_RETRIEVED: flatbuffers::VOffsetT = 12; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucExternalFileData { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucExternalFileDataArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucExternalFileDataBuilder::new(_fbb); - if let Some(x) = args.last_retrieved { builder.add_last_retrieved(x); } - builder.add_created(args.created); - if let Some(x) = args.data { builder.add_data(x); } - if let Some(x) = args.id { builder.add_id(x); } - if let Some(x) = args.mime_type { builder.add_mime_type(x); } - builder.finish() - } - - - #[inline] - pub fn mime_type(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucExternalFileData::VT_MIME_TYPE, None)} - } - #[inline] - pub fn id(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucExternalFileData::VT_ID, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DucExternalFileData) -> bool { - self.id() < o.id() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.id(); - key.cmp(val) - } - #[inline] - pub fn data(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(DucExternalFileData::VT_DATA, None)} - } - #[inline] - pub fn created(&self) -> i64 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucExternalFileData::VT_CREATED, Some(0)).unwrap()} - } - #[inline] - pub fn last_retrieved(&self) -> Option { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(DucExternalFileData::VT_LAST_RETRIEVED, None)} - } -} - -impl flatbuffers::Verifiable for DucExternalFileData<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("mime_type", Self::VT_MIME_TYPE, false)? - .visit_field::>("id", Self::VT_ID, true)? - .visit_field::>>("data", Self::VT_DATA, false)? - .visit_field::("created", Self::VT_CREATED, false)? - .visit_field::("last_retrieved", Self::VT_LAST_RETRIEVED, false)? - .finish(); - Ok(()) - } -} -pub struct DucExternalFileDataArgs<'a> { - pub mime_type: Option>, - pub id: Option>, - pub data: Option>>, - pub created: i64, - pub last_retrieved: Option, -} -impl<'a> Default for DucExternalFileDataArgs<'a> { - #[inline] - fn default() -> Self { - DucExternalFileDataArgs { - mime_type: None, - id: None, // required field - data: None, - created: 0, - last_retrieved: None, - } - } -} - -pub struct DucExternalFileDataBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucExternalFileDataBuilder<'a, 'b, A> { - #[inline] - pub fn add_mime_type(&mut self, mime_type: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucExternalFileData::VT_MIME_TYPE, mime_type); - } - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucExternalFileData::VT_ID, id); - } - #[inline] - pub fn add_data(&mut self, data: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucExternalFileData::VT_DATA, data); - } - #[inline] - pub fn add_created(&mut self, created: i64) { - self.fbb_.push_slot::(DucExternalFileData::VT_CREATED, created, 0); - } - #[inline] - pub fn add_last_retrieved(&mut self, last_retrieved: i64) { - self.fbb_.push_slot_always::(DucExternalFileData::VT_LAST_RETRIEVED, last_retrieved); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucExternalFileDataBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucExternalFileDataBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DucExternalFileData::VT_ID,"id"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucExternalFileData<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucExternalFileData"); - ds.field("mime_type", &self.mime_type()); - ds.field("id", &self.id()); - ds.field("data", &self.data()); - ds.field("created", &self.created()); - ds.field("last_retrieved", &self.last_retrieved()); - ds.finish() - } -} -pub enum DucExternalFileEntryOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct DucExternalFileEntry<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for DucExternalFileEntry<'a> { - type Inner = DucExternalFileEntry<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> DucExternalFileEntry<'a> { - pub const VT_KEY: flatbuffers::VOffsetT = 4; - pub const VT_VALUE: flatbuffers::VOffsetT = 6; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - DucExternalFileEntry { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args DucExternalFileEntryArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = DucExternalFileEntryBuilder::new(_fbb); - if let Some(x) = args.value { builder.add_value(x); } - if let Some(x) = args.key { builder.add_key(x); } - builder.finish() - } - - - #[inline] - pub fn key(&self) -> &'a str { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucExternalFileEntry::VT_KEY, None).unwrap()} - } - #[inline] - pub fn key_compare_less_than(&self, o: &DucExternalFileEntry) -> bool { - self.key() < o.key() - } - - #[inline] - pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering { - let key = self.key(); - key.cmp(val) - } - #[inline] - pub fn value(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(DucExternalFileEntry::VT_VALUE, None)} - } -} - -impl flatbuffers::Verifiable for DucExternalFileEntry<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("key", Self::VT_KEY, true)? - .visit_field::>("value", Self::VT_VALUE, false)? - .finish(); - Ok(()) - } -} -pub struct DucExternalFileEntryArgs<'a> { - pub key: Option>, - pub value: Option>>, -} -impl<'a> Default for DucExternalFileEntryArgs<'a> { - #[inline] - fn default() -> Self { - DucExternalFileEntryArgs { - key: None, // required field - value: None, - } - } -} - -pub struct DucExternalFileEntryBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DucExternalFileEntryBuilder<'a, 'b, A> { - #[inline] - pub fn add_key(&mut self, key: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(DucExternalFileEntry::VT_KEY, key); - } - #[inline] - pub fn add_value(&mut self, value: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(DucExternalFileEntry::VT_VALUE, value); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DucExternalFileEntryBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - DucExternalFileEntryBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - self.fbb_.required(o, DucExternalFileEntry::VT_KEY,"key"); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for DucExternalFileEntry<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("DucExternalFileEntry"); - ds.field("key", &self.key()); - ds.field("value", &self.value()); - ds.finish() - } -} -pub enum ExportedDataStateOffset {} -#[derive(Copy, Clone, PartialEq)] - -pub struct ExportedDataState<'a> { - pub _tab: flatbuffers::Table<'a>, -} - -impl<'a> flatbuffers::Follow<'a> for ExportedDataState<'a> { - type Inner = ExportedDataState<'a>; - #[inline] - unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { - Self { _tab: flatbuffers::Table::new(buf, loc) } - } -} - -impl<'a> ExportedDataState<'a> { - pub const VT_TYPE_: flatbuffers::VOffsetT = 4; - pub const VT_VERSION_LEGACY: flatbuffers::VOffsetT = 6; - pub const VT_SOURCE: flatbuffers::VOffsetT = 8; - pub const VT_VERSION: flatbuffers::VOffsetT = 10; - pub const VT_THUMBNAIL: flatbuffers::VOffsetT = 12; - pub const VT_DICTIONARY: flatbuffers::VOffsetT = 14; - pub const VT_ELEMENTS: flatbuffers::VOffsetT = 16; - pub const VT_BLOCKS: flatbuffers::VOffsetT = 18; - pub const VT_GROUPS: flatbuffers::VOffsetT = 20; - pub const VT_REGIONS: flatbuffers::VOffsetT = 22; - pub const VT_LAYERS: flatbuffers::VOffsetT = 24; - pub const VT_STANDARDS: flatbuffers::VOffsetT = 26; - pub const VT_DUC_LOCAL_STATE: flatbuffers::VOffsetT = 28; - pub const VT_DUC_GLOBAL_STATE: flatbuffers::VOffsetT = 30; - pub const VT_EXTERNAL_FILES: flatbuffers::VOffsetT = 32; - pub const VT_VERSION_GRAPH: flatbuffers::VOffsetT = 34; - pub const VT_ID: flatbuffers::VOffsetT = 36; - pub const VT_BLOCKINSTANCES: flatbuffers::VOffsetT = 38; - pub const VT_BLOCKCOLLECTIONS: flatbuffers::VOffsetT = 40; - - #[inline] - pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { - ExportedDataState { _tab: table } - } - #[allow(unused_mut)] - pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( - _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, - args: &'args ExportedDataStateArgs<'args> - ) -> flatbuffers::WIPOffset> { - let mut builder = ExportedDataStateBuilder::new(_fbb); - if let Some(x) = args.blockCollections { builder.add_blockCollections(x); } - if let Some(x) = args.blockInstances { builder.add_blockInstances(x); } - if let Some(x) = args.id { builder.add_id(x); } - if let Some(x) = args.version_graph { builder.add_version_graph(x); } - if let Some(x) = args.external_files { builder.add_external_files(x); } - if let Some(x) = args.duc_global_state { builder.add_duc_global_state(x); } - if let Some(x) = args.duc_local_state { builder.add_duc_local_state(x); } - if let Some(x) = args.standards { builder.add_standards(x); } - if let Some(x) = args.layers { builder.add_layers(x); } - if let Some(x) = args.regions { builder.add_regions(x); } - if let Some(x) = args.groups { builder.add_groups(x); } - if let Some(x) = args.blocks { builder.add_blocks(x); } - if let Some(x) = args.elements { builder.add_elements(x); } - if let Some(x) = args.dictionary { builder.add_dictionary(x); } - if let Some(x) = args.thumbnail { builder.add_thumbnail(x); } - if let Some(x) = args.version { builder.add_version(x); } - if let Some(x) = args.source { builder.add_source(x); } - builder.add_version_legacy(args.version_legacy); - if let Some(x) = args.type_ { builder.add_type_(x); } - builder.finish() - } - - - #[inline] - pub fn type_(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ExportedDataState::VT_TYPE_, None)} - } - #[inline] - pub fn version_legacy(&self) -> i32 { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::(ExportedDataState::VT_VERSION_LEGACY, Some(0)).unwrap()} - } - #[inline] - pub fn source(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ExportedDataState::VT_SOURCE, None)} - } - #[inline] - pub fn version(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ExportedDataState::VT_VERSION, None)} - } - #[inline] - pub fn thumbnail(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>(ExportedDataState::VT_THUMBNAIL, None)} - } - #[inline] - pub fn dictionary(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(ExportedDataState::VT_DICTIONARY, None)} - } - #[inline] - pub fn elements(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(ExportedDataState::VT_ELEMENTS, None)} - } - #[inline] - pub fn blocks(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(ExportedDataState::VT_BLOCKS, None)} - } - #[inline] - pub fn groups(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(ExportedDataState::VT_GROUPS, None)} - } - #[inline] - pub fn regions(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(ExportedDataState::VT_REGIONS, None)} - } - #[inline] - pub fn layers(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(ExportedDataState::VT_LAYERS, None)} - } - #[inline] - pub fn standards(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(ExportedDataState::VT_STANDARDS, None)} - } - #[inline] - pub fn duc_local_state(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ExportedDataState::VT_DUC_LOCAL_STATE, None)} - } - #[inline] - pub fn duc_global_state(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ExportedDataState::VT_DUC_GLOBAL_STATE, None)} - } - #[inline] - pub fn external_files(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(ExportedDataState::VT_EXTERNAL_FILES, None)} - } - #[inline] - pub fn version_graph(&self) -> Option> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ExportedDataState::VT_VERSION_GRAPH, None)} - } - #[inline] - pub fn id(&self) -> Option<&'a str> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>(ExportedDataState::VT_ID, None)} - } - #[inline] - pub fn blockInstances(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(ExportedDataState::VT_BLOCKINSTANCES, None)} - } - #[inline] - pub fn blockCollections(&self) -> Option>>> { - // Safety: - // Created from valid Table for this object - // which contains a valid value in this slot - unsafe { self._tab.get::>>>(ExportedDataState::VT_BLOCKCOLLECTIONS, None)} - } -} - -impl flatbuffers::Verifiable for ExportedDataState<'_> { - #[inline] - fn run_verifier( - v: &mut flatbuffers::Verifier, pos: usize - ) -> Result<(), flatbuffers::InvalidFlatbuffer> { - use self::flatbuffers::Verifiable; - v.visit_table(pos)? - .visit_field::>("type_", Self::VT_TYPE_, false)? - .visit_field::("version_legacy", Self::VT_VERSION_LEGACY, false)? - .visit_field::>("source", Self::VT_SOURCE, false)? - .visit_field::>("version", Self::VT_VERSION, false)? - .visit_field::>>("thumbnail", Self::VT_THUMBNAIL, false)? - .visit_field::>>>("dictionary", Self::VT_DICTIONARY, false)? - .visit_field::>>>("elements", Self::VT_ELEMENTS, false)? - .visit_field::>>>("blocks", Self::VT_BLOCKS, false)? - .visit_field::>>>("groups", Self::VT_GROUPS, false)? - .visit_field::>>>("regions", Self::VT_REGIONS, false)? - .visit_field::>>>("layers", Self::VT_LAYERS, false)? - .visit_field::>>>("standards", Self::VT_STANDARDS, false)? - .visit_field::>("duc_local_state", Self::VT_DUC_LOCAL_STATE, false)? - .visit_field::>("duc_global_state", Self::VT_DUC_GLOBAL_STATE, false)? - .visit_field::>>>("external_files", Self::VT_EXTERNAL_FILES, false)? - .visit_field::>("version_graph", Self::VT_VERSION_GRAPH, false)? - .visit_field::>("id", Self::VT_ID, false)? - .visit_field::>>>("blockInstances", Self::VT_BLOCKINSTANCES, false)? - .visit_field::>>>("blockCollections", Self::VT_BLOCKCOLLECTIONS, false)? - .finish(); - Ok(()) - } -} -pub struct ExportedDataStateArgs<'a> { - pub type_: Option>, - pub version_legacy: i32, - pub source: Option>, - pub version: Option>, - pub thumbnail: Option>>, - pub dictionary: Option>>>>, - pub elements: Option>>>>, - pub blocks: Option>>>>, - pub groups: Option>>>>, - pub regions: Option>>>>, - pub layers: Option>>>>, - pub standards: Option>>>>, - pub duc_local_state: Option>>, - pub duc_global_state: Option>>, - pub external_files: Option>>>>, - pub version_graph: Option>>, - pub id: Option>, - pub blockInstances: Option>>>>, - pub blockCollections: Option>>>>, -} -impl<'a> Default for ExportedDataStateArgs<'a> { - #[inline] - fn default() -> Self { - ExportedDataStateArgs { - type_: None, - version_legacy: 0, - source: None, - version: None, - thumbnail: None, - dictionary: None, - elements: None, - blocks: None, - groups: None, - regions: None, - layers: None, - standards: None, - duc_local_state: None, - duc_global_state: None, - external_files: None, - version_graph: None, - id: None, - blockInstances: None, - blockCollections: None, - } - } -} - -pub struct ExportedDataStateBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { - fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - start_: flatbuffers::WIPOffset, -} -impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ExportedDataStateBuilder<'a, 'b, A> { - #[inline] - pub fn add_type_(&mut self, type_: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_TYPE_, type_); - } - #[inline] - pub fn add_version_legacy(&mut self, version_legacy: i32) { - self.fbb_.push_slot::(ExportedDataState::VT_VERSION_LEGACY, version_legacy, 0); - } - #[inline] - pub fn add_source(&mut self, source: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_SOURCE, source); - } - #[inline] - pub fn add_version(&mut self, version: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_VERSION, version); - } - #[inline] - pub fn add_thumbnail(&mut self, thumbnail: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_THUMBNAIL, thumbnail); - } - #[inline] - pub fn add_dictionary(&mut self, dictionary: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_DICTIONARY, dictionary); - } - #[inline] - pub fn add_elements(&mut self, elements: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_ELEMENTS, elements); - } - #[inline] - pub fn add_blocks(&mut self, blocks: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_BLOCKS, blocks); - } - #[inline] - pub fn add_groups(&mut self, groups: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_GROUPS, groups); - } - #[inline] - pub fn add_regions(&mut self, regions: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_REGIONS, regions); - } - #[inline] - pub fn add_layers(&mut self, layers: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_LAYERS, layers); - } - #[inline] - pub fn add_standards(&mut self, standards: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_STANDARDS, standards); - } - #[inline] - pub fn add_duc_local_state(&mut self, duc_local_state: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_DUC_LOCAL_STATE, duc_local_state); - } - #[inline] - pub fn add_duc_global_state(&mut self, duc_global_state: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_DUC_GLOBAL_STATE, duc_global_state); - } - #[inline] - pub fn add_external_files(&mut self, external_files: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_EXTERNAL_FILES, external_files); - } - #[inline] - pub fn add_version_graph(&mut self, version_graph: flatbuffers::WIPOffset>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_VERSION_GRAPH, version_graph); - } - #[inline] - pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_ID, id); - } - #[inline] - pub fn add_blockInstances(&mut self, blockInstances: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_BLOCKINSTANCES, blockInstances); - } - #[inline] - pub fn add_blockCollections(&mut self, blockCollections: flatbuffers::WIPOffset>>>) { - self.fbb_.push_slot_always::>(ExportedDataState::VT_BLOCKCOLLECTIONS, blockCollections); - } - #[inline] - pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ExportedDataStateBuilder<'a, 'b, A> { - let start = _fbb.start_table(); - ExportedDataStateBuilder { - fbb_: _fbb, - start_: start, - } - } - #[inline] - pub fn finish(self) -> flatbuffers::WIPOffset> { - let o = self.fbb_.end_table(self.start_); - flatbuffers::WIPOffset::new(o.value()) - } -} - -impl core::fmt::Debug for ExportedDataState<'_> { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let mut ds = f.debug_struct("ExportedDataState"); - ds.field("type_", &self.type_()); - ds.field("version_legacy", &self.version_legacy()); - ds.field("source", &self.source()); - ds.field("version", &self.version()); - ds.field("thumbnail", &self.thumbnail()); - ds.field("dictionary", &self.dictionary()); - ds.field("elements", &self.elements()); - ds.field("blocks", &self.blocks()); - ds.field("groups", &self.groups()); - ds.field("regions", &self.regions()); - ds.field("layers", &self.layers()); - ds.field("standards", &self.standards()); - ds.field("duc_local_state", &self.duc_local_state()); - ds.field("duc_global_state", &self.duc_global_state()); - ds.field("external_files", &self.external_files()); - ds.field("version_graph", &self.version_graph()); - ds.field("id", &self.id()); - ds.field("blockInstances", &self.blockInstances()); - ds.field("blockCollections", &self.blockCollections()); - ds.finish() - } -} -#[inline] -/// Verifies that a buffer of bytes contains a `ExportedDataState` -/// and returns it. -/// Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `root_as_exported_data_state_unchecked`. -pub fn root_as_exported_data_state(buf: &[u8]) -> Result { - flatbuffers::root::(buf) -} -#[inline] -/// Verifies that a buffer of bytes contains a size prefixed -/// `ExportedDataState` and returns it. -/// Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `size_prefixed_root_as_exported_data_state_unchecked`. -pub fn size_prefixed_root_as_exported_data_state(buf: &[u8]) -> Result { - flatbuffers::size_prefixed_root::(buf) -} -#[inline] -/// Verifies, with the given options, that a buffer of bytes -/// contains a `ExportedDataState` and returns it. -/// Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `root_as_exported_data_state_unchecked`. -pub fn root_as_exported_data_state_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], -) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::root_with_opts::>(opts, buf) -} -#[inline] -/// Verifies, with the given verifier options, that a buffer of -/// bytes contains a size prefixed `ExportedDataState` and returns -/// it. Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `root_as_exported_data_state_unchecked`. -pub fn size_prefixed_root_as_exported_data_state_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], -) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::size_prefixed_root_with_opts::>(opts, buf) -} -#[inline] -/// Assumes, without verification, that a buffer of bytes contains a ExportedDataState and returns it. -/// # Safety -/// Callers must trust the given bytes do indeed contain a valid `ExportedDataState`. -pub unsafe fn root_as_exported_data_state_unchecked(buf: &[u8]) -> ExportedDataState { - flatbuffers::root_unchecked::(buf) -} -#[inline] -/// Assumes, without verification, that a buffer of bytes contains a size prefixed ExportedDataState and returns it. -/// # Safety -/// Callers must trust the given bytes do indeed contain a valid size prefixed `ExportedDataState`. -pub unsafe fn size_prefixed_root_as_exported_data_state_unchecked(buf: &[u8]) -> ExportedDataState { - flatbuffers::size_prefixed_root_unchecked::(buf) -} -pub const EXPORTED_DATA_STATE_IDENTIFIER: &str = "DUC_"; - -#[inline] -pub fn exported_data_state_buffer_has_identifier(buf: &[u8]) -> bool { - flatbuffers::buffer_has_identifier(buf, EXPORTED_DATA_STATE_IDENTIFIER, false) -} - -#[inline] -pub fn exported_data_state_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool { - flatbuffers::buffer_has_identifier(buf, EXPORTED_DATA_STATE_IDENTIFIER, true) -} - -#[inline] -pub fn finish_exported_data_state_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>( - fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - root: flatbuffers::WIPOffset>) { - fbb.finish(root, Some(EXPORTED_DATA_STATE_IDENTIFIER)); -} - -#[inline] -pub fn finish_size_prefixed_exported_data_state_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset>) { - fbb.finish_size_prefixed(root, Some(EXPORTED_DATA_STATE_IDENTIFIER)); -} -} // pub mod Duc - diff --git a/packages/ducrs/src/flatbuffers/mod.rs b/packages/ducrs/src/flatbuffers/mod.rs deleted file mode 100644 index 9c091e7a..00000000 --- a/packages/ducrs/src/flatbuffers/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![allow(warnings)] - -pub mod duc_generated; \ No newline at end of file diff --git a/packages/ducrs/src/lib.rs b/packages/ducrs/src/lib.rs index 71512914..3a8f3635 100644 --- a/packages/ducrs/src/lib.rs +++ b/packages/ducrs/src/lib.rs @@ -1,9 +1,3 @@ -// Re-export the generated FlatBuffers code -mod flatbuffers; -pub mod generated { - pub use crate::flatbuffers::duc_generated::duc; -} - #[allow(unused_imports)] #[allow(non_camel_case_types)] #[allow(non_snake_case)] @@ -11,7 +5,10 @@ pub mod generated { pub mod parse; pub mod serialize; pub mod types; -pub mod units; + +// SQLite storage layer and high-level document API +pub mod db; +pub mod api; #[cfg(test)] mod tests { @@ -63,4 +60,35 @@ mod tests { } } } + + #[test] + fn test_serialize_roundtrip_compressed() { + init_logging(); + + let test_file_path = Path::new(env!("CARGO_MANIFEST_DIR")) + .join("../../assets/testing/duc-files/universal.duc"); + if !test_file_path.exists() { + println!("Skipped — test file not found: {}", test_file_path.display()); + return; + } + + let original = fs::read(test_file_path).expect("read test file"); + let parsed = crate::parse::parse(&original).expect("parse original"); + + let compressed = crate::serialize::serialize(&parsed).expect("serialize"); + + assert!(!compressed.is_empty(), "serialized output must not be empty"); + println!( + "original={} bytes, compressed={} bytes ({:.1}%)", + original.len(), + compressed.len(), + compressed.len() as f64 / original.len() as f64 * 100.0 + ); + + let reparsed = crate::parse::parse(&compressed).expect("parse compressed"); + assert_eq!(parsed.elements.len(), reparsed.elements.len()); + assert_eq!(parsed.layers.len(), reparsed.layers.len()); + assert_eq!(parsed.blocks.len(), reparsed.blocks.len()); + println!("Round-trip OK — {} elements preserved", reparsed.elements.len()); + } } diff --git a/packages/ducrs/src/parse.rs b/packages/ducrs/src/parse.rs index d66d00ae..04bee050 100644 --- a/packages/ducrs/src/parse.rs +++ b/packages/ducrs/src/parse.rs @@ -1,2179 +1,1880 @@ -#![allow(clippy::too_many_arguments)] -#![allow(clippy::new_ret_no_self)] - -use crate::generated::duc as fb; -use crate::types; - -/// Alias for a parsing result. -type ParseResult = Result; - -/// Parses a byte slice into the main `ExportedDataState` struct. -pub fn parse(buf: &[u8]) -> ParseResult { - let root = flatbuffers::root::(buf) - .map_err(|_| "Invalid FlatBuffer for ExportedDataState")?; - parse_exported_data_state(root) -} - -// ============================================================================= -// Helper: Vector Parsing -// ============================================================================= - -fn parse_vec_of_strings(vec: Option>>) -> Vec { - match vec { - Some(v) => { - let mut out = Vec::with_capacity(v.len()); - for i in 0..v.len() { - // For FlatBuffers Vector>, get(i) returns &str - let s = v.get(i); - out.push(s.to_string()); - } - out +//! Parses a `.duc` SQLite binary (byte vector) into an [`ExportedDataState`]. +//! +//! Flow: raw bytes → in-memory SQLite DB → ExportedDataState +//! +//! The inverse of [`crate::serialize::serialize`]. + +use rusqlite::{params, Connection}; +use std::os::raw::c_char; +use std::collections::HashMap; + +use crate::db; +use crate::types::*; + +#[derive(Debug)] +pub enum ParseError { + Db(db::DbError), + Sqlite(rusqlite::Error), + Io(String), + InvalidData(String), +} + +impl std::fmt::Display for ParseError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ParseError::Db(e) => write!(f, "db: {e}"), + ParseError::Sqlite(e) => write!(f, "sqlite: {e}"), + ParseError::Io(e) => write!(f, "io: {e}"), + ParseError::InvalidData(e) => write!(f, "invalid data: {e}"), } - None => Vec::new(), } } -fn parse_vec_of_required_strings(vec: Option>>) -> ParseResult> { - match vec { - Some(v) => { - let mut out = Vec::with_capacity(v.len()); - for i in 0..v.len() { - let s = v.get(i); - out.push(s.to_string()); - } - Ok(out) - } - None => Err("Missing required vector of strings"), - } +impl std::error::Error for ParseError {} + +impl From for ParseError { + fn from(e: db::DbError) -> Self { ParseError::Db(e) } +} +impl From for ParseError { + fn from(e: rusqlite::Error) -> Self { ParseError::Sqlite(e) } } -/// Helper function to parse binary JSON data to a JSON string -/// Expects zlib-compressed JSON -/// Returns None if the data is empty or parsing fails -fn parse_binary_json_to_string(vec: Option>) -> Option { - match vec { - Some(v) if v.len() > 0 => { - let data: Vec = (0..v.len()).map(|i| v.get(i)).collect(); +pub type ParseResult = Result; +const SQLITE_HEADER_MAGIC: &[u8; 16] = b"SQLite format 3\0"; - use flate2::read::ZlibDecoder; - use std::io::Read; +// ─── Public entry point ────────────────────────────────────────────────────── - let mut d = ZlibDecoder::new(data.as_slice()); - let mut decompressed = Vec::new(); +/// Parse a `.duc` file (raw bytes) into an [`ExportedDataState`]. +pub fn parse(buf: &[u8]) -> ParseResult { + let conn = load_db_bytes(buf)?; - if d.read_to_end(&mut decompressed).is_ok() { - if let Ok(text) = String::from_utf8(decompressed) { - return Some(text); - } - } + let (id, version, source, data_type, thumbnail) = read_document(&conn)?; + let duc_global_state = read_global_state(&conn)?; + let duc_local_state = read_local_state(&conn)?; + let dictionary = read_dictionary(&conn)?; + let layers = read_layers(&conn)?; + let groups = read_groups(&conn)?; + let regions = read_regions(&conn)?; + let (blocks, block_instances, block_collections) = read_blocks(&conn)?; + let elements = read_elements(&conn)?; + let external_files = read_external_files(&conn)?; + let version_graph = read_version_graph(&conn)?; - // Fallback to legacy format: plain JSON string (for old file compatibility) - String::from_utf8(data).ok() - } - _ => None, - } + Ok(ExportedDataState { + id, + version, + source, + data_type, + dictionary, + thumbnail, + elements, + blocks, + block_instances, + block_collections, + groups, + regions, + layers, + duc_local_state, + duc_global_state, + version_graph, + external_files, + }) } - -// ============================================================================= -// UTILITY & GEOMETRY TYPES -// ============================================================================= - -fn parse_geometric_point(point: &fb::GeometricPoint) -> types::GeometricPoint { - types::GeometricPoint { - x: point.x(), - y: point.y(), +/// Parse a `.duc` file but skip the heavy external-file data blobs. +/// +/// Returns `external_files: None` — callers can fetch individual files +/// later via [`get_external_file`]. +pub fn parse_lazy(buf: &[u8]) -> ParseResult { + let conn = load_db_bytes(buf)?; + + let (id, version, source, data_type, thumbnail) = read_document(&conn)?; + let duc_global_state = read_global_state(&conn)?; + let duc_local_state = read_local_state(&conn)?; + let dictionary = read_dictionary(&conn)?; + let layers = read_layers(&conn)?; + let groups = read_groups(&conn)?; + let regions = read_regions(&conn)?; + let (blocks, block_instances, block_collections) = read_blocks(&conn)?; + let elements = read_elements(&conn)?; + let version_graph = read_version_graph(&conn)?; + + Ok(ExportedDataState { + id, + version, + source, + data_type, + dictionary, + thumbnail, + elements, + blocks, + block_instances, + block_collections, + groups, + regions, + layers, + duc_local_state, + duc_global_state, + version_graph, + external_files: None, + }) +} + +/// Fetch a single external file from a `.duc` buffer by file ID. +pub fn get_external_file(buf: &[u8], file_id: &str) -> ParseResult> { + let conn = load_db_bytes(buf)?; + let mut stmt = conn.prepare( + "SELECT id, mime_type, data, created, last_retrieved, version FROM external_files WHERE id = ?1" + )?; + let result = stmt.query_row(params![file_id], |row| { + let id: String = row.get(0)?; + Ok(DucExternalFileEntry { + key: id.clone(), + value: DucExternalFileData { + id, + mime_type: row.get(1)?, + data: row.get(2)?, + created: row.get(3)?, + last_retrieved: row.get(4)?, + version: row.get(5)?, + }, + }) + }); + match result { + Ok(entry) => Ok(Some(entry)), + Err(rusqlite::Error::QueryReturnedNoRows) => Ok(None), + Err(e) => Err(e.into()), } } -fn parse_required_geometric_point(point: Option) -> ParseResult { - match point { - Some(p) => Ok(parse_geometric_point(&p)), - None => Err("Missing required GeometricPoint"), +/// List metadata for all external files (without the heavy data blobs). +pub fn list_external_files(buf: &[u8]) -> ParseResult> { + let conn = load_db_bytes(buf)?; + let mut stmt = conn.prepare( + "SELECT id, mime_type, created, last_retrieved, version FROM external_files" + )?; + let files: Vec = stmt.query_map([], |row| { + Ok(ExternalFileMetadata { + id: row.get(0)?, + mime_type: row.get(1)?, + created: row.get(2)?, + last_retrieved: row.get(3)?, + version: row.get(4)?, + }) + })?.collect::, _>>()?; + Ok(files) +} + +// ─── Database import ───────────────────────────────────────────────────────── + +fn load_db_bytes(buf: &[u8]) -> ParseResult { + if buf.is_empty() { + return Err(ParseError::InvalidData("empty .duc buffer".into())); } -} -fn parse_duc_point(point: fb::DucPoint) -> types::DucPoint { - types::DucPoint { - x: point.x(), - y: point.y(), - mirroring: point.mirroring(), - } -} + // New format: compressed by default (no custom header). + // Backward compatibility: accept legacy raw SQLite bytes as-is. + let decompressed; + let raw = if is_sqlite_header(buf) { + buf + } else { + decompressed = decompress_duc_bytes(buf).map_err(|e| { + ParseError::InvalidData(format!( + "input is neither raw SQLite nor valid compressed SQLite stream: {e}" + )) + })?; + if !is_sqlite_header(&decompressed) { + return Err(ParseError::InvalidData( + "decompressed payload does not start with SQLite header".into(), + )); + } + &decompressed + }; -fn parse_required_duc_point(point: Option) -> ParseResult { - point.map(|p| parse_duc_point(p)).ok_or("Missing required DucPoint") -} + let info = parse_sqlite_header(raw)?; + + let mut candidates: Vec<(&str, &[u8])> = vec![("full", raw)]; + if info.expected_size <= raw.len() && info.expected_size > 0 && info.expected_size != raw.len() { + candidates.push(("header-expected", &raw[..info.expected_size])); + } + let page_aligned = (raw.len() / info.page_size) * info.page_size; + if page_aligned > 0 && page_aligned != raw.len() && page_aligned != info.expected_size { + candidates.push(("page-aligned", &raw[..page_aligned])); + } -fn parse_vec_of_duc_points(vec: Option>>>) -> Vec { - match vec { - Some(v) => { - let mut out = Vec::with_capacity(v.len()); - for i in 0..v.len() { - let p = v.get(i); - out.push(parse_duc_point(p)); + let mut errors = Vec::new(); + for (label, candidate) in candidates { + match deserialize_image(candidate) { + Ok(conn) => return Ok(conn), + Err(err) => { + errors.push(format!("{label}({} bytes): {err}", candidate.len())); } - out } - None => Vec::new(), } -} - -fn parse_identifier(id: fb::Identifier) -> ParseResult { - Ok(types::Identifier { - id: id.id().to_string(), - name: id.name().map(|s| s.to_string()).unwrap_or_default(), - description: id.description().map(|s| s.to_string()), - }) -} - -fn parse_dictionary_entry(entry: fb::DictionaryEntry) -> ParseResult { - Ok(types::DictionaryEntry { - key: entry.key().to_string(), - value: entry.value().map(|s| s.to_string()).unwrap_or_default(), - }) -} - -fn parse_string_value_entry(entry: fb::StringValueEntry) -> ParseResult { - Ok(types::StringValueEntry { - key: entry.key().to_string(), - value: entry.value().map(|s| s.to_string()).unwrap_or_default(), - }) -} - -fn parse_duc_ucs(ucs: fb::DucUcs) -> ParseResult { - Ok(types::DucUcs { - origin: parse_required_geometric_point(ucs.origin().copied())?, - angle: ucs.angle(), - }) -} - -fn parse_duc_view(view: fb::DucView) -> ParseResult { - Ok(types::DucView { - scroll_x: view.scroll_x(), - scroll_y: view.scroll_y(), - zoom: view.zoom(), - twist_angle: view.twist_angle(), - center_point: parse_required_duc_point(view.center_point())?, - scope: view.scope().map(|s| s.to_string()).unwrap_or_default(), - }) -} - -fn parse_margins(margins: fb::Margins) -> ParseResult { - Ok(types::Margins { - top: margins.top(), - right: margins.right(), - bottom: margins.bottom(), - left: margins.left(), - }) -} - -// ============================================================================= -// STYLING & CONTENT -// ============================================================================= -fn parse_tiling_properties(tiling: fb::TilingProperties) -> ParseResult { - Ok(types::TilingProperties { - size_in_percent: tiling.size_in_percent(), - angle: tiling.angle(), - spacing: tiling.spacing(), - offset_x: tiling.offset_x(), - offset_y: tiling.offset_y(), - }) -} + Err(ParseError::InvalidData(format!( + "failed to deserialize/read sqlite image (input={} bytes, page_size={}, page_count={}, expected={}): {}", + raw.len(), + info.page_size, + info.page_count, + info.expected_size, + errors.join(" | ") + ))) +} + +#[inline] +fn is_sqlite_header(buf: &[u8]) -> bool { + buf.len() >= SQLITE_HEADER_MAGIC.len() && &buf[..SQLITE_HEADER_MAGIC.len()] == SQLITE_HEADER_MAGIC +} + +/// Inflate a compressed deflate payload. +fn decompress_duc_bytes(compressed: &[u8]) -> ParseResult> { + use flate2::read::DeflateDecoder; + use std::io::Read; + + let mut decoder = DeflateDecoder::new(compressed); + let mut out = Vec::new(); + decoder + .read_to_end(&mut out) + .map_err(|e| ParseError::Io(format!("DUCz decompression failed: {e}")))?; + Ok(out) +} + +fn deserialize_image(buf: &[u8]) -> ParseResult { + let conn = Connection::open_in_memory().map_err(ParseError::Sqlite)?; + let mut image = buf.to_vec(); + + // Header bytes 18/19 are read/write format versions: + // 1 = rollback journal, 2 = WAL. + // For standalone deserialized images in wasm (no sidecar files), WAL mode + // can lead SQLite to attempt journal/wal handling that surfaces CANTOPEN. + // Normalize to rollback mode for read-only parsing. + if image.len() > 19 { + if image[18] == 2 { + image[18] = 1; + } + if image[19] == 2 { + image[19] = 1; + } + } -fn parse_hatch_pattern_line(line: fb::HatchPatternLine) -> ParseResult { - Ok(types::HatchPatternLine { - angle: line.angle(), - origin: parse_required_duc_point(line.origin())?, - offset: line.offset().ok_or("Missing HatchPatternLine.offset")?.iter().collect(), - dash_pattern: line.dash_pattern().ok_or("Missing HatchPatternLine.dash_pattern")?.iter().collect(), - }) -} + let n = image.len(); + let db_name = b"main\0"; -fn parse_custom_hatch_pattern(pattern: fb::CustomHatchPattern) -> ParseResult { - let lines_vec = pattern.lines().ok_or("Missing CustomHatchPattern.lines")?; - let lines = lines_vec.iter().map(parse_hatch_pattern_line).collect::>()?; - Ok(types::CustomHatchPattern { - name: pattern.name().unwrap_or("").to_string(), - description: pattern.description().map(|s| s.to_string()), - lines, - }) -} + let mem = unsafe { rusqlite::ffi::sqlite3_malloc64(n as u64) as *mut u8 }; + if mem.is_null() { + return Err(ParseError::Io("sqlite3_malloc64 failed".into())); + } -fn parse_duc_hatch_style(style: fb::DucHatchStyle) -> ParseResult { - Ok(types::DucHatchStyle { - hatch_style: style.hatch_style().expect("Missing DucHatchStyle.hatch_style"), - pattern_name: style.pattern_name().map(|s| s.to_string()).ok_or("Missing DucHatchStyle.pattern_name")?, - pattern_scale: style.pattern_scale(), - pattern_angle: style.pattern_angle(), - pattern_origin: parse_required_duc_point(style.pattern_origin())?, - pattern_double: style.pattern_double(), - custom_pattern: style.custom_pattern().map(parse_custom_hatch_pattern).transpose()?, - }) -} + unsafe { + std::ptr::copy_nonoverlapping(image.as_ptr(), mem, n); + } -fn parse_duc_image_filter(filter: fb::DucImageFilter) -> ParseResult { - Ok(types::DucImageFilter { - brightness: filter.brightness(), - contrast: filter.contrast(), - }) -} + // Allow SQLite to manage deserialized pages in-memory without touching files. + let flags = (rusqlite::ffi::SQLITE_DESERIALIZE_FREEONCLOSE + | rusqlite::ffi::SQLITE_DESERIALIZE_RESIZEABLE) as u32; + let rc = unsafe { + rusqlite::ffi::sqlite3_deserialize( + conn.handle(), + db_name.as_ptr() as *const c_char, + mem, + n as i64, + n as i64, + flags, + ) + }; -fn parse_element_content_base(content: fb::ElementContentBase) -> ParseResult { - Ok(types::ElementContentBase { - preference: content.preference(), - src: content.src().map(|s| s.to_string()).unwrap_or_default(), - visible: content.visible(), - opacity: content.opacity(), - tiling: content.tiling().map(parse_tiling_properties).transpose()?, - hatch: content.hatch().map(parse_duc_hatch_style).transpose()?, - image_filter: content.image_filter().map(parse_duc_image_filter).transpose()?, - }) -} + if rc != rusqlite::ffi::SQLITE_OK { + unsafe { rusqlite::ffi::sqlite3_free(mem as *mut std::ffi::c_void) }; + return Err(ParseError::InvalidData(format!( + "sqlite3_deserialize failed with code {rc}" + ))); + } -fn parse_stroke_style(style: fb::StrokeStyle) -> ParseResult { - Ok(types::StrokeStyle { - preference: style.preference(), - cap: style.cap(), - join: style.join(), - dash: style.dash().map(|v| Some(v.iter().collect())).unwrap_or(None), - dash_line_override: style.dash_line_override().map(|s| s.to_string()), - dash_cap: style.dash_cap(), - miter_limit: style.miter_limit(), - }) -} + // Read-only parse path. Avoid journal transitions. + conn.execute_batch("PRAGMA query_only = ON;") + .map_err(|e| ParseError::InvalidData(format!( + "failed to enable query_only after deserialize: {e}" + )))?; -fn parse_stroke_sides(sides: fb::StrokeSides) -> ParseResult { - Ok(types::StrokeSides { - preference: sides.preference(), - values: sides.values().map(|v| v.iter().collect()), - }) -} + conn.query_row("SELECT count(*) FROM sqlite_master", [], |_row| Ok(())) + .map_err(|e| ParseError::InvalidData(format!( + "deserialized database is not readable: {e}" + )))?; -fn parse_element_stroke(stroke: fb::ElementStroke) -> ParseResult { - Ok(types::ElementStroke { - content: parse_element_content_base(stroke.content().ok_or("Missing ElementStroke.content")?)?, - width: stroke.width(), - style: parse_stroke_style(stroke.style().ok_or("Missing ElementStroke.style")?)?, - placement: stroke.placement(), - stroke_sides: stroke - .stroke_sides() - .map(parse_stroke_sides) - .transpose()?, - }) + Ok(conn) } -fn parse_element_background(background: fb::ElementBackground) -> ParseResult { - Ok(types::ElementBackground { - content: parse_element_content_base(background.content().ok_or("Missing ElementBackground.content")?)?, - }) +struct SqliteHeaderInfo { + page_size: usize, + page_count: usize, + expected_size: usize, } -fn parse_duc_element_styles_base(styles: fb::_DucElementStylesBase) -> ParseResult { - let background_vec = styles.background().ok_or("Missing _DucElementStylesBase.background")?; - let background = background_vec.iter().map(parse_element_background).collect::>()?; - - let stroke_vec = styles.stroke().ok_or("Missing _DucElementStylesBase.stroke")?; - let stroke = stroke_vec.iter().map(parse_element_stroke).collect::>()?; - - Ok(types::DucElementStylesBase { - roundness: styles.roundness(), - blending: styles.blending(), - background, - stroke, - opacity: styles.opacity(), - }) -} +fn parse_sqlite_header(buf: &[u8]) -> ParseResult { + if buf.len() < 100 { + return Err(ParseError::InvalidData( + "buffer too small for SQLite header".into(), + )); + } -// ============================================================================= -// BASE ELEMENT & COMMON ELEMENT COMPONENTS -// ============================================================================= + let magic = b"SQLite format 3\0"; + if &buf[..16] != magic { + return Err(ParseError::InvalidData( + "missing SQLite header magic".into(), + )); + } -fn parse_bound_element(be: fb::BoundElement) -> ParseResult { - Ok(types::BoundElement { - id: be.id().map(|s| s.to_string()).ok_or("Missing BoundElement.id")?, - element_type: be.type_().map(|s| s.to_string()).ok_or("Missing BoundElement.type")?, - }) -} + let page_size_raw = u16::from_be_bytes([buf[16], buf[17]]) as usize; + let page_size = if page_size_raw == 1 { 65_536 } else { page_size_raw }; + if page_size < 512 || page_size > 65_536 || (page_size & (page_size - 1)) != 0 { + return Err(ParseError::InvalidData(format!( + "invalid SQLite page_size in header: {page_size}" + ))); + } -fn parse_duc_element_base(base: fb::_DucElementBase) -> ParseResult { - let bound_elements = base - .bound_elements() - .map(|v| v.iter().map(parse_bound_element).collect::>>()) - .transpose()?; - - Ok(types::DucElementBase { - id: base.id().to_string(), - styles: base.styles() - .map(|s| parse_duc_element_styles_base(s)) - .transpose()? - .unwrap_or_else(|| types::DucElementStylesBase { - roundness: 0.0, - blending: None, - background: Vec::new(), - stroke: Vec::new(), - opacity: 1.0, - }), - x: base.x(), - y: base.y(), - width: base.width(), - height: base.height(), - angle: base.angle(), - scope: base.scope().map(|s| s.to_string()).ok_or("Missing _DucElementBase.scope")?, - label: base.label().map(|s| s.to_string()).unwrap_or_default(), - description: base.description().map(|s| s.to_string()), - is_visible: base.is_visible(), - seed: base.seed(), - version: base.version(), - version_nonce: base.version_nonce(), - updated: base.updated(), - index: base.index().map(|s| s.to_string()), - is_plot: base.is_plot(), - is_annotative: base.is_annotative(), - is_deleted: base.is_deleted(), - group_ids: parse_vec_of_strings(base.group_ids()), - block_ids: parse_vec_of_strings(base.block_ids()), - region_ids: parse_vec_of_strings(base.region_ids()), - instance_id: base.instance_id().map(|s| s.to_string()), - layer_id: base.layer_id().map(|s| s.to_string()), - frame_id: base.frame_id().map(|s| s.to_string()), - bound_elements, - z_index: base.z_index(), - link: base.link().map(|s| s.to_string()), - locked: base.locked(), - custom_data: parse_binary_json_to_string(base.custom_data()), - }) -} + let page_count = u32::from_be_bytes([buf[28], buf[29], buf[30], buf[31]]) as usize; + if page_count == 0 { + return Err(ParseError::InvalidData( + "invalid SQLite page_count=0 in header".into(), + )); + } -fn parse_duc_head(head: fb::DucHead) -> ParseResult { - Ok(types::DucHead { - head_type: head.type_(), - block_id: head.block_id().map(|s| s.to_string()), - size: head.size(), - }) -} + let expected_size = page_size + .checked_mul(page_count) + .ok_or_else(|| ParseError::InvalidData("SQLite size overflow".into()))?; -fn parse_point_binding_point(pbp: fb::PointBindingPoint) -> ParseResult { - Ok(types::PointBindingPoint { - index: pbp.index(), - offset: pbp.offset(), - }) -} + if buf.len() < expected_size { + return Err(ParseError::InvalidData(format!( + "truncated SQLite image: have {} bytes, expected at least {}", + buf.len(), + expected_size + ))); + } -fn parse_duc_point_binding(binding: fb::DucPointBinding) -> ParseResult { - Ok(types::DucPointBinding { - element_id: binding.element_id().ok_or("Missing DucPointBinding.element_id")?.to_string(), - focus: binding.focus(), - gap: binding.gap(), - fixed_point: binding.fixed_point().map(|p| parse_geometric_point(&p)), - point: binding.point().map(parse_point_binding_point).transpose()?, - head: binding.head().map(parse_duc_head).transpose()?, + Ok(SqliteHeaderInfo { + page_size, + page_count, + expected_size, }) } -fn parse_duc_line_reference(line_ref: fb::DucLineReference) -> ParseResult { - Ok(types::DucLineReference { - index: line_ref.index(), - handle: line_ref.handle().map(|gp| parse_geometric_point(&gp)), - }) -} +// ─── Enum helpers ──────────────────────────────────────────────────────────── -fn parse_duc_line(line: fb::DucLine) -> ParseResult { - Ok(types::DucLine { - start: parse_duc_line_reference(line.start().ok_or("Missing DucLine.start")?)?, - end: parse_duc_line_reference(line.end().ok_or("Missing DucLine.end")?)?, - }) +fn int_to_vertical_align(v: i32) -> VERTICAL_ALIGN { + match v { + 10 => VERTICAL_ALIGN::TOP, + 11 => VERTICAL_ALIGN::MIDDLE, + 12 => VERTICAL_ALIGN::BOTTOM, + _ => VERTICAL_ALIGN::TOP, + } } - -fn parse_duc_path(path: fb::DucPath) -> ParseResult { - Ok(types::DucPath { - line_indices: path.line_indices().ok_or("Missing DucPath.line_indices")?.iter().collect(), - background: path.background().map(parse_element_background).transpose()?, - stroke: path.stroke().map(parse_element_stroke).transpose()?, - }) +fn int_to_text_align(v: i32) -> TEXT_ALIGN { + match v { + 10 => TEXT_ALIGN::LEFT, + 11 => TEXT_ALIGN::CENTER, + 12 => TEXT_ALIGN::RIGHT, + _ => TEXT_ALIGN::LEFT, + } } - -fn parse_duc_linear_element_base(base: fb::_DucLinearElementBase) -> ParseResult { - let lines = base - .lines() - .map(|v| v.iter().map(parse_duc_line).collect::>>()) - .transpose()? - .unwrap_or_default(); - - let path_overrides = base - .path_overrides() - .map(|v| v.iter().map(parse_duc_path).collect::>>()) - .transpose()? - .unwrap_or_default(); - - Ok(types::DucLinearElementBase { - base: parse_duc_element_base(base.base().ok_or("Missing _DucLinearElementBase.base")?)?, - points: parse_vec_of_duc_points(base.points()), - lines, - path_overrides, - last_committed_point: base.last_committed_point().map(|p| parse_duc_point(p)), - start_binding: base.start_binding().map(parse_duc_point_binding).transpose()?, - end_binding: base.end_binding().map(parse_duc_point_binding).transpose()?, - }) +fn int_to_line_spacing_type(v: i32) -> LINE_SPACING_TYPE { + match v { + 10 => LINE_SPACING_TYPE::AT_LEAST, + 11 => LINE_SPACING_TYPE::EXACTLY, + 12 => LINE_SPACING_TYPE::MULTIPLE, + _ => LINE_SPACING_TYPE::AT_LEAST, + } } - -fn parse_duc_stack_like_styles(styles: fb::DucStackLikeStyles) -> ParseResult { - Ok(types::DucStackLikeStyles { - opacity: styles.opacity(), - labeling_color: styles.labeling_color().map(|s| s.to_string()).unwrap_or_default(), - }) +fn int_to_stroke_placement(v: i32) -> STROKE_PLACEMENT { + match v { + 10 => STROKE_PLACEMENT::INSIDE, + 11 => STROKE_PLACEMENT::CENTER, + 12 => STROKE_PLACEMENT::OUTSIDE, + _ => STROKE_PLACEMENT::CENTER, + } } - -fn parse_duc_stack_base(base: fb::_DucStackBase) -> ParseResult { - Ok(types::DucStackBase { - label: base.label().ok_or("Missing _DucStackBase.label")?.to_string(), - description: base.description().map(|s| s.to_string()), - is_collapsed: base.is_collapsed(), - is_plot: base.is_plot(), - is_visible: base.is_visible(), - locked: base.locked(), - styles: parse_duc_stack_like_styles(base.styles().ok_or("Missing _DucStackBase.styles")?)?, - }) +fn int_to_stroke_preference(v: i32) -> STROKE_PREFERENCE { + match v { + 10 => STROKE_PREFERENCE::SOLID, + 11 => STROKE_PREFERENCE::DASHED, + 12 => STROKE_PREFERENCE::DOTTED, + 13 => STROKE_PREFERENCE::CUSTOM, + _ => STROKE_PREFERENCE::SOLID, + } } - -fn parse_duc_stack_element_base(base: fb::_DucStackElementBase) -> ParseResult { - Ok(types::DucStackElementBase { - base: parse_duc_element_base(base.base().ok_or("Missing _DucStackElementBase.base")?)?, - stack_base: parse_duc_stack_base(base.stack_base().ok_or("Missing _DucStackElementBase.stack_base")?)?, - clip: base.clip(), - label_visible: base.label_visible(), - standard_override: base.standard_override().map(|s| s.to_string()), - }) +fn int_to_stroke_side_preference(v: i32) -> STROKE_SIDE_PREFERENCE { + match v { + 10 => STROKE_SIDE_PREFERENCE::TOP, + 11 => STROKE_SIDE_PREFERENCE::BOTTOM, + 12 => STROKE_SIDE_PREFERENCE::LEFT, + 13 => STROKE_SIDE_PREFERENCE::RIGHT, + 14 => STROKE_SIDE_PREFERENCE::CUSTOM, + 15 => STROKE_SIDE_PREFERENCE::ALL, + _ => STROKE_SIDE_PREFERENCE::ALL, + } } - -// ============================================================================= -// ELEMENT-SPECIFIC STYLES -// ============================================================================= - -fn parse_line_spacing(spacing: fb::LineSpacing) -> ParseResult { - Ok(types::LineSpacing { - value: spacing.value(), - line_type: spacing.type_(), - }) +fn int_to_stroke_cap(v: i32) -> STROKE_CAP { + match v { + 10 => STROKE_CAP::BUTT, + 11 => STROKE_CAP::ROUND, + 12 => STROKE_CAP::SQUARE, + _ => STROKE_CAP::ROUND, + } } - -fn parse_duc_text_style(style: fb::DucTextStyle) -> ParseResult { - Ok(types::DucTextStyle { - is_ltr: style.is_ltr(), - font_family: style.font_family().map(|s| s.to_string()).ok_or("Missing DucTextStyle.font_family")?, - big_font_family: style.big_font_family().map(|s| s.to_string()).ok_or("Missing DucTextStyle.big_font_family")?, - text_align: style.text_align().expect("Missing DucTextStyle.text_align"), - vertical_align: style.vertical_align().expect("Missing DucTextStyle.vertical_align"), - line_height: style.line_height(), - line_spacing: parse_line_spacing(style.line_spacing().ok_or("Missing DucTextStyle.line_spacing")?)?, - oblique_angle: style.oblique_angle(), - font_size: style.font_size(), - paper_text_height: Some(style.paper_text_height()), - width_factor: style.width_factor(), - is_upside_down: style.is_upside_down(), - is_backwards: style.is_backwards(), - }) +fn int_to_stroke_join(v: i32) -> STROKE_JOIN { + match v { + 10 => STROKE_JOIN::MITER, + 11 => STROKE_JOIN::ROUND, + 12 => STROKE_JOIN::BEVEL, + _ => STROKE_JOIN::ROUND, + } } - -fn parse_duc_table_cell_style(style: fb::DucTableCellStyle) -> ParseResult { - Ok(types::DucTableCellStyle { - base_style: parse_duc_element_styles_base(style.base_style().ok_or("Missing DucTableCellStyle.base_style")?)?, - text_style: parse_duc_text_style(style.text_style().ok_or("Missing DucTableCellStyle.text_style")?)?, - margins: parse_margins(style.margins().ok_or("Missing DucTableCellStyle.margins")?)?, - alignment: style.alignment(), - }) +fn int_to_line_head(v: i32) -> LINE_HEAD { + match v { + 10 => LINE_HEAD::ARROW, + 11 => LINE_HEAD::BAR, + 12 => LINE_HEAD::CIRCLE, + 13 => LINE_HEAD::CIRCLE_OUTLINED, + 14 => LINE_HEAD::TRIANGLE, + 15 => LINE_HEAD::TRIANGLE_OUTLINED, + 16 => LINE_HEAD::DIAMOND, + 17 => LINE_HEAD::DIAMOND_OUTLINED, + 18 => LINE_HEAD::CROSS, + 19 => LINE_HEAD::OPEN_ARROW, + 20 => LINE_HEAD::REVERSED_ARROW, + 21 => LINE_HEAD::REVERSED_TRIANGLE, + 22 => LINE_HEAD::REVERSED_TRIANGLE_OUTLINED, + 23 => LINE_HEAD::CONE, + 24 => LINE_HEAD::HALF_CONE, + _ => LINE_HEAD::ARROW, + } } - -fn parse_duc_table_style(style: fb::DucTableStyle) -> ParseResult { - Ok(types::DucTableStyle { - flow_direction: style.flow_direction().expect("Missing DucTableStyle.flow_direction"), - header_row_style: parse_duc_table_cell_style(style.header_row_style().ok_or("Missing DucTableStyle.header_row_style")?)?, - data_row_style: parse_duc_table_cell_style(style.data_row_style().ok_or("Missing DucTableStyle.data_row_style")?)?, - data_column_style: parse_duc_table_cell_style(style.data_column_style().ok_or("Missing DucTableStyle.data_column_style")?)?, - }) +fn int_to_bezier_mirroring(v: i32) -> BEZIER_MIRRORING { + match v { + 10 => BEZIER_MIRRORING::NONE, + 11 => BEZIER_MIRRORING::ANGLE, + 12 => BEZIER_MIRRORING::ANGLE_LENGTH, + _ => BEZIER_MIRRORING::NONE, + } } - -fn parse_duc_leader_style(style: fb::DucLeaderStyle) -> ParseResult { - let heads_override = style - .heads_override() - .map(|v| v.iter().map(parse_duc_head).collect::>>()) - .transpose()?; - Ok(types::DucLeaderStyle { - heads_override, - dogleg: Some(style.dogleg()), - text_style: parse_duc_text_style(style.text_style().ok_or("Missing DucLeaderStyle.text_style")?)?, - text_attachment: style.text_attachment().expect("Missing DucLeaderStyle.text_attachment"), - block_attachment: style.block_attachment().expect("Missing DucLeaderStyle.block_attachment"), - }) +fn int_to_blending(v: i32) -> BLENDING { + match v { + 11 => BLENDING::MULTIPLY, + 12 => BLENDING::SCREEN, + 13 => BLENDING::OVERLAY, + 14 => BLENDING::DARKEN, + 15 => BLENDING::LIGHTEN, + 16 => BLENDING::DIFFERENCE, + 17 => BLENDING::EXCLUSION, + _ => BLENDING::MULTIPLY, + } } - -fn parse_dimension_tolerance_style(style: fb::DimensionToleranceStyle) -> ParseResult { - Ok(types::DimensionToleranceStyle { - enabled: style.enabled(), - display_method: style.display_method().expect("Missing DimensionToleranceStyle.display_method"), - upper_value: style.upper_value(), - lower_value: style.lower_value(), - precision: style.precision(), - text_style: style.text_style().map(parse_duc_text_style).transpose()?, - }) +fn int_to_content_preference(v: i32) -> ELEMENT_CONTENT_PREFERENCE { + match v { + 12 => ELEMENT_CONTENT_PREFERENCE::SOLID, + 14 => ELEMENT_CONTENT_PREFERENCE::FILL, + 15 => ELEMENT_CONTENT_PREFERENCE::FIT, + 16 => ELEMENT_CONTENT_PREFERENCE::TILE, + 17 => ELEMENT_CONTENT_PREFERENCE::STRETCH, + 18 => ELEMENT_CONTENT_PREFERENCE::HATCH, + _ => ELEMENT_CONTENT_PREFERENCE::SOLID, + } } - -fn parse_dimension_fit_style(style: fb::DimensionFitStyle) -> ParseResult { - Ok(types::DimensionFitStyle { - rule: style.rule().expect("Missing DimensionFitStyle.rule"), - text_placement: style.text_placement().expect("Missing DimensionFitStyle.text_placement"), - force_text_inside: style.force_text_inside(), - }) +fn int_to_hatch_style(v: i32) -> HATCH_STYLE { + match v { + 10 => HATCH_STYLE::NORMAL, + 11 => HATCH_STYLE::OUTER, + 12 => HATCH_STYLE::IGNORE, + _ => HATCH_STYLE::NORMAL, + } } - -fn parse_dimension_line_style(style: fb::DimensionLineStyle) -> ParseResult { - Ok(types::DimensionLineStyle { - stroke: parse_element_stroke(style.stroke().ok_or("Missing DimensionLineStyle.stroke")?)?, - text_gap: style.text_gap(), - }) +fn int_to_image_status(v: i32) -> IMAGE_STATUS { + match v { + 10 => IMAGE_STATUS::PENDING, + 11 => IMAGE_STATUS::SAVED, + 12 => IMAGE_STATUS::ERROR, + _ => IMAGE_STATUS::PENDING, + } } - -fn parse_dimension_ext_line_style(style: fb::DimensionExtLineStyle) -> ParseResult { - Ok(types::DimensionExtLineStyle { - stroke: parse_element_stroke(style.stroke().ok_or("Missing DimensionExtLineStyle.stroke")?)?, - overshoot: style.overshoot(), - offset: style.offset(), - }) +fn int_to_pruning_level(v: i32) -> PRUNING_LEVEL { + match v { + 10 => PRUNING_LEVEL::CONSERVATIVE, + 20 => PRUNING_LEVEL::BALANCED, + 30 => PRUNING_LEVEL::AGGRESSIVE, + _ => PRUNING_LEVEL::BALANCED, + } } - -fn parse_dimension_symbol_style(style: fb::DimensionSymbolStyle) -> ParseResult { - let heads_override = style - .heads_override() - .map(|v| v.iter().map(parse_duc_head).collect::>>()) - .transpose()?; - Ok(types::DimensionSymbolStyle { - heads_override, - center_mark_type: style.center_mark_type().expect("Missing DimensionSymbolStyle.center_mark_type"), - center_mark_size: style.center_mark_size(), - }) +fn int_to_boolean_operation(v: i32) -> BOOLEAN_OPERATION { + match v { + 10 => BOOLEAN_OPERATION::UNION, + 11 => BOOLEAN_OPERATION::SUBTRACT, + 12 => BOOLEAN_OPERATION::INTERSECT, + 13 => BOOLEAN_OPERATION::EXCLUDE, + _ => BOOLEAN_OPERATION::UNION, + } } -fn parse_duc_dimension_style(style: fb::DucDimensionStyle) -> ParseResult { - Ok(types::DucDimensionStyle { - dim_line: parse_dimension_line_style(style.dim_line().ok_or("Missing DucDimensionStyle.dim_line")?)?, - ext_line: parse_dimension_ext_line_style(style.ext_line().ok_or("Missing DucDimensionStyle.ext_line")?)?, - text_style: parse_duc_text_style(style.text_style().ok_or("Missing DucDimensionStyle.text_style")?)?, - symbols: parse_dimension_symbol_style(style.symbols().ok_or("Missing DucDimensionStyle.symbols")?)?, - tolerance: parse_dimension_tolerance_style(style.tolerance().ok_or("Missing DucDimensionStyle.tolerance")?)?, - fit: parse_dimension_fit_style(style.fit().ok_or("Missing DucDimensionStyle.fit")?)?, - }) +/// Unpack a BLOB of little-endian f64 values. +fn blob_to_f64_vec(blob: &[u8]) -> Vec { + blob.chunks_exact(8) + .map(|c| f64::from_le_bytes(c.try_into().unwrap())) + .collect() } -fn parse_fcf_layout_style(style: fb::FCFLayoutStyle) -> ParseResult { - Ok(types::FCFLayoutStyle { - padding: style.padding(), - segment_spacing: style.segment_spacing(), - row_spacing: style.row_spacing(), - }) +/// Unpack a BLOB of little-endian f32 values. +fn blob_to_f32_vec(blob: &[u8]) -> Vec { + blob.chunks_exact(4) + .map(|c| f32::from_le_bytes(c.try_into().unwrap())) + .collect() } -fn parse_fcf_symbol_style(style: fb::FCFSymbolStyle) -> ParseResult { - Ok(types::FCFSymbolStyle { - scale: style.scale(), - }) -} +// ─── duc_document ──────────────────────────────────────────────────────────── -fn parse_fcf_datum_style(style: fb::FCFDatumStyle) -> ParseResult { - Ok(types::FCFDatumStyle { - bracket_style: style.bracket_style().expect("Missing FCFDatumStyle.bracket_style"), - }) -} +fn read_document(conn: &Connection) -> ParseResult<(Option, String, String, String, Option>)> { + let mut stmt = conn.prepare("SELECT id, version, source, data_type, thumbnail FROM duc_document LIMIT 1")?; + let result = stmt.query_row([], |row| { + let id: String = row.get(0)?; + let version: String = row.get(1)?; + let source: String = row.get(2)?; + let data_type: String = row.get(3)?; + let thumbnail: Option> = row.get(4)?; + let id_opt = if id.is_empty() { None } else { Some(id) }; + Ok((id_opt, version, source, data_type, thumbnail)) + }); -fn parse_duc_feature_control_frame_style(style: fb::DucFeatureControlFrameStyle) -> ParseResult { - Ok(types::DucFeatureControlFrameStyle { - text_style: parse_duc_text_style(style.text_style().ok_or("Missing DucFeatureControlFrameStyle.text_style")?)?, - layout: parse_fcf_layout_style(style.layout().ok_or("Missing DucFeatureControlFrameStyle.layout")?)?, - symbols: parse_fcf_symbol_style(style.symbols().ok_or("Missing DucFeatureControlFrameStyle.symbols")?)?, - datum_style: parse_fcf_datum_style(style.datum_style().ok_or("Missing DucFeatureControlFrameStyle.datum_style")?)?, - }) + match result { + Ok(v) => Ok(v), + Err(rusqlite::Error::QueryReturnedNoRows) => Ok((None, String::new(), String::new(), String::new(), None)), + Err(e) => Err(e.into()), + } } -fn parse_paragraph_formatting(format: fb::ParagraphFormatting) -> ParseResult { - Ok(types::ParagraphFormatting { - first_line_indent: format.first_line_indent(), - hanging_indent: format.hanging_indent(), - left_indent: format.left_indent(), - right_indent: format.right_indent(), - space_before: format.space_before(), - space_after: format.space_after(), - tab_stops: format.tab_stops().ok_or("Missing ParagraphFormatting.tab_stops")?.iter().collect(), - }) +// ─── duc_global_state ──────────────────────────────────────────────────────── + +fn read_global_state(conn: &Connection) -> ParseResult> { + let mut stmt = conn.prepare( + "SELECT name, view_background_color, main_scope, scope_exponent_threshold, pruning_level + FROM duc_global_state WHERE id = 1" + )?; + let result = stmt.query_row([], |row| { + Ok(DucGlobalState { + name: row.get(0)?, + view_background_color: row.get(1)?, + main_scope: row.get(2)?, + scope_exponent_threshold: row.get(3)?, + pruning_level: int_to_pruning_level(row.get(4)?), + }) + }); + + match result { + Ok(gs) => Ok(Some(gs)), + Err(rusqlite::Error::QueryReturnedNoRows) => Ok(None), + Err(e) => Err(e.into()), + } } -fn parse_stack_format_properties(props: fb::StackFormatProperties) -> ParseResult { - Ok(types::StackFormatProperties { - upper_scale: props.upper_scale(), - lower_scale: props.lower_scale(), - alignment: props.alignment().expect("Missing StackFormatProperties.alignment"), - }) +// ─── duc_local_state ───────────────────────────────────────────────────────── + +fn read_local_state(conn: &Connection) -> ParseResult> { + let mut stmt = conn.prepare( + "SELECT scope, scroll_x, scroll_y, zoom, is_binding_enabled, + current_item_opacity, current_item_font_family, current_item_font_size, + current_item_text_align, current_item_roundness, + start_head_type, start_head_block_id, start_head_size, + end_head_type, end_head_block_id, end_head_size, + pen_mode, view_mode_enabled, objects_snap_mode_enabled, + grid_mode_enabled, outline_mode_enabled, manual_save_mode, + decimal_places + FROM duc_local_state WHERE id = 1" + )?; + let result = stmt.query_row([], |row| { + let start_head_type: Option = row.get(10)?; + let start_head = match start_head_type { + Some(_) => Some(DucHead { + head_type: row.get::<_, Option>(10)?.map(int_to_line_head), + block_id: row.get(11)?, + size: row.get::<_, Option>(12)?.unwrap_or(1.0), + }), + None => None, + }; + + let end_head_type: Option = row.get(13)?; + let end_head = match end_head_type { + Some(_) => Some(DucHead { + head_type: row.get::<_, Option>(13)?.map(int_to_line_head), + block_id: row.get(14)?, + size: row.get::<_, Option>(15)?.unwrap_or(1.0), + }), + None => None, + }; + + Ok(DucLocalState { + scope: row.get(0)?, + scroll_x: row.get(1)?, + scroll_y: row.get(2)?, + zoom: row.get(3)?, + is_binding_enabled: row.get::<_, i32>(4)? != 0, + current_item_stroke: None, // loaded below + current_item_background: None, // loaded below + current_item_opacity: row.get(5)?, + current_item_font_family: row.get(6)?, + current_item_font_size: row.get(7)?, + current_item_text_align: int_to_text_align(row.get(8)?), + current_item_start_line_head: start_head, + current_item_end_line_head: end_head, + current_item_roundness: row.get(9)?, + pen_mode: row.get::<_, i32>(16)? != 0, + view_mode_enabled: row.get::<_, i32>(17)? != 0, + objects_snap_mode_enabled: row.get::<_, i32>(18)? != 0, + grid_mode_enabled: row.get::<_, i32>(19)? != 0, + outline_mode_enabled: row.get::<_, i32>(20)? != 0, + manual_save_mode: row.get::<_, i32>(21)? != 0, + decimal_places: row.get(22)?, + }) + }); + + match result { + Ok(mut ls) => { + let strokes = read_strokes(conn, "local_state", "1")?; + ls.current_item_stroke = strokes.into_iter().next(); + let bgs = read_backgrounds(conn, "local_state", "1")?; + ls.current_item_background = bgs.into_iter().next(); + Ok(Some(ls)) + } + Err(rusqlite::Error::QueryReturnedNoRows) => Ok(None), + Err(e) => Err(e.into()), + } } -fn parse_stack_format(format: fb::StackFormat) -> ParseResult { - Ok(types::StackFormat { - auto_stack: format.auto_stack(), - stack_chars: format.stack_chars().map(|v| parse_vec_of_strings(Some(v))).unwrap_or_default(), - properties: parse_stack_format_properties(format.properties().ok_or("Missing StackFormat.properties")?)?, - }) -} +// ─── dictionary ────────────────────────────────────────────────────────────── -fn parse_duc_doc_style(style: fb::DucDocStyle) -> ParseResult { - Ok(types::DucDocStyle { - text_style: parse_duc_text_style(style.text_style().ok_or("Missing DucDocStyle.text_style")?)?, - paragraph: parse_paragraph_formatting(style.paragraph().ok_or("Missing DucDocStyle.paragraph")?)?, - stack_format: parse_stack_format(style.stack_format().ok_or("Missing DucDocStyle.stack_format")?)?, - }) -} +fn read_dictionary(conn: &Connection) -> ParseResult>> { + let mut stmt = conn.prepare("SELECT key, value FROM document_dictionary")?; + let mut map = HashMap::new(); + let rows = stmt.query_map([], |row| { + Ok((row.get::<_, String>(0)?, row.get::<_, String>(1)?)) + })?; + for row in rows { + let (k, v) = row?; + map.insert(k, v); + } -fn parse_duc_viewport_style(style: fb::DucViewportStyle) -> ParseResult { - Ok(types::DucViewportStyle { - scale_indicator_visible: style.scale_indicator_visible(), - }) + if map.is_empty() { Ok(None) } else { Ok(Some(map)) } +} + +// ─── layers, groups, regions ───────────────────────────────────────────────── + +fn read_stack_base(conn: &Connection, id: &str) -> ParseResult { + let mut stmt = conn.prepare_cached( + "SELECT label, description, is_collapsed, is_plot, is_visible, locked, opacity + FROM stack_properties WHERE id = ?1" + )?; + Ok(stmt.query_row(params![id], |row| { + Ok(DucStackBase { + label: row.get(0)?, + description: row.get(1)?, + is_collapsed: row.get::<_, i32>(2)? != 0, + is_plot: row.get::<_, i32>(3)? != 0, + is_visible: row.get::<_, i32>(4)? != 0, + locked: row.get::<_, i32>(5)? != 0, + styles: DucStackLikeStyles { opacity: row.get(6)? }, + }) + })?) +} + +fn read_layers(conn: &Connection) -> ParseResult> { + let mut stmt = conn.prepare("SELECT id, readonly FROM layers")?; + let rows: Vec<(String, i32)> = stmt.query_map([], |row| { + Ok((row.get(0)?, row.get(1)?)) + })?.collect::, _>>()?; + + let mut layers = Vec::with_capacity(rows.len()); + for (id, readonly) in rows { + let stack_base = read_stack_base(conn, &id)?; + + let strokes = read_strokes(conn, "layer", &id)?; + let bgs = read_backgrounds(conn, "layer", &id)?; + let overrides = if !strokes.is_empty() || !bgs.is_empty() { + Some(DucLayerOverrides { + stroke: strokes.into_iter().next().unwrap_or_else(default_stroke), + background: bgs.into_iter().next().unwrap_or_else(default_background), + }) + } else { + None + }; + + layers.push(DucLayer { + id, + stack_base, + readonly: readonly != 0, + overrides, + }); + } + Ok(layers) } -fn parse_duc_plot_style(_style: fb::DucPlotStyle) -> ParseResult { - Ok(types::DucPlotStyle { - }) -} +fn read_groups(conn: &Connection) -> ParseResult> { + let mut stmt = conn.prepare("SELECT id FROM groups")?; + let ids: Vec = stmt.query_map([], |row| row.get(0))?.collect::, _>>()?; -fn parse_duc_xray_style(style: fb::DucXRayStyle) -> ParseResult { - Ok(types::DucXRayStyle { - color: style.color().ok_or("Missing DucXRayStyle.color")?.to_string(), - }) + let mut groups = Vec::with_capacity(ids.len()); + for id in ids { + let stack_base = read_stack_base(conn, &id)?; + groups.push(DucGroup { id, stack_base }); + } + Ok(groups) +} + +fn read_regions(conn: &Connection) -> ParseResult> { + let mut stmt = conn.prepare("SELECT id, boolean_operation FROM regions")?; + let rows: Vec<(String, i32)> = stmt.query_map([], |row| { + Ok((row.get(0)?, row.get(1)?)) + })?.collect::, _>>()?; + + let mut regions = Vec::with_capacity(rows.len()); + for (id, bool_op) in rows { + let stack_base = read_stack_base(conn, &id)?; + regions.push(DucRegion { + id, + stack_base, + boolean_operation: int_to_boolean_operation(bool_op), + }); + } + Ok(regions) +} + +// ─── blocks ────────────────────────────────────────────────────────────────── + +fn read_blocks(conn: &Connection) -> ParseResult<(Vec, Vec, Vec)> { + // Blocks + let mut b_stmt = conn.prepare( + "SELECT id, label, description, version FROM blocks" + )?; + let blocks: Vec = b_stmt.query_map([], |row| { + let id: String = row.get(0)?; + Ok((id, row.get(1)?, row.get(2)?, row.get(3)?)) + })?.collect::, i32)>, _>>()? + .into_iter() + .map(|(id, label, description, version)| { + let (metadata, thumbnail) = read_block_metadata(conn, "block", &id).unwrap_or((None, None)); + DucBlock { id, label, description, version, metadata, thumbnail } + }).collect(); + + // Block instances + let mut i_stmt = conn.prepare( + "SELECT id, block_id, version, dup_rows, dup_cols, dup_row_spacing, dup_col_spacing + FROM block_instances" + )?; + let instances: Vec = i_stmt.query_map([], |row| { + let id: String = row.get(0)?; + let dup_rows: Option = row.get(3)?; + let duplication_array = dup_rows.map(|rows| DucBlockDuplicationArray { + rows, + cols: row.get::<_, i32>(4).unwrap_or(1), + row_spacing: row.get::<_, f64>(5).unwrap_or(0.0), + col_spacing: row.get::<_, f64>(6).unwrap_or(0.0), + }); + Ok(DucBlockInstance { + id: id.clone(), + block_id: row.get(1)?, + version: row.get(2)?, + element_overrides: None, // loaded below + duplication_array, + }) + })?.collect::, _>>()?; + + let instances: Vec = instances.into_iter().map(|mut inst| { + let mut ov_stmt = conn.prepare_cached( + "SELECT key, value FROM block_instance_overrides WHERE instance_id = ?1" + ).unwrap(); + let overrides: Vec = ov_stmt.query_map(params![inst.id], |row| { + Ok(StringValueEntry { key: row.get(0)?, value: row.get(1)? }) + }).unwrap().collect::, _>>().unwrap_or_default(); + inst.element_overrides = if overrides.is_empty() { None } else { Some(overrides) }; + inst + }).collect(); + + // Block collections + let mut c_stmt = conn.prepare("SELECT id, label FROM block_collections")?; + let collections: Vec = c_stmt.query_map([], |row| { + let id: String = row.get(0)?; + Ok((id, row.get(1)?)) + })?.collect::, _>>()? + .into_iter() + .map(|(id, label)| { + let (metadata, thumbnail) = read_block_metadata(conn, "collection", &id).unwrap_or((None, None)); + let mut e_stmt = conn.prepare_cached( + "SELECT child_id, is_collection FROM block_collection_entries WHERE collection_id = ?1" + ).unwrap(); + let children: Vec = e_stmt.query_map(params![id], |row| { + Ok(DucBlockCollectionEntry { + id: row.get(0)?, + is_collection: row.get::<_, i32>(1)? != 0, + }) + }).unwrap().collect::, _>>().unwrap_or_default(); + DucBlockCollection { id, label, children, metadata, thumbnail } + }).collect(); + + Ok((blocks, instances, collections)) +} + +fn read_block_metadata(conn: &Connection, owner_type: &str, owner_id: &str) -> ParseResult<(Option, Option>)> { + let mut stmt = conn.prepare_cached( + "SELECT source, usage_count, created_at, updated_at, localization, thumbnail + FROM block_metadata WHERE owner_type = ?1 AND owner_id = ?2" + )?; + let result = stmt.query_row(params![owner_type, owner_id], |row| { + Ok(( + DucBlockMetadata { + source: row.get(0)?, + usage_count: row.get(1)?, + created_at: row.get(2)?, + updated_at: row.get(3)?, + localization: row.get(4)?, + }, + row.get::<_, Option>>(5)?, + )) + }); + + match result { + Ok((meta, thumb)) => Ok((Some(meta), thumb)), + Err(rusqlite::Error::QueryReturnedNoRows) => Ok((None, None)), + Err(e) => Err(e.into()), + } } -// ============================================================================= -// ELEMENT DEFINITIONS -// ============================================================================= +// ─── elements ──────────────────────────────────────────────────────────────── + +fn read_elements(conn: &Connection) -> ParseResult> { + let mut stmt = conn.prepare( + "SELECT id, element_type, + x, y, width, height, angle, + scope, label, description, is_visible, + seed, version, version_nonce, updated, \"index\", + is_plot, is_deleted, + roundness, blending, opacity, + instance_id, layer_id, frame_id, + z_index, link, locked, custom_data + FROM elements ORDER BY z_index ASC" + )?; + + let rows: Vec<(String, String, DucElementBase)> = stmt.query_map([], |row| { + let id: String = row.get(0)?; + let element_type: String = row.get(1)?; + + let base = DucElementBase { + id: id.clone(), + x: row.get(2)?, + y: row.get(3)?, + width: row.get(4)?, + height: row.get(5)?, + angle: row.get(6)?, + scope: row.get(7)?, + label: row.get(8)?, + description: row.get(9)?, + is_visible: row.get::<_, i32>(10)? != 0, + seed: row.get(11)?, + version: row.get(12)?, + version_nonce: row.get(13)?, + updated: row.get(14)?, + index: row.get(15)?, + is_plot: row.get::<_, i32>(16)? != 0, + is_deleted: row.get::<_, i32>(17)? != 0, + styles: DucElementStylesBase { + roundness: row.get(18)?, + blending: row.get::<_, Option>(19)?.map(int_to_blending), + opacity: row.get(20)?, + background: Vec::new(), // loaded below + stroke: Vec::new(), // loaded below + }, + instance_id: row.get(21)?, + layer_id: row.get(22)?, + frame_id: row.get(23)?, + z_index: row.get(24)?, + link: row.get(25)?, + locked: row.get::<_, i32>(26)? != 0, + custom_data: row.get(27)?, + group_ids: Vec::new(), // loaded below + block_ids: Vec::new(), // loaded below + region_ids: Vec::new(), // loaded below + bound_elements: None, // loaded below + }; + + Ok((id, element_type, base)) + })?.collect::, _>>()?; + + let mut elements = Vec::with_capacity(rows.len()); + for (id, element_type, mut base) in rows { + // Load backgrounds & strokes + base.styles.background = read_backgrounds(conn, "element", &id)?; + base.styles.stroke = read_strokes(conn, "element", &id)?; + + // Load memberships + base.group_ids = read_string_list(conn, + "SELECT group_id FROM element_group_memberships WHERE element_id = ?1 ORDER BY sort_order", &id)?; + base.block_ids = read_string_list(conn, + "SELECT block_id FROM element_block_memberships WHERE element_id = ?1 ORDER BY sort_order", &id)?; + base.region_ids = read_string_list(conn, + "SELECT region_id FROM element_region_memberships WHERE element_id = ?1 ORDER BY sort_order", &id)?; + + // Bound elements + base.bound_elements = read_bound_elements(conn, &id)?; + + let element = match element_type.as_str() { + "rectangle" => DucElementEnum::DucRectangleElement(DucRectangleElement { base }), + "polygon" => read_polygon_element(conn, base)?, + "ellipse" => read_ellipse_element(conn, base)?, + "embeddable" => DucElementEnum::DucEmbeddableElement(DucEmbeddableElement { base }), + "text" => read_text_element(conn, base)?, + "image" => read_image_element(conn, base)?, + "freedraw" => read_freedraw_element(conn, base)?, + "line" => read_linear_element(conn, base, false)?, + "arrow" => read_linear_element(conn, base, true)?, + "frame" => read_frame_element(conn, base)?, + "plot" => read_plot_element(conn, base)?, + "pdf" => read_pdf_element(conn, base)?, + "doc" => read_doc_element(conn, base)?, + "table" => read_table_element(conn, base)?, + "model" => read_model_element(conn, base)?, + _ => return Err(ParseError::InvalidData(format!("unknown element type: {element_type}"))), + }; + + elements.push(ElementWrapper { element }); + } -fn parse_duc_rectangle_element(el: fb::DucRectangleElement) -> ParseResult { - Ok(types::DucRectangleElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucRectangleElement.base")?)?, - }) -} + Ok(elements) +} + +fn read_string_list(conn: &Connection, sql: &str, id: &str) -> ParseResult> { + let mut stmt = conn.prepare_cached(sql)?; + let list: Vec = stmt.query_map(params![id], |row| row.get(0))? + .collect::, _>>()?; + Ok(list) +} + +fn read_bound_elements(conn: &Connection, element_id: &str) -> ParseResult>> { + let mut stmt = conn.prepare_cached( + "SELECT bound_element_id, bound_type FROM element_bound_elements + WHERE element_id = ?1 ORDER BY sort_order" + )?; + let bound: Vec = stmt.query_map(params![element_id], |row| { + Ok(BoundElement { + id: row.get(0)?, + element_type: row.get(1)?, + }) + })?.collect::, _>>()?; + + if bound.is_empty() { Ok(None) } else { Ok(Some(bound)) } +} + +// ─── element type readers ──────────────────────────────────────────────────── + +fn read_polygon_element(conn: &Connection, base: DucElementBase) -> ParseResult { + let mut stmt = conn.prepare_cached("SELECT sides FROM element_polygon WHERE element_id = ?1")?; + let sides: i32 = stmt.query_row(params![base.id], |row| row.get(0))?; + Ok(DucElementEnum::DucPolygonElement(DucPolygonElement { base, sides })) +} + +fn read_ellipse_element(conn: &Connection, base: DucElementBase) -> ParseResult { + let id = base.id.clone(); + let mut stmt = conn.prepare_cached( + "SELECT ratio, start_angle, end_angle, show_aux_crosshair FROM element_ellipse WHERE element_id = ?1" + )?; + let e = stmt.query_row(params![id], |row| { + Ok(DucEllipseElement { + base, + ratio: row.get(0)?, + start_angle: row.get(1)?, + end_angle: row.get(2)?, + show_aux_crosshair: row.get::<_, i32>(3)? != 0, + }) + })?; + Ok(DucElementEnum::DucEllipseElement(e)) +} + +fn read_text_element(conn: &Connection, base: DucElementBase) -> ParseResult { + let id = base.id.clone(); + let mut stmt = conn.prepare_cached( + "SELECT text, original_text, auto_resize, container_id, + is_ltr, font_family, big_font_family, text_align, vertical_align, + line_height, line_spacing_value, line_spacing_type, + oblique_angle, font_size, width_factor, + is_upside_down, is_backwards + FROM element_text WHERE element_id = ?1" + )?; + let e = stmt.query_row(params![id], |row| { + Ok(DucTextElement { + base, + text: row.get(0)?, + original_text: row.get(1)?, + auto_resize: row.get::<_, i32>(2)? != 0, + container_id: row.get(3)?, + style: DucTextStyle { + is_ltr: row.get::<_, i32>(4)? != 0, + font_family: row.get(5)?, + big_font_family: row.get(6)?, + text_align: int_to_text_align(row.get(7)?), + vertical_align: int_to_vertical_align(row.get(8)?), + line_height: row.get(9)?, + line_spacing: LineSpacing { + value: row.get(10)?, + line_type: row.get::<_, Option>(11)?.map(int_to_line_spacing_type), + }, + oblique_angle: row.get(12)?, + font_size: row.get(13)?, + width_factor: row.get(14)?, + is_upside_down: row.get::<_, i32>(15)? != 0, + is_backwards: row.get::<_, i32>(16)? != 0, + }, + }) + })?; + Ok(DucElementEnum::DucTextElement(e)) +} + +fn read_image_element(conn: &Connection, base: DucElementBase) -> ParseResult { + let id = base.id.clone(); + let mut stmt = conn.prepare_cached( + "SELECT file_id, status, scale_x, scale_y, + crop_x, crop_y, crop_width, crop_height, crop_natural_width, crop_natural_height, + filter_brightness, filter_contrast + FROM element_image WHERE element_id = ?1" + )?; + let e = stmt.query_row(params![id], |row| { + let crop_x: Option = row.get(4)?; + let crop = crop_x.map(|x| ImageCrop { + x, + y: row.get::<_, f64>(5).unwrap_or(0.0), + width: row.get::<_, f64>(6).unwrap_or(0.0), + height: row.get::<_, f64>(7).unwrap_or(0.0), + natural_width: row.get::<_, f64>(8).unwrap_or(0.0), + natural_height: row.get::<_, f64>(9).unwrap_or(0.0), + }); + let brightness: Option = row.get(10)?; + let filter = brightness.map(|b| DucImageFilter { + brightness: b, + contrast: row.get::<_, f32>(11).unwrap_or(1.0), + }); + + Ok(DucImageElement { + base, + file_id: row.get(0)?, + status: int_to_image_status(row.get(1)?), + scale: vec![row.get(2)?, row.get(3)?], + crop, + filter, + }) + })?; + Ok(DucElementEnum::DucImageElement(e)) +} + +fn read_freedraw_element(conn: &Connection, base: DucElementBase) -> ParseResult { + let id = base.id.clone(); + let mut stmt = conn.prepare_cached( + "SELECT size, thinning, smoothing, streamline, easing, + start_cap, start_taper, start_easing, + end_cap, end_taper, end_easing, + pressures, simulate_pressure, + last_committed_point_x, last_committed_point_y, last_committed_point_mirror, + svg_path + FROM element_freedraw WHERE element_id = ?1" + )?; + let mut e = stmt.query_row(params![id], |row| { + let start_cap: Option = row.get(5)?; + let start = start_cap.map(|cap| DucFreeDrawEnds { + cap: cap != 0, + taper: row.get::<_, f32>(6).unwrap_or(0.0), + easing: row.get::<_, String>(7).unwrap_or_default(), + }); + let end_cap: Option = row.get(8)?; + let end = end_cap.map(|cap| DucFreeDrawEnds { + cap: cap != 0, + taper: row.get::<_, f32>(9).unwrap_or(0.0), + easing: row.get::<_, String>(10).unwrap_or_default(), + }); + + let pressures_blob: Option> = row.get(11)?; + let pressures = pressures_blob.map(|b| blob_to_f32_vec(&b)).unwrap_or_default(); + + let lcp_x: Option = row.get(13)?; + let last_committed_point = lcp_x.map(|x| DucPoint { + x, + y: row.get::<_, f64>(14).unwrap_or(0.0), + mirroring: row.get::<_, Option>(15).ok().flatten().map(int_to_bezier_mirroring), + }); + + Ok(DucFreeDrawElement { + base, + points: Vec::new(), // loaded below + size: row.get(0)?, + thinning: row.get(1)?, + smoothing: row.get(2)?, + streamline: row.get(3)?, + easing: row.get(4)?, + start, + end, + pressures, + simulate_pressure: row.get::<_, i32>(12)? != 0, + last_committed_point, + svg_path: row.get(16)?, + }) + })?; + + e.points = read_duc_points(conn, + "SELECT x, y, mirroring FROM freedraw_element_points WHERE element_id = ?1 ORDER BY sort_order", + &id)?; + + Ok(DucElementEnum::DucFreeDrawElement(e)) +} + +fn read_linear_element(conn: &Connection, base: DucElementBase, is_arrow: bool) -> ParseResult { + let id = base.id.clone(); + let mut stmt = conn.prepare_cached( + "SELECT last_committed_point_x, last_committed_point_y, last_committed_point_mirror, + start_binding_element_id, start_binding_focus, start_binding_gap, + start_binding_fixed_point_x, start_binding_fixed_point_y, + start_binding_point_index, start_binding_point_offset, + start_binding_head_type, start_binding_head_block_id, start_binding_head_size, + end_binding_element_id, end_binding_focus, end_binding_gap, + end_binding_fixed_point_x, end_binding_fixed_point_y, + end_binding_point_index, end_binding_point_offset, + end_binding_head_type, end_binding_head_block_id, end_binding_head_size, + wipeout_below, elbowed + FROM element_linear WHERE element_id = ?1" + )?; + + let (mut linear_base, wipeout_below, elbowed) = stmt.query_row(params![id], |row| { + let lcp_x: Option = row.get(0)?; + let last_committed_point = lcp_x.map(|x| DucPoint { + x, + y: row.get::<_, f64>(1).unwrap_or(0.0), + mirroring: row.get::<_, Option>(2).ok().flatten().map(int_to_bezier_mirroring), + }); + + let start_binding = read_binding_from_row(row, 3)?; + let end_binding = read_binding_from_row(row, 13)?; + + let wipeout: i32 = row.get(23)?; + let elbowed_val: i32 = row.get(24)?; + + Ok(( + DucLinearElementBase { + base, + points: Vec::new(), + lines: Vec::new(), + path_overrides: Vec::new(), + last_committed_point, + start_binding, + end_binding, + }, + wipeout != 0, + elbowed_val != 0, + )) + })?; + + // Points + linear_base.points = read_duc_points(conn, + "SELECT x, y, mirroring FROM linear_element_points WHERE element_id = ?1 ORDER BY sort_order", + &id)?; + + // Lines + { + let mut l_stmt = conn.prepare_cached( + "SELECT start_index, start_handle_x, start_handle_y, end_index, end_handle_x, end_handle_y + FROM linear_element_lines WHERE element_id = ?1 ORDER BY sort_order" + )?; + linear_base.lines = l_stmt.query_map(params![id], |row| { + Ok(DucLine { + start: DucLineReference { + index: row.get(0)?, + handle: match row.get::<_, Option>(1)? { + Some(x) => Some(GeometricPoint { x, y: row.get::<_, f64>(2).unwrap_or(0.0) }), + None => None, + }, + }, + end: DucLineReference { + index: row.get(3)?, + handle: match row.get::<_, Option>(4)? { + Some(x) => Some(GeometricPoint { x, y: row.get::<_, f64>(5).unwrap_or(0.0) }), + None => None, + }, + }, + }) + })?.collect::, _>>()?; + } -fn parse_duc_polygon_element(el: fb::DucPolygonElement) -> ParseResult { - Ok(types::DucPolygonElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucPolygonElement.base")?)?, - sides: el.sides(), - }) -} + // Path overrides + { + let mut po_stmt = conn.prepare_cached( + "SELECT id, sort_order FROM linear_path_overrides WHERE element_id = ?1 ORDER BY sort_order" + )?; + let path_rows: Vec<(i64, i32)> = po_stmt.query_map(params![id], |row| { + Ok((row.get(0)?, row.get(1)?)) + })?.collect::, _>>()?; + + for (path_id, _sort) in path_rows { + let mut idx_stmt = conn.prepare_cached( + "SELECT line_index FROM linear_path_override_indices + WHERE path_override_id = ?1 ORDER BY sort_order" + )?; + let line_indices: Vec = idx_stmt.query_map(params![path_id], |row| row.get(0))? + .collect::, _>>()?; + + let pid_str = path_id.to_string(); + let bgs = read_backgrounds(conn, "path_override", &pid_str)?; + let sts = read_strokes(conn, "path_override", &pid_str)?; + + linear_base.path_overrides.push(DucPath { + line_indices, + background: bgs.into_iter().next(), + stroke: sts.into_iter().next(), + }); + } + } -fn parse_duc_ellipse_element(el: fb::DucEllipseElement) -> ParseResult { - Ok(types::DucEllipseElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucEllipseElement.base")?)?, - ratio: el.ratio(), - start_angle: el.start_angle(), - end_angle: el.end_angle(), - show_aux_crosshair: el.show_aux_crosshair(), - }) + if is_arrow { + Ok(DucElementEnum::DucArrowElement(DucArrowElement { linear_base, elbowed })) + } else { + Ok(DucElementEnum::DucLinearElement(DucLinearElement { linear_base, wipeout_below })) + } } -fn parse_duc_embeddable_element(el: fb::DucEmbeddableElement) -> ParseResult { - Ok(types::DucEmbeddableElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucEmbeddableElement.base")?)?, - }) -} +fn read_binding_from_row(row: &rusqlite::Row, offset: usize) -> rusqlite::Result> { + let elem_id: Option = row.get(offset)?; + let Some(element_id) = elem_id else { return Ok(None) }; + + let fixed_x: Option = row.get(offset + 4)?; + let fixed_point = fixed_x.map(|x| GeometricPoint { + x, + y: row.get::<_, f64>(offset + 5).unwrap_or(0.0), + }); + + let pt_idx: Option = row.get(offset + 6)?; + let point = pt_idx.map(|index| PointBindingPoint { + index, + offset: row.get::<_, f64>(offset + 7).unwrap_or(0.0), + }); + + let head_type: Option = row.get(offset + 8)?; + let head = head_type.map(|ht| DucHead { + head_type: Some(int_to_line_head(ht)), + block_id: row.get::<_, Option>(offset + 9).unwrap_or(None), + size: row.get::<_, f64>(offset + 10).unwrap_or(1.0), + }); + + Ok(Some(DucPointBinding { + element_id, + focus: row.get(offset + 1)?, + gap: row.get(offset + 2)?, + fixed_point, + point, + head, + })) +} + +fn read_frame_element(conn: &Connection, base: DucElementBase) -> ParseResult { + let stack_element_base = read_stack_element_base(conn, base)?; + Ok(DucElementEnum::DucFrameElement(DucFrameElement { stack_element_base })) +} + +fn read_plot_element(conn: &Connection, base: DucElementBase) -> ParseResult { + let stack_element_base = read_stack_element_base(conn, base)?; + let mut stmt = conn.prepare_cached( + "SELECT margin_top, margin_right, margin_bottom, margin_left + FROM element_plot WHERE element_id = ?1" + )?; + let margins = stmt.query_row(params![stack_element_base.base.id], |row| { + Ok(Margins { + top: row.get(0)?, + right: row.get(1)?, + bottom: row.get(2)?, + left: row.get(3)?, + }) + })?; + + Ok(DucElementEnum::DucPlotElement(DucPlotElement { + stack_element_base, + style: DucPlotStyle {}, + layout: PlotLayout { margins }, + })) +} + +fn read_stack_element_base(conn: &Connection, base: DucElementBase) -> ParseResult { + let id = base.id.clone(); + let mut stmt = conn.prepare_cached( + "SELECT label, description, is_collapsed, is_plot, is_visible, locked, opacity, clip, label_visible + FROM element_stack_properties WHERE element_id = ?1" + )?; + Ok(stmt.query_row(params![id], |row| { + Ok(DucStackElementBase { + base, + stack_base: DucStackBase { + label: row.get(0)?, + description: row.get(1)?, + is_collapsed: row.get::<_, i32>(2)? != 0, + is_plot: row.get::<_, i32>(3)? != 0, + is_visible: row.get::<_, i32>(4)? != 0, + locked: row.get::<_, i32>(5)? != 0, + styles: DucStackLikeStyles { opacity: row.get(6)? }, + }, + clip: row.get::<_, i32>(7)? != 0, + label_visible: row.get::<_, i32>(8)? != 0, + }) + })?) +} + +fn read_pdf_element(conn: &Connection, base: DucElementBase) -> ParseResult { + let (file_id, grid_config) = read_document_grid_config(conn, &base.id)?; + Ok(DucElementEnum::DucPdfElement(DucPdfElement { base, file_id, grid_config })) +} + +fn read_doc_element(conn: &Connection, base: DucElementBase) -> ParseResult { + let (file_id, grid_config) = read_document_grid_config(conn, &base.id)?; + let mut stmt = conn.prepare_cached( + "SELECT text FROM element_doc WHERE element_id = ?1" + )?; + let text: String = stmt.query_row(params![base.id], |row| row.get(0))?; + Ok(DucElementEnum::DucDocElement(DucDocElement { + base, + style: DucDocStyle {}, + text, + grid_config, + file_id, + })) +} + +fn read_document_grid_config(conn: &Connection, element_id: &str) -> ParseResult<(Option, DocumentGridConfig)> { + let mut stmt = conn.prepare_cached( + "SELECT file_id, grid_columns, grid_gap_x, grid_gap_y, grid_first_page_alone, grid_scale + FROM document_grid_config WHERE element_id = ?1" + )?; + Ok(stmt.query_row(params![element_id], |row| { + Ok(( + row.get(0)?, + DocumentGridConfig { + columns: row.get(1)?, + gap_x: row.get(2)?, + gap_y: row.get(3)?, + first_page_alone: row.get::<_, i32>(4)? != 0, + scale: row.get(5)?, + }, + )) + })?) +} + +fn read_table_element(conn: &Connection, base: DucElementBase) -> ParseResult { + let mut stmt = conn.prepare_cached("SELECT file_id FROM element_table WHERE element_id = ?1")?; + let file_id: Option = stmt.query_row(params![base.id], |row| row.get(0))?; + Ok(DucElementEnum::DucTableElement(DucTableElement { + base, + style: DucTableStyle {}, + file_id, + })) +} + +fn read_model_element(conn: &Connection, base: DucElementBase) -> ParseResult { + let id = base.id.clone(); + let mut stmt = conn.prepare_cached( + "SELECT model_type, code, svg_path FROM element_model WHERE element_id = ?1" + )?; + let (model_type, code, svg_path) = stmt.query_row(params![id], |row| { + Ok((row.get::<_, Option>(0)?, row.get::<_, Option>(1)?, row.get::<_, Option>(2)?)) + })?; + + let mut f_stmt = conn.prepare_cached( + "SELECT file_id FROM model_element_files WHERE element_id = ?1 ORDER BY sort_order" + )?; + let file_ids: Vec = f_stmt.query_map(params![id], |row| row.get(0))? + .collect::, _>>()?; + + let viewer_state = read_model_viewer_state(conn, &id)?; + + Ok(DucElementEnum::DucModelElement(DucModelElement { + base, model_type, code, svg_path, file_ids, viewer_state, + })) +} + +fn read_model_viewer_state(conn: &Connection, element_id: &str) -> ParseResult> { + let mut stmt = conn.prepare_cached( + "SELECT + camera_control, camera_ortho, camera_up, + camera_position_x, camera_position_y, camera_position_z, + camera_quaternion_x, camera_quaternion_y, camera_quaternion_z, camera_quaternion_w, + camera_target_x, camera_target_y, camera_target_z, + camera_zoom, camera_pan_speed, camera_rotate_speed, camera_zoom_speed, camera_holroyd, + display_wireframe, display_transparent, display_black_edges, + display_grid_uniform, display_grid_xy, display_grid_xz, display_grid_yz, + display_axes_visible, display_axes_at_origin, + material_metalness, material_roughness, material_default_opacity, + material_edge_color, material_ambient_intensity, material_direct_intensity, + clip_x_enabled, clip_x_value, clip_x_normal_x, clip_x_normal_y, clip_x_normal_z, + clip_y_enabled, clip_y_value, clip_y_normal_x, clip_y_normal_y, clip_y_normal_z, + clip_z_enabled, clip_z_value, clip_z_normal_x, clip_z_normal_y, clip_z_normal_z, + clip_intersection, clip_show_planes, clip_object_color_caps, + explode_active, explode_value, + zebra_active, zebra_stripe_count, zebra_stripe_direction, + zebra_color_scheme, zebra_opacity, zebra_mapping_mode + FROM model_viewer_state WHERE element_id = ?1" + )?; + + let result = stmt.query_row(params![element_id], |row| { + let grid_uniform: Option = row.get(21)?; + let grid = match grid_uniform { + Some(v) => Viewer3DGrid::Uniform(v != 0), + None => Viewer3DGrid::PerPlane(Viewer3DGridPlanes { + xy: row.get::<_, i32>(22)? != 0, + xz: row.get::<_, i32>(23)? != 0, + yz: row.get::<_, i32>(24)? != 0, + }), + }; + + fn read_clip(row: &rusqlite::Row, offset: usize) -> rusqlite::Result { + let nx: Option = row.get(offset + 2)?; + let normal = nx.map(|x| [ + x, + row.get::<_, f64>(offset + 3).unwrap_or(0.0), + row.get::<_, f64>(offset + 4).unwrap_or(0.0), + ]); + Ok(Viewer3DClipPlane { + enabled: row.get::<_, i32>(offset)? != 0, + value: row.get(offset + 1)?, + normal, + }) + } -fn parse_duc_pdf_element(el: fb::DucPdfElement) -> ParseResult { - let grid_config = el.grid_config(); - Ok(types::DucPdfElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucPdfElement.base")?)?, - file_id: el.file_id().map(|s| s.to_string()), - grid_config: match grid_config { - Some(gc) => types::DocumentGridConfig { - columns: gc.columns(), - gap_x: gc.gap_x(), - gap_y: gc.gap_y(), - align_items: gc.align_items().map(|a| a.into()).unwrap_or(types::DocumentGridAlignItems::Start), - first_page_alone: gc.first_page_alone(), - scale: gc.scale(), + Ok(Viewer3DState { + camera: Viewer3DCamera { + control: row.get(0)?, + ortho: row.get::<_, i32>(1)? != 0, + up: row.get(2)?, + position: [row.get(3)?, row.get(4)?, row.get(5)?], + quaternion: [row.get(6)?, row.get(7)?, row.get(8)?, row.get(9)?], + target: [row.get(10)?, row.get(11)?, row.get(12)?], + zoom: row.get(13)?, + pan_speed: row.get(14)?, + rotate_speed: row.get(15)?, + zoom_speed: row.get(16)?, + holroyd: row.get::<_, i32>(17)? != 0, }, - None => types::DocumentGridConfig { - columns: 1, - gap_x: 0.0, - gap_y: 0.0, - align_items: types::DocumentGridAlignItems::Start, - first_page_alone: false, - scale: 1.0, + display: Viewer3DDisplay { + wireframe: row.get::<_, i32>(18)? != 0, + transparent: row.get::<_, i32>(19)? != 0, + black_edges: row.get::<_, i32>(20)? != 0, + grid, + axes_visible: row.get::<_, i32>(25)? != 0, + axes_at_origin: row.get::<_, i32>(26)? != 0, }, - }, - }) -} + material: Viewer3DMaterial { + metalness: row.get(27)?, + roughness: row.get(28)?, + default_opacity: row.get(29)?, + edge_color: row.get(30)?, + ambient_intensity: row.get(31)?, + direct_intensity: row.get(32)?, + }, + clipping: Viewer3DClipping { + x: read_clip(row, 33)?, + y: read_clip(row, 38)?, + z: read_clip(row, 43)?, + intersection: row.get::<_, i32>(48)? != 0, + show_planes: row.get::<_, i32>(49)? != 0, + object_color_caps: row.get::<_, i32>(50)? != 0, + }, + explode: Viewer3DExplode { + active: row.get::<_, i32>(51)? != 0, + value: row.get(52)?, + }, + zebra: Viewer3DZebra { + active: row.get::<_, i32>(53)? != 0, + stripe_count: row.get(54)?, + stripe_direction: row.get(55)?, + color_scheme: row.get(56)?, + opacity: row.get(57)?, + mapping_mode: row.get(58)?, + }, + }) + }); -fn parse_duc_mermaid_element(el: fb::DucMermaidElement) -> ParseResult { - Ok(types::DucMermaidElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucMermaidElement.base")?)?, - source: el.source().ok_or("Missing DucMermaidElement.source")?.to_string(), - theme: el.theme().map(|s| s.to_string()), - svg_path: el.svg_path().map(|s| s.to_string()), - }) + match result { + Ok(vs) => Ok(Some(vs)), + Err(rusqlite::Error::QueryReturnedNoRows) => Ok(None), + Err(e) => Err(e.into()), + } } -fn parse_duc_table_column(col: fb::DucTableColumn) -> ParseResult { - Ok(types::DucTableColumn { - id: col.id().to_string(), - width: col.width(), - style_overrides: col.style_overrides().map(parse_duc_table_cell_style).transpose()?, - }) -} +// ─── shared point reader ───────────────────────────────────────────────────── + +fn read_duc_points(conn: &Connection, sql: &str, id: &str) -> ParseResult> { + let mut stmt = conn.prepare_cached(sql)?; + let points: Vec = stmt.query_map(params![id], |row| { + Ok(DucPoint { + x: row.get(0)?, + y: row.get(1)?, + mirroring: row.get::<_, Option>(2)?.map(int_to_bezier_mirroring), + }) + })?.collect::, _>>()?; + Ok(points) +} + +// ─── backgrounds & strokes ─────────────────────────────────────────────────── + +fn read_backgrounds(conn: &Connection, owner_type: &str, owner_id: &str) -> ParseResult> { + let mut stmt = conn.prepare_cached( + "SELECT id, preference, src, visible, opacity, + tiling_size_in_percent, tiling_angle, tiling_spacing, tiling_offset_x, tiling_offset_y, + hatch_style, hatch_pattern_name, hatch_pattern_scale, hatch_pattern_angle, + hatch_pattern_origin_x, hatch_pattern_origin_y, hatch_pattern_origin_mirror, + hatch_pattern_double, + hatch_custom_pattern_name, hatch_custom_pattern_desc, + image_filter_brightness, image_filter_contrast + FROM backgrounds WHERE owner_type = ?1 AND owner_id = ?2 ORDER BY sort_order" + )?; + + let rows: Vec<(i64, ElementBackground)> = stmt.query_map(params![owner_type, owner_id], |row| { + let bg_id: i64 = row.get(0)?; + let content = read_element_content_base(row, 1)?; + Ok((bg_id, ElementBackground { content })) + })?.collect::, _>>()?; + + let mut bgs = Vec::with_capacity(rows.len()); + for (bg_id, mut bg) in rows { + if let Some(ref mut hatch) = bg.content.hatch { + if let Some(ref mut cp) = hatch.custom_pattern { + cp.lines = read_hatch_pattern_lines(conn, "background", bg_id)?; + } + } + bgs.push(bg); + } + Ok(bgs) +} + +fn read_strokes(conn: &Connection, owner_type: &str, owner_id: &str) -> ParseResult> { + let mut stmt = conn.prepare_cached( + "SELECT id, preference, src, visible, opacity, + tiling_size_in_percent, tiling_angle, tiling_spacing, tiling_offset_x, tiling_offset_y, + hatch_style, hatch_pattern_name, hatch_pattern_scale, hatch_pattern_angle, + hatch_pattern_origin_x, hatch_pattern_origin_y, hatch_pattern_origin_mirror, + hatch_pattern_double, + hatch_custom_pattern_name, hatch_custom_pattern_desc, + image_filter_brightness, image_filter_contrast, + width, + style_preference, style_cap, style_join, style_dash, style_dash_line_override, style_dash_cap, style_miter_limit, + placement, + sides_preference, sides_values + FROM strokes WHERE owner_type = ?1 AND owner_id = ?2 ORDER BY sort_order" + )?; + + let rows: Vec<(i64, ElementStroke)> = stmt.query_map(params![owner_type, owner_id], |row| { + let st_id: i64 = row.get(0)?; + let content = read_element_content_base(row, 1)?; + + let dash_blob: Option> = row.get(26)?; + let dash = dash_blob.map(|b| blob_to_f64_vec(&b)); + + let sides_blob: Option> = row.get(32)?; + let sides_pref: Option = row.get(31)?; + let stroke_sides = if sides_pref.is_some() || sides_blob.is_some() { + Some(StrokeSides { + preference: sides_pref.map(int_to_stroke_side_preference), + values: sides_blob.map(|b| blob_to_f64_vec(&b)), + }) + } else { + None + }; + + Ok((st_id, ElementStroke { + content, + width: row.get(22)?, + style: StrokeStyle { + preference: row.get::<_, Option>(23)?.map(int_to_stroke_preference), + cap: row.get::<_, Option>(24)?.map(int_to_stroke_cap), + join: row.get::<_, Option>(25)?.map(int_to_stroke_join), + dash, + dash_line_override: row.get(27)?, + dash_cap: row.get::<_, Option>(28)?.map(int_to_stroke_cap), + miter_limit: row.get(29)?, + }, + placement: row.get::<_, Option>(30)?.map(int_to_stroke_placement), + stroke_sides, + })) + })?.collect::, _>>()?; + + let mut strokes = Vec::with_capacity(rows.len()); + for (st_id, mut st) in rows { + if let Some(ref mut hatch) = st.content.hatch { + if let Some(ref mut cp) = hatch.custom_pattern { + cp.lines = read_hatch_pattern_lines(conn, "stroke", st_id)?; + } + } + strokes.push(st); + } + Ok(strokes) +} + +fn read_element_content_base(row: &rusqlite::Row, offset: usize) -> rusqlite::Result { + let tiling_size: Option = row.get(offset + 4)?; + let tiling = tiling_size.map(|size_in_percent| TilingProperties { + size_in_percent, + angle: row.get::<_, f64>(offset + 5).unwrap_or(0.0), + spacing: row.get(offset + 6).ok().flatten(), + offset_x: row.get(offset + 7).ok().flatten(), + offset_y: row.get(offset + 8).ok().flatten(), + }); + + let hatch_style_val: Option = row.get(offset + 9)?; + let hatch = hatch_style_val.map(|hs| { + let custom_name: Option = row.get(offset + 17).ok().flatten(); + let custom_pattern = custom_name.map(|name| CustomHatchPattern { + name, + description: row.get(offset + 18).ok().flatten(), + lines: Vec::new(), // loaded separately + }); + + DucHatchStyle { + hatch_style: int_to_hatch_style(hs), + pattern_name: row.get::<_, String>(offset + 10).unwrap_or_default(), + pattern_scale: row.get::<_, f32>(offset + 11).unwrap_or(1.0), + pattern_angle: row.get::<_, f64>(offset + 12).unwrap_or(0.0), + pattern_origin: DucPoint { + x: row.get::<_, f64>(offset + 13).unwrap_or(0.0), + y: row.get::<_, f64>(offset + 14).unwrap_or(0.0), + mirroring: row.get::<_, Option>(offset + 15).ok().flatten().map(int_to_bezier_mirroring), + }, + pattern_double: row.get::<_, Option>(offset + 16).ok().flatten().unwrap_or(0) != 0, + custom_pattern, + } + }); + + let brightness: Option = row.get(offset + 19)?; + let image_filter = brightness.map(|b| DucImageFilter { + brightness: b, + contrast: row.get::<_, f32>(offset + 20).unwrap_or(1.0), + }); + + Ok(ElementContentBase { + preference: row.get::<_, Option>(offset)?.map(int_to_content_preference), + src: row.get(offset + 1)?, + visible: row.get::<_, i32>(offset + 2)? != 0, + opacity: row.get(offset + 3)?, + tiling, + hatch, + image_filter, + }) +} + +fn read_hatch_pattern_lines(conn: &Connection, owner_type: &str, owner_id: i64) -> ParseResult> { + let mut stmt = conn.prepare_cached( + "SELECT angle, origin_x, origin_y, origin_mirroring, offset_x, offset_y, dash_pattern + FROM hatch_pattern_lines WHERE owner_type = ?1 AND owner_id = ?2 ORDER BY sort_order" + )?; + let lines: Vec = stmt.query_map(params![owner_type, owner_id], |row| { + let dash_blob: Option> = row.get(6)?; + let dash_pattern = dash_blob.map(|b| blob_to_f64_vec(&b)).unwrap_or_default(); + Ok(HatchPatternLine { + angle: row.get(0)?, + origin: DucPoint { + x: row.get(1)?, + y: row.get(2)?, + mirroring: row.get::<_, Option>(3)?.map(int_to_bezier_mirroring), + }, + offset: vec![row.get(4)?, row.get(5)?], + dash_pattern, + }) + })?.collect::, _>>()?; + Ok(lines) +} + +// ─── external_files ────────────────────────────────────────────────────────── + +fn read_external_files(conn: &Connection) -> ParseResult>> { + let mut stmt = conn.prepare( + "SELECT id, mime_type, data, created, last_retrieved, version FROM external_files" + )?; + let mut map = HashMap::new(); + let rows = stmt.query_map([], |row| { + let id: String = row.get(0)?; + Ok((id.clone(), DucExternalFileData { + id, + mime_type: row.get(1)?, + data: row.get(2)?, + created: row.get(3)?, + last_retrieved: row.get(4)?, + version: row.get(5)?, + })) + })?; + for row in rows { + let (k, v) = row?; + map.insert(k, v); + } -fn parse_duc_table_row(row: fb::DucTableRow) -> ParseResult { - Ok(types::DucTableRow { - id: row.id().to_string(), - height: row.height(), - style_overrides: row.style_overrides().map(parse_duc_table_cell_style).transpose()?, - }) + if map.is_empty() { Ok(None) } else { Ok(Some(map)) } } -fn parse_duc_table_cell_span(span: fb::DucTableCellSpan) -> ParseResult { - Ok(types::DucTableCellSpan { - columns: span.columns(), - rows: span.rows(), - }) -} +// ─── version_graph ─────────────────────────────────────────────────────────── -fn parse_duc_table_cell(cell: fb::DucTableCell) -> ParseResult { - Ok(types::DucTableCell { - row_id: cell.row_id().ok_or("Missing DucTableCell.row_id")?.to_string(), - column_id: cell.column_id().ok_or("Missing DucTableCell.column_id")?.to_string(), - data: cell.data().map(|s| s.to_string()).unwrap_or_default(), - span: cell.span().map(parse_duc_table_cell_span).transpose()?, - locked: cell.locked(), - style_overrides: cell.style_overrides().map(parse_duc_table_cell_style).transpose()?, - }) -} +fn read_version_graph(conn: &Connection) -> ParseResult> { + // Check if version_graph table exists and has data + let has_table: bool = conn.prepare( + "SELECT count(*) FROM sqlite_master WHERE type='table' AND name='version_graph'" + )?.query_row([], |row| row.get::<_, i32>(0)).unwrap_or(0) > 0; -fn parse_duc_table_column_entry(entry: fb::DucTableColumnEntry) -> ParseResult { - Ok(types::DucTableColumnEntry { - key: entry.key().to_string(), - value: parse_duc_table_column(entry.value().ok_or("Missing DucTableColumnEntry.value")?)?, - }) -} + if !has_table { + return Ok(None); + } -fn parse_duc_table_row_entry(entry: fb::DucTableRowEntry) -> ParseResult { - Ok(types::DucTableRowEntry { - key: entry.key().to_string(), - value: parse_duc_table_row(entry.value().ok_or("Missing DucTableRowEntry.value")?)?, - }) -} + let mut vg_stmt = conn.prepare( + "SELECT current_version, current_schema_version, user_checkpoint_version_id, + latest_version_id, chain_count, last_pruned, total_size + FROM version_graph WHERE id = 1" + )?; + let (metadata, user_cp_id, latest_id) = match vg_stmt.query_row([], |row| { + Ok(( + VersionGraphMetadata { + current_version: row.get(0)?, + current_schema_version: row.get(1)?, + chain_count: row.get(4)?, + last_pruned: row.get::<_, Option>(5)?.unwrap_or(0), + total_size: row.get::<_, Option>(6)?.unwrap_or(0), + }, + row.get::<_, Option>(2)?.unwrap_or_default(), + row.get::<_, Option>(3)?.unwrap_or_default(), + )) + }) { + Ok(v) => v, + Err(rusqlite::Error::QueryReturnedNoRows) => return Ok(None), + Err(e) => return Err(e.into()), + }; -fn parse_duc_table_cell_entry(entry: fb::DucTableCellEntry) -> ParseResult { - Ok(types::DucTableCellEntry { - key: entry.key().to_string(), - value: parse_duc_table_cell(entry.value().ok_or("Missing DucTableCellEntry.value")?)?, - }) + // Read migrations keyed by id + let mut m_stmt = conn.prepare( + "SELECT id, from_schema_version, to_schema_version, migration_name, + migration_checksum, applied_at, boundary_checkpoint_id + FROM schema_migrations" + )?; + let migrations: HashMap = m_stmt.query_map([], |row| { + let id: i64 = row.get(0)?; + Ok((id, SchemaMigration { + from_schema_version: row.get(1)?, + to_schema_version: row.get(2)?, + migration_name: row.get(3)?, + migration_checksum: row.get(4)?, + applied_at: row.get(5)?, + boundary_checkpoint_id: row.get(6)?, + })) + })?.collect::, _>>().unwrap_or_default(); + + // Version chains + let mut ch_stmt = conn.prepare( + "SELECT id, schema_version, start_version, end_version, migration_id, root_checkpoint_id + FROM version_chains ORDER BY start_version" + )?; + let chains: Vec = ch_stmt.query_map([], |row| { + let mig_id: Option = row.get(4)?; + Ok(VersionChain { + id: row.get(0)?, + schema_version: row.get(1)?, + start_version: row.get(2)?, + end_version: row.get(3)?, + migration: mig_id.and_then(|mid| migrations.get(&mid).cloned()), + root_checkpoint_id: row.get(5)?, + }) + })?.collect::, _>>()?; + + // Checkpoints + let mut cp_stmt = conn.prepare( + "SELECT id, parent_id, version_number, schema_version, timestamp, + description, is_manual_save, is_schema_boundary, user_id, data, size_bytes + FROM checkpoints ORDER BY version_number" + )?; + let checkpoints: Vec = cp_stmt.query_map([], |row| { + Ok(Checkpoint { + base: VersionBase { + id: row.get(0)?, + parent_id: row.get(1)?, + timestamp: row.get(4)?, + description: row.get(5)?, + is_manual_save: row.get::<_, i32>(6)? != 0, + user_id: row.get(8)?, + }, + version_number: row.get(2)?, + schema_version: row.get(3)?, + is_schema_boundary: row.get::<_, i32>(7)? != 0, + data: row.get::<_, Option>>(9)?.unwrap_or_default(), + size_bytes: row.get::<_, Option>(10)?.unwrap_or(0), + }) + })?.collect::, _>>()?; + + // Deltas + let mut d_stmt = conn.prepare( + "SELECT id, parent_id, base_checkpoint_id, version_number, schema_version, + timestamp, description, is_manual_save, user_id, changeset, size_bytes + FROM deltas ORDER BY version_number" + )?; + let deltas: Vec = d_stmt.query_map([], |row| { + Ok(Delta { + base: VersionBase { + id: row.get(0)?, + parent_id: row.get(1)?, + timestamp: row.get(5)?, + description: row.get(6)?, + is_manual_save: row.get::<_, i32>(7)? != 0, + user_id: row.get(8)?, + }, + base_checkpoint_id: row.get(2)?, + version_number: row.get(3)?, + schema_version: row.get(4)?, + payload: row.get::<_, Option>>(9)?.unwrap_or_default(), + size_bytes: row.get::<_, Option>(10)?.unwrap_or(0), + }) + })?.collect::, _>>()?; + + Ok(Some(VersionGraph { + user_checkpoint_version_id: user_cp_id, + latest_version_id: latest_id, + chains, + checkpoints, + deltas, + metadata, + })) } -fn parse_duc_table_auto_size(auto_size: fb::DucTableAutoSize) -> ParseResult { - Ok(types::DucTableAutoSize { - columns: auto_size.columns(), - rows: auto_size.rows(), - }) -} +// ─── defaults ──────────────────────────────────────────────────────────────── -fn parse_duc_table_element(el: fb::DucTableElement) -> ParseResult { - let columns_vec = el.columns().ok_or("Missing DucTableElement.columns")?; - let columns = columns_vec.iter().map(parse_duc_table_column_entry).collect::>()?; - - let rows_vec = el.rows().ok_or("Missing DucTableElement.rows")?; - let rows = rows_vec.iter().map(parse_duc_table_row_entry).collect::>()?; - - let cells_vec = el.cells().ok_or("Missing DucTableElement.cells")?; - let cells = cells_vec.iter().map(parse_duc_table_cell_entry).collect::>()?; - - Ok(types::DucTableElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucTableElement.base")?)?, - style: parse_duc_table_style(el.style().ok_or("Missing DucTableElement.style")?)?, - column_order: parse_vec_of_required_strings(el.column_order())?, - row_order: parse_vec_of_required_strings(el.row_order())?, - columns, - rows, - cells, - header_row_count: el.header_row_count(), - auto_size: parse_duc_table_auto_size(el.auto_size().ok_or("Missing DucTableElement.auto_size")?)?, - }) +fn default_stroke() -> ElementStroke { + ElementStroke { + content: ElementContentBase { + preference: None, + src: String::new(), + visible: true, + opacity: 1.0, + tiling: None, + hatch: None, + image_filter: None, + }, + width: 1.0, + style: StrokeStyle { + preference: None, + cap: None, + join: None, + dash: None, + dash_line_override: None, + dash_cap: None, + miter_limit: None, + }, + placement: None, + stroke_sides: None, + } } -fn parse_image_crop(crop: fb::ImageCrop) -> ParseResult { - Ok(types::ImageCrop { - x: crop.x(), - y: crop.y(), - width: crop.width(), - height: crop.height(), - natural_width: crop.natural_width(), - natural_height: crop.natural_height(), - }) -} - -fn parse_duc_image_element(el: fb::DucImageElement) -> ParseResult { - Ok(types::DucImageElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucImageElement.base")?)?, - file_id: el.file_id().map(|s| s.to_string()), - status: el.status().expect("Missing DucImageElement.status"), - scale: el.scale().ok_or("Missing DucImageElement.scale")?.iter().collect(), - crop: el.crop().map(parse_image_crop).transpose()?, - filter: el.filter().map(parse_duc_image_filter).transpose()?, - }) -} - -fn parse_duc_text_dynamic_element_source(source: fb::DucTextDynamicElementSource) -> ParseResult { - Ok(types::DucTextDynamicElementSource { - element_id: source.element_id().ok_or("Missing DucTextDynamicElementSource.element_id")?.to_string(), - property: source.property(), - }) -} - -fn parse_duc_text_dynamic_dictionary_source(source: fb::DucTextDynamicDictionarySource) -> ParseResult { - Ok(types::DucTextDynamicDictionarySource { - key: source.key().ok_or("Missing DucTextDynamicDictionarySource.key")?.to_string(), - }) -} - -fn parse_duc_text_dynamic_source(source: fb::DucTextDynamicSource) -> ParseResult { - let source_data = match source.source_type() { - fb::DucTextDynamicSourceData::DucTextDynamicElementSource => { - let el_source = source.source_as_duc_text_dynamic_element_source().ok_or("Mismatched dynamic source data")?; - types::DucTextDynamicSourceData::DucTextDynamicElementSource(parse_duc_text_dynamic_element_source(el_source)?) - }, - fb::DucTextDynamicSourceData::DucTextDynamicDictionarySource => { - let dict_source = source.source_as_duc_text_dynamic_dictionary_source().ok_or("Mismatched dynamic source data")?; - types::DucTextDynamicSourceData::DucTextDynamicDictionarySource(parse_duc_text_dynamic_dictionary_source(dict_source)?) - }, - _ => return Err("Unknown DucTextDynamicSourceData type"), - }; - Ok(types::DucTextDynamicSource { - text_source_type: source.text_source_type(), - source: source_data, - formatting: None, - cached_value: String::new(), - }) -} - -fn parse_duc_text_dynamic_part(part: fb::DucTextDynamicPart) -> ParseResult { - Ok(types::DucTextDynamicPart { - tag: part.tag().ok_or("Missing DucTextDynamicPart.tag")?.to_string(), - source: parse_duc_text_dynamic_source(part.source().ok_or("Missing DucTextDynamicPart.source")?)?, - formatting: part.formatting().map(parse_primary_units).transpose()?, - cached_value: part.cached_value().ok_or("Missing DucTextDynamicPart.cached_value")?.to_string(), - }) -} - -fn parse_duc_text_element(el: fb::DucTextElement) -> ParseResult { - let dynamic = if let Some(dynamic_vec) = el.dynamic() { - dynamic_vec.iter().map(parse_duc_text_dynamic_part).collect::>()? - } else { - Vec::new() - }; - Ok(types::DucTextElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucTextElement.base")?)?, - style: parse_duc_text_style(el.style().ok_or("Missing DucTextElement.style")?)?, - text: el.text().map(|s| s.to_string()).ok_or("Missing DucTextElement.text")?, - dynamic, - auto_resize: el.auto_resize(), - container_id: el.container_id().map(|s| s.to_string()), - original_text: el.original_text().map(|s| s.to_string()).unwrap_or_default(), - }) -} - -fn parse_duc_linear_element(el: fb::DucLinearElement) -> ParseResult { - Ok(types::DucLinearElement { - linear_base: parse_duc_linear_element_base(el.linear_base().ok_or("Missing DucLinearElement.linear_base")?)?, - wipeout_below: el.wipeout_below(), - }) -} - -fn parse_duc_arrow_element(el: fb::DucArrowElement) -> ParseResult { - Ok(types::DucArrowElement { - linear_base: parse_duc_linear_element_base(el.linear_base().ok_or("Missing DucArrowElement.linear_base")?)?, - elbowed: el.elbowed(), - }) -} - -fn parse_duc_free_draw_ends(ends: fb::DucFreeDrawEnds) -> ParseResult { - Ok(types::DucFreeDrawEnds { - cap: ends.cap(), - taper: ends.taper(), - easing: ends.easing().unwrap_or_default().to_string(), - }) -} - -fn parse_duc_free_draw_element(el: fb::DucFreeDrawElement) -> ParseResult { - Ok(types::DucFreeDrawElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucFreeDrawElement.base")?)?, - points: parse_vec_of_duc_points(el.points()), - size: el.size(), - thinning: el.thinning(), - smoothing: el.smoothing(), - streamline: el.streamline(), - easing: el.easing().unwrap_or_default().to_string(), - start: el.start().map(parse_duc_free_draw_ends).transpose()?, - end: el.end().map(parse_duc_free_draw_ends).transpose()?, - pressures: el.pressures().map(|v| v.iter().collect()).unwrap_or_default(), - simulate_pressure: el.simulate_pressure(), - last_committed_point: el.last_committed_point().map(|p| parse_duc_point(p)), - svg_path: el.svg_path().map(|s| s.to_string()), - }) -} - -fn parse_duc_block_duplication_array(array: fb::DucBlockDuplicationArray) -> ParseResult { - Ok(types::DucBlockDuplicationArray { - rows: array.rows(), - cols: array.cols(), - row_spacing: array.row_spacing(), - col_spacing: array.col_spacing(), - }) -} - -fn parse_duc_frame_element(el: fb::DucFrameElement) -> ParseResult { - Ok(types::DucFrameElement { - stack_element_base: parse_duc_stack_element_base(el.stack_element_base().ok_or("Missing DucFrameElement.stack_element_base")?)?, - }) -} - -fn parse_plot_layout(layout: fb::PlotLayout) -> ParseResult { - Ok(types::PlotLayout { - margins: parse_margins(layout.margins().ok_or("Missing PlotLayout.margins")?)?, - }) -} - -fn parse_duc_plot_element(el: fb::DucPlotElement) -> ParseResult { - Ok(types::DucPlotElement { - stack_element_base: parse_duc_stack_element_base(el.stack_element_base().ok_or("Missing DucPlotElement.stack_element_base")?)?, - style: parse_duc_plot_style(el.style().ok_or("Missing DucPlotElement.style")?)?, - layout: parse_plot_layout(el.layout().ok_or("Missing DucPlotElement.layout")?)?, - }) -} - -fn parse_duc_viewport_element(el: fb::DucViewportElement) -> ParseResult { - Ok(types::DucViewportElement { - linear_base: parse_duc_linear_element_base(el.linear_base().ok_or("Missing DucViewportElement.linear_base")?)?, - stack_base: parse_duc_stack_base(el.stack_base().ok_or("Missing DucViewportElement.stack_base")?)?, - style: parse_duc_viewport_style(el.style().ok_or("Missing DucViewportElement.style")?)?, - view: parse_duc_view(el.view().ok_or("Missing DucViewportElement.view")?)?, - scale: el.scale(), - shade_plot: el.shade_plot().expect("Missing DucViewportElement.shade_plot"), - frozen_group_ids: parse_vec_of_strings(el.frozen_group_ids()), - standard_override: el.standard_override().map(|s| s.to_string()), - }) -} - -fn parse_duc_xray_element(el: fb::DucXRayElement) -> ParseResult { - Ok(types::DucXRayElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucXRayElement.base")?)?, - style: parse_duc_xray_style(el.style().ok_or("Missing DucXRayElement.style")?)?, - origin: { - let p = parse_required_duc_point(el.origin())?; - types::GeometricPoint { x: p.x, y: p.y } +fn default_background() -> ElementBackground { + ElementBackground { + content: ElementContentBase { + preference: None, + src: String::new(), + visible: true, + opacity: 1.0, + tiling: None, + hatch: None, + image_filter: None, }, - direction: { - let p = parse_required_duc_point(el.direction())?; - types::GeometricPoint { x: p.x, y: p.y } - }, - start_from_origin: el.start_from_origin(), - }) -} - -fn parse_leader_text_block_content(content: fb::LeaderTextBlockContent) -> ParseResult { - Ok(types::LeaderTextBlockContent { - text: content.text().ok_or("Missing LeaderTextBlockContent.text")?.to_string(), - }) -} - -fn parse_leader_block_content(content: fb::LeaderBlockContent) -> ParseResult { - let attribute_values = content - .attribute_values() - .map(|v| v.iter().map(parse_string_value_entry).collect::>>()) - .transpose()? - .unwrap_or_default(); - - let element_overrides = content - .element_overrides() - .map(|v| v.iter().map(parse_string_value_entry).collect::>>()) - .transpose()? - .unwrap_or_default(); - - Ok(types::LeaderBlockContent { - block_id: content.block_id().ok_or("Missing LeaderBlockContent.block_id")?.to_string(), - attribute_values: Some(attribute_values), - element_overrides: Some(element_overrides), - }) -} - -fn parse_leader_content(content: fb::LeaderContent) -> ParseResult { - let content_data = match content.leader_content_type() { - Some(fb::LEADER_CONTENT_TYPE::TEXT) => { - let text_content = content.content_as_leader_text_block_content().ok_or("Mismatched leader content data")?; - types::LeaderContentData::LeaderTextBlockContent(parse_leader_text_block_content(text_content)?) - } - Some(fb::LEADER_CONTENT_TYPE::BLOCK) => { - let block_content = content.content_as_leader_block_content().ok_or("Mismatched leader content data")?; - types::LeaderContentData::LeaderBlockContent(parse_leader_block_content(block_content)?) - } - _ => return Err("Unknown LeaderContentData type"), - }; - Ok(types::LeaderContent { - leader_content_type: content.leader_content_type().expect("Missing LeaderContent.leader_content_type"), - content: content_data, - }) -} - -fn parse_duc_leader_element(el: fb::DucLeaderElement) -> ParseResult { - Ok(types::DucLeaderElement { - linear_base: parse_duc_linear_element_base(el.linear_base().ok_or("Missing DucLeaderElement.linear_base")?)?, - style: parse_duc_leader_style(el.style().ok_or("Missing DucLeaderElement.style")?)?, - content: el.content().map(parse_leader_content).transpose()?, - content_anchor: parse_required_geometric_point(el.content_anchor().copied())?, - }) -} - -fn parse_dimension_definition_points(points: fb::DimensionDefinitionPoints) -> ParseResult { - Ok(types::DimensionDefinitionPoints { - origin1: parse_required_geometric_point(points.origin1().copied())?, - origin2: points.origin2().map(|p| parse_geometric_point(&p)), - location: parse_required_geometric_point(points.location().copied())?, - center: points.center().map(|p| parse_geometric_point(&p)), - jog: points.jog().map(|p| parse_geometric_point(&p)), - }) -} - -fn parse_dimension_bindings(bindings: fb::DimensionBindings) -> ParseResult { - Ok(types::DimensionBindings { - origin1: bindings.origin1().map(parse_duc_point_binding).transpose()?, - origin2: bindings.origin2().map(parse_duc_point_binding).transpose()?, - center: bindings.center().map(parse_duc_point_binding).transpose()?, - }) -} - -fn parse_dimension_baseline_data(data: fb::DimensionBaselineData) -> ParseResult { - Ok(types::DimensionBaselineData { - base_dimension_id: data.base_dimension_id().map(|s| s.to_string()), - }) -} - -fn parse_dimension_continue_data(data: fb::DimensionContinueData) -> ParseResult { - Ok(types::DimensionContinueData { - continue_from_dimension_id: data.continue_from_dimension_id().map(|s| s.to_string()), - }) -} - -fn parse_duc_dimension_element(el: fb::DucDimensionElement) -> ParseResult { - Ok(types::DucDimensionElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucDimensionElement.base")?)?, - style: parse_duc_dimension_style(el.style().ok_or("Missing DucDimensionElement.style")?)?, - dimension_type: el.dimension_type().expect("Missing DucDimensionElement.dimension_type"), - definition_points: parse_dimension_definition_points(el.definition_points().ok_or("Missing DucDimensionElement.definition_points")?)?, - oblique_angle: el.oblique_angle(), - ordinate_axis: el.ordinate_axis(), - bindings: el.bindings().map(parse_dimension_bindings).transpose()?, - text_override: el.text_override().map(|s| s.to_string()), - text_position: el.text_position().map(|p| parse_geometric_point(&p)), - tolerance_override: el.tolerance_override().map(parse_dimension_tolerance_style).transpose()?, - baseline_data: el.baseline_data().map(parse_dimension_baseline_data).transpose()?, - continue_data: el.continue_data().map(parse_dimension_continue_data).transpose()?, - }) -} - -fn parse_datum_reference(datum: fb::DatumReference) -> ParseResult { - Ok(types::DatumReference { - letters: datum.letters().map(|s| s.to_string()).ok_or("Missing DatumReference.letters")?, - modifier: datum.modifier(), - }) -} - -fn parse_tolerance_clause(clause: fb::ToleranceClause) -> ParseResult { - Ok(types::ToleranceClause { - value: clause.value().map(|s| s.to_string()).ok_or("Missing ToleranceClause.value")?, - zone_type: clause.zone_type(), - feature_modifiers: clause.feature_modifiers().ok_or("Missing ToleranceClause.feature_modifiers")?.iter().collect(), - material_condition: clause.material_condition(), - }) -} - -fn parse_feature_control_frame_segment(segment: fb::FeatureControlFrameSegment) -> ParseResult { - let datums_vec = segment.datums().ok_or("Missing FeatureControlFrameSegment.datums")?; - let datums = datums_vec - .iter() - .map(|d| Ok(Some(parse_datum_reference(d)?))) - .collect::>>>()?; - Ok(types::FeatureControlFrameSegment { - symbol: segment.symbol().expect("Missing FeatureControlFrameSegment.symbol"), - tolerance: parse_tolerance_clause(segment.tolerance().ok_or("Missing FeatureControlFrameSegment.tolerance")?)?, - datums, - }) -} - -fn parse_fcf_between_modifier(modifier: fb::FCFBetweenModifier) -> ParseResult { - Ok(types::FCFBetweenModifier { - start: modifier.start().ok_or("Missing FCFBetweenModifier.start")?.to_string(), - end: modifier.end().ok_or("Missing FCFBetweenModifier.end")?.to_string(), - }) -} - -fn parse_fcf_projected_zone_modifier(modifier: fb::FCFProjectedZoneModifier) -> ParseResult { - Ok(types::FCFProjectedZoneModifier { - value: modifier.value(), - }) -} - -fn parse_fcf_frame_modifiers(modifiers: fb::FCFFrameModifiers) -> ParseResult { - Ok(types::FCFFrameModifiers { - all_around: modifiers.all_around(), - all_over: modifiers.all_over(), - continuous_feature: modifiers.continuous_feature(), - between: modifiers.between().map(parse_fcf_between_modifier).transpose()?, - projected_tolerance_zone: modifiers.projected_tolerance_zone().map(parse_fcf_projected_zone_modifier).transpose()?, - }) -} - -fn parse_fcf_datum_definition(def: fb::FCFDatumDefinition) -> ParseResult { - Ok(types::FCFDatumDefinition { - letter: def.letter().map(|s| s.to_string()).ok_or("Missing FCFDatumDefinition.letter")?, - feature_binding: def.feature_binding().map(parse_duc_point_binding).transpose()?, - }) -} - -fn parse_fcf_segment_row(row: fb::FCFSegmentRow) -> ParseResult { - let segments_vec = row.segments().ok_or("Missing FCFSegmentRow.segments")?; - let segments = segments_vec.iter().map(parse_feature_control_frame_segment).collect::>()?; - Ok(types::FCFSegmentRow { - segments, - }) -} - -fn parse_duc_feature_control_frame_element(el: fb::DucFeatureControlFrameElement) -> ParseResult { - let rows_vec = el.rows().ok_or("Missing DucFeatureControlFrameElement.rows")?; - let rows = rows_vec.iter().map(parse_fcf_segment_row).collect::>()?; - Ok(types::DucFeatureControlFrameElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucFeatureControlFrameElement.base")?)?, - style: parse_duc_feature_control_frame_style(el.style().ok_or("Missing DucFeatureControlFrameElement.style")?)?, - rows, - frame_modifiers: el.frame_modifiers().map(parse_fcf_frame_modifiers).transpose()?, - leader_element_id: el.leader_element_id().map(|s| s.to_string()), - datum_definition: el.datum_definition().map(parse_fcf_datum_definition).transpose()?, - }) -} - -fn parse_text_column(col: fb::TextColumn) -> ParseResult { - Ok(types::TextColumn { - width: col.width(), - gutter: col.gutter(), - }) -} - -fn parse_column_layout(layout: fb::ColumnLayout) -> ParseResult { - let defs_vec = layout.definitions().ok_or("Missing ColumnLayout.definitions")?; - let definitions = defs_vec.iter().map(parse_text_column).collect::>()?; - Ok(types::ColumnLayout { - column_type: layout.type_().expect("Missing ColumnLayout.type"), - definitions, - auto_height: layout.auto_height(), - }) -} - -fn parse_duc_doc_element(el: fb::DucDocElement) -> ParseResult { - let dynamic = el - .dynamic() - .map(|v| v.iter().map(parse_duc_text_dynamic_part).collect::>>()) - .transpose()? - .unwrap_or_default(); - let grid_config = el.grid_config(); - Ok(types::DucDocElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucDocElement.base")?)?, - style: parse_duc_doc_style(el.style().ok_or("Missing DucDocElement.style")?)?, - text: el.text().map(|s| s.to_string()).ok_or("Missing DucDocElement.text")?, - dynamic, - flow_direction: el.flow_direction().expect("Missing DucDocElement.flow_direction"), - columns: parse_column_layout(el.columns().ok_or("Missing DucDocElement.columns")?)?, - auto_resize: el.auto_resize(), - file_id: el.file_id().map(|s| s.to_string()), - grid_config: match grid_config { - Some(gc) => types::DocumentGridConfig { - columns: gc.columns(), - gap_x: gc.gap_x(), - gap_y: gc.gap_y(), - align_items: gc.align_items().map(|a| a.into()).unwrap_or(types::DocumentGridAlignItems::Start), - first_page_alone: gc.first_page_alone(), - scale: gc.scale(), - }, - None => types::DocumentGridConfig { - columns: 1, - gap_x: 0.0, - gap_y: 0.0, - align_items: types::DocumentGridAlignItems::Start, - first_page_alone: false, - scale: 1.0, - }, - }, - }) -} - -fn parse_parametric_source(source: fb::ParametricSource) -> ParseResult { - Ok(types::ParametricSource { - source_type: source.type_().expect("Missing ParametricSource.type"), - code: source.code().unwrap_or_default().to_string(), - file_id: source.file_id().map(|s| s.to_string()), - }) -} - -fn parse_duc_parametric_element(el: fb::DucParametricElement) -> ParseResult { - Ok(types::DucParametricElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucParametricElement.base")?)?, - source: parse_parametric_source(el.source().ok_or("Missing DucParametricElement.source")?)?, - }) -} - -fn parse_duc_model_element(el: fb::DucModelElement) -> ParseResult { - let file_ids = el.file_ids() - .map(|v| v.iter().map(|s| s.to_string()).collect::>()) - .unwrap_or_default(); - Ok(types::DucModelElement { - base: parse_duc_element_base(el.base().ok_or("Missing DucModelElement.base")?)?, - source: el.source().ok_or("Missing DucModelElement.source")?.to_string(), - svg_path: el.svg_path().map(|s| s.to_string()), - file_ids, - }) -} - -// ============================================================================= -// ELEMENT UNION & WRAPPER -// ============================================================================= - -fn parse_element_wrapper(wrapper: fb::ElementWrapper) -> ParseResult { - let element_enum = match wrapper.element_type() { - fb::Element::DucRectangleElement => { - let el = wrapper.element_as_duc_rectangle_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucRectangleElement(parse_duc_rectangle_element(el)?) - }, - fb::Element::DucPolygonElement => { - let el = wrapper.element_as_duc_polygon_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucPolygonElement(parse_duc_polygon_element(el)?) - }, - fb::Element::DucEllipseElement => { - let el = wrapper.element_as_duc_ellipse_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucEllipseElement(parse_duc_ellipse_element(el)?) - }, - fb::Element::DucEmbeddableElement => { - let el = wrapper.element_as_duc_embeddable_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucEmbeddableElement(parse_duc_embeddable_element(el)?) - }, - fb::Element::DucPdfElement => { - let el = wrapper.element_as_duc_pdf_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucPdfElement(parse_duc_pdf_element(el)?) - }, - fb::Element::DucMermaidElement => { - let el = wrapper.element_as_duc_mermaid_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucMermaidElement(parse_duc_mermaid_element(el)?) - }, - fb::Element::DucTableElement => { - let el = wrapper.element_as_duc_table_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucTableElement(parse_duc_table_element(el)?) - }, - fb::Element::DucImageElement => { - let el = wrapper.element_as_duc_image_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucImageElement(parse_duc_image_element(el)?) - }, - fb::Element::DucTextElement => { - let el = wrapper.element_as_duc_text_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucTextElement(parse_duc_text_element(el)?) - }, - fb::Element::DucLinearElement => { - let el = wrapper.element_as_duc_linear_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucLinearElement(parse_duc_linear_element(el)?) - }, - fb::Element::DucArrowElement => { - let el = wrapper.element_as_duc_arrow_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucArrowElement(parse_duc_arrow_element(el)?) - }, - fb::Element::DucFreeDrawElement => { - let el = wrapper.element_as_duc_free_draw_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucFreeDrawElement(parse_duc_free_draw_element(el)?) - }, - fb::Element::DucFrameElement => { - let el = wrapper.element_as_duc_frame_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucFrameElement(parse_duc_frame_element(el)?) - }, - fb::Element::DucPlotElement => { - let el = wrapper.element_as_duc_plot_element().ok_or("Missing element type")?; - types::DucElementEnum::DucPlotElement(parse_duc_plot_element(el)?) - }, - fb::Element::DucViewportElement => { - let el = wrapper.element_as_duc_viewport_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucViewportElement(parse_duc_viewport_element(el)?) - }, - fb::Element::DucXRayElement => { - let el = wrapper.element_as_duc_xray_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucXRayElement(parse_duc_xray_element(el)?) - }, - fb::Element::DucLeaderElement => { - let el = wrapper.element_as_duc_leader_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucLeaderElement(parse_duc_leader_element(el)?) - }, - fb::Element::DucDimensionElement => { - let el = wrapper.element_as_duc_dimension_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucDimensionElement(parse_duc_dimension_element(el)?) - }, - fb::Element::DucFeatureControlFrameElement => { - let el = wrapper.element_as_duc_feature_control_frame_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucFeatureControlFrameElement(parse_duc_feature_control_frame_element(el)?) - }, - fb::Element::DucDocElement => { - let el = wrapper.element_as_duc_doc_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucDocElement(parse_duc_doc_element(el)?) - }, - fb::Element::DucParametricElement => { - let el = wrapper.element_as_duc_parametric_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucParametricElement(parse_duc_parametric_element(el)?) - }, - fb::Element::DucModelElement => { - let el = wrapper.element_as_duc_model_element().ok_or("Mismatched element type")?; - types::DucElementEnum::DucModelElement(parse_duc_model_element(el)?) - }, - _ => return Err("Unknown element type in wrapper"), - }; - Ok(types::ElementWrapper { element: element_enum }) -} - - -// ============================================================================= -// BLOCK DEFINITIONS -// ============================================================================= - -fn parse_duc_block_attribute_definition(def: fb::DucBlockAttributeDefinition) -> ParseResult { - Ok(types::DucBlockAttributeDefinition { - tag: def.tag().ok_or("Missing DucBlockAttributeDefinition.tag")?.to_string(), - prompt: def.prompt().map(|s| s.to_string()), - default_value: def.default_value().ok_or("Missing DucBlockAttributeDefinition.default_value")?.to_string(), - is_constant: def.is_constant(), - }) -} - -fn parse_duc_block_attribute_definition_entry(entry: fb::DucBlockAttributeDefinitionEntry) -> ParseResult { - Ok(types::DucBlockAttributeDefinitionEntry { - key: entry.key().to_string(), - value: parse_duc_block_attribute_definition(entry.value().ok_or("Missing DucBlockAttributeDefinitionEntry.value")?)?, - }) -} - -fn parse_duc_block_metadata(metadata: fb::DucBlockMetadata) -> ParseResult { - let source = metadata.source() - .map(|s| s.trim().to_string()) - .filter(|s| !s.is_empty()); - - Ok(types::DucBlockMetadata { - source, - usage_count: metadata.usage_count(), - created_at: metadata.created_at(), - updated_at: metadata.updated_at(), - localization: parse_binary_json_to_string(metadata.localization()), - }) -} - -fn parse_duc_block(block: fb::DucBlock) -> ParseResult { - let attribute_definitions = if let Some(defs_vec) = block.attribute_definitions() { - defs_vec.iter().map(parse_duc_block_attribute_definition_entry).collect::>()? - } else { - Vec::new() - }; - - let metadata = if let Some(metadata_fb) = block.metadata() { - Some(parse_duc_block_metadata(metadata_fb)?) - } else { - None - }; - - let thumbnail = block.thumbnail().map(|data| (0..data.len()).map(|i| data.get(i)).collect::>()); - - Ok(types::DucBlock { - id: block.id().to_string(), - label: block.label().map(|s| s.to_string()).unwrap_or_default(), - description: block.description().map(|s| s.to_string()), - version: block.version(), - attribute_definitions, - metadata, - thumbnail, - }) -} - -fn parse_duc_block_instance(el: fb::DucBlockInstance) -> ParseResult { - let element_overrides = el - .element_overrides() - .map(|v| v.iter().map(parse_string_value_entry).collect::>>()) - .transpose()? - .unwrap_or_default(); - let attribute_values = el - .attribute_values() - .map(|v| v.iter().map(parse_string_value_entry).collect::>>()) - .transpose()? - .unwrap_or_default(); - Ok(types::DucBlockInstance { - id: el.id().ok_or("Missing DucBlockInstance.id")?.to_string(), - block_id: el.block_id().ok_or("Missing DucBlockInstance.block_id")?.to_string(), - version: el.version(), - element_overrides: Some(element_overrides), - attribute_values: Some(attribute_values), - duplication_array: el.duplication_array().map(parse_duc_block_duplication_array).transpose()?, - }) -} - -fn parse_duc_block_collection(el: fb::DucBlockCollection) -> ParseResult { - let children = el - .children() - .map(|v| v.iter().map(parse_duc_block_collection_entry).collect::>>()) - .transpose()? - .unwrap_or_default(); - - let metadata = el.metadata().map(parse_duc_block_metadata).transpose()?; - - Ok(types::DucBlockCollection { - id: el.id().ok_or("Missing DucBlockCollection.id")?.to_string(), - label: el.label().ok_or("Missing DucBlockCollection.label")?.to_string(), - children, - metadata, - thumbnail: el.thumbnail().map(|b| b.bytes().to_vec()), - }) -} - -fn parse_duc_block_collection_entry(entry: fb::DucBlockCollectionEntry) -> ParseResult { - Ok(types::DucBlockCollectionEntry { - id: entry.id().ok_or("Missing DucBlockCollectionEntry.id")?.to_string(), - is_collection: entry.is_collection(), - }) -} - - -// ============================================================================= -// APP & DOCUMENT STATE -// ============================================================================= - -fn parse_duc_global_state(state: fb::DucGlobalState) -> ParseResult { - Ok(types::DucGlobalState { - name: Some(state.name().map(|s| s.to_string()).unwrap_or_default()), - view_background_color: state.view_background_color().map(|s| s.to_string()).unwrap_or_default(), - main_scope: state.main_scope().map(|s| s.to_string()).unwrap_or_default(), - dash_spacing_scale: state.dash_spacing_scale(), - is_dash_spacing_affected_by_viewport_scale: state.is_dash_spacing_affected_by_viewport_scale(), - scope_exponent_threshold: state.scope_exponent_threshold(), - dimensions_associative_by_default: state.dimensions_associative_by_default(), - use_annotative_scaling: state.use_annotative_scaling(), - display_precision_linear: state.display_precision_linear(), - display_precision_angular: state.display_precision_angular(), - pruning_level: state.pruning_level().expect("Missing DucGlobalState.pruning_level"), - }) -} - -fn parse_duc_local_state(state: fb::DucLocalState) -> ParseResult { - Ok(types::DucLocalState { - scope: state.scope().ok_or("Missing DucLocalState.scope")?.to_string(), - active_standard_id: state.active_standard_id().ok_or("Missing DucLocalState.active_standard_id")?.to_string(), - scroll_x: state.scroll_x(), - scroll_y: state.scroll_y(), - zoom: state.zoom(), - active_grid_settings: state.active_grid_settings().map(|v| { - let arr = parse_vec_of_strings(Some(v)); - if arr.is_empty() { None } else { Some(arr) } - }).flatten(), - active_snap_settings: state.active_snap_settings().map(|s| s.to_string()), - is_binding_enabled: state.is_binding_enabled(), - current_item_stroke: state.current_item_stroke().map(parse_element_stroke).transpose()?, - current_item_background: state.current_item_background().map(parse_element_background).transpose()?, - current_item_opacity: state.current_item_opacity(), - current_item_font_family: state.current_item_font_family().map(|s| s.to_string()).unwrap_or_default(), - current_item_font_size: state.current_item_font_size(), - current_item_text_align: state.current_item_text_align().unwrap_or(fb::TEXT_ALIGN(0)), - current_item_start_line_head: state.current_item_start_line_head().map(parse_duc_head).transpose()?, - current_item_end_line_head: state.current_item_end_line_head().map(parse_duc_head).transpose()?, - current_item_roundness: state.current_item_roundness(), - pen_mode: state.pen_mode(), - view_mode_enabled: state.view_mode_enabled(), - objects_snap_mode_enabled: state.objects_snap_mode_enabled(), - grid_mode_enabled: state.grid_mode_enabled(), - outline_mode_enabled: state.outline_mode_enabled(), - manual_save_mode: state.manual_save_mode(), - }) -} - -fn parse_duc_group(group: fb::DucGroup) -> ParseResult { - Ok(types::DucGroup { - id: group.id().to_string(), - stack_base: parse_duc_stack_base(group.stack_base().ok_or("Missing DucGroup.stack_base")?)?, - }) -} - -fn parse_duc_region(region: fb::DucRegion) -> ParseResult { - Ok(types::DucRegion { - id: region.id().to_string(), - stack_base: parse_duc_stack_base(region.stack_base().ok_or("Missing DucRegion.stack_base")?)?, - boolean_operation: region.boolean_operation().expect("Missing DucRegion.boolean_operation"), - }) -} - -fn parse_duc_layer_overrides(overrides: fb::DucLayerOverrides) -> ParseResult { - Ok(types::DucLayerOverrides { - stroke: parse_element_stroke(overrides.stroke().ok_or("Missing DucLayerOverrides.stroke")?)?, - background: parse_element_background(overrides.background().ok_or("Missing DucLayerOverrides.background")?)?, - }) -} - -fn parse_duc_layer(layer: fb::DucLayer) -> ParseResult { - Ok(types::DucLayer { - id: layer.id().to_string(), - stack_base: parse_duc_stack_base(layer.stack_base().ok_or("Missing DucLayer.stack_base")?)?, - readonly: layer.readonly(), - overrides: layer.overrides().map(parse_duc_layer_overrides).transpose()?, - }) -} - - -// ============================================================================= -// STANDARDS & SETTINGS -// ============================================================================= - -fn parse_unit_system_base(base: fb::_UnitSystemBase) -> ParseResult { - Ok(types::UnitSystemBase { - system: base.system().expect("Missing UnitSystemBase.system"), - format: None, - precision: base.precision(), - suppress_leading_zeros: base.suppress_leading_zeros(), - suppress_trailing_zeros: base.suppress_trailing_zeros(), - }) -} - -fn parse_linear_unit_system(sys: fb::LinearUnitSystem) -> ParseResult { - Ok(types::LinearUnitSystem { - base: parse_unit_system_base(sys.base().ok_or("Missing LinearUnitSystem.base")?)?, - format: sys.format().expect("Missing LinearUnitSystem.format"), - decimal_separator: sys.decimal_separator().expect("Missing LinearUnitSystem.decimal_separator"), - suppress_zero_feet: sys.suppress_zero_feet(), - suppress_zero_inches: sys.suppress_zero_inches(), - }) -} - -fn parse_angular_unit_system(sys: fb::AngularUnitSystem) -> ParseResult { - Ok(types::AngularUnitSystem { - base: parse_unit_system_base(sys.base().ok_or("Missing AngularUnitSystem.base")?)?, - format: sys.format().expect("Missing AngularUnitSystem.format"), - }) -} - -fn parse_alternate_units(units: fb::AlternateUnits) -> ParseResult { - Ok(types::AlternateUnits { - base: parse_unit_system_base(units.base().ok_or("Missing AlternateUnits.base")?)?, - format: units.format().expect("Missing AlternateUnits.format"), - is_visible: units.is_visible(), - multiplier: units.multiplier(), - }) -} - -fn parse_primary_units(units: fb::PrimaryUnits) -> ParseResult { - Ok(types::PrimaryUnits { - linear: parse_linear_unit_system(units.linear().ok_or("Missing PrimaryUnits.linear")?)?, - angular: parse_angular_unit_system(units.angular().ok_or("Missing PrimaryUnits.angular")?)?, - }) -} - -fn parse_standard_units(units: fb::StandardUnits) -> ParseResult { - Ok(types::StandardUnits { - primary_units: parse_primary_units(units.primary_units().ok_or("Missing StandardUnits.primary_units")?)?, - alternate_units: parse_alternate_units(units.alternate_units().ok_or("Missing StandardUnits.alternate_units")?)?, - }) -} - -fn parse_unit_precision(precision: fb::UnitPrecision) -> ParseResult { - Ok(types::UnitPrecision { - linear: Some(precision.linear()), - angular: Some(precision.angular()), - area: Some(precision.area()), - volume: Some(precision.volume()), - }) -} - -fn parse_standard_overrides(overrides: fb::StandardOverrides) -> ParseResult { - let _ = overrides.active_grid_settings_id().map(|v| parse_vec_of_strings(Some(v))); - Ok(types::StandardOverrides { - main_scope: overrides.main_scope().map(|s| s.to_string()), - elements_stroke_width_override: Some(overrides.elements_stroke_width_override()), - common_style_id: overrides.common_style_id().map(|s| s.to_string()), - stack_like_style_id: overrides.stack_like_style_id().map(|s| s.to_string()), - text_style_id: overrides.text_style_id().map(|s| s.to_string()), - dimension_style_id: overrides.dimension_style_id().map(|s| s.to_string()), - leader_style_id: overrides.leader_style_id().map(|s| s.to_string()), - feature_control_frame_style_id: overrides.feature_control_frame_style_id().map(|s| s.to_string()), - table_style_id: overrides.table_style_id().map(|s| s.to_string()), - doc_style_id: overrides.doc_style_id().map(|s| s.to_string()), - viewport_style_id: overrides.viewport_style_id().map(|s| s.to_string()), - plot_style_id: overrides.plot_style_id().map(|s| s.to_string()), - hatch_style_id: overrides.hatch_style_id().map(|s| s.to_string()), - active_grid_settings_id: overrides.active_grid_settings_id().map(|v| v.iter().map(|s| s.to_string()).collect()), - active_snap_settings_id: overrides.active_snap_settings_id().map(|s| s.to_string()), - dash_line_override: overrides.dash_line_override().map(|s| s.to_string()), - unit_precision: overrides.unit_precision().map(parse_unit_precision).transpose()?, - }) -} - -fn parse_duc_common_style(style: fb::DucCommonStyle) -> ParseResult { - Ok(types::DucCommonStyle { - background: parse_element_background(style.background().ok_or("Missing DucCommonStyle.background")?)?, - stroke: parse_element_stroke(style.stroke().ok_or("Missing DucCommonStyle.stroke")?)?, - }) -} - -fn parse_identified_common_style(style: fb::IdentifiedCommonStyle) -> ParseResult { - Ok(types::IdentifiedCommonStyle { - id: parse_identifier(style.id().ok_or("Missing IdentifiedCommonStyle.id")?)?, - style: parse_duc_common_style(style.style().ok_or("Missing IdentifiedCommonStyle.style")?)?, - }) -} - -fn parse_identified_stack_like_style(style: fb::IdentifiedStackLikeStyle) -> ParseResult { - Ok(types::IdentifiedStackLikeStyle { - id: parse_identifier(style.id().ok_or("Missing IdentifiedStackLikeStyle.id")?)?, - style: parse_duc_stack_like_styles(style.style().ok_or("Missing IdentifiedStackLikeStyle.style")?)?, - }) -} - -fn parse_identified_text_style(style: fb::IdentifiedTextStyle) -> ParseResult { - Ok(types::IdentifiedTextStyle { - id: parse_identifier(style.id().ok_or("Missing IdentifiedTextStyle.id")?)?, - style: parse_duc_text_style(style.style().ok_or("Missing IdentifiedTextStyle.style")?)?, - }) -} - -fn parse_identified_dimension_style(style: fb::IdentifiedDimensionStyle) -> ParseResult { - Ok(types::IdentifiedDimensionStyle { - id: parse_identifier(style.id().ok_or("Missing IdentifiedDimensionStyle.id")?)?, - style: parse_duc_dimension_style(style.style().ok_or("Missing IdentifiedDimensionStyle.style")?)?, - }) -} - -fn parse_identified_leader_style(style: fb::IdentifiedLeaderStyle) -> ParseResult { - Ok(types::IdentifiedLeaderStyle { - id: parse_identifier(style.id().ok_or("Missing IdentifiedLeaderStyle.id")?)?, - style: parse_duc_leader_style(style.style().ok_or("Missing IdentifiedLeaderStyle.style")?)?, - }) -} - -fn parse_identified_fcf_style(style: fb::IdentifiedFCFStyle) -> ParseResult { - Ok(types::IdentifiedFCFStyle { - id: parse_identifier(style.id().ok_or("Missing IdentifiedFCFStyle.id")?)?, - style: parse_duc_feature_control_frame_style(style.style().ok_or("Missing IdentifiedFCFStyle.style")?)?, - }) -} - -fn parse_identified_table_style(style: fb::IdentifiedTableStyle) -> ParseResult { - Ok(types::IdentifiedTableStyle { - id: parse_identifier(style.id().ok_or("Missing IdentifiedTableStyle.id")?)?, - style: parse_duc_table_style(style.style().ok_or("Missing IdentifiedTableStyle.style")?)?, - }) -} - -fn parse_identified_doc_style(style: fb::IdentifiedDocStyle) -> ParseResult { - Ok(types::IdentifiedDocStyle { - id: parse_identifier(style.id().ok_or("Missing IdentifiedDocStyle.id")?)?, - style: parse_duc_doc_style(style.style().ok_or("Missing IdentifiedDocStyle.style")?)?, - }) -} - -fn parse_identified_viewport_style(style: fb::IdentifiedViewportStyle) -> ParseResult { - Ok(types::IdentifiedViewportStyle { - id: parse_identifier(style.id().ok_or("Missing IdentifiedViewportStyle.id")?)?, - style: parse_duc_viewport_style(style.style().ok_or("Missing IdentifiedViewportStyle.style")?)?, - }) -} - -fn parse_identified_hatch_style(style: fb::IdentifiedHatchStyle) -> ParseResult { - Ok(types::IdentifiedHatchStyle { - id: parse_identifier(style.id().ok_or("Missing IdentifiedHatchStyle.id")?)?, - style: parse_duc_hatch_style(style.style().ok_or("Missing IdentifiedHatchStyle.style")?)?, - }) -} - -fn parse_identified_xray_style(style: fb::IdentifiedXRayStyle) -> ParseResult { - Ok(types::IdentifiedXRayStyle { - id: parse_identifier(style.id().ok_or("Missing IdentifiedXRayStyle.id")?)?, - style: parse_duc_xray_style(style.style().ok_or("Missing IdentifiedXRayStyle.style")?)?, - }) -} - -fn parse_standard_styles(styles: fb::StandardStyles) -> ParseResult { - let common_styles = styles.common_styles().ok_or("Missing StandardStyles.common_styles")?.iter().map(parse_identified_common_style).collect::>()?; - let stack_like_styles = styles.stack_like_styles().ok_or("Missing StandardStyles.stack_like_styles")?.iter().map(parse_identified_stack_like_style).collect::>()?; - let text_styles = styles.text_styles().ok_or("Missing StandardStyles.text_styles")?.iter().map(parse_identified_text_style).collect::>()?; - let dimension_styles = styles.dimension_styles().ok_or("Missing StandardStyles.dimension_styles")?.iter().map(parse_identified_dimension_style).collect::>()?; - let leader_styles = styles.leader_styles().ok_or("Missing StandardStyles.leader_styles")?.iter().map(parse_identified_leader_style).collect::>()?; - let fcf_styles = styles.feature_control_frame_styles().ok_or("Missing StandardStyles.feature_control_frame_styles")?.iter().map(parse_identified_fcf_style).collect::>()?; - let table_styles = styles.table_styles().ok_or("Missing StandardStyles.table_styles")?.iter().map(parse_identified_table_style).collect::>()?; - let doc_styles = styles.doc_styles().ok_or("Missing StandardStyles.doc_styles")?.iter().map(parse_identified_doc_style).collect::>()?; - let viewport_styles = styles.viewport_styles().ok_or("Missing StandardStyles.viewport_styles")?.iter().map(parse_identified_viewport_style).collect::>()?; - let hatch_styles = styles.hatch_styles().ok_or("Missing StandardStyles.hatch_styles")?.iter().map(parse_identified_hatch_style).collect::>()?; - let xray_styles = styles.xray_styles().ok_or("Missing StandardStyles.xray_styles")?.iter().map(parse_identified_xray_style).collect::>()?; - Ok(types::StandardStyles { - common_styles, - stack_like_styles, - text_styles, - dimension_styles, - leader_styles, - feature_control_frame_styles: fcf_styles, - table_styles, - doc_styles, - viewport_styles, - hatch_styles, - xray_styles, - }) -} - -fn parse_grid_style(style: fb::GridStyle) -> ParseResult { - Ok(types::GridStyle { - color: style.color().ok_or("Missing GridStyle.color")?.to_string(), - opacity: style.opacity(), - dash_pattern: style.dash_pattern().ok_or("Missing GridStyle.dash_pattern")?.iter().collect(), - }) -} - -fn parse_polar_grid_settings(settings: fb::PolarGridSettings) -> ParseResult { - Ok(types::PolarGridSettings { - radial_divisions: settings.radial_divisions(), - radial_spacing: settings.radial_spacing(), - show_labels: settings.show_labels(), - }) -} - -fn parse_isometric_grid_settings(settings: fb::IsometricGridSettings) -> ParseResult { - Ok(types::IsometricGridSettings { - left_angle: settings.left_angle(), - right_angle: settings.right_angle(), - }) -} - -fn parse_grid_settings(settings: fb::GridSettings) -> ParseResult { - Ok(types::GridSettings { - grid_type: settings.type_().expect("Missing GridSettings.type"), - readonly: settings.readonly(), - display_type: settings.display_type().expect("Missing GridSettings.display_type"), - is_adaptive: settings.is_adaptive(), - x_spacing: settings.x_spacing(), - y_spacing: settings.y_spacing(), - subdivisions: settings.subdivisions(), - origin: parse_required_geometric_point(settings.origin().copied())?, - rotation: settings.rotation(), - follow_ucs: settings.follow_ucs(), - major_style: parse_grid_style(settings.major_style().ok_or("Missing GridSettings.major_style")?)?, - minor_style: parse_grid_style(settings.minor_style().ok_or("Missing GridSettings.minor_style")?)?, - show_minor: settings.show_minor(), - min_zoom: settings.min_zoom(), - max_zoom: settings.max_zoom(), - auto_hide: settings.auto_hide(), - polar_settings: settings.polar_settings().map(parse_polar_grid_settings).transpose()?, - isometric_settings: settings.isometric_settings().map(parse_isometric_grid_settings).transpose()?, - enable_snapping: settings.enable_snapping(), - // construction_snap_enabled and snap_to_grid_intersections are not present in the generated getters - construction_snap_enabled: false, - snap_to_grid_intersections: None, - }) -} - -fn parse_snap_override(so: fb::SnapOverride) -> ParseResult { - Ok(types::SnapOverride { - key: so.key().ok_or("Missing SnapOverride.key")?.to_string(), - behavior: so.behavior(), - }) -} - -fn parse_dynamic_snap_settings(settings: fb::DynamicSnapSettings) -> ParseResult { - Ok(types::DynamicSnapSettings { - enabled_during_drag: settings.enabled_during_drag(), - enabled_during_rotation: settings.enabled_during_rotation(), - enabled_during_scale: settings.enabled_during_scale(), - }) -} - -fn parse_polar_tracking_settings(settings: fb::PolarTrackingSettings) -> ParseResult { - Ok(types::PolarTrackingSettings { - enabled: settings.enabled(), - angles: settings.angles().ok_or("Missing PolarTrackingSettings.angles")?.iter().collect(), - increment_angle: Some(settings.increment_angle()), - track_from_last_point: settings.track_from_last_point(), - show_polar_coordinates: settings.show_polar_coordinates(), - }) -} - -fn parse_tracking_line_style(style: fb::TrackingLineStyle) -> ParseResult { - Ok(types::TrackingLineStyle { - color: style.color().ok_or("Missing TrackingLineStyle.color")?.to_string(), - opacity: style.opacity(), - dash_pattern: style.dash_pattern().map(|v| v.iter().collect()), - }) -} - -fn parse_layer_snap_filters(filters: fb::LayerSnapFilters) -> ParseResult { - Ok(types::LayerSnapFilters { - include_layers: filters.include_layers().map(|v| parse_vec_of_strings(Some(v))), - exclude_layers: filters.exclude_layers().map(|v| parse_vec_of_strings(Some(v))), - }) -} - -fn parse_snap_marker_style(style: fb::SnapMarkerStyle) -> ParseResult { - Ok(types::SnapMarkerStyle { - shape: style.shape().expect("Missing SnapMarkerStyle.shape"), - color: style.color().ok_or("Missing SnapMarkerStyle.color")?.to_string(), - }) -} - -fn parse_snap_marker_style_entry(entry: fb::SnapMarkerStyleEntry) -> ParseResult { - Ok(types::SnapMarkerStyleEntry { - key: entry.key().expect("Missing SnapMarkerStyleEntry.key"), - value: parse_snap_marker_style(entry.value().ok_or("Missing SnapMarkerStyleEntry.value")?)?, - }) -} - -fn parse_snap_marker_settings(settings: fb::SnapMarkerSettings) -> ParseResult { - let styles_vec = settings.styles().ok_or("Missing SnapMarkerSettings.styles")?; - let styles = styles_vec.iter().map(parse_snap_marker_style_entry).collect::>()?; - Ok(types::SnapMarkerSettings { - enabled: settings.enabled(), - size: settings.size(), - duration: Some(settings.duration()), - styles, - }) -} - -fn parse_snap_settings(settings: fb::SnapSettings) -> ParseResult { - let temporary_overrides = settings - .temporary_overrides() - .map(|v| v.iter().map(parse_snap_override).collect::>>()) - .transpose()?; - Ok(types::SnapSettings { - readonly: settings.readonly(), - twist_angle: settings.twist_angle(), - snap_tolerance: settings.snap_tolerance(), - object_snap_aperture: settings.object_snap_aperture(), - is_ortho_mode_on: settings.is_ortho_mode_on(), - polar_tracking: parse_polar_tracking_settings(settings.polar_tracking().ok_or("Missing SnapSettings.polar_tracking")?)?, - is_object_snap_on: settings.is_object_snap_on(), - active_object_snap_modes: settings.active_object_snap_modes().ok_or("Missing SnapSettings.active_object_snap_modes")?.iter().collect(), - snap_priority: settings.snap_priority().ok_or("Missing SnapSettings.snap_priority")?.iter().collect(), - show_tracking_lines: settings.show_tracking_lines(), - tracking_line_style: settings.tracking_line_style().map(parse_tracking_line_style).transpose()?, - dynamic_snap: parse_dynamic_snap_settings(settings.dynamic_snap().ok_or("Missing SnapSettings.dynamic_snap")?)?, - temporary_overrides, - incremental_distance: Some(settings.incremental_distance()), - magnetic_strength: Some(settings.magnetic_strength()), - layer_snap_filters: settings.layer_snap_filters().map(parse_layer_snap_filters).transpose()?, - element_type_filters: settings.element_type_filters().map(|v| parse_vec_of_strings(Some(v))), - snap_mode: settings.snap_mode().expect("Missing SnapSettings.snap_mode"), - snap_markers: parse_snap_marker_settings(settings.snap_markers().ok_or("Missing SnapSettings.snap_markers")?)?, - construction_snap_enabled: settings.construction_snap_enabled(), - snap_to_grid_intersections: Some(settings.snap_to_grid_intersections()), - }) -} - -fn parse_identified_grid_settings(settings: fb::IdentifiedGridSettings) -> ParseResult { - Ok(types::IdentifiedGridSettings { - id: parse_identifier(settings.id().ok_or("Missing IdentifiedGridSettings.id")?)?, - settings: parse_grid_settings(settings.settings().ok_or("Missing IdentifiedGridSettings.settings")?)?, - }) -} - -fn parse_identified_snap_settings(settings: fb::IdentifiedSnapSettings) -> ParseResult { - Ok(types::IdentifiedSnapSettings { - id: parse_identifier(settings.id().ok_or("Missing IdentifiedSnapSettings.id")?)?, - settings: parse_snap_settings(settings.settings().ok_or("Missing IdentifiedSnapSettings.settings")?)?, - }) -} - -fn parse_identified_ucs(ucs: fb::IdentifiedUcs) -> ParseResult { - Ok(types::IdentifiedUcs { - id: parse_identifier(ucs.id().ok_or("Missing IdentifiedUcs.id")?)?, - ucs: parse_duc_ucs(ucs.ucs().ok_or("Missing IdentifiedUcs.ucs")?)?, - }) -} - -fn parse_identified_view(view: fb::IdentifiedView) -> ParseResult { - Ok(types::IdentifiedView { - id: parse_identifier(view.id().ok_or("Missing IdentifiedView.id")?)?, - view: parse_duc_view(view.view().ok_or("Missing IdentifiedView.view")?)?, - }) -} - -fn parse_standard_view_settings(settings: fb::StandardViewSettings) -> ParseResult { - let views_vec = settings.views().ok_or("Missing StandardViewSettings.views")?; - let views = views_vec.iter().map(parse_identified_view).collect::>>()?; - - let ucs_vec = settings.ucs().ok_or("Missing StandardViewSettings.ucs")?; - let ucs = ucs_vec.iter().map(parse_identified_ucs).collect::>>()?; - - let grid_settings = settings - .grid_settings() - .map(|v| v.iter().map(parse_identified_grid_settings).collect::>>()) - .transpose()? - .unwrap_or_default(); - - let snap_settings = settings - .snap_settings() - .map(|v| v.iter().map(parse_identified_snap_settings).collect::>>()) - .transpose()? - .unwrap_or_default(); - - Ok(types::StandardViewSettings { - views, - ucs, - grid_settings, - snap_settings, - }) -} - -fn parse_dimension_validation_rules(rules: fb::DimensionValidationRules) -> ParseResult { - Ok(types::DimensionValidationRules { - min_text_height: Some(rules.min_text_height()), - max_text_height: Some(rules.max_text_height()), - allowed_precisions: rules.allowed_precisions().ok_or("Missing DimensionValidationRules.allowed_precisions")?.iter().collect(), - }) -} - -fn parse_layer_validation_rules(rules: fb::LayerValidationRules) -> ParseResult { - Ok(types::LayerValidationRules { - prohibited_layer_names: rules.prohibited_layer_names().map(|v| parse_vec_of_strings(Some(v))), - }) -} - -fn parse_standard_validation(validation: fb::StandardValidation) -> ParseResult { - Ok(types::StandardValidation { - dimension_rules: validation.dimension_rules().map(parse_dimension_validation_rules).transpose()?, - layer_rules: validation.layer_rules().map(parse_layer_validation_rules).transpose()?, - }) -} - -fn parse_standard(standard: fb::Standard) -> ParseResult { - Ok(types::Standard { - identifier: parse_identifier(standard.identifier().ok_or("Missing Standard.identifier")?)?, - version: standard.version().map(|s| s.to_string()).ok_or("Missing Standard.version")?, - readonly: standard.readonly(), - overrides: standard.overrides().map(parse_standard_overrides).transpose()?, - styles: standard.styles().map(parse_standard_styles).transpose()?, - view_settings: standard.view_settings().map(parse_standard_view_settings).transpose()?, - units: standard.units().map(parse_standard_units).transpose()?, - validation: standard.validation().map(parse_standard_validation).transpose()?, - }) -} - - -// ============================================================================= -// VERSION CONTROL -// ============================================================================= - -fn parse_version_base(base: fb::VersionBase) -> ParseResult { - Ok(types::VersionBase { - id: base.id().ok_or("Missing VersionBase.id")?.to_string(), - parent_id: base.parent_id().map(|s| s.to_string()), - timestamp: base.timestamp(), - description: base.description().map(|s| s.to_string()), - is_manual_save: base.is_manual_save(), - user_id: base.user_id().map(|s| s.to_string()), - }) -} - -fn parse_checkpoint(checkpoint: fb::Checkpoint) -> ParseResult { - Ok(types::Checkpoint { - base: parse_version_base(checkpoint.base().ok_or("Missing Checkpoint.base")?)?, - data: checkpoint.data().ok_or("Missing Checkpoint.data")?.bytes().to_vec(), - size_bytes: checkpoint.size_bytes(), - }) -} - - -fn parse_delta(delta: fb::Delta) -> ParseResult { - // patch is now zlib-compressed JSON data - let patch_json = parse_binary_json_to_string(delta.patch()) - .ok_or("Failed to parse delta patch")?; - - // Parse the JSON string into a vector of JSONPatchOperation - let patch: Vec = serde_json::from_str(&patch_json) - .map_err(|_| "Failed to parse delta patch JSON")?; - - Ok(types::Delta { - base: parse_version_base(delta.base().ok_or("Missing Delta.base")?)?, - patch, - }) -} - -fn parse_version_graph_metadata(meta: fb::VersionGraphMetadata) -> ParseResult { - Ok(types::VersionGraphMetadata { - last_pruned: meta.last_pruned(), - total_size: meta.total_size(), - }) -} - -fn parse_version_graph(graph: fb::VersionGraph) -> ParseResult { - let checkpoints_vec = graph.checkpoints().ok_or("Missing VersionGraph.checkpoints")?; - let checkpoints = checkpoints_vec.iter().map(parse_checkpoint).collect::>()?; - - let deltas_vec = graph.deltas().ok_or("Missing VersionGraph.deltas")?; - let deltas = deltas_vec.iter().map(parse_delta).collect::>()?; - - Ok(types::VersionGraph { - user_checkpoint_version_id: graph.user_checkpoint_version_id().ok_or("Missing VersionGraph.user_checkpoint_version_id")?.to_string(), - latest_version_id: graph.latest_version_id().ok_or("Missing VersionGraph.latest_version_id")?.to_string(), - checkpoints, - deltas, - metadata: parse_version_graph_metadata(graph.metadata().ok_or("Missing VersionGraph.metadata")?)?, - }) -} - - -// ============================================================================= -// EXTERNAL FILES -// ============================================================================= - -fn parse_duc_external_file_data(file: fb::DucExternalFileData) -> ParseResult { - Ok(types::DucExternalFileData { - mime_type: file.mime_type().ok_or("Missing DucExternalFileData.mime_type")?.to_string(), - id: file.id().to_string(), - data: file.data().ok_or("Missing DucExternalFileData.data")?.bytes().to_vec(), - created: file.created(), - last_retrieved: file.last_retrieved(), - version: None, - }) -} - -fn parse_duc_external_file_entry(entry: fb::DucExternalFileEntry) -> ParseResult { - Ok(types::DucExternalFileEntry { - key: entry.key().to_string(), - value: parse_duc_external_file_data(entry.value().ok_or("Missing DucExternalFileEntry.value")?)?, - }) -} - -// ============================================================================= -// ROOT TYPE -// ============================================================================= - -fn parse_exported_data_state(root: fb::ExportedDataState) -> ParseResult { - let dictionary = root - .dictionary() - .map(|v| v.iter().map(parse_dictionary_entry).collect::>>()) - .transpose()?; - - let elements_vec = root.elements().ok_or("Missing ExportedDataState.elements")?; - let elements = elements_vec.iter().map(parse_element_wrapper).collect::>()?; - - // blocks is optional: treat missing as empty vec - let blocks = root - .blocks() - .map(|v| v.iter().map(parse_duc_block).collect::>>()) - .transpose()? - .unwrap_or_default(); - - // block_instances is optional: treat missing as empty vec - let block_instances = root - .blockInstances() - .map(|v| v.iter().map(parse_duc_block_instance).collect::>>()) - .transpose()? - .unwrap_or_default(); - - // block_collections is optional: treat missing as empty vec - let block_collections = root - .blockCollections() - .map(|v| v.iter().map(parse_duc_block_collection).collect::>>()) - .transpose()? - .unwrap_or_default(); - - // groups optional - let groups = root - .groups() - .map(|v| v.iter().map(parse_duc_group).collect::>>()) - .transpose()? - .unwrap_or_default(); - - // regions optional - let regions = root - .regions() - .map(|v| v.iter().map(parse_duc_region).collect::>>()) - .transpose()? - .unwrap_or_default(); - - // layers optional - let layers = root - .layers() - .map(|v| v.iter().map(parse_duc_layer).collect::>>()) - .transpose()? - .unwrap_or_default(); - - // standards optional - let standards = root - .standards() - .map(|v| v.iter().map(parse_standard).collect::>>()) - .transpose()? - .unwrap_or_default(); - - let external_files = root - .external_files() - .map(|v| v.iter().map(parse_duc_external_file_entry).collect::>>()) - .transpose()?; - - Ok(types::ExportedDataState { - data_type: root.type_().ok_or("Missing ExportedDataState.type")?.to_string(), - source: root.source().ok_or("Missing ExportedDataState.source")?.to_string(), - version: root.version().ok_or("Missing ExportedDataState.version")?.to_string(), - thumbnail: root.thumbnail().map(|b| b.bytes().to_vec()), - dictionary, - elements, - blocks, - block_instances, - block_collections, - groups, - regions, - layers, - standards, - duc_local_state: root.duc_local_state().map(parse_duc_local_state).transpose()?.or_else(|| { - // Provide default DucLocalState when missing - Some(types::DucLocalState { - scope: "mm".to_string(), - active_standard_id: "".to_string(), - scroll_x: 0.0, - scroll_y: 0.0, - zoom: 1.0, - active_grid_settings: None, - active_snap_settings: None, - is_binding_enabled: false, - current_item_stroke: None, - current_item_background: None, - current_item_opacity: 1.0, - current_item_font_family: "Arial".to_string(), - current_item_font_size: 12.0, - current_item_text_align: fb::TEXT_ALIGN::LEFT, - current_item_start_line_head: None, - current_item_end_line_head: None, - current_item_roundness: 0.0, - pen_mode: false, - view_mode_enabled: false, - objects_snap_mode_enabled: false, - grid_mode_enabled: false, - outline_mode_enabled: false, - manual_save_mode: false, - }) - }), - duc_global_state: root.duc_global_state().map(parse_duc_global_state).transpose()?.or_else(|| { - // Provide default DucGlobalState when missing - Some(types::DucGlobalState { - name: None, - view_background_color: "#ffffff".to_string(), - main_scope: "mm".to_string(), - dash_spacing_scale: 1.0, - is_dash_spacing_affected_by_viewport_scale: false, - scope_exponent_threshold: 0, - dimensions_associative_by_default: false, - use_annotative_scaling: false, - display_precision_linear: 2, - display_precision_angular: 2, - pruning_level: fb::PRUNING_LEVEL::CONSERVATIVE, - }) - }), - external_files, - version_graph: root.version_graph().map(parse_version_graph).transpose()?, - id: root.id().map(|s| s.to_string()), - }) + } } diff --git a/packages/ducrs/src/serialize.rs b/packages/ducrs/src/serialize.rs index d775ec7d..a8bde5f9 100644 --- a/packages/ducrs/src/serialize.rs +++ b/packages/ducrs/src/serialize.rs @@ -1,4046 +1,1264 @@ -#![allow(clippy::too_many_arguments)] -#![allow(clippy::new_ret_no_self)] - -use crate::generated::duc as fb; -use crate::types; -use flatbuffers::{FlatBufferBuilder, WIPOffset}; - -/// Serializes the main `ExportedDataState` into a byte vector. -pub fn serialize(state: &types::ExportedDataState) -> Vec { - let mut builder = FlatBufferBuilder::new(); - let root = serialize_exported_data_state(&mut builder, state); - // Use the correct generated file identifier constant - builder.finish(root, Some(fb::EXPORTED_DATA_STATE_IDENTIFIER)); - builder.finished_data().to_vec() -} - -// ============================================================================= -// Helper: Vector Serialization -// ============================================================================= - -fn serialize_vec_of_strings<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - vec: &[String], -) -> Option>>> { - if vec.is_empty() { - return None; +//! Serializes an [`ExportedDataState`] into a `.duc` SQLite binary (byte vector). +//! +//! Flow: ExportedDataState → in-memory SQLite DB → raw bytes +//! +//! The schema is applied via [`crate::db::open_memory`] so every output is a +//! valid `.duc` file that can be opened again with [`crate::parse::parse`]. + +use rusqlite::{params, Connection, Transaction}; +use std::os::raw::c_char; + +use crate::db; +use crate::types::*; + +#[derive(Debug)] +pub enum SerializeError { + Db(db::DbError), + Sqlite(rusqlite::Error), + Io(String), +} + +impl std::fmt::Display for SerializeError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + SerializeError::Db(e) => write!(f, "db: {e}"), + SerializeError::Sqlite(e) => write!(f, "sqlite: {e}"), + SerializeError::Io(e) => write!(f, "io: {e}"), + } } - // Collect in a separate scope to end the iterator borrow before the next builder call. - let offsets: Vec> = { - vec.iter() - .map(|s| builder.create_string(s.as_str())) - .collect() - }; - let v: WIPOffset>> = - builder.create_vector(&offsets); - Some(v) -} - -/// Helper function to compress a string using zlib compression -/// Returns the compressed byte vector -fn compress_string(s: &str) -> Vec { - use flate2::write::ZlibEncoder; - use flate2::Compression; - use std::io::Write; - - let mut encoder = ZlibEncoder::new(Vec::new(), Compression::default()); - encoder.write_all(s.as_bytes()).unwrap(); - encoder.finish().unwrap() -} - -// ============================================================================= -// UTILITY & GEOMETRY TYPES -// ============================================================================= - -fn serialize_geometric_point(point: &types::GeometricPoint) -> fb::GeometricPoint { - fb::GeometricPoint::new(point.x, point.y) } -fn serialize_duc_point<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - point: &types::DucPoint, -) -> WIPOffset> { - fb::DucPoint::create( - builder, - &fb::DucPointArgs { - x: point.x, - y: point.y, - mirroring: point.mirroring, - }, - ) -} - -fn serialize_vec_of_duc_points<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - vec: &[types::DucPoint], -) -> Option>>>> -{ - if vec.is_empty() { - return None; - } - let offsets: Vec>> = vec - .iter() - .map(|p| serialize_duc_point(builder, p)) - .collect(); - let v: WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - > = builder.create_vector(&offsets); - Some(v) -} +impl std::error::Error for SerializeError {} -fn serialize_identifier<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - id: &types::Identifier, -) -> WIPOffset> { - let id_offset = builder.create_string(&id.id); - let name_offset = builder.create_string(&id.name); - let description_offset = id.description.as_ref().map(|s| builder.create_string(s)); - - fb::Identifier::create( - builder, - &fb::IdentifierArgs { - id: Some(id_offset), - name: Some(name_offset), - description: description_offset, - }, - ) +impl From for SerializeError { + fn from(e: db::DbError) -> Self { SerializeError::Db(e) } } - -fn serialize_dictionary_entry<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - entry: &types::DictionaryEntry, -) -> WIPOffset> { - let key_offset = builder.create_string(&entry.key); - let value_offset = builder.create_string(&entry.value); - - fb::DictionaryEntry::create( - builder, - &fb::DictionaryEntryArgs { - key: Some(key_offset), - value: Some(value_offset), - }, - ) +impl From for SerializeError { + fn from(e: rusqlite::Error) -> Self { SerializeError::Sqlite(e) } } - -fn serialize_string_value_entry<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - entry: &types::StringValueEntry, -) -> WIPOffset> { - let key_offset = builder.create_string(&entry.key); - let value_offset = builder.create_string(&entry.value); - - fb::StringValueEntry::create( - builder, - &fb::StringValueEntryArgs { - key: Some(key_offset), - value: Some(value_offset), - }, - ) +impl From for SerializeError { + fn from(e: std::io::Error) -> Self { SerializeError::Io(e.to_string()) } } -fn serialize_duc_ucs<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - ucs: &types::DucUcs, -) -> WIPOffset> { - let origin = serialize_geometric_point(&ucs.origin); - fb::DucUcs::create( - builder, - &fb::DucUcsArgs { - origin: Some(&origin), - angle: ucs.angle, - }, - ) -} +pub type SerializeResult = Result; -fn serialize_duc_view<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - view: &types::DucView, -) -> WIPOffset> { - let center_point_offset = serialize_duc_point(builder, &view.center_point); - - // Guide type inference explicitly for scope string - let scope_str: WIPOffset<&'bldr str> = builder.create_string(view.scope.as_str()); - fb::DucView::create( - builder, - &fb::DucViewArgs { - scroll_x: view.scroll_x, - scroll_y: view.scroll_y, - zoom: view.zoom, - twist_angle: view.twist_angle, - center_point: Some(center_point_offset), - scope: Some(scope_str), - }, - ) -} +// ─── Public entry point ────────────────────────────────────────────────────── -fn serialize_margins<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - margins: &types::Margins, -) -> WIPOffset> { - fb::Margins::create( - builder, - &fb::MarginsArgs { - top: margins.top, - right: margins.right, - bottom: margins.bottom, - left: margins.left, - }, - ) -} +/// Serialize an [`ExportedDataState`] into a compressed `.duc` file (raw bytes). +/// +/// Uses `page_size = 1024` and zlib compression for minimal output size. +/// The result can be parsed back with [`crate::parse::parse`]. +pub fn serialize(state: &ExportedDataState) -> SerializeResult> { + let conn = db::open_memory_compact()?; + let mut inner = conn.into_inner(); -// ============================================================================= -// STYLING & CONTENT -// ============================================================================= - -fn serialize_tiling_properties<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - tiling: &types::TilingProperties, -) -> WIPOffset> { - fb::TilingProperties::create( - builder, - &fb::TilingPropertiesArgs { - size_in_percent: tiling.size_in_percent, - angle: tiling.angle, - spacing: Some(tiling.spacing.unwrap_or(0.0)), - offset_x: Some(tiling.offset_x.unwrap_or(0.0)), - offset_y: Some(tiling.offset_y.unwrap_or(0.0)), - }, - ) -} + { + // Temporarily disable FK checks during bulk insert so that + // partially-consistent app state (e.g. elements referencing + // groups/layers that weren't exported) doesn't abort the write. + // FKs are re-enabled after the transaction so the resulting + // file is still a valid database that enforces FKs on open. + inner.execute_batch("PRAGMA foreign_keys = OFF;")?; -fn serialize_hatch_pattern_line<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - line: &types::HatchPatternLine, -) -> WIPOffset> { - let origin_offset = serialize_duc_point(builder, &line.origin); - let offset_vec: WIPOffset> = - builder.create_vector(&line.offset); - let dash_pattern_vec: WIPOffset> = - builder.create_vector(&line.dash_pattern); - - fb::HatchPatternLine::create( - builder, - &fb::HatchPatternLineArgs { - angle: line.angle, - origin: Some(origin_offset), - offset: Some(offset_vec), - dash_pattern: Some(dash_pattern_vec), - }, - ) -} + let tx = inner.transaction()?; + write_document(&tx, state)?; + write_global_state(&tx, &state.duc_global_state)?; + write_local_state(&tx, &state.duc_local_state)?; + write_dictionary(&tx, &state.dictionary)?; + write_stack_and_containers(&tx, state)?; + write_blocks(&tx, state)?; + write_elements(&tx, state)?; + write_external_files(&tx, &state.external_files)?; + write_version_graph(&tx, &state.version_graph)?; + tx.commit()?; -fn serialize_custom_hatch_pattern<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - pattern: &types::CustomHatchPattern, -) -> WIPOffset> { - let name_offset = builder.create_string(&pattern.name); - let description_offset: Option> = pattern.description.as_ref().map(|s| { - let off: WIPOffset<&'bldr str> = builder.create_string(s.as_str()); - off - }); - let lines_offsets: Vec<_> = pattern - .lines - .iter() - .map(|l| serialize_hatch_pattern_line(builder, l)) - .collect(); - let lines_vec: WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - > = builder.create_vector(&lines_offsets); - - fb::CustomHatchPattern::create( - builder, - &fb::CustomHatchPatternArgs { - name: Some(name_offset), - description: description_offset, - lines: Some(lines_vec), - }, - ) -} - -fn serialize_duc_hatch_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DucHatchStyle, -) -> WIPOffset> { - // pattern_name is a required String in types, so serialize directly - let pattern_name_offset: Option> = { - let off: WIPOffset<&'bldr str> = builder.create_string(style.pattern_name.as_str()); - Some(off) - }; - let pattern_origin_offset = serialize_duc_point(builder, &style.pattern_origin); - let custom_pattern_offset = style - .custom_pattern - .as_ref() - .map(|cp| serialize_custom_hatch_pattern(builder, cp)); - - fb::DucHatchStyle::create( - builder, - &fb::DucHatchStyleArgs { - hatch_style: Some(style.hatch_style), - pattern_name: pattern_name_offset, - pattern_scale: style.pattern_scale, - pattern_angle: style.pattern_angle, - pattern_origin: Some(pattern_origin_offset), - pattern_double: style.pattern_double, - custom_pattern: custom_pattern_offset, - }, - ) -} - -fn serialize_duc_image_filter<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - filter: &types::DucImageFilter, -) -> WIPOffset> { - fb::DucImageFilter::create( - builder, - &fb::DucImageFilterArgs { - brightness: filter.brightness, - contrast: filter.contrast, - }, - ) -} - -fn serialize_element_content_base<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - content: &types::ElementContentBase, -) -> WIPOffset> { - let src_offset = builder.create_string(&content.src); - let tiling_offset: Option> = content - .tiling - .as_ref() - .map(|t| serialize_tiling_properties(builder, t)); - let hatch_offset: Option> = content - .hatch - .as_ref() - .map(|h| serialize_duc_hatch_style(builder, h)); - let image_filter_offset: Option> = content - .image_filter - .as_ref() - .map(|f| serialize_duc_image_filter(builder, f)); - - fb::ElementContentBase::create( - builder, - &fb::ElementContentBaseArgs { - preference: content.preference, - src: Some(src_offset), - visible: content.visible, - opacity: content.opacity, - tiling: tiling_offset, - hatch: hatch_offset, - image_filter: image_filter_offset, - }, - ) -} - -fn serialize_stroke_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::StrokeStyle, -) -> WIPOffset> { - let dash_vec = style.dash.as_ref().map(|v| builder.create_vector(v)); - // Map Option -> Option> explicitly for type inference - let dash_line_override_offset: Option> = style - .dash_line_override - .as_ref() - .map(|s| builder.create_string(s.as_str())); - - fb::StrokeStyle::create( - builder, - &fb::StrokeStyleArgs { - preference: style.preference, - cap: style.cap, - join: style.join, - dash: dash_vec, - dash_line_override: dash_line_override_offset, - dash_cap: style.dash_cap, - miter_limit: style.miter_limit, - }, - ) -} - -fn serialize_stroke_sides<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - sides: &types::StrokeSides, -) -> WIPOffset> { - let values_vec = sides.values.as_ref().map(|v| builder.create_vector(v)); - fb::StrokeSides::create( - builder, - &fb::StrokeSidesArgs { - preference: sides.preference, - values: values_vec, - }, - ) -} - -fn serialize_element_stroke<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - stroke: &types::ElementStroke, -) -> WIPOffset> { - let content_offset = serialize_element_content_base(builder, &stroke.content); - let style_offset = serialize_stroke_style(builder, &stroke.style); - let stroke_sides_offset = stroke - .stroke_sides - .as_ref() - .map(|s| serialize_stroke_sides(builder, s)); - - fb::ElementStroke::create( - builder, - &fb::ElementStrokeArgs { - content: Some(content_offset), - width: stroke.width, - style: Some(style_offset), - placement: stroke.placement, - stroke_sides: stroke_sides_offset, - }, - ) -} - -fn serialize_element_background<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - background: &types::ElementBackground, -) -> WIPOffset> { - let content_offset = serialize_element_content_base(builder, &background.content); - fb::ElementBackground::create( - builder, - &fb::ElementBackgroundArgs { - content: Some(content_offset), - }, - ) -} - -fn serialize_duc_element_styles_base<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - styles: &types::DucElementStylesBase, -) -> WIPOffset> { - let background_offsets: Vec<_> = styles - .background - .iter() - .map(|b| serialize_element_background(builder, b)) - .collect(); - let background_vec = builder.create_vector(&background_offsets); - - let stroke_offsets: Vec<_> = styles - .stroke - .iter() - .map(|s| serialize_element_stroke(builder, s)) - .collect(); - let stroke_vec = builder.create_vector(&stroke_offsets); - - fb::_DucElementStylesBase::create( - builder, - &fb::_DucElementStylesBaseArgs { - roundness: styles.roundness, - blending: Some(styles.blending.unwrap_or(fb::BLENDING::MULTIPLY)), - background: Some(background_vec), - stroke: Some(stroke_vec), - opacity: styles.opacity, - }, - ) -} - -// ============================================================================= -// BASE ELEMENT & COMMON ELEMENT COMPONENTS -// ============================================================================= - -fn serialize_bound_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - bound_element: &types::BoundElement, -) -> WIPOffset> { - let id_offset = builder.create_string(&bound_element.id); - let type_offset = builder.create_string(&bound_element.element_type); - fb::BoundElement::create( - builder, - &fb::BoundElementArgs { - id: Some(id_offset), - type_: Some(type_offset), - }, - ) -} - -fn serialize_duc_element_base<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - base: &types::DucElementBase, -) -> WIPOffset> { - let styles_offset = Some(serialize_duc_element_styles_base(builder, &base.styles)); - let id_offset = builder.create_string(&base.id); - let scope_offset = builder.create_string(&base.scope); - let label_offset = Some(builder.create_string(&base.label)); - let description_offset = base.description.as_ref().map(|s| builder.create_string(s)); - let index_offset = base.index.as_ref().map(|s| builder.create_string(s)); - let group_ids_vec = serialize_vec_of_strings(builder, &base.group_ids); - let block_ids_vec = serialize_vec_of_strings(builder, &base.block_ids); - let region_ids_vec = serialize_vec_of_strings(builder, &base.region_ids); - let instance_id_offset = base.instance_id.as_ref().map(|s| builder.create_string(s)); - let layer_id_offset = base.layer_id.as_ref().map(|s| builder.create_string(s)); - let frame_id_offset = base.frame_id.as_ref().map(|s| builder.create_string(s)); - let bound_elements_offsets: Vec<_> = base - .bound_elements - .iter() - .flat_map(|v| v.iter()) - .map(|be| serialize_bound_element(builder, be)) - .collect(); - let bound_elements_vec = if bound_elements_offsets.is_empty() { - None - } else { - Some(builder.create_vector(&bound_elements_offsets)) - }; - let link_offset = base.link.as_ref().map(|s| builder.create_string(s)); - - // Compress custom_data JSON and create byte vector - let custom_data_offset = base.custom_data.as_ref().map(|s| { - let compressed = compress_string(s); - builder.create_vector::(&compressed) - }); - - fb::_DucElementBase::create( - builder, - &fb::_DucElementBaseArgs { - id: Some(id_offset), - styles: styles_offset, - x: base.x, - y: base.y, - width: base.width, - height: base.height, - angle: base.angle, - scope: Some(scope_offset), - label: label_offset, - description: description_offset, - is_visible: base.is_visible, - seed: base.seed, - version: base.version, - version_nonce: base.version_nonce, - updated: base.updated, - index: index_offset, - is_plot: base.is_plot, - is_annotative: base.is_annotative, - is_deleted: base.is_deleted, - group_ids: group_ids_vec, - block_ids: block_ids_vec, - region_ids: region_ids_vec, - instance_id: instance_id_offset, - layer_id: layer_id_offset, - frame_id: frame_id_offset, - bound_elements: bound_elements_vec, - z_index: base.z_index, - link: link_offset, - locked: base.locked, - custom_data: custom_data_offset, - }, - ) -} - -fn serialize_duc_head<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - head: &types::DucHead, -) -> WIPOffset> { - let block_id_offset = head - .block_id - .as_ref() - .map(|s| builder.create_string(s.as_str())); - fb::DucHead::create( - builder, - &fb::DucHeadArgs { - type_: head.head_type, - block_id: block_id_offset, - size: head.size, - }, - ) -} - -fn serialize_point_binding_point<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - pbp: &types::PointBindingPoint, -) -> WIPOffset> { - fb::PointBindingPoint::create( - builder, - &fb::PointBindingPointArgs { - index: pbp.index, - offset: pbp.offset, - }, - ) -} - -fn serialize_duc_point_binding<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - binding: &types::DucPointBinding, -) -> WIPOffset> { - let element_id_offset = builder.create_string(&binding.element_id); - let fixed_point_built: Option = binding - .fixed_point - .as_ref() - .map(|gp| serialize_geometric_point(gp)); - let fixed_point_ref: Option<&fb::GeometricPoint> = fixed_point_built.as_ref(); - let point_offset = binding - .point - .as_ref() - .map(|p| serialize_point_binding_point(builder, p)); - let head_offset = binding - .head - .as_ref() - .map(|h| serialize_duc_head(builder, h)); - - fb::DucPointBinding::create( - builder, - &fb::DucPointBindingArgs { - element_id: Some(element_id_offset), - focus: binding.focus, - gap: binding.gap, - fixed_point: fixed_point_ref, - point: point_offset, - head: head_offset, - }, - ) -} - -fn serialize_duc_line_reference<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - line_ref: &types::DucLineReference, -) -> WIPOffset> { - // Build fb::GeometricPoint and pass Option<&fb::GeometricPoint> as required - let handle_built: Option = line_ref - .handle - .as_ref() - .map(|gp| serialize_geometric_point(gp)); - let handle_ref: Option<&fb::GeometricPoint> = handle_built.as_ref(); - - fb::DucLineReference::create( - builder, - &fb::DucLineReferenceArgs { - index: line_ref.index, - handle: handle_ref, - }, - ) -} - -fn serialize_duc_line<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - line: &types::DucLine, -) -> WIPOffset> { - let start_offset = serialize_duc_line_reference(builder, &line.start); - let end_offset = serialize_duc_line_reference(builder, &line.end); - fb::DucLine::create( - builder, - &fb::DucLineArgs { - start: Some(start_offset), - end: Some(end_offset), - }, - ) -} - -fn serialize_duc_path<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - path: &types::DucPath, -) -> WIPOffset> { - let line_indices_vec = builder.create_vector(&path.line_indices); - let background_offset = path - .background - .as_ref() - .map(|b| serialize_element_background(builder, b)); - let stroke_offset = path - .stroke - .as_ref() - .map(|s| serialize_element_stroke(builder, s)); - fb::DucPath::create( - builder, - &fb::DucPathArgs { - line_indices: Some(line_indices_vec), - background: background_offset, - stroke: stroke_offset, - }, - ) -} - -fn serialize_duc_linear_element_base<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - base: &types::DucLinearElementBase, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &base.base); - let points_vec = serialize_vec_of_duc_points(builder, &base.points); - let lines_offsets: Vec>> = base - .lines - .iter() - .map(|l| serialize_duc_line(builder, l)) - .collect(); - let lines_vec: WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - > = builder.create_vector(&lines_offsets); - let path_overrides_offsets: Vec<_> = base - .path_overrides - .iter() - .map(|p| serialize_duc_path(builder, p)) - .collect(); - let path_overrides_vec = builder.create_vector(&path_overrides_offsets); - let last_committed_point_offset = base - .last_committed_point - .as_ref() - .map(|p| serialize_duc_point(builder, p)); - let start_binding_offset = base - .start_binding - .as_ref() - .map(|b| serialize_duc_point_binding(builder, b)); - let end_binding_offset = base - .end_binding - .as_ref() - .map(|b| serialize_duc_point_binding(builder, b)); - - fb::_DucLinearElementBase::create( - builder, - &fb::_DucLinearElementBaseArgs { - base: Some(base_offset), - points: points_vec, - lines: Some(lines_vec), - path_overrides: Some(path_overrides_vec), - last_committed_point: last_committed_point_offset, - start_binding: start_binding_offset, - end_binding: end_binding_offset, - }, - ) -} - -fn serialize_duc_stack_like_styles<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - styles: &types::DucStackLikeStyles, -) -> WIPOffset> { - let labeling_color_offset = builder.create_string(&styles.labeling_color); - fb::DucStackLikeStyles::create( - builder, - &fb::DucStackLikeStylesArgs { - opacity: styles.opacity, - labeling_color: Some(labeling_color_offset), - }, - ) -} - -fn serialize_duc_stack_base<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - base: &types::DucStackBase, -) -> WIPOffset> { - let label_offset = builder.create_string(&base.label); - let description_offset = base.description.as_ref().map(|s| builder.create_string(s)); - let styles_offset = serialize_duc_stack_like_styles(builder, &base.styles); - fb::_DucStackBase::create( - builder, - &fb::_DucStackBaseArgs { - label: Some(label_offset), - description: description_offset, - is_collapsed: base.is_collapsed, - is_plot: base.is_plot, - is_visible: base.is_visible, - locked: base.locked, - styles: Some(styles_offset), - }, - ) -} - -fn serialize_duc_stack_element_base<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - base: &types::DucStackElementBase, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &base.base); - let stack_base_offset = serialize_duc_stack_base(builder, &base.stack_base); - // base.standard_override is Option in types; map to Option> - let standard_override_offset = base - .standard_override - .as_deref() - .map(|s| builder.create_string(s)); - fb::_DucStackElementBase::create( - builder, - &fb::_DucStackElementBaseArgs { - base: Some(base_offset), - stack_base: Some(stack_base_offset), - clip: base.clip, - label_visible: base.label_visible, - standard_override: standard_override_offset, - }, - ) -} - -// ============================================================================= -// ELEMENT-SPECIFIC STYLES -// ============================================================================= - -fn serialize_line_spacing<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - spacing: &types::LineSpacing, -) -> WIPOffset> { - fb::LineSpacing::create( - builder, - &fb::LineSpacingArgs { - value: spacing.value, - type_: spacing.line_type, - }, - ) -} - -fn serialize_duc_text_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DucTextStyle, -) -> WIPOffset> { - let font_family_offset = builder.create_string(&style.font_family); - let big_font_family_offset = builder.create_string(&style.big_font_family); - let line_spacing_offset = serialize_line_spacing(builder, &style.line_spacing); - - fb::DucTextStyle::create( - builder, - &fb::DucTextStyleArgs { - is_ltr: style.is_ltr, - font_family: Some(font_family_offset), - big_font_family: Some(big_font_family_offset), - text_align: Some(style.text_align), - vertical_align: Some(style.vertical_align), - line_height: style.line_height, - line_spacing: Some(line_spacing_offset), - oblique_angle: style.oblique_angle, - font_size: style.font_size, - paper_text_height: style.paper_text_height.unwrap_or(0.0), - width_factor: style.width_factor, - is_upside_down: style.is_upside_down, - is_backwards: style.is_backwards, - }, - ) -} - -fn serialize_duc_table_cell_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DucTableCellStyle, -) -> WIPOffset> { - let base_style_offset = serialize_duc_element_styles_base(builder, &style.base_style); - let text_style_offset = serialize_duc_text_style(builder, &style.text_style); - let margins_offset = serialize_margins(builder, &style.margins); - - fb::DucTableCellStyle::create( - builder, - &fb::DucTableCellStyleArgs { - base_style: Some(base_style_offset), - text_style: Some(text_style_offset), - margins: Some(margins_offset), - alignment: style.alignment, - }, - ) -} - -fn serialize_duc_table_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DucTableStyle, -) -> WIPOffset> { - let header_row_style_offset = serialize_duc_table_cell_style(builder, &style.header_row_style); - let data_row_style_offset = serialize_duc_table_cell_style(builder, &style.data_row_style); - let data_column_style_offset = - serialize_duc_table_cell_style(builder, &style.data_column_style); - - fb::DucTableStyle::create( - builder, - &fb::DucTableStyleArgs { - flow_direction: Some(style.flow_direction), - header_row_style: Some(header_row_style_offset), - data_row_style: Some(data_row_style_offset), - data_column_style: Some(data_column_style_offset), - }, - ) -} - -fn serialize_duc_leader_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DucLeaderStyle, -) -> WIPOffset> { - let heads_override_vec = style.heads_override.as_ref().map(|v| { - let offsets: Vec<_> = v.iter().map(|h| serialize_duc_head(builder, h)).collect(); - builder.create_vector(&offsets) - }); - let text_style_offset = serialize_duc_text_style(builder, &style.text_style); - - fb::DucLeaderStyle::create( - builder, - &fb::DucLeaderStyleArgs { - heads_override: heads_override_vec, - dogleg: style.dogleg.unwrap_or(0.0), - text_style: Some(text_style_offset), - text_attachment: Some(style.text_attachment), - block_attachment: Some(style.block_attachment), - }, - ) -} - -fn serialize_dimension_tolerance_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DimensionToleranceStyle, -) -> WIPOffset> { - let text_style_offset = style - .text_style - .as_ref() - .map(|t| serialize_duc_text_style(builder, t)); - - fb::DimensionToleranceStyle::create( - builder, - &fb::DimensionToleranceStyleArgs { - enabled: style.enabled, - display_method: Some(style.display_method), - upper_value: style.upper_value, - lower_value: style.lower_value, - precision: style.precision, - text_style: text_style_offset, - }, - ) -} - -fn serialize_dimension_fit_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DimensionFitStyle, -) -> WIPOffset> { - fb::DimensionFitStyle::create( - builder, - &fb::DimensionFitStyleArgs { - rule: Some(style.rule), - text_placement: Some(style.text_placement), - force_text_inside: style.force_text_inside, - }, - ) -} - -fn serialize_dimension_line_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DimensionLineStyle, -) -> WIPOffset> { - let stroke_offset = serialize_element_stroke(builder, &style.stroke); - fb::DimensionLineStyle::create( - builder, - &fb::DimensionLineStyleArgs { - stroke: Some(stroke_offset), - text_gap: style.text_gap, - }, - ) -} - -fn serialize_dimension_ext_line_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DimensionExtLineStyle, -) -> WIPOffset> { - let stroke_offset = serialize_element_stroke(builder, &style.stroke); - fb::DimensionExtLineStyle::create( - builder, - &fb::DimensionExtLineStyleArgs { - stroke: Some(stroke_offset), - overshoot: style.overshoot, - offset: style.offset, - }, - ) -} - -fn serialize_dimension_symbol_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DimensionSymbolStyle, -) -> WIPOffset> { - let heads_override_vec = style.heads_override.as_ref().map(|v| { - let offsets: Vec<_> = v.iter().map(|h| serialize_duc_head(builder, h)).collect(); - builder.create_vector(&offsets) - }); - fb::DimensionSymbolStyle::create( - builder, - &fb::DimensionSymbolStyleArgs { - heads_override: heads_override_vec, - center_mark_type: Some(style.center_mark_type), - center_mark_size: style.center_mark_size, - }, - ) -} - -fn serialize_duc_dimension_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DucDimensionStyle, -) -> WIPOffset> { - let dim_line_offset = serialize_dimension_line_style(builder, &style.dim_line); - let ext_line_offset = serialize_dimension_ext_line_style(builder, &style.ext_line); - let text_style_offset = serialize_duc_text_style(builder, &style.text_style); - let symbols_offset = serialize_dimension_symbol_style(builder, &style.symbols); - let tolerance_offset = serialize_dimension_tolerance_style(builder, &style.tolerance); - let fit_offset = serialize_dimension_fit_style(builder, &style.fit); - - fb::DucDimensionStyle::create( - builder, - &fb::DucDimensionStyleArgs { - dim_line: Some(dim_line_offset), - ext_line: Some(ext_line_offset), - text_style: Some(text_style_offset), - symbols: Some(symbols_offset), - tolerance: Some(tolerance_offset), - fit: Some(fit_offset), - }, - ) -} - -fn serialize_fcf_layout_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::FCFLayoutStyle, -) -> WIPOffset> { - fb::FCFLayoutStyle::create( - builder, - &fb::FCFLayoutStyleArgs { - padding: style.padding, - segment_spacing: style.segment_spacing, - row_spacing: style.row_spacing, - }, - ) -} - -fn serialize_fcf_symbol_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::FCFSymbolStyle, -) -> WIPOffset> { - fb::FCFSymbolStyle::create(builder, &fb::FCFSymbolStyleArgs { scale: style.scale }) -} - -fn serialize_fcf_datum_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::FCFDatumStyle, -) -> WIPOffset> { - fb::FCFDatumStyle::create( - builder, - &fb::FCFDatumStyleArgs { - bracket_style: Some(style.bracket_style), - }, - ) -} - -fn serialize_duc_feature_control_frame_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DucFeatureControlFrameStyle, -) -> WIPOffset> { - let text_style_offset = serialize_duc_text_style(builder, &style.text_style); - let layout_offset = serialize_fcf_layout_style(builder, &style.layout); - let symbols_offset = serialize_fcf_symbol_style(builder, &style.symbols); - let datum_style_offset = serialize_fcf_datum_style(builder, &style.datum_style); - - fb::DucFeatureControlFrameStyle::create( - builder, - &fb::DucFeatureControlFrameStyleArgs { - text_style: Some(text_style_offset), - layout: Some(layout_offset), - symbols: Some(symbols_offset), - datum_style: Some(datum_style_offset), - }, - ) -} - -fn serialize_paragraph_formatting<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - format: &types::ParagraphFormatting, -) -> WIPOffset> { - let tab_stops_vec = builder.create_vector(&format.tab_stops); - fb::ParagraphFormatting::create( - builder, - &fb::ParagraphFormattingArgs { - first_line_indent: format.first_line_indent, - hanging_indent: format.hanging_indent, - left_indent: format.left_indent, - right_indent: format.right_indent, - space_before: format.space_before, - space_after: format.space_after, - tab_stops: Some(tab_stops_vec), - }, - ) -} - -fn serialize_stack_format_properties<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - props: &types::StackFormatProperties, -) -> WIPOffset> { - fb::StackFormatProperties::create( - builder, - &fb::StackFormatPropertiesArgs { - upper_scale: props.upper_scale, - lower_scale: props.lower_scale, - alignment: Some(props.alignment), - }, - ) -} - -fn serialize_stack_format<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - format: &types::StackFormat, -) -> WIPOffset> { - let stack_chars_vec = serialize_vec_of_strings(builder, &format.stack_chars); - let properties_offset = serialize_stack_format_properties(builder, &format.properties); - fb::StackFormat::create( - builder, - &fb::StackFormatArgs { - auto_stack: format.auto_stack, - stack_chars: stack_chars_vec, - properties: Some(properties_offset), - }, - ) -} - -fn serialize_duc_doc_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DucDocStyle, -) -> WIPOffset> { - let text_style_offset = serialize_duc_text_style(builder, &style.text_style); - let paragraph_offset = serialize_paragraph_formatting(builder, &style.paragraph); - let stack_format_offset = serialize_stack_format(builder, &style.stack_format); - fb::DucDocStyle::create( - builder, - &fb::DucDocStyleArgs { - text_style: Some(text_style_offset), - paragraph: Some(paragraph_offset), - stack_format: Some(stack_format_offset), - }, - ) -} - -fn serialize_duc_viewport_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DucViewportStyle, -) -> WIPOffset> { - fb::DucViewportStyle::create( - builder, - &fb::DucViewportStyleArgs { - scale_indicator_visible: style.scale_indicator_visible, - }, - ) -} - -fn serialize_duc_plot_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - _style: &types::DucPlotStyle, -) -> WIPOffset> { - fb::DucPlotStyle::create(builder, &fb::DucPlotStyleArgs {}) -} - -fn serialize_duc_xray_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DucXRayStyle, -) -> WIPOffset> { - let color_offset = builder.create_string(&style.color); - fb::DucXRayStyle::create( - builder, - &fb::DucXRayStyleArgs { - color: Some(color_offset), - }, - ) -} - -// ============================================================================= -// ELEMENT DEFINITIONS -// ============================================================================= - -fn serialize_duc_rectangle_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucRectangleElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - fb::DucRectangleElement::create( - builder, - &fb::DucRectangleElementArgs { - base: Some(base_offset), - }, - ) -} - -fn serialize_duc_polygon_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucPolygonElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - fb::DucPolygonElement::create( - builder, - &fb::DucPolygonElementArgs { - base: Some(base_offset), - sides: element.sides, - }, - ) -} - -fn serialize_duc_ellipse_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucEllipseElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - fb::DucEllipseElement::create( - builder, - &fb::DucEllipseElementArgs { - base: Some(base_offset), - ratio: element.ratio, - start_angle: element.start_angle, - end_angle: element.end_angle, - show_aux_crosshair: element.show_aux_crosshair, - }, - ) -} - -fn serialize_duc_embeddable_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucEmbeddableElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - fb::DucEmbeddableElement::create( - builder, - &fb::DucEmbeddableElementArgs { - base: Some(base_offset), - }, - ) -} - -fn serialize_duc_pdf_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucPdfElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - let file_id_offset = element.file_id.as_deref().map(|s| builder.create_string(s)); - let grid_config_offset = serialize_document_grid_config(builder, &element.grid_config); - fb::DucPdfElement::create( - builder, - &fb::DucPdfElementArgs { - base: Some(base_offset), - file_id: file_id_offset, - grid_config: Some(grid_config_offset), - }, - ) -} - -fn serialize_duc_mermaid_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucMermaidElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - let source_offset = builder.create_string(&element.source); - let theme_offset: Option> = element - .theme - .as_ref() - .map(|s| builder.create_string(s.as_str())); - let svg_path_offset = element - .svg_path - .as_ref() - .map(|s| builder.create_string(s.as_str())); - fb::DucMermaidElement::create( - builder, - &fb::DucMermaidElementArgs { - base: Some(base_offset), - source: Some(source_offset), - theme: theme_offset, - svg_path: svg_path_offset, - }, - ) -} - -fn serialize_duc_table_column<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - col: &types::DucTableColumn, -) -> WIPOffset> { - let id_offset = builder.create_string(&col.id); - let style_overrides_offset = col - .style_overrides - .as_ref() - .map(|s| serialize_duc_table_cell_style(builder, s)); - fb::DucTableColumn::create( - builder, - &fb::DucTableColumnArgs { - id: Some(id_offset), - width: col.width, - style_overrides: style_overrides_offset, - }, - ) -} - -fn serialize_duc_table_row<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - row: &types::DucTableRow, -) -> WIPOffset> { - let id_offset = builder.create_string(&row.id); - let style_overrides_offset = row - .style_overrides - .as_ref() - .map(|s| serialize_duc_table_cell_style(builder, s)); - fb::DucTableRow::create( - builder, - &fb::DucTableRowArgs { - id: Some(id_offset), - height: row.height, - style_overrides: style_overrides_offset, - }, - ) -} - -fn serialize_duc_table_cell_span<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - span: &types::DucTableCellSpan, -) -> WIPOffset> { - fb::DucTableCellSpan::create( - builder, - &fb::DucTableCellSpanArgs { - columns: span.columns, - rows: span.rows, - }, - ) -} - -fn serialize_duc_table_cell<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - cell: &types::DucTableCell, -) -> WIPOffset> { - let row_id_offset = builder.create_string(&cell.row_id); - let column_id_offset = builder.create_string(&cell.column_id); - let data_offset = builder.create_string(&cell.data); - let span_offset = cell - .span - .as_ref() - .map(|s| serialize_duc_table_cell_span(builder, s)); - let style_overrides_offset = cell - .style_overrides - .as_ref() - .map(|s| serialize_duc_table_cell_style(builder, s)); - - fb::DucTableCell::create( - builder, - &fb::DucTableCellArgs { - row_id: Some(row_id_offset), - column_id: Some(column_id_offset), - data: Some(data_offset), - span: span_offset, - locked: cell.locked, - style_overrides: style_overrides_offset, - }, - ) -} - -fn serialize_duc_table_column_entry<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - entry: &types::DucTableColumnEntry, -) -> WIPOffset> { - let key_offset = builder.create_string(&entry.key); - let value_offset = serialize_duc_table_column(builder, &entry.value); - fb::DucTableColumnEntry::create( - builder, - &fb::DucTableColumnEntryArgs { - key: Some(key_offset), - value: Some(value_offset), - }, - ) -} - -fn serialize_duc_table_row_entry<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - entry: &types::DucTableRowEntry, -) -> WIPOffset> { - let key_offset = builder.create_string(&entry.key); - let value_offset = serialize_duc_table_row(builder, &entry.value); - fb::DucTableRowEntry::create( - builder, - &fb::DucTableRowEntryArgs { - key: Some(key_offset), - value: Some(value_offset), - }, - ) -} - -fn serialize_duc_table_cell_entry<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - entry: &types::DucTableCellEntry, -) -> WIPOffset> { - let key_offset = builder.create_string(&entry.key); - let value_offset = serialize_duc_table_cell(builder, &entry.value); - fb::DucTableCellEntry::create( - builder, - &fb::DucTableCellEntryArgs { - key: Some(key_offset), - value: Some(value_offset), - }, - ) -} - -fn serialize_duc_table_auto_size<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - auto_size: &types::DucTableAutoSize, -) -> WIPOffset> { - fb::DucTableAutoSize::create( - builder, - &fb::DucTableAutoSizeArgs { - columns: auto_size.columns, - rows: auto_size.rows, - }, - ) -} - -fn serialize_duc_table_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucTableElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - let style_offset = serialize_duc_table_style(builder, &element.style); - let column_order_vec = serialize_vec_of_strings(builder, &element.column_order); - let row_order_vec = serialize_vec_of_strings(builder, &element.row_order); - let columns_offsets: Vec<_> = element - .columns - .iter() - .map(|c| serialize_duc_table_column_entry(builder, c)) - .collect(); - let columns_vec = builder.create_vector(&columns_offsets); - let rows_offsets: Vec<_> = element - .rows - .iter() - .map(|r| serialize_duc_table_row_entry(builder, r)) - .collect(); - let rows_vec = builder.create_vector(&rows_offsets); - let cells_offsets: Vec<_> = element - .cells - .iter() - .map(|c| serialize_duc_table_cell_entry(builder, c)) - .collect(); - let cells_vec = builder.create_vector(&cells_offsets); - let auto_size_offset = serialize_duc_table_auto_size(builder, &element.auto_size); - - fb::DucTableElement::create( - builder, - &fb::DucTableElementArgs { - base: Some(base_offset), - style: Some(style_offset), - column_order: column_order_vec, - row_order: row_order_vec, - columns: Some(columns_vec), - rows: Some(rows_vec), - cells: Some(cells_vec), - header_row_count: element.header_row_count, - auto_size: Some(auto_size_offset), - }, - ) -} - -fn serialize_image_crop<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - crop: &types::ImageCrop, -) -> WIPOffset> { - fb::ImageCrop::create( - builder, - &fb::ImageCropArgs { - x: crop.x, - y: crop.y, - width: crop.width, - height: crop.height, - natural_width: crop.natural_width, - natural_height: crop.natural_height, - }, - ) -} - -fn serialize_duc_image_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucImageElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - let file_id_offset = element.file_id.as_ref().map(|s| builder.create_string(s)); - let scale_vec = builder.create_vector(&element.scale); - let crop_offset = element - .crop - .as_ref() - .map(|c| serialize_image_crop(builder, c)); - let filter_offset = element - .filter - .as_ref() - .map(|f| serialize_duc_image_filter(builder, f)); - - fb::DucImageElement::create( - builder, - &fb::DucImageElementArgs { - base: Some(base_offset), - file_id: file_id_offset, - status: Some(element.status), - scale: Some(scale_vec), - crop: crop_offset, - filter: filter_offset, - }, - ) -} - -fn serialize_duc_text_dynamic_element_source<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - source: &types::DucTextDynamicElementSource, -) -> WIPOffset> { - let element_id_offset = builder.create_string(&source.element_id); - fb::DucTextDynamicElementSource::create( - builder, - &fb::DucTextDynamicElementSourceArgs { - element_id: Some(element_id_offset), - property: source.property, - }, - ) -} - -fn serialize_duc_text_dynamic_dictionary_source<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - source: &types::DucTextDynamicDictionarySource, -) -> WIPOffset> { - let key_offset = builder.create_string(&source.key); - fb::DucTextDynamicDictionarySource::create( - builder, - &fb::DucTextDynamicDictionarySourceArgs { - key: Some(key_offset), - }, - ) -} - -fn serialize_duc_text_dynamic_source<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - source: &types::DucTextDynamicSource, -) -> WIPOffset> { - let (source_type, source_offset) = match &source.source { - types::DucTextDynamicSourceData::DucTextDynamicElementSource(s) => ( - fb::DucTextDynamicSourceData::DucTextDynamicElementSource, - serialize_duc_text_dynamic_element_source(builder, s).as_union_value(), - ), - types::DucTextDynamicSourceData::DucTextDynamicDictionarySource(s) => ( - fb::DucTextDynamicSourceData::DucTextDynamicDictionarySource, - serialize_duc_text_dynamic_dictionary_source(builder, s).as_union_value(), - ), - }; - - fb::DucTextDynamicSource::create( - builder, - &fb::DucTextDynamicSourceArgs { - text_source_type: source.text_source_type, - source_type, - source: Some(source_offset), - }, - ) -} - -fn serialize_duc_text_dynamic_part<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - part: &types::DucTextDynamicPart, -) -> WIPOffset> { - let tag_offset = builder.create_string(&part.tag); - let source_offset = serialize_duc_text_dynamic_source(builder, &part.source); - let formatting_offset = part - .formatting - .as_ref() - .map(|f| serialize_primary_units(builder, f)); - let cached_value_offset = builder.create_string(&part.cached_value); - - fb::DucTextDynamicPart::create( - builder, - &fb::DucTextDynamicPartArgs { - tag: Some(tag_offset), - source: Some(source_offset), - formatting: formatting_offset, - cached_value: Some(cached_value_offset), - }, - ) -} - -fn serialize_duc_text_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucTextElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - let style_offset = serialize_duc_text_style(builder, &element.style); - let text_offset = builder.create_string(&element.text); - // Help the compiler infer element type of the vector of offsets - let dynamic_offsets: Vec>> = element - .dynamic - .iter() - .map(|p| serialize_duc_text_dynamic_part(builder, p)) - .collect(); - let dynamic_vec: WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - > = builder.create_vector(&dynamic_offsets); - let container_id_offset = element - .container_id - .as_ref() - .map(|s| builder.create_string(s)); - // original_text is a required String in types, so always serialize - let original_text_offset: Option> = { - let off: WIPOffset<&'bldr str> = builder.create_string(element.original_text.as_str()); - Some(off) - }; - - fb::DucTextElement::create( - builder, - &fb::DucTextElementArgs { - base: Some(base_offset), - style: Some(style_offset), - text: Some(text_offset), - dynamic: Some(dynamic_vec), - auto_resize: element.auto_resize, - container_id: container_id_offset, - original_text: original_text_offset, - }, - ) -} - -fn serialize_duc_linear_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucLinearElement, -) -> WIPOffset> { - let linear_base_offset = serialize_duc_linear_element_base(builder, &element.linear_base); - fb::DucLinearElement::create( - builder, - &fb::DucLinearElementArgs { - linear_base: Some(linear_base_offset), - wipeout_below: element.wipeout_below, - }, - ) -} - -fn serialize_duc_arrow_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucArrowElement, -) -> WIPOffset> { - let linear_base_offset = serialize_duc_linear_element_base(builder, &element.linear_base); - fb::DucArrowElement::create( - builder, - &fb::DucArrowElementArgs { - linear_base: Some(linear_base_offset), - elbowed: element.elbowed, - }, - ) -} - -fn serialize_duc_free_draw_ends<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - ends: &types::DucFreeDrawEnds, -) -> WIPOffset> { - let easing_offset = builder.create_string(&ends.easing); - fb::DucFreeDrawEnds::create( - builder, - &fb::DucFreeDrawEndsArgs { - cap: ends.cap, - taper: ends.taper, - easing: Some(easing_offset), - }, - ) -} - -fn serialize_duc_free_draw_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucFreeDrawElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - let points_vec = serialize_vec_of_duc_points(builder, &element.points); - let easing_offset = builder.create_string(&element.easing); - let start_offset = element - .start - .as_ref() - .map(|s| serialize_duc_free_draw_ends(builder, s)); - let end_offset = element - .end - .as_ref() - .map(|e| serialize_duc_free_draw_ends(builder, e)); - let pressures_vec = builder.create_vector(&element.pressures); - let last_committed_point_offset = element - .last_committed_point - .as_ref() - .map(|p| serialize_duc_point(builder, p)); - let svg_path_offset = element - .svg_path - .as_deref() - .map(|s| builder.create_string(s)); - - fb::DucFreeDrawElement::create( - builder, - &fb::DucFreeDrawElementArgs { - base: Some(base_offset), - points: points_vec, - size: element.size, - thinning: element.thinning, - smoothing: element.smoothing, - streamline: element.streamline, - easing: Some(easing_offset), - start: start_offset, - end: end_offset, - pressures: Some(pressures_vec), - simulate_pressure: element.simulate_pressure, - last_committed_point: last_committed_point_offset, - svg_path: svg_path_offset, - }, - ) -} - -fn serialize_duc_block_duplication_array<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - array: &types::DucBlockDuplicationArray, -) -> WIPOffset> { - fb::DucBlockDuplicationArray::create( - builder, - &fb::DucBlockDuplicationArrayArgs { - rows: array.rows, - cols: array.cols, - row_spacing: array.row_spacing, - col_spacing: array.col_spacing, - }, - ) -} - - -fn serialize_duc_block_instance<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - instance: &types::DucBlockInstance, -) -> WIPOffset> { - let id_offset = builder.create_string(&instance.id); - let block_id_offset = builder.create_string(&instance.block_id); - let element_overrides_vec = instance.element_overrides.as_ref().map(|v| { - let offsets: Vec<_> = v - .iter() - .map(|e| serialize_string_value_entry(builder, e)) - .collect(); - builder.create_vector(&offsets) - }); - let attribute_values_vec = instance.attribute_values.as_ref().map(|v| { - let offsets: Vec<_> = v - .iter() - .map(|a| serialize_string_value_entry(builder, a)) - .collect(); - builder.create_vector(&offsets) - }); - let duplication_array_offset = instance - .duplication_array - .as_ref() - .map(|d| serialize_duc_block_duplication_array(builder, d)); - fb::DucBlockInstance::create( - builder, - &fb::DucBlockInstanceArgs { - id: Some(id_offset), - block_id: Some(block_id_offset), - version: instance.version, - element_overrides: element_overrides_vec, - attribute_values: attribute_values_vec, - duplication_array: duplication_array_offset, - }, - ) -} - -fn serialize_duc_block_collection<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - collection: &types::DucBlockCollection, -) -> WIPOffset> { - let id_offset = builder.create_string(&collection.id); - let label_offset = builder.create_string(&collection.label); - - let children_offsets: Vec<_> = collection - .children - .iter() - .map(|child| { - let child_id_offset = builder.create_string(&child.id); - fb::DucBlockCollectionEntry::create( - builder, - &fb::DucBlockCollectionEntryArgs { - id: Some(child_id_offset), - is_collection: child.is_collection, - }, - ) - }) - .collect(); - let children_vec = builder.create_vector(&children_offsets); - - let metadata_offset = collection.metadata.as_ref().map(|m| serialize_duc_block_metadata(builder, m)); - - let thumbnail_vec = collection.thumbnail.as_ref().map(|v| builder.create_vector(v)); - - fb::DucBlockCollection::create( - builder, - &fb::DucBlockCollectionArgs { - id: Some(id_offset), - label: Some(label_offset), - children: Some(children_vec), - metadata: metadata_offset, - thumbnail: thumbnail_vec, - }, - ) -} - -fn serialize_duc_frame_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucFrameElement, -) -> WIPOffset> { - let stack_element_base_offset = - serialize_duc_stack_element_base(builder, &element.stack_element_base); - fb::DucFrameElement::create( - builder, - &fb::DucFrameElementArgs { - stack_element_base: Some(stack_element_base_offset), - }, - ) -} - -fn serialize_plot_layout<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - layout: &types::PlotLayout, -) -> WIPOffset> { - let margins_offset = serialize_margins(builder, &layout.margins); - fb::PlotLayout::create( - builder, - &fb::PlotLayoutArgs { - margins: Some(margins_offset), - }, - ) -} - -fn serialize_duc_plot_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucPlotElement, -) -> WIPOffset> { - let stack_element_base_offset = - serialize_duc_stack_element_base(builder, &element.stack_element_base); - let style_offset = serialize_duc_plot_style(builder, &element.style); - let layout_offset = serialize_plot_layout(builder, &element.layout); - - fb::DucPlotElement::create( - builder, - &fb::DucPlotElementArgs { - stack_element_base: Some(stack_element_base_offset), - style: Some(style_offset), - layout: Some(layout_offset), - }, - ) -} - -fn serialize_duc_viewport_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucViewportElement, -) -> WIPOffset> { - let linear_base_offset = serialize_duc_linear_element_base(builder, &element.linear_base); - let stack_base_offset = serialize_duc_stack_base(builder, &element.stack_base); - let style_offset = serialize_duc_viewport_style(builder, &element.style); - let view_offset = serialize_duc_view(builder, &element.view); - let frozen_group_ids_vec = serialize_vec_of_strings(builder, &element.frozen_group_ids); - let standard_override_offset = element - .standard_override - .as_deref() - .map(|s| builder.create_string(s)); - - fb::DucViewportElement::create( - builder, - &fb::DucViewportElementArgs { - linear_base: Some(linear_base_offset), - stack_base: Some(stack_base_offset), - style: Some(style_offset), - view: Some(view_offset), - scale: element.scale, - shade_plot: Some(element.shade_plot), - frozen_group_ids: frozen_group_ids_vec, - standard_override: standard_override_offset, - }, - ) -} - -fn serialize_duc_xray_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucXRayElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - let style_offset = serialize_duc_xray_style(builder, &element.style); - let origin_offset = serialize_duc_point( - builder, - &types::DucPoint { - x: element.origin.x, - y: element.origin.y, - mirroring: None, - }, - ); - let direction_offset = serialize_duc_point( - builder, - &types::DucPoint { - x: element.direction.x, - y: element.direction.y, - mirroring: None, - }, - ); - - fb::DucXRayElement::create( - builder, - &fb::DucXRayElementArgs { - base: Some(base_offset), - style: Some(style_offset), - origin: Some(origin_offset), - direction: Some(direction_offset), - start_from_origin: element.start_from_origin, - }, - ) -} - -fn serialize_leader_text_block_content<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - content: &types::LeaderTextBlockContent, -) -> WIPOffset> { - let text_offset = builder.create_string(&content.text); - fb::LeaderTextBlockContent::create( - builder, - &fb::LeaderTextBlockContentArgs { - text: Some(text_offset), - }, - ) -} - -fn serialize_leader_block_content<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - content: &types::LeaderBlockContent, -) -> WIPOffset> { - let block_id_offset = builder.create_string(&content.block_id); - let attribute_values_vec: Option< - WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - >, - > = content - .attribute_values - .as_ref() - .map(|vec_entries: &Vec| { - let offsets: Vec>> = vec_entries - .iter() - .map(|a: &types::StringValueEntry| serialize_string_value_entry(builder, a)) - .collect(); - builder.create_vector(&offsets) - }); - let element_overrides_vec: Option< - WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - >, - > = content - .element_overrides - .as_ref() - .map(|vec_entries: &Vec| { - let offsets: Vec>> = vec_entries - .iter() - .map(|e: &types::StringValueEntry| serialize_string_value_entry(builder, e)) - .collect(); - builder.create_vector(&offsets) - }); - - fb::LeaderBlockContent::create( - builder, - &fb::LeaderBlockContentArgs { - block_id: Some(block_id_offset), - attribute_values: attribute_values_vec, - element_overrides: element_overrides_vec, - }, - ) -} - -fn serialize_leader_content<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - content: &types::LeaderContent, -) -> WIPOffset> { - let (content_type, content_offset) = match &content.content { - types::LeaderContentData::LeaderTextBlockContent(c) => ( - fb::LeaderContentData::LeaderTextBlockContent, - serialize_leader_text_block_content(builder, c).as_union_value(), - ), - types::LeaderContentData::LeaderBlockContent(c) => ( - fb::LeaderContentData::LeaderBlockContent, - serialize_leader_block_content(builder, c).as_union_value(), - ), - }; - - fb::LeaderContent::create( - builder, - &fb::LeaderContentArgs { - leader_content_type: Some(content.leader_content_type), - content_type, - content: Some(content_offset), - }, - ) -} - -fn serialize_duc_leader_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucLeaderElement, -) -> WIPOffset> { - let linear_base_offset = serialize_duc_linear_element_base(builder, &element.linear_base); - let style_offset = serialize_duc_leader_style(builder, &element.style); - let content_offset = element - .content - .as_ref() - .map(|c| serialize_leader_content(builder, c)); - let content_anchor = serialize_geometric_point(&element.content_anchor); - - fb::DucLeaderElement::create( - builder, - &fb::DucLeaderElementArgs { - linear_base: Some(linear_base_offset), - style: Some(style_offset), - content: content_offset, - content_anchor: Some(&content_anchor), - }, - ) -} + inner.execute_batch("PRAGMA foreign_keys = ON;")?; + } -fn serialize_dimension_definition_points<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - points: &types::DimensionDefinitionPoints, -) -> WIPOffset> { - let origin1: fb::GeometricPoint = serialize_geometric_point(&points.origin1); - let origin2_built: Option = - points.origin2.as_ref().map(serialize_geometric_point); - let location: fb::GeometricPoint = serialize_geometric_point(&points.location); - let center_built: Option = - points.center.as_ref().map(serialize_geometric_point); - let jog_built: Option = points.jog.as_ref().map(serialize_geometric_point); - - let origin2_ref: Option<&fb::GeometricPoint> = origin2_built.as_ref(); - let center_ref: Option<&fb::GeometricPoint> = center_built.as_ref(); - let jog_ref: Option<&fb::GeometricPoint> = jog_built.as_ref(); - - fb::DimensionDefinitionPoints::create( - builder, - &fb::DimensionDefinitionPointsArgs { - origin1: Some(&origin1), - origin2: origin2_ref, - location: Some(&location), - center: center_ref, - jog: jog_ref, - }, - ) -} + // Reclaim any wasted pages before exporting. + inner.execute_batch("VACUUM;")?; -fn serialize_dimension_bindings<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - bindings: &types::DimensionBindings, -) -> WIPOffset> { - let origin1_offset = bindings - .origin1 - .as_ref() - .map(|b| serialize_duc_point_binding(builder, b)); - let origin2_offset = bindings - .origin2 - .as_ref() - .map(|b| serialize_duc_point_binding(builder, b)); - let center_offset = bindings - .center - .as_ref() - .map(|b| serialize_duc_point_binding(builder, b)); - - fb::DimensionBindings::create( - builder, - &fb::DimensionBindingsArgs { - origin1: origin1_offset, - origin2: origin2_offset, - center: center_offset, - }, - ) + let raw = export_db_bytes(&inner)?; + compress_duc_bytes(&raw) } -fn serialize_dimension_baseline_data<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - data: &types::DimensionBaselineData, -) -> WIPOffset> { - let id_offset = data - .base_dimension_id - .as_deref() - .map(|s| builder.create_string(s)); - fb::DimensionBaselineData::create( - builder, - &fb::DimensionBaselineDataArgs { - base_dimension_id: id_offset, - }, - ) -} +// ─── Database export ───────────────────────────────────────────────────────── -fn serialize_dimension_continue_data<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - data: &types::DimensionContinueData, -) -> WIPOffset> { - let id_offset = data - .continue_from_dimension_id - .as_deref() - .map(|s| builder.create_string(s)); - fb::DimensionContinueData::create( - builder, - &fb::DimensionContinueDataArgs { - continue_from_dimension_id: id_offset, - }, - ) -} +fn export_db_bytes(conn: &Connection) -> SerializeResult> { + // Use SQLite's in-memory serializer instead of filesystem temp files. + // This works on native and wasm targets. + let schema = b"main\0"; -fn serialize_duc_dimension_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucDimensionElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - let style_offset = serialize_duc_dimension_style(builder, &element.style); - let definition_points_offset = - serialize_dimension_definition_points(builder, &element.definition_points); - let bindings_offset = element - .bindings - .as_ref() - .map(|b| serialize_dimension_bindings(builder, b)); - let text_override_offset = element - .text_override - .as_deref() - .map(|s| builder.create_string(s)); - let text_position_offset = element - .text_position - .as_ref() - .map(serialize_geometric_point); - let tolerance_override_offset = element - .tolerance_override - .as_ref() - .map(|t| serialize_dimension_tolerance_style(builder, t)); - let baseline_data_offset = element - .baseline_data - .as_ref() - .map(|d| serialize_dimension_baseline_data(builder, d)); - let continue_data_offset = element - .continue_data - .as_ref() - .map(|d| serialize_dimension_continue_data(builder, d)); - - // text_override_offset is Option>; keep as-is. - let args = fb::DucDimensionElementArgs { - base: Some(base_offset), - style: Some(style_offset), - dimension_type: Some(element.dimension_type), - definition_points: Some(definition_points_offset), - oblique_angle: element.oblique_angle, - ordinate_axis: element.ordinate_axis, - bindings: bindings_offset, - text_override: text_override_offset, - text_position: text_position_offset.as_ref(), - tolerance_override: tolerance_override_offset, - baseline_data: baseline_data_offset, - continue_data: continue_data_offset, + let mut size: rusqlite::ffi::sqlite3_int64 = 0; + let ptr = unsafe { + rusqlite::ffi::sqlite3_serialize( + conn.handle(), + schema.as_ptr() as *const c_char, + &mut size, + 0, + ) }; - fb::DucDimensionElement::create(builder, &args) -} - -fn serialize_datum_reference<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - datum: &types::DatumReference, -) -> WIPOffset> { - let letters_offset = builder.create_string(&datum.letters); - fb::DatumReference::create( - builder, - &fb::DatumReferenceArgs { - letters: Some(letters_offset), - modifier: datum.modifier, - }, - ) -} - -fn serialize_tolerance_clause<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - clause: &types::ToleranceClause, -) -> WIPOffset> { - let value_offset = builder.create_string(&clause.value); - let feature_modifiers_vec = - builder.create_vector_from_iter(clause.feature_modifiers.iter().copied()); - fb::ToleranceClause::create( - builder, - &fb::ToleranceClauseArgs { - value: Some(value_offset), - zone_type: clause.zone_type, - feature_modifiers: Some(feature_modifiers_vec), - material_condition: clause.material_condition, - }, - ) -} - -fn serialize_feature_control_frame_segment<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - segment: &types::FeatureControlFrameSegment, -) -> WIPOffset> { - let tolerance_offset = serialize_tolerance_clause(builder, &segment.tolerance); - let datums_offsets: Vec>>> = segment - .datums - .iter() - .map(|d| d.as_ref().map(|dr| serialize_datum_reference(builder, dr))) - .collect(); - let datums_vec = - builder.create_vector(&datums_offsets.into_iter().flatten().collect::>()); - fb::FeatureControlFrameSegment::create( - builder, - &fb::FeatureControlFrameSegmentArgs { - symbol: Some(segment.symbol), - tolerance: Some(tolerance_offset), - datums: Some(datums_vec), - }, - ) -} - -fn serialize_fcf_between_modifier<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - modifier: &types::FCFBetweenModifier, -) -> WIPOffset> { - let start_offset = builder.create_string(&modifier.start); - let end_offset = builder.create_string(&modifier.end); - fb::FCFBetweenModifier::create( - builder, - &fb::FCFBetweenModifierArgs { - start: Some(start_offset), - end: Some(end_offset), - }, - ) -} - -fn serialize_fcf_projected_zone_modifier<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - modifier: &types::FCFProjectedZoneModifier, -) -> WIPOffset> { - fb::FCFProjectedZoneModifier::create( - builder, - &fb::FCFProjectedZoneModifierArgs { - value: modifier.value, - }, - ) -} - -fn serialize_fcf_frame_modifiers<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - modifiers: &types::FCFFrameModifiers, -) -> WIPOffset> { - let between_offset = modifiers - .between - .as_ref() - .map(|m| serialize_fcf_between_modifier(builder, m)); - let projected_zone_offset = modifiers - .projected_tolerance_zone - .as_ref() - .map(|m| serialize_fcf_projected_zone_modifier(builder, m)); - fb::FCFFrameModifiers::create( - builder, - &fb::FCFFrameModifiersArgs { - all_around: modifiers.all_around, - all_over: modifiers.all_over, - continuous_feature: modifiers.continuous_feature, - between: between_offset, - projected_tolerance_zone: projected_zone_offset, - }, - ) -} - -fn serialize_fcf_datum_definition<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - def: &types::FCFDatumDefinition, -) -> WIPOffset> { - let letter_offset = builder.create_string(&def.letter); - let feature_binding_offset = def - .feature_binding - .as_ref() - .map(|b| serialize_duc_point_binding(builder, b)); - fb::FCFDatumDefinition::create( - builder, - &fb::FCFDatumDefinitionArgs { - letter: Some(letter_offset), - feature_binding: feature_binding_offset, - }, - ) -} - -fn serialize_fcf_segment_row<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - row: &types::FCFSegmentRow, -) -> WIPOffset> { - let segments_offsets: Vec<_> = row - .segments - .iter() - .map(|s| serialize_feature_control_frame_segment(builder, s)) - .collect(); - let segments_vec = builder.create_vector(&segments_offsets); - fb::FCFSegmentRow::create( - builder, - &fb::FCFSegmentRowArgs { - segments: Some(segments_vec), - }, - ) -} - -fn serialize_duc_feature_control_frame_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucFeatureControlFrameElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - let style_offset = serialize_duc_feature_control_frame_style(builder, &element.style); - let rows_offsets: Vec<_> = element - .rows - .iter() - .map(|r| serialize_fcf_segment_row(builder, r)) - .collect(); - let rows_vec = builder.create_vector(&rows_offsets); - let frame_modifiers_offset = element - .frame_modifiers - .as_ref() - .map(|m| serialize_fcf_frame_modifiers(builder, m)); - let leader_element_id_offset = element - .leader_element_id - .as_ref() - .map(|id| builder.create_string(id)); - let datum_definition_offset = element - .datum_definition - .as_ref() - .map(|d| serialize_fcf_datum_definition(builder, d)); - - fb::DucFeatureControlFrameElement::create( - builder, - &fb::DucFeatureControlFrameElementArgs { - base: Some(base_offset), - style: Some(style_offset), - rows: Some(rows_vec), - frame_modifiers: frame_modifiers_offset, - leader_element_id: leader_element_id_offset, - datum_definition: datum_definition_offset, - }, - ) -} - -fn serialize_text_column<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - col: &types::TextColumn, -) -> WIPOffset> { - fb::TextColumn::create( - builder, - &fb::TextColumnArgs { - width: col.width, - gutter: col.gutter, - }, - ) -} - -fn serialize_column_layout<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - layout: &types::ColumnLayout, -) -> WIPOffset> { - let definitions_offsets: Vec<_> = layout - .definitions - .iter() - .map(|d| serialize_text_column(builder, d)) - .collect(); - let definitions_vec = builder.create_vector(&definitions_offsets); - fb::ColumnLayout::create( - builder, - &fb::ColumnLayoutArgs { - type_: Some(layout.column_type), - definitions: Some(definitions_vec), - auto_height: layout.auto_height, - }, - ) -} - -fn serialize_document_grid_config<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - config: &types::DocumentGridConfig, -) -> WIPOffset> { - fb::DocumentGridConfig::create( - builder, - &fb::DocumentGridConfigArgs { - columns: config.columns, - gap_x: config.gap_x, - gap_y: config.gap_y, - align_items: Some(config.align_items.into()), - first_page_alone: config.first_page_alone, - scale: config.scale, - }, - ) -} - -fn serialize_duc_doc_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucDocElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - let style_offset = serialize_duc_doc_style(builder, &element.style); - let text_offset = builder.create_string(&element.text); - let dynamic_offsets: Vec>> = element - .dynamic - .iter() - .map(|p| serialize_duc_text_dynamic_part(builder, p)) - .collect(); - let dynamic_vec: WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - > = builder.create_vector(&dynamic_offsets); - let columns_offset = serialize_column_layout(builder, &element.columns); - let file_id_offset = element.file_id.as_deref().map(|s| builder.create_string(s)); - let grid_config_offset = serialize_document_grid_config(builder, &element.grid_config); - - fb::DucDocElement::create( - builder, - &fb::DucDocElementArgs { - base: Some(base_offset), - style: Some(style_offset), - text: Some(text_offset), - dynamic: Some(dynamic_vec), - flow_direction: Some(element.flow_direction), - columns: Some(columns_offset), - auto_resize: element.auto_resize, - file_id: file_id_offset, - grid_config: Some(grid_config_offset), - }, - ) -} - -fn serialize_parametric_source<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - source: &types::ParametricSource, -) -> WIPOffset> { - let code_offset = builder.create_string(&source.code); - let file_id_offset = source.file_id.as_deref().map(|s| builder.create_string(s)); - fb::ParametricSource::create( - builder, - &fb::ParametricSourceArgs { - type_: Some(source.source_type), - code: Some(code_offset), - file_id: file_id_offset, - }, - ) -} - -fn serialize_duc_parametric_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucParametricElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - let source_offset = serialize_parametric_source(builder, &element.source); - fb::DucParametricElement::create( - builder, - &fb::DucParametricElementArgs { - base: Some(base_offset), - source: Some(source_offset), - }, - ) -} - -fn serialize_duc_model_element<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - element: &types::DucModelElement, -) -> WIPOffset> { - let base_offset = serialize_duc_element_base(builder, &element.base); - let source_offset = builder.create_string(&element.source); - let svg_path_offset = element.svg_path.as_deref().map(|s| builder.create_string(s)); - let file_id_offsets: Vec<_> = element.file_ids.iter().map(|s| builder.create_string(s)).collect(); - let file_ids_vec = if !file_id_offsets.is_empty() { - Some(builder.create_vector(&file_id_offsets)) - } else { - None - }; - fb::DucModelElement::create( - builder, - &fb::DucModelElementArgs { - base: Some(base_offset), - source: Some(source_offset), - svg_path: svg_path_offset, - file_ids: file_ids_vec, - }, - ) -} + if ptr.is_null() || size < 0 { + return Err(SerializeError::Io( + "sqlite3_serialize failed to export database bytes".into(), + )); + } -// ============================================================================= -// ELEMENT UNION & WRAPPER -// ============================================================================= - -fn serialize_element_wrapper<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - wrapper: &types::ElementWrapper, -) -> WIPOffset> { - let (element_type, element_offset) = match &wrapper.element { - types::DucElementEnum::DucRectangleElement(e) => ( - fb::Element::DucRectangleElement, - serialize_duc_rectangle_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucPolygonElement(e) => ( - fb::Element::DucPolygonElement, - serialize_duc_polygon_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucEllipseElement(e) => ( - fb::Element::DucEllipseElement, - serialize_duc_ellipse_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucEmbeddableElement(e) => ( - fb::Element::DucEmbeddableElement, - serialize_duc_embeddable_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucPdfElement(e) => ( - fb::Element::DucPdfElement, - serialize_duc_pdf_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucMermaidElement(e) => ( - fb::Element::DucMermaidElement, - serialize_duc_mermaid_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucTableElement(e) => ( - fb::Element::DucTableElement, - serialize_duc_table_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucImageElement(e) => ( - fb::Element::DucImageElement, - serialize_duc_image_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucTextElement(e) => ( - fb::Element::DucTextElement, - serialize_duc_text_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucLinearElement(e) => ( - fb::Element::DucLinearElement, - serialize_duc_linear_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucArrowElement(e) => ( - fb::Element::DucArrowElement, - serialize_duc_arrow_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucFreeDrawElement(e) => ( - fb::Element::DucFreeDrawElement, - serialize_duc_free_draw_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucFrameElement(e) => ( - fb::Element::DucFrameElement, - serialize_duc_frame_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucPlotElement(e) => ( - fb::Element::DucPlotElement, - serialize_duc_plot_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucViewportElement(e) => ( - fb::Element::DucViewportElement, - serialize_duc_viewport_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucXRayElement(e) => ( - fb::Element::DucXRayElement, - serialize_duc_xray_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucLeaderElement(e) => ( - fb::Element::DucLeaderElement, - serialize_duc_leader_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucDimensionElement(e) => ( - fb::Element::DucDimensionElement, - serialize_duc_dimension_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucFeatureControlFrameElement(e) => ( - fb::Element::DucFeatureControlFrameElement, - serialize_duc_feature_control_frame_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucDocElement(e) => ( - fb::Element::DucDocElement, - serialize_duc_doc_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucParametricElement(e) => ( - fb::Element::DucParametricElement, - serialize_duc_parametric_element(builder, e).as_union_value(), - ), - types::DucElementEnum::DucModelElement(e) => ( - fb::Element::DucModelElement, - serialize_duc_model_element(builder, e).as_union_value(), - ), + let bytes = unsafe { + let slice = std::slice::from_raw_parts(ptr as *const u8, size as usize); + let out = slice.to_vec(); + rusqlite::ffi::sqlite3_free(ptr as *mut std::ffi::c_void); + out }; - fb::ElementWrapper::create( - builder, - &fb::ElementWrapperArgs { - element_type, - element: Some(element_offset), - }, - ) -} - -// ============================================================================= -// BLOCK DEFINITIONS -// ============================================================================= - -fn serialize_duc_block_attribute_definition<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - def: &types::DucBlockAttributeDefinition, -) -> WIPOffset> { - let tag_offset = builder.create_string(&def.tag); - let prompt_offset = def.prompt.as_ref().map(|s| builder.create_string(s)); - let default_value_offset = builder.create_string(&def.default_value); - - fb::DucBlockAttributeDefinition::create( - builder, - &fb::DucBlockAttributeDefinitionArgs { - tag: Some(tag_offset), - prompt: prompt_offset, - default_value: Some(default_value_offset), - is_constant: def.is_constant, - }, - ) -} - -fn serialize_duc_block_attribute_definition_entry<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - entry: &types::DucBlockAttributeDefinitionEntry, -) -> WIPOffset> { - let key_offset = builder.create_string(&entry.key); - let value_offset = serialize_duc_block_attribute_definition(builder, &entry.value); - fb::DucBlockAttributeDefinitionEntry::create( - builder, - &fb::DucBlockAttributeDefinitionEntryArgs { - key: Some(key_offset), - value: Some(value_offset), - }, - ) -} - -pub fn serialize_duc_block_metadata<'bldr>( - builder: &mut flatbuffers::FlatBufferBuilder<'bldr>, - metadata: &types::DucBlockMetadata, -) -> WIPOffset> { - let source_offset = metadata.source.as_ref().map(|s| builder.create_string(s)); - - // Compress localization JSON and create byte vector - let localization_offset = metadata - .localization - .as_ref() - .map(|s| { - let compressed = compress_string(s); - builder.create_vector::(&compressed) - }); - - fb::DucBlockMetadata::create( - builder, - &fb::DucBlockMetadataArgs { - source: source_offset, - usage_count: metadata.usage_count, - created_at: metadata.created_at, - updated_at: metadata.updated_at, - localization: localization_offset, - }, - ) -} - -fn serialize_duc_block<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - block: &types::DucBlock, -) -> WIPOffset> { - let id_offset = builder.create_string(&block.id); - let label_offset = builder.create_string(&block.label); - let description_offset: Option> = block - .description - .as_ref() - .map(|s| builder.create_string(s.as_str())); - - let attribute_definitions_offsets: Vec<_> = block - .attribute_definitions - .iter() - .map(|ad| serialize_duc_block_attribute_definition_entry(builder, ad)) - .collect(); - let attribute_definitions_vec = builder.create_vector(&attribute_definitions_offsets); - - let metadata_offset: Option>> = block - .metadata - .as_ref() - .map(|metadata| serialize_duc_block_metadata(builder, metadata)); - - let thumbnail_offset = block - .thumbnail - .as_ref() - .filter(|data| !data.is_empty()) - .map(|data| builder.create_vector(data)); - - fb::DucBlock::create( - builder, - &fb::DucBlockArgs { - id: Some(id_offset), - label: Some(label_offset), - description: description_offset, - version: block.version, - attribute_definitions: Some(attribute_definitions_vec), - metadata: metadata_offset, - thumbnail: thumbnail_offset, - }, - ) -} - -// ============================================================================= -// APP & DOCUMENT STATE -// ============================================================================= - -fn serialize_duc_global_state<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - state: &types::DucGlobalState, -) -> WIPOffset> { - let name_offset = state.name.as_ref().map(|s| builder.create_string(s)); - let view_background_color_offset = builder.create_string(&state.view_background_color); - let main_scope_offset = builder.create_string(&state.main_scope); - - fb::DucGlobalState::create( - builder, - &fb::DucGlobalStateArgs { - name: name_offset, - view_background_color: Some(view_background_color_offset), - main_scope: Some(main_scope_offset), - dash_spacing_scale: state.dash_spacing_scale, - is_dash_spacing_affected_by_viewport_scale: state - .is_dash_spacing_affected_by_viewport_scale, - scope_exponent_threshold: state.scope_exponent_threshold, - dimensions_associative_by_default: state.dimensions_associative_by_default, - use_annotative_scaling: state.use_annotative_scaling, - display_precision_linear: state.display_precision_linear, - display_precision_angular: state.display_precision_angular, - pruning_level: Some(state.pruning_level), - }, - ) -} - -fn serialize_duc_local_state<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - state: &types::DucLocalState, -) -> WIPOffset> { - let scope_offset = builder.create_string(&state.scope); - let active_standard_id_offset = builder.create_string(&state.active_standard_id); - let active_grid_settings_vec = state - .active_grid_settings - .as_ref() - .and_then(|v| serialize_vec_of_strings(builder, v)); - let active_snap_settings_offset = state - .active_snap_settings - .as_ref() - .map(|s| builder.create_string(s)); - let current_item_stroke_offset = - serialize_element_stroke(builder, state.current_item_stroke.as_ref().unwrap()); - let current_item_background_offset = - serialize_element_background(builder, state.current_item_background.as_ref().unwrap()); - let current_item_font_family_offset = builder.create_string(&state.current_item_font_family); - let current_item_start_line_head_offset = state - .current_item_start_line_head - .as_ref() - .map(|h| serialize_duc_head(builder, h)); - let current_item_end_line_head_offset = state - .current_item_end_line_head - .as_ref() - .map(|h| serialize_duc_head(builder, h)); - - fb::DucLocalState::create( - builder, - &fb::DucLocalStateArgs { - scope: Some(scope_offset), - active_standard_id: Some(active_standard_id_offset), - scroll_x: state.scroll_x, - scroll_y: state.scroll_y, - zoom: state.zoom, - active_grid_settings: active_grid_settings_vec, - active_snap_settings: active_snap_settings_offset, - is_binding_enabled: state.is_binding_enabled, - current_item_stroke: Some(current_item_stroke_offset), - current_item_background: Some(current_item_background_offset), - current_item_opacity: state.current_item_opacity, - current_item_font_family: Some(current_item_font_family_offset), - current_item_font_size: state.current_item_font_size, - current_item_text_align: Some(state.current_item_text_align), - current_item_start_line_head: current_item_start_line_head_offset, - current_item_end_line_head: current_item_end_line_head_offset, - current_item_roundness: state.current_item_roundness, - pen_mode: state.pen_mode, - view_mode_enabled: state.view_mode_enabled, - objects_snap_mode_enabled: state.objects_snap_mode_enabled, - grid_mode_enabled: state.grid_mode_enabled, - outline_mode_enabled: state.outline_mode_enabled, - manual_save_mode: state.manual_save_mode, - }, - ) -} - -fn serialize_duc_group<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - group: &types::DucGroup, -) -> WIPOffset> { - let id_offset = builder.create_string(&group.id); - let stack_base_offset = serialize_duc_stack_base(builder, &group.stack_base); - fb::DucGroup::create( - builder, - &fb::DucGroupArgs { - id: Some(id_offset), - stack_base: Some(stack_base_offset), - }, - ) -} - -fn serialize_duc_region<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - region: &types::DucRegion, -) -> WIPOffset> { - let id_offset = builder.create_string(®ion.id); - let stack_base_offset = serialize_duc_stack_base(builder, ®ion.stack_base); - fb::DucRegion::create( - builder, - &fb::DucRegionArgs { - id: Some(id_offset), - stack_base: Some(stack_base_offset), - boolean_operation: Some(region.boolean_operation), - }, - ) -} - -fn serialize_duc_layer_overrides<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - overrides: &types::DucLayerOverrides, -) -> WIPOffset> { - let stroke_offset = serialize_element_stroke(builder, &overrides.stroke); - let background_offset = serialize_element_background(builder, &overrides.background); - fb::DucLayerOverrides::create( - builder, - &fb::DucLayerOverridesArgs { - stroke: Some(stroke_offset), - background: Some(background_offset), - }, - ) -} - -fn serialize_duc_layer<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - layer: &types::DucLayer, -) -> WIPOffset> { - let id_offset = builder.create_string(&layer.id); - let stack_base_offset = serialize_duc_stack_base(builder, &layer.stack_base); - let overrides_offset = layer - .overrides - .as_ref() - .map(|o| serialize_duc_layer_overrides(builder, o)); - fb::DucLayer::create( - builder, - &fb::DucLayerArgs { - id: Some(id_offset), - stack_base: Some(stack_base_offset), - readonly: layer.readonly, - overrides: overrides_offset, - }, - ) -} - -// ============================================================================= -// STANDARDS & SETTINGS -// ============================================================================= - -fn serialize_unit_system_base<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - base: &types::UnitSystemBase, -) -> WIPOffset> { - fb::_UnitSystemBase::create( - builder, - &fb::_UnitSystemBaseArgs { - system: Some(base.system), - precision: base.precision, - suppress_leading_zeros: base.suppress_leading_zeros, - suppress_trailing_zeros: base.suppress_trailing_zeros, - }, - ) -} - -fn serialize_linear_unit_system<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - sys: &types::LinearUnitSystem, -) -> WIPOffset> { - let base_offset = serialize_unit_system_base(builder, &sys.base); - fb::LinearUnitSystem::create( - builder, - &fb::LinearUnitSystemArgs { - base: Some(base_offset), - format: Some(sys.format), - decimal_separator: Some(sys.decimal_separator), - suppress_zero_feet: sys.suppress_zero_feet, - suppress_zero_inches: sys.suppress_zero_inches, - }, - ) -} - -fn serialize_angular_unit_system<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - sys: &types::AngularUnitSystem, -) -> WIPOffset> { - let base_offset = serialize_unit_system_base(builder, &sys.base); - fb::AngularUnitSystem::create( - builder, - &fb::AngularUnitSystemArgs { - base: Some(base_offset), - format: Some(sys.format), - }, - ) -} - -fn serialize_alternate_units<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - units: &types::AlternateUnits, -) -> WIPOffset> { - let base_offset = serialize_unit_system_base(builder, &units.base); - fb::AlternateUnits::create( - builder, - &fb::AlternateUnitsArgs { - base: Some(base_offset), - format: Some(units.format), - is_visible: units.is_visible, - multiplier: units.multiplier, - }, - ) -} - -fn serialize_primary_units<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - units: &types::PrimaryUnits, -) -> WIPOffset> { - let linear_offset = serialize_linear_unit_system(builder, &units.linear); - let angular_offset = serialize_angular_unit_system(builder, &units.angular); - fb::PrimaryUnits::create( - builder, - &fb::PrimaryUnitsArgs { - linear: Some(linear_offset), - angular: Some(angular_offset), - }, - ) -} - -fn serialize_standard_units<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - units: &types::StandardUnits, -) -> WIPOffset> { - let primary_units_offset = serialize_primary_units(builder, &units.primary_units); - let alternate_units_offset = serialize_alternate_units(builder, &units.alternate_units); - fb::StandardUnits::create( - builder, - &fb::StandardUnitsArgs { - primary_units: Some(primary_units_offset), - alternate_units: Some(alternate_units_offset), - }, - ) -} - -fn serialize_unit_precision<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - precision: &types::UnitPrecision, -) -> WIPOffset> { - fb::UnitPrecision::create( - builder, - &fb::UnitPrecisionArgs { - linear: precision.linear.unwrap_or(0), - angular: precision.angular.unwrap_or(0), - area: precision.area.unwrap_or(0), - volume: precision.volume.unwrap_or(0), - }, - ) -} - -fn serialize_standard_overrides<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - overrides: &types::StandardOverrides, -) -> WIPOffset> { - let main_scope_offset = overrides - .main_scope - .as_ref() - .map(|s| builder.create_string(s)); - let common_style_id_offset = overrides - .common_style_id - .as_ref() - .map(|s| builder.create_string(s)); - let stack_like_style_id_offset = overrides - .stack_like_style_id - .as_ref() - .map(|s| builder.create_string(s)); - let text_style_id_offset = overrides - .text_style_id - .as_ref() - .map(|s| builder.create_string(s)); - let dimension_style_id_offset = overrides - .dimension_style_id - .as_ref() - .map(|s| builder.create_string(s)); - let leader_style_id_offset = overrides - .leader_style_id - .as_ref() - .map(|s| builder.create_string(s)); - let fcf_style_id_offset = overrides - .feature_control_frame_style_id - .as_ref() - .map(|s| builder.create_string(s)); - let table_style_id_offset = overrides - .table_style_id - .as_ref() - .map(|s| builder.create_string(s)); - let doc_style_id_offset = overrides - .doc_style_id - .as_ref() - .map(|s| builder.create_string(s)); - let viewport_style_id_offset = overrides - .viewport_style_id - .as_ref() - .map(|s| builder.create_string(s)); - let plot_style_id_offset = overrides - .plot_style_id - .as_ref() - .map(|s| builder.create_string(s)); - let hatch_style_id_offset = overrides - .hatch_style_id - .as_ref() - .map(|s| builder.create_string(s)); - let active_grid_settings_id_vec = overrides - .active_grid_settings_id - .as_ref() - .and_then(|v| serialize_vec_of_strings(builder, v)); - let active_snap_settings_id_offset = overrides - .active_snap_settings_id - .as_ref() - .map(|s| builder.create_string(s)); - let dash_line_override_offset = overrides - .dash_line_override - .as_ref() - .map(|s| builder.create_string(s)); - let unit_precision_offset = overrides - .unit_precision - .as_ref() - .map(|u| serialize_unit_precision(builder, u)); - - fb::StandardOverrides::create( - builder, - &fb::StandardOverridesArgs { - main_scope: main_scope_offset, - elements_stroke_width_override: overrides.elements_stroke_width_override.unwrap_or(0.0), - common_style_id: common_style_id_offset, - stack_like_style_id: stack_like_style_id_offset, - text_style_id: text_style_id_offset, - dimension_style_id: dimension_style_id_offset, - leader_style_id: leader_style_id_offset, - feature_control_frame_style_id: fcf_style_id_offset, - table_style_id: table_style_id_offset, - doc_style_id: doc_style_id_offset, - viewport_style_id: viewport_style_id_offset, - plot_style_id: plot_style_id_offset, - hatch_style_id: hatch_style_id_offset, - active_grid_settings_id: active_grid_settings_id_vec, - active_snap_settings_id: active_snap_settings_id_offset, - dash_line_override: dash_line_override_offset, - unit_precision: unit_precision_offset, - }, - ) -} - -fn serialize_duc_common_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::DucCommonStyle, -) -> WIPOffset> { - let background_offset = serialize_element_background(builder, &style.background); - let stroke_offset = serialize_element_stroke(builder, &style.stroke); - fb::DucCommonStyle::create( - builder, - &fb::DucCommonStyleArgs { - background: Some(background_offset), - stroke: Some(stroke_offset), - }, - ) -} - -fn serialize_identified_common_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::IdentifiedCommonStyle, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &style.id); - let style_offset = serialize_duc_common_style(builder, &style.style); - fb::IdentifiedCommonStyle::create( - builder, - &fb::IdentifiedCommonStyleArgs { - id: Some(id_offset), - style: Some(style_offset), - }, - ) -} - -fn serialize_identified_stack_like_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::IdentifiedStackLikeStyle, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &style.id); - let style_offset = serialize_duc_stack_like_styles(builder, &style.style); - fb::IdentifiedStackLikeStyle::create( - builder, - &fb::IdentifiedStackLikeStyleArgs { - id: Some(id_offset), - style: Some(style_offset), - }, - ) -} - -fn serialize_identified_text_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::IdentifiedTextStyle, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &style.id); - let style_offset = serialize_duc_text_style(builder, &style.style); - fb::IdentifiedTextStyle::create( - builder, - &fb::IdentifiedTextStyleArgs { - id: Some(id_offset), - style: Some(style_offset), - }, - ) -} - -fn serialize_identified_dimension_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::IdentifiedDimensionStyle, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &style.id); - let style_offset = serialize_duc_dimension_style(builder, &style.style); - fb::IdentifiedDimensionStyle::create( - builder, - &fb::IdentifiedDimensionStyleArgs { - id: Some(id_offset), - style: Some(style_offset), - }, - ) -} - -fn serialize_identified_leader_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::IdentifiedLeaderStyle, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &style.id); - let style_offset = serialize_duc_leader_style(builder, &style.style); - fb::IdentifiedLeaderStyle::create( - builder, - &fb::IdentifiedLeaderStyleArgs { - id: Some(id_offset), - style: Some(style_offset), - }, - ) -} - -fn serialize_identified_fcf_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::IdentifiedFCFStyle, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &style.id); - let style_offset = serialize_duc_feature_control_frame_style(builder, &style.style); - fb::IdentifiedFCFStyle::create( - builder, - &fb::IdentifiedFCFStyleArgs { - id: Some(id_offset), - style: Some(style_offset), - }, - ) -} - -fn serialize_identified_table_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::IdentifiedTableStyle, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &style.id); - let style_offset = serialize_duc_table_style(builder, &style.style); - fb::IdentifiedTableStyle::create( - builder, - &fb::IdentifiedTableStyleArgs { - id: Some(id_offset), - style: Some(style_offset), - }, - ) -} - -fn serialize_identified_doc_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::IdentifiedDocStyle, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &style.id); - let style_offset = serialize_duc_doc_style(builder, &style.style); - fb::IdentifiedDocStyle::create( - builder, - &fb::IdentifiedDocStyleArgs { - id: Some(id_offset), - style: Some(style_offset), - }, - ) -} - -fn serialize_identified_viewport_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::IdentifiedViewportStyle, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &style.id); - let style_offset = serialize_duc_viewport_style(builder, &style.style); - fb::IdentifiedViewportStyle::create( - builder, - &fb::IdentifiedViewportStyleArgs { - id: Some(id_offset), - style: Some(style_offset), - }, - ) + Ok(bytes) } -fn serialize_identified_hatch_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::IdentifiedHatchStyle, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &style.id); - let style_offset = serialize_duc_hatch_style(builder, &style.style); - fb::IdentifiedHatchStyle::create( - builder, - &fb::IdentifiedHatchStyleArgs { - id: Some(id_offset), - style: Some(style_offset), - }, - ) -} - -fn serialize_identified_xray_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::IdentifiedXRayStyle, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &style.id); - let style_offset = serialize_duc_xray_style(builder, &style.style); - fb::IdentifiedXRayStyle::create( - builder, - &fb::IdentifiedXRayStyleArgs { - id: Some(id_offset), - style: Some(style_offset), - }, - ) -} +/// Compress raw SQLite bytes using a zlib/deflate stream. +fn compress_duc_bytes(raw: &[u8]) -> SerializeResult> { + use flate2::write::DeflateEncoder; + use flate2::Compression; + use std::io::Write; -fn serialize_standard_styles<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - styles: &types::StandardStyles, -) -> WIPOffset> { - let common_styles_offsets: Vec<_> = styles - .common_styles - .iter() - .map(|s| serialize_identified_common_style(builder, s)) - .collect(); - let common_styles_vec = builder.create_vector(&common_styles_offsets); - - let stack_like_styles_offsets: Vec<_> = styles - .stack_like_styles - .iter() - .map(|s| serialize_identified_stack_like_style(builder, s)) - .collect(); - let stack_like_styles_vec = builder.create_vector(&stack_like_styles_offsets); - - let text_styles_offsets: Vec<_> = styles - .text_styles - .iter() - .map(|s| serialize_identified_text_style(builder, s)) - .collect(); - let text_styles_vec = builder.create_vector(&text_styles_offsets); - - let dimension_styles_offsets: Vec<_> = styles - .dimension_styles - .iter() - .map(|s| serialize_identified_dimension_style(builder, s)) - .collect(); - let dimension_styles_vec = builder.create_vector(&dimension_styles_offsets); - - let leader_styles_offsets: Vec<_> = styles - .leader_styles - .iter() - .map(|s| serialize_identified_leader_style(builder, s)) - .collect(); - let leader_styles_vec = builder.create_vector(&leader_styles_offsets); - - let fcf_styles_offsets: Vec<_> = styles - .feature_control_frame_styles - .iter() - .map(|s| serialize_identified_fcf_style(builder, s)) - .collect(); - let fcf_styles_vec = builder.create_vector(&fcf_styles_offsets); - - let table_styles_offsets: Vec<_> = styles - .table_styles - .iter() - .map(|s| serialize_identified_table_style(builder, s)) - .collect(); - let table_styles_vec = builder.create_vector(&table_styles_offsets); - - let doc_styles_offsets: Vec<_> = styles - .doc_styles - .iter() - .map(|s| serialize_identified_doc_style(builder, s)) - .collect(); - let doc_styles_vec = builder.create_vector(&doc_styles_offsets); - - let viewport_styles_offsets: Vec<_> = styles - .viewport_styles - .iter() - .map(|s| serialize_identified_viewport_style(builder, s)) - .collect(); - let viewport_styles_vec = builder.create_vector(&viewport_styles_offsets); - - let hatch_styles_offsets: Vec<_> = styles - .hatch_styles - .iter() - .map(|s| serialize_identified_hatch_style(builder, s)) - .collect(); - let hatch_styles_vec = builder.create_vector(&hatch_styles_offsets); - - let xray_styles_offsets: Vec<_> = styles - .xray_styles - .iter() - .map(|s| serialize_identified_xray_style(builder, s)) - .collect(); - let xray_styles_vec = builder.create_vector(&xray_styles_offsets); - - fb::StandardStyles::create( - builder, - &fb::StandardStylesArgs { - common_styles: Some(common_styles_vec), - stack_like_styles: Some(stack_like_styles_vec), - text_styles: Some(text_styles_vec), - dimension_styles: Some(dimension_styles_vec), - leader_styles: Some(leader_styles_vec), - feature_control_frame_styles: Some(fcf_styles_vec), - table_styles: Some(table_styles_vec), - doc_styles: Some(doc_styles_vec), - viewport_styles: Some(viewport_styles_vec), - hatch_styles: Some(hatch_styles_vec), - xray_styles: Some(xray_styles_vec), - }, - ) -} + let mut encoder = DeflateEncoder::new(Vec::with_capacity(raw.len() / 4), Compression::default()); + encoder.write_all(raw)?; + Ok(encoder.finish()?) +} + +// ─── duc_document ──────────────────────────────────────────────────────────── + +fn write_document(tx: &Transaction, state: &ExportedDataState) -> SerializeResult<()> { + tx.execute( + "INSERT OR REPLACE INTO duc_document (id, version, source, data_type, thumbnail) + VALUES (?1, ?2, ?3, ?4, ?5)", + params![ + state.id.as_deref().unwrap_or(""), + state.version, + state.source, + state.data_type, + state.thumbnail.as_deref(), + ], + )?; + Ok(()) +} + +// ─── duc_global_state ──────────────────────────────────────────────────────── + +fn write_global_state(tx: &Transaction, gs: &Option) -> SerializeResult<()> { + let Some(gs) = gs else { return Ok(()) }; + tx.execute( + "INSERT OR REPLACE INTO duc_global_state + (id, name, view_background_color, main_scope, scope_exponent_threshold, pruning_level) + VALUES (1, ?1, ?2, ?3, ?4, ?5)", + params![ + gs.name, + gs.view_background_color, + gs.main_scope, + gs.scope_exponent_threshold, + gs.pruning_level as i32, + ], + )?; + Ok(()) +} + +// ─── duc_local_state ───────────────────────────────────────────────────────── + +fn write_local_state(tx: &Transaction, ls: &Option) -> SerializeResult<()> { + let Some(ls) = ls else { return Ok(()) }; + tx.execute( + "INSERT OR REPLACE INTO duc_local_state ( + id, scope, scroll_x, scroll_y, zoom, + is_binding_enabled, + current_item_opacity, current_item_font_family, current_item_font_size, + current_item_text_align, current_item_roundness, + start_head_type, start_head_block_id, start_head_size, + end_head_type, end_head_block_id, end_head_size, + pen_mode, view_mode_enabled, objects_snap_mode_enabled, + grid_mode_enabled, outline_mode_enabled, manual_save_mode, + decimal_places + ) VALUES ( + 1, ?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, + ?11, ?12, ?13, ?14, ?15, ?16, + ?17, ?18, ?19, ?20, ?21, ?22, ?23 + )", + params![ + ls.scope, + ls.scroll_x, + ls.scroll_y, + ls.zoom, + ls.is_binding_enabled as i32, + ls.current_item_opacity, + ls.current_item_font_family, + ls.current_item_font_size, + ls.current_item_text_align as i32, + ls.current_item_roundness, + ls.current_item_start_line_head.as_ref().and_then(|h| h.head_type.map(|t| t as i32)), + ls.current_item_start_line_head.as_ref().and_then(|h| h.block_id.clone()), + ls.current_item_start_line_head.as_ref().map(|h| h.size), + ls.current_item_end_line_head.as_ref().and_then(|h| h.head_type.map(|t| t as i32)), + ls.current_item_end_line_head.as_ref().and_then(|h| h.block_id.clone()), + ls.current_item_end_line_head.as_ref().map(|h| h.size), + ls.pen_mode as i32, + ls.view_mode_enabled as i32, + ls.objects_snap_mode_enabled as i32, + ls.grid_mode_enabled as i32, + ls.outline_mode_enabled as i32, + ls.manual_save_mode as i32, + ls.decimal_places, + ], + )?; + + if let Some(ref stroke) = ls.current_item_stroke { + write_stroke(tx, "local_state", "1", 0, stroke)?; + } + if let Some(ref bg) = ls.current_item_background { + write_background(tx, "local_state", "1", 0, bg)?; + } -fn serialize_grid_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::GridStyle, -) -> WIPOffset> { - let color_offset = builder.create_string(&style.color); - let dash_pattern_vec = builder.create_vector(&style.dash_pattern); - fb::GridStyle::create( - builder, - &fb::GridStyleArgs { - color: Some(color_offset), - opacity: style.opacity, - dash_pattern: Some(dash_pattern_vec), - }, - ) + Ok(()) } -fn serialize_polar_grid_settings<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - settings: &types::PolarGridSettings, -) -> WIPOffset> { - fb::PolarGridSettings::create( - builder, - &fb::PolarGridSettingsArgs { - radial_divisions: settings.radial_divisions, - radial_spacing: settings.radial_spacing, - show_labels: settings.show_labels, - }, - ) -} +// ─── dictionary ────────────────────────────────────────────────────────────── -fn serialize_isometric_grid_settings<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - settings: &types::IsometricGridSettings, -) -> WIPOffset> { - fb::IsometricGridSettings::create( - builder, - &fb::IsometricGridSettingsArgs { - left_angle: settings.left_angle, - right_angle: settings.right_angle, - }, - ) +fn write_dictionary(tx: &Transaction, dict: &Option>) -> SerializeResult<()> { + let Some(dict) = dict else { return Ok(()) }; + let mut stmt = tx.prepare_cached( + "INSERT OR REPLACE INTO document_dictionary (key, value) VALUES (?1, ?2)" + )?; + for (key, value) in dict { + stmt.execute(params![key, value])?; + } + Ok(()) +} + +// ─── stack_properties, layers, groups, regions ─────────────────────────────── + +fn write_stack_base(tx: &Transaction, id: &str, sb: &DucStackBase) -> SerializeResult<()> { + tx.execute( + "INSERT OR REPLACE INTO stack_properties + (id, label, description, is_collapsed, is_plot, is_visible, locked, opacity) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)", + params![ + id, + sb.label, + sb.description, + sb.is_collapsed as i32, + sb.is_plot as i32, + sb.is_visible as i32, + sb.locked as i32, + sb.styles.opacity, + ], + )?; + Ok(()) +} + +fn write_stack_and_containers(tx: &Transaction, state: &ExportedDataState) -> SerializeResult<()> { + for layer in &state.layers { + write_stack_base(tx, &layer.id, &layer.stack_base)?; + tx.execute( + "INSERT OR REPLACE INTO layers (id, readonly) VALUES (?1, ?2)", + params![layer.id, layer.readonly as i32], + )?; + if let Some(ref ov) = layer.overrides { + write_stroke(tx, "layer", &layer.id, 0, &ov.stroke)?; + write_background(tx, "layer", &layer.id, 0, &ov.background)?; + } + } + for group in &state.groups { + write_stack_base(tx, &group.id, &group.stack_base)?; + tx.execute( + "INSERT OR REPLACE INTO groups (id) VALUES (?1)", + params![group.id], + )?; + } + for region in &state.regions { + write_stack_base(tx, ®ion.id, ®ion.stack_base)?; + tx.execute( + "INSERT OR REPLACE INTO regions (id, boolean_operation) VALUES (?1, ?2)", + params![region.id, region.boolean_operation as i32], + )?; + } + Ok(()) } -fn serialize_grid_settings<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - settings: &types::GridSettings, -) -> WIPOffset> { - let origin = serialize_geometric_point(&settings.origin); - let major_style_offset = serialize_grid_style(builder, &settings.major_style); - let minor_style_offset = serialize_grid_style(builder, &settings.minor_style); - let polar_settings_offset = settings - .polar_settings - .as_ref() - .map(|s| serialize_polar_grid_settings(builder, s)); - let isometric_settings_offset = settings - .isometric_settings - .as_ref() - .map(|s| serialize_isometric_grid_settings(builder, s)); - - fb::GridSettings::create( - builder, - &fb::GridSettingsArgs { - type_: Some(settings.grid_type), - readonly: settings.readonly, - display_type: Some(settings.display_type), - is_adaptive: settings.is_adaptive, - x_spacing: settings.x_spacing, - y_spacing: settings.y_spacing, - subdivisions: settings.subdivisions, - origin: Some(&origin), - rotation: settings.rotation, - follow_ucs: settings.follow_ucs, - major_style: Some(major_style_offset), - minor_style: Some(minor_style_offset), - show_minor: settings.show_minor, - min_zoom: settings.min_zoom, - max_zoom: settings.max_zoom, - auto_hide: settings.auto_hide, - polar_settings: polar_settings_offset, - isometric_settings: isometric_settings_offset, - enable_snapping: settings.enable_snapping, - }, - ) -} +// ─── blocks ────────────────────────────────────────────────────────────────── -fn serialize_snap_override<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - so: &types::SnapOverride, -) -> WIPOffset> { - let key_offset = builder.create_string(&so.key); - fb::SnapOverride::create( - builder, - &fb::SnapOverrideArgs { - key: Some(key_offset), - behavior: so.behavior, - }, - ) -} +fn write_blocks(tx: &Transaction, state: &ExportedDataState) -> SerializeResult<()> { + for block in &state.blocks { + tx.execute( + "INSERT OR REPLACE INTO blocks (id, label, description, version) + VALUES (?1, ?2, ?3, ?4)", + params![block.id, block.label, block.description, block.version], + )?; + if let Some(ref meta) = block.metadata { + write_block_metadata(tx, "block", &block.id, meta, block.thumbnail.as_deref())?; + } + } -fn serialize_dynamic_snap_settings<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - settings: &types::DynamicSnapSettings, -) -> WIPOffset> { - fb::DynamicSnapSettings::create( - builder, - &fb::DynamicSnapSettingsArgs { - enabled_during_drag: settings.enabled_during_drag, - enabled_during_rotation: settings.enabled_during_rotation, - enabled_during_scale: settings.enabled_during_scale, - }, - ) -} + for inst in &state.block_instances { + let (dup_rows, dup_cols, dup_row_sp, dup_col_sp) = match &inst.duplication_array { + Some(da) => (Some(da.rows), Some(da.cols), Some(da.row_spacing), Some(da.col_spacing)), + None => (None, None, None, None), + }; + tx.execute( + "INSERT OR REPLACE INTO block_instances + (id, block_id, version, dup_rows, dup_cols, dup_row_spacing, dup_col_spacing) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)", + params![inst.id, inst.block_id, inst.version, dup_rows, dup_cols, dup_row_sp, dup_col_sp], + )?; + if let Some(ref overrides) = inst.element_overrides { + let mut stmt = tx.prepare_cached( + "INSERT OR REPLACE INTO block_instance_overrides (instance_id, key, value) + VALUES (?1, ?2, ?3)" + )?; + for ov in overrides { + stmt.execute(params![inst.id, ov.key, ov.value])?; + } + } + } -fn serialize_polar_tracking_settings<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - settings: &types::PolarTrackingSettings, -) -> WIPOffset> { - let angles_vec = builder.create_vector(&settings.angles); - fb::PolarTrackingSettings::create( - builder, - &fb::PolarTrackingSettingsArgs { - enabled: settings.enabled, - angles: Some(angles_vec), - increment_angle: settings.increment_angle.unwrap_or(0.0), - track_from_last_point: settings.track_from_last_point, - show_polar_coordinates: settings.show_polar_coordinates, - }, - ) -} + for col in &state.block_collections { + tx.execute( + "INSERT OR REPLACE INTO block_collections (id, label) VALUES (?1, ?2)", + params![col.id, col.label], + )?; + if let Some(ref meta) = col.metadata { + write_block_metadata(tx, "collection", &col.id, meta, col.thumbnail.as_deref())?; + } + let mut stmt = tx.prepare_cached( + "INSERT OR REPLACE INTO block_collection_entries (collection_id, child_id, is_collection) + VALUES (?1, ?2, ?3)" + )?; + for child in &col.children { + stmt.execute(params![col.id, child.id, child.is_collection as i32])?; + } + } -fn serialize_tracking_line_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::TrackingLineStyle, -) -> WIPOffset> { - let color_offset = builder.create_string(&style.color); - let dash_pattern_vec = style - .dash_pattern - .as_ref() - .map(|v| builder.create_vector(v)); - fb::TrackingLineStyle::create( - builder, - &fb::TrackingLineStyleArgs { - color: Some(color_offset), - opacity: style.opacity, - dash_pattern: dash_pattern_vec, - }, - ) -} + Ok(()) +} + +fn write_block_metadata( + tx: &Transaction, + owner_type: &str, + owner_id: &str, + meta: &DucBlockMetadata, + thumbnail: Option<&[u8]>, +) -> SerializeResult<()> { + tx.execute( + "INSERT OR REPLACE INTO block_metadata + (owner_type, owner_id, source, usage_count, created_at, updated_at, localization, thumbnail) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)", + params![ + owner_type, + owner_id, + meta.source, + meta.usage_count, + meta.created_at, + meta.updated_at, + meta.localization, + thumbnail, + ], + )?; + Ok(()) +} + +// ─── elements ──────────────────────────────────────────────────────────────── + +fn write_elements(tx: &Transaction, state: &ExportedDataState) -> SerializeResult<()> { + for wrapper in &state.elements { + write_element_wrapper(tx, wrapper)?; + } + Ok(()) +} + +fn write_element_wrapper(tx: &Transaction, wrapper: &ElementWrapper) -> SerializeResult<()> { + match &wrapper.element { + DucElementEnum::DucRectangleElement(e) => { + write_base_element(tx, "rectangle", &e.base)?; + } + DucElementEnum::DucPolygonElement(e) => { + write_base_element(tx, "polygon", &e.base)?; + tx.execute( + "INSERT INTO element_polygon (element_id, sides) VALUES (?1, ?2)", + params![e.base.id, e.sides], + )?; + } + DucElementEnum::DucEllipseElement(e) => { + write_base_element(tx, "ellipse", &e.base)?; + tx.execute( + "INSERT INTO element_ellipse (element_id, ratio, start_angle, end_angle, show_aux_crosshair) + VALUES (?1, ?2, ?3, ?4, ?5)", + params![e.base.id, e.ratio, e.start_angle, e.end_angle, e.show_aux_crosshair as i32], + )?; + } + DucElementEnum::DucEmbeddableElement(e) => { + write_base_element(tx, "embeddable", &e.base)?; + tx.execute( + "INSERT INTO element_embeddable (element_id) VALUES (?1)", + params![e.base.id], + )?; + } + DucElementEnum::DucTextElement(e) => { + write_base_element(tx, "text", &e.base)?; + write_text_element(tx, e)?; + } + DucElementEnum::DucImageElement(e) => { + write_base_element(tx, "image", &e.base)?; + write_image_element(tx, e)?; + } + DucElementEnum::DucFreeDrawElement(e) => { + write_base_element(tx, "freedraw", &e.base)?; + write_freedraw_element(tx, e)?; + } + DucElementEnum::DucLinearElement(e) => { + write_base_element(tx, "line", &e.linear_base.base)?; + write_linear_element(tx, &e.linear_base, e.wipeout_below, false)?; + } + DucElementEnum::DucArrowElement(e) => { + write_base_element(tx, "arrow", &e.linear_base.base)?; + write_linear_element(tx, &e.linear_base, false, e.elbowed)?; + } + DucElementEnum::DucFrameElement(e) => { + write_base_element(tx, "frame", &e.stack_element_base.base)?; + write_stack_element_base(tx, &e.stack_element_base)?; + tx.execute( + "INSERT INTO element_frame (element_id) VALUES (?1)", + params![e.stack_element_base.base.id], + )?; + } + DucElementEnum::DucPlotElement(e) => { + write_base_element(tx, "plot", &e.stack_element_base.base)?; + write_stack_element_base(tx, &e.stack_element_base)?; + tx.execute( + "INSERT INTO element_plot (element_id, margin_top, margin_right, margin_bottom, margin_left) + VALUES (?1, ?2, ?3, ?4, ?5)", + params![ + e.stack_element_base.base.id, + e.layout.margins.top, + e.layout.margins.right, + e.layout.margins.bottom, + e.layout.margins.left, + ], + )?; + } + DucElementEnum::DucPdfElement(e) => { + write_base_element(tx, "pdf", &e.base)?; + write_document_grid_config(tx, &e.base.id, e.file_id.as_deref(), &e.grid_config)?; + tx.execute( + "INSERT INTO element_pdf (element_id) VALUES (?1)", + params![e.base.id], + )?; + } + DucElementEnum::DucDocElement(e) => { + write_base_element(tx, "doc", &e.base)?; + write_document_grid_config(tx, &e.base.id, e.file_id.as_deref(), &e.grid_config)?; + tx.execute( + "INSERT INTO element_doc (element_id, text) VALUES (?1, ?2)", + params![e.base.id, e.text], + )?; + } + DucElementEnum::DucTableElement(e) => { + write_base_element(tx, "table", &e.base)?; + tx.execute( + "INSERT INTO element_table (element_id, file_id) VALUES (?1, ?2)", + params![e.base.id, e.file_id], + )?; + } + DucElementEnum::DucModelElement(e) => { + write_base_element(tx, "model", &e.base)?; + write_model_element(tx, e)?; + } + } + Ok(()) +} + +// ─── base element ──────────────────────────────────────────────────────────── + +fn write_base_element(tx: &Transaction, element_type: &str, base: &DucElementBase) -> SerializeResult<()> { + tx.execute( + "INSERT INTO elements ( + id, element_type, + x, y, width, height, angle, + scope, label, description, is_visible, + seed, version, version_nonce, updated, \"index\", + is_plot, is_deleted, + roundness, blending, opacity, + instance_id, layer_id, frame_id, + z_index, link, locked, custom_data + ) VALUES ( + ?1, ?2, + ?3, ?4, ?5, ?6, ?7, + ?8, ?9, ?10, ?11, + ?12, ?13, ?14, ?15, ?16, + ?17, ?18, + ?19, ?20, ?21, + ?22, ?23, ?24, + ?25, ?26, ?27, ?28 + )", + params![ + base.id, element_type, + base.x, base.y, base.width, base.height, base.angle, + base.scope, base.label, base.description, base.is_visible as i32, + base.seed, base.version, base.version_nonce, base.updated, base.index, + base.is_plot as i32, base.is_deleted as i32, + base.styles.roundness, base.styles.blending.map(|b| b as i32), base.styles.opacity, + base.instance_id, base.layer_id, base.frame_id, + base.z_index, base.link, base.locked as i32, base.custom_data, + ], + )?; + + for (i, bg) in base.styles.background.iter().enumerate() { + write_background(tx, "element", &base.id, i as i32, bg)?; + } + for (i, st) in base.styles.stroke.iter().enumerate() { + write_stroke(tx, "element", &base.id, i as i32, st)?; + } -fn serialize_layer_snap_filters<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - filters: &types::LayerSnapFilters, -) -> WIPOffset> { - let include_layers_vec = filters - .include_layers - .as_ref() - .and_then(|v| serialize_vec_of_strings(builder, v)); - let exclude_layers_vec = filters - .exclude_layers - .as_ref() - .and_then(|v| serialize_vec_of_strings(builder, v)); - fb::LayerSnapFilters::create( - builder, - &fb::LayerSnapFiltersArgs { - include_layers: include_layers_vec, - exclude_layers: exclude_layers_vec, - }, - ) -} + if let Some(ref bound) = base.bound_elements { + let mut stmt = tx.prepare_cached( + "INSERT INTO element_bound_elements (element_id, bound_element_id, bound_type, sort_order) + VALUES (?1, ?2, ?3, ?4)" + )?; + for (i, be) in bound.iter().enumerate() { + stmt.execute(params![base.id, be.id, be.element_type, i as i32])?; + } + } -fn serialize_snap_marker_style<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - style: &types::SnapMarkerStyle, -) -> WIPOffset> { - let color_offset = builder.create_string(&style.color); - fb::SnapMarkerStyle::create( - builder, - &fb::SnapMarkerStyleArgs { - shape: Some(style.shape), - color: Some(color_offset), - }, - ) -} + { + let mut stmt = tx.prepare_cached( + "INSERT INTO element_group_memberships (element_id, group_id, sort_order) VALUES (?1, ?2, ?3)" + )?; + for (i, gid) in base.group_ids.iter().enumerate() { + stmt.execute(params![base.id, gid, i as i32])?; + } + } -fn serialize_snap_marker_style_entry<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - entry: &types::SnapMarkerStyleEntry, -) -> WIPOffset> { - let value_offset = serialize_snap_marker_style(builder, &entry.value); - fb::SnapMarkerStyleEntry::create( - builder, - &fb::SnapMarkerStyleEntryArgs { - key: Some(entry.key), - value: Some(value_offset), - }, - ) -} + { + let mut stmt = tx.prepare_cached( + "INSERT INTO element_block_memberships (element_id, block_id, sort_order) VALUES (?1, ?2, ?3)" + )?; + for (i, bid) in base.block_ids.iter().enumerate() { + stmt.execute(params![base.id, bid, i as i32])?; + } + } -fn serialize_snap_marker_settings<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - settings: &types::SnapMarkerSettings, -) -> WIPOffset> { - let styles_offsets: Vec<_> = settings - .styles - .iter() - .map(|s| serialize_snap_marker_style_entry(builder, s)) - .collect(); - let styles_vec = builder.create_vector(&styles_offsets); - fb::SnapMarkerSettings::create( - builder, - &fb::SnapMarkerSettingsArgs { - enabled: settings.enabled, - size: settings.size, - duration: settings.duration.unwrap_or(0), - styles: Some(styles_vec), - }, - ) -} + { + let mut stmt = tx.prepare_cached( + "INSERT INTO element_region_memberships (element_id, region_id, sort_order) VALUES (?1, ?2, ?3)" + )?; + for (i, rid) in base.region_ids.iter().enumerate() { + stmt.execute(params![base.id, rid, i as i32])?; + } + } -fn serialize_snap_settings<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - settings: &types::SnapSettings, -) -> WIPOffset> { - let polar_tracking_offset = - serialize_polar_tracking_settings(builder, &settings.polar_tracking); - let active_object_snap_modes_vec = - builder.create_vector_from_iter(settings.active_object_snap_modes.iter().copied()); - let snap_priority_vec = builder.create_vector_from_iter(settings.snap_priority.iter().copied()); - let tracking_line_style_offset = settings - .tracking_line_style - .as_ref() - .map(|s| serialize_tracking_line_style(builder, s)); - let dynamic_snap_offset = serialize_dynamic_snap_settings(builder, &settings.dynamic_snap); - let temporary_overrides_offsets: Vec<_> = settings - .temporary_overrides - .as_ref() - .map(|v| { - v.iter() - .map(|o| serialize_snap_override(builder, o)) - .collect() - }) - .unwrap_or_else(|| Vec::new()); - let temporary_overrides_vec = if temporary_overrides_offsets.is_empty() { + Ok(()) +} + +// ─── element_stack_properties ──────────────────────────────────────────────── + +fn write_stack_element_base(tx: &Transaction, seb: &DucStackElementBase) -> SerializeResult<()> { + tx.execute( + "INSERT INTO element_stack_properties + (element_id, label, description, is_collapsed, is_plot, is_visible, locked, opacity, clip, label_visible) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10)", + params![ + seb.base.id, + seb.stack_base.label, + seb.stack_base.description, + seb.stack_base.is_collapsed as i32, + seb.stack_base.is_plot as i32, + seb.stack_base.is_visible as i32, + seb.stack_base.locked as i32, + seb.stack_base.styles.opacity, + seb.clip as i32, + seb.label_visible as i32, + ], + )?; + Ok(()) +} + +// ─── element_text ──────────────────────────────────────────────────────────── + +fn write_text_element(tx: &Transaction, e: &DucTextElement) -> SerializeResult<()> { + tx.execute( + "INSERT INTO element_text ( + element_id, text, original_text, auto_resize, container_id, + is_ltr, font_family, big_font_family, text_align, vertical_align, + line_height, line_spacing_value, line_spacing_type, + oblique_angle, font_size, width_factor, + is_upside_down, is_backwards + ) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18)", + params![ + e.base.id, + e.text, + e.original_text, + e.auto_resize as i32, + e.container_id, + e.style.is_ltr as i32, + e.style.font_family, + e.style.big_font_family, + e.style.text_align as i32, + e.style.vertical_align as i32, + e.style.line_height, + e.style.line_spacing.value, + e.style.line_spacing.line_type.map(|t| t as i32), + e.style.oblique_angle, + e.style.font_size, + e.style.width_factor, + e.style.is_upside_down as i32, + e.style.is_backwards as i32, + ], + )?; + Ok(()) +} + +// ─── element_image ─────────────────────────────────────────────────────────── + +fn write_image_element(tx: &Transaction, e: &DucImageElement) -> SerializeResult<()> { + let scale_x = e.scale.first().copied().unwrap_or(1.0); + let scale_y = e.scale.get(1).copied().unwrap_or(1.0); + tx.execute( + "INSERT INTO element_image ( + element_id, file_id, status, scale_x, scale_y, + crop_x, crop_y, crop_width, crop_height, crop_natural_width, crop_natural_height, + filter_brightness, filter_contrast + ) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13)", + params![ + e.base.id, + e.file_id, + e.status as i32, + scale_x, + scale_y, + e.crop.as_ref().map(|c| c.x), + e.crop.as_ref().map(|c| c.y), + e.crop.as_ref().map(|c| c.width), + e.crop.as_ref().map(|c| c.height), + e.crop.as_ref().map(|c| c.natural_width), + e.crop.as_ref().map(|c| c.natural_height), + e.filter.as_ref().map(|f| f.brightness), + e.filter.as_ref().map(|f| f.contrast), + ], + )?; + Ok(()) +} + +// ─── element_freedraw ──────────────────────────────────────────────────────── + +fn write_freedraw_element(tx: &Transaction, e: &DucFreeDrawElement) -> SerializeResult<()> { + let pressures_blob: Option> = if e.pressures.is_empty() { None } else { - Some(builder.create_vector(&temporary_overrides_offsets)) + Some(e.pressures.iter().flat_map(|p| p.to_le_bytes()).collect()) }; - let layer_snap_filters_offset = settings - .layer_snap_filters - .as_ref() - .map(|s| serialize_layer_snap_filters(builder, s)); - let element_type_filters_vec = settings - .element_type_filters - .as_ref() - .and_then(|v| serialize_vec_of_strings(builder, v)); - let snap_markers_offset = serialize_snap_marker_settings(builder, &settings.snap_markers); - - fb::SnapSettings::create( - builder, - &fb::SnapSettingsArgs { - readonly: settings.readonly, - twist_angle: settings.twist_angle, - snap_tolerance: settings.snap_tolerance, - object_snap_aperture: settings.object_snap_aperture, - is_ortho_mode_on: settings.is_ortho_mode_on, - polar_tracking: Some(polar_tracking_offset), - is_object_snap_on: settings.is_object_snap_on, - active_object_snap_modes: Some(active_object_snap_modes_vec), - snap_priority: Some(snap_priority_vec), - show_tracking_lines: settings.show_tracking_lines, - tracking_line_style: tracking_line_style_offset, - dynamic_snap: Some(dynamic_snap_offset), - temporary_overrides: temporary_overrides_vec, - incremental_distance: settings.incremental_distance.unwrap_or(0.0), - magnetic_strength: settings.magnetic_strength.unwrap_or(0.0), - layer_snap_filters: layer_snap_filters_offset, - element_type_filters: element_type_filters_vec, - snap_mode: Some(settings.snap_mode), - snap_markers: Some(snap_markers_offset), - construction_snap_enabled: settings.construction_snap_enabled, - snap_to_grid_intersections: settings.snap_to_grid_intersections.unwrap_or(false), - }, - ) -} -fn serialize_identified_grid_settings<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - settings: &types::IdentifiedGridSettings, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &settings.id); - let settings_offset = serialize_grid_settings(builder, &settings.settings); - fb::IdentifiedGridSettings::create( - builder, - &fb::IdentifiedGridSettingsArgs { - id: Some(id_offset), - settings: Some(settings_offset), - }, - ) -} - -fn serialize_identified_snap_settings<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - settings: &types::IdentifiedSnapSettings, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &settings.id); - let settings_offset = serialize_snap_settings(builder, &settings.settings); - fb::IdentifiedSnapSettings::create( - builder, - &fb::IdentifiedSnapSettingsArgs { - id: Some(id_offset), - settings: Some(settings_offset), - }, - ) -} - -fn serialize_identified_ucs<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - ucs: &types::IdentifiedUcs, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &ucs.id); - let ucs_offset = serialize_duc_ucs(builder, &ucs.ucs); - fb::IdentifiedUcs::create( - builder, - &fb::IdentifiedUcsArgs { - id: Some(id_offset), - ucs: Some(ucs_offset), - }, - ) -} - -fn serialize_identified_view<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - view: &types::IdentifiedView, -) -> WIPOffset> { - let id_offset = serialize_identifier(builder, &view.id); - let view_offset = serialize_duc_view(builder, &view.view); - fb::IdentifiedView::create( - builder, - &fb::IdentifiedViewArgs { - id: Some(id_offset), - view: Some(view_offset), - }, - ) -} + tx.execute( + "INSERT INTO element_freedraw ( + element_id, size, thinning, smoothing, streamline, easing, + start_cap, start_taper, start_easing, + end_cap, end_taper, end_easing, + pressures, simulate_pressure, + last_committed_point_x, last_committed_point_y, last_committed_point_mirror, + svg_path + ) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18)", + params![ + e.base.id, + e.size, + e.thinning, + e.smoothing, + e.streamline, + e.easing, + e.start.as_ref().map(|s| s.cap as i32), + e.start.as_ref().map(|s| s.taper), + e.start.as_ref().map(|s| s.easing.clone()), + e.end.as_ref().map(|en| en.cap as i32), + e.end.as_ref().map(|en| en.taper), + e.end.as_ref().map(|en| en.easing.clone()), + pressures_blob, + e.simulate_pressure as i32, + e.last_committed_point.as_ref().map(|p| p.x), + e.last_committed_point.as_ref().map(|p| p.y), + e.last_committed_point.as_ref().and_then(|p| p.mirroring.map(|m| m as i32)), + e.svg_path, + ], + )?; + + let mut stmt = tx.prepare_cached( + "INSERT INTO freedraw_element_points (element_id, sort_order, x, y, mirroring) + VALUES (?1, ?2, ?3, ?4, ?5)" + )?; + for (i, pt) in e.points.iter().enumerate() { + stmt.execute(params![e.base.id, i as i32, pt.x, pt.y, pt.mirroring.map(|m| m as i32)])?; + } -fn serialize_standard_view_settings<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - settings: &types::StandardViewSettings, -) -> WIPOffset> { - let views_offsets: Vec<_> = settings - .views - .iter() - .map(|v| serialize_identified_view(builder, v)) - .collect(); - let views_vec = builder.create_vector(&views_offsets); - - let ucs_offsets: Vec<_> = settings - .ucs - .iter() - .map(|u| serialize_identified_ucs(builder, u)) - .collect(); - let ucs_vec = builder.create_vector(&ucs_offsets); - - let grid_settings_offsets: Vec<_> = settings - .grid_settings - .iter() - .map(|g| serialize_identified_grid_settings(builder, g)) - .collect(); - let grid_settings_vec = builder.create_vector(&grid_settings_offsets); - - let snap_settings_offsets: Vec<_> = settings - .snap_settings - .iter() - .map(|s| serialize_identified_snap_settings(builder, s)) - .collect(); - let snap_settings_vec = builder.create_vector(&snap_settings_offsets); - - fb::StandardViewSettings::create( - builder, - &fb::StandardViewSettingsArgs { - views: Some(views_vec), - ucs: Some(ucs_vec), - grid_settings: Some(grid_settings_vec), - snap_settings: Some(snap_settings_vec), - }, - ) -} + Ok(()) +} + +// ─── element_linear ────────────────────────────────────────────────────────── + +fn write_linear_element( + tx: &Transaction, + lb: &DucLinearElementBase, + wipeout_below: bool, + elbowed: bool, +) -> SerializeResult<()> { + let id = &lb.base.id; + + tx.execute( + "INSERT INTO element_linear ( + element_id, + last_committed_point_x, last_committed_point_y, last_committed_point_mirror, + start_binding_element_id, start_binding_focus, start_binding_gap, + start_binding_fixed_point_x, start_binding_fixed_point_y, + start_binding_point_index, start_binding_point_offset, + start_binding_head_type, start_binding_head_block_id, start_binding_head_size, + end_binding_element_id, end_binding_focus, end_binding_gap, + end_binding_fixed_point_x, end_binding_fixed_point_y, + end_binding_point_index, end_binding_point_offset, + end_binding_head_type, end_binding_head_block_id, end_binding_head_size, + wipeout_below, elbowed + ) VALUES ( + ?1, + ?2, ?3, ?4, + ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, + ?15, ?16, ?17, ?18, ?19, ?20, ?21, ?22, ?23, ?24, + ?25, ?26 + )", + params![ + id, + lb.last_committed_point.as_ref().map(|p| p.x), + lb.last_committed_point.as_ref().map(|p| p.y), + lb.last_committed_point.as_ref().and_then(|p| p.mirroring.map(|m| m as i32)), + lb.start_binding.as_ref().map(|b| b.element_id.clone()), + lb.start_binding.as_ref().map(|b| b.focus), + lb.start_binding.as_ref().map(|b| b.gap), + lb.start_binding.as_ref().and_then(|b| b.fixed_point.as_ref().map(|fp| fp.x)), + lb.start_binding.as_ref().and_then(|b| b.fixed_point.as_ref().map(|fp| fp.y)), + lb.start_binding.as_ref().and_then(|b| b.point.as_ref().map(|p| p.index)), + lb.start_binding.as_ref().and_then(|b| b.point.as_ref().map(|p| p.offset)), + lb.start_binding.as_ref().and_then(|b| b.head.as_ref().and_then(|h| h.head_type.map(|t| t as i32))), + lb.start_binding.as_ref().and_then(|b| b.head.as_ref().and_then(|h| h.block_id.clone())), + lb.start_binding.as_ref().and_then(|b| b.head.as_ref().map(|h| h.size)), + lb.end_binding.as_ref().map(|b| b.element_id.clone()), + lb.end_binding.as_ref().map(|b| b.focus), + lb.end_binding.as_ref().map(|b| b.gap), + lb.end_binding.as_ref().and_then(|b| b.fixed_point.as_ref().map(|fp| fp.x)), + lb.end_binding.as_ref().and_then(|b| b.fixed_point.as_ref().map(|fp| fp.y)), + lb.end_binding.as_ref().and_then(|b| b.point.as_ref().map(|p| p.index)), + lb.end_binding.as_ref().and_then(|b| b.point.as_ref().map(|p| p.offset)), + lb.end_binding.as_ref().and_then(|b| b.head.as_ref().and_then(|h| h.head_type.map(|t| t as i32))), + lb.end_binding.as_ref().and_then(|b| b.head.as_ref().and_then(|h| h.block_id.clone())), + lb.end_binding.as_ref().and_then(|b| b.head.as_ref().map(|h| h.size)), + wipeout_below as i32, + elbowed as i32, + ], + )?; + + { + let mut stmt = tx.prepare_cached( + "INSERT INTO linear_element_points (element_id, sort_order, x, y, mirroring) + VALUES (?1, ?2, ?3, ?4, ?5)" + )?; + for (i, pt) in lb.points.iter().enumerate() { + stmt.execute(params![id, i as i32, pt.x, pt.y, pt.mirroring.map(|m| m as i32)])?; + } + } -fn serialize_dimension_validation_rules<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - rules: &types::DimensionValidationRules, -) -> WIPOffset> { - let allowed_precisions_vec = builder.create_vector(&rules.allowed_precisions); - fb::DimensionValidationRules::create( - builder, - &fb::DimensionValidationRulesArgs { - min_text_height: rules.min_text_height.unwrap_or(0.0), - max_text_height: rules.max_text_height.unwrap_or(0.0), - allowed_precisions: Some(allowed_precisions_vec), - }, - ) -} + { + let mut stmt = tx.prepare_cached( + "INSERT INTO linear_element_lines (element_id, sort_order, start_index, start_handle_x, start_handle_y, end_index, end_handle_x, end_handle_y) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)" + )?; + for (i, line) in lb.lines.iter().enumerate() { + stmt.execute(params![ + id, + i as i32, + line.start.index, + line.start.handle.as_ref().map(|h| h.x), + line.start.handle.as_ref().map(|h| h.y), + line.end.index, + line.end.handle.as_ref().map(|h| h.x), + line.end.handle.as_ref().map(|h| h.y), + ])?; + } + } -fn serialize_layer_validation_rules<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - rules: &types::LayerValidationRules, -) -> WIPOffset> { - let prohibited_layer_names_vec = rules - .prohibited_layer_names - .as_ref() - .and_then(|v| serialize_vec_of_strings(builder, v)); - fb::LayerValidationRules::create( - builder, - &fb::LayerValidationRulesArgs { - prohibited_layer_names: prohibited_layer_names_vec, - }, - ) -} + for (i, path) in lb.path_overrides.iter().enumerate() { + let path_id: i64 = tx.query_row( + "INSERT INTO linear_path_overrides (element_id, sort_order) VALUES (?1, ?2) RETURNING id", + params![id, i as i32], + |row| row.get(0), + )?; + + let mut idx_stmt = tx.prepare_cached( + "INSERT INTO linear_path_override_indices (path_override_id, sort_order, line_index) + VALUES (?1, ?2, ?3)" + )?; + for (j, &line_idx) in path.line_indices.iter().enumerate() { + idx_stmt.execute(params![path_id, j as i32, line_idx])?; + } + + if let Some(ref bg) = path.background { + write_background(tx, "path_override", &path_id.to_string(), 0, bg)?; + } + if let Some(ref st) = path.stroke { + write_stroke(tx, "path_override", &path_id.to_string(), 0, st)?; + } + } -fn serialize_standard_validation<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - validation: &types::StandardValidation, -) -> WIPOffset> { - let dimension_rules_offset = validation - .dimension_rules - .as_ref() - .map(|r| serialize_dimension_validation_rules(builder, r)); - let layer_rules_offset = validation - .layer_rules - .as_ref() - .map(|r| serialize_layer_validation_rules(builder, r)); - fb::StandardValidation::create( - builder, - &fb::StandardValidationArgs { - dimension_rules: dimension_rules_offset, - layer_rules: layer_rules_offset, - }, - ) -} + Ok(()) +} + +// ─── document_grid_config ──────────────────────────────────────────────────── + +fn write_document_grid_config( + tx: &Transaction, + element_id: &str, + file_id: Option<&str>, + gc: &DocumentGridConfig, +) -> SerializeResult<()> { + tx.execute( + "INSERT INTO document_grid_config + (element_id, file_id, grid_columns, grid_gap_x, grid_gap_y, grid_first_page_alone, grid_scale) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)", + params![element_id, file_id, gc.columns, gc.gap_x, gc.gap_y, gc.first_page_alone as i32, gc.scale], + )?; + Ok(()) +} + +// ─── element_model ─────────────────────────────────────────────────────────── + +fn write_model_element(tx: &Transaction, e: &DucModelElement) -> SerializeResult<()> { + tx.execute( + "INSERT INTO element_model (element_id, model_type, code, svg_path) + VALUES (?1, ?2, ?3, ?4)", + params![e.base.id, e.model_type, e.code, e.svg_path], + )?; + + { + let mut stmt = tx.prepare_cached( + "INSERT INTO model_element_files (element_id, file_id, sort_order) VALUES (?1, ?2, ?3)" + )?; + for (i, fid) in e.file_ids.iter().enumerate() { + stmt.execute(params![e.base.id, fid, i as i32])?; + } + } -fn serialize_standard<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - standard: &types::Standard, -) -> WIPOffset> { - let identifier_offset = serialize_identifier(builder, &standard.identifier); - let version_offset = builder.create_string(&standard.version); - let overrides_offset = standard - .overrides - .as_ref() - .map(|o| serialize_standard_overrides(builder, o)); - let styles_offset = standard - .styles - .as_ref() - .map(|s| serialize_standard_styles(builder, s)); - let view_settings_offset = standard - .view_settings - .as_ref() - .map(|s| serialize_standard_view_settings(builder, s)); - let units_offset = standard - .units - .as_ref() - .map(|u| serialize_standard_units(builder, u)); - let validation_offset = standard - .validation - .as_ref() - .map(|v| serialize_standard_validation(builder, v)); - - fb::Standard::create( - builder, - &fb::StandardArgs { - identifier: Some(identifier_offset), - version: Some(version_offset), - readonly: standard.readonly, - overrides: overrides_offset, - styles: styles_offset, - view_settings: view_settings_offset, - units: units_offset, - validation: validation_offset, - }, - ) -} + if let Some(ref vs) = e.viewer_state { + write_model_viewer_state(tx, &e.base.id, vs)?; + } -// ============================================================================= -// VERSION CONTROL -// ============================================================================= - -fn serialize_version_base<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - base: &types::VersionBase, -) -> WIPOffset> { - let id_offset = builder.create_string(&base.id); - let parent_id_offset = base.parent_id.as_ref().map(|s| builder.create_string(s)); - let description_offset = base.description.as_ref().map(|s| builder.create_string(s)); - let user_id_offset = base.user_id.as_ref().map(|s| builder.create_string(s)); - fb::VersionBase::create( - builder, - &fb::VersionBaseArgs { - id: Some(id_offset), - parent_id: parent_id_offset, - timestamp: base.timestamp, - description: description_offset, - is_manual_save: base.is_manual_save, - user_id: user_id_offset, - }, - ) + Ok(()) } -fn serialize_checkpoint<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - checkpoint: &types::Checkpoint, -) -> WIPOffset> { - let base_offset = serialize_version_base(builder, &checkpoint.base); - let data_vec = builder.create_vector(&checkpoint.data); - fb::Checkpoint::create( - builder, - &fb::CheckpointArgs { - base: Some(base_offset), - data: Some(data_vec), - size_bytes: checkpoint.size_bytes, - }, - ) -} +fn write_model_viewer_state(tx: &Transaction, element_id: &str, vs: &Viewer3DState) -> SerializeResult<()> { + let cam = &vs.camera; + let disp = &vs.display; + let mat = &vs.material; + let clip = &vs.clipping; + let expl = &vs.explode; + let zeb = &vs.zebra; + let (grid_uniform, grid_xy, grid_xz, grid_yz) = match &disp.grid { + Viewer3DGrid::Uniform(v) => (Some(*v as i32), 0i32, 0i32, 0i32), + Viewer3DGrid::PerPlane(p) => (None, p.xy as i32, p.xz as i32, p.yz as i32), + }; -fn serialize_delta<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - delta: &types::Delta, -) -> WIPOffset> { - let base_offset = serialize_version_base(builder, &delta.base); - - // Serialize patch as compressed JSON data - let patch_json = serde_json::to_string(&delta.patch).unwrap(); - let patch_compressed = compress_string(&patch_json); - let patch_vec = builder.create_vector::(&patch_compressed); - let size_bytes = patch_compressed.len() as i64; - - fb::Delta::create( - builder, - &fb::DeltaArgs { - base: Some(base_offset), - patch: Some(patch_vec), - size_bytes, - }, - ) -} + tx.execute( + "INSERT INTO model_viewer_state ( + element_id, + camera_control, camera_ortho, camera_up, + camera_position_x, camera_position_y, camera_position_z, + camera_quaternion_x, camera_quaternion_y, camera_quaternion_z, camera_quaternion_w, + camera_target_x, camera_target_y, camera_target_z, + camera_zoom, camera_pan_speed, camera_rotate_speed, camera_zoom_speed, camera_holroyd, + display_wireframe, display_transparent, display_black_edges, + display_grid_uniform, display_grid_xy, display_grid_xz, display_grid_yz, + display_axes_visible, display_axes_at_origin, + material_metalness, material_roughness, material_default_opacity, + material_edge_color, material_ambient_intensity, material_direct_intensity, + clip_x_enabled, clip_x_value, clip_x_normal_x, clip_x_normal_y, clip_x_normal_z, + clip_y_enabled, clip_y_value, clip_y_normal_x, clip_y_normal_y, clip_y_normal_z, + clip_z_enabled, clip_z_value, clip_z_normal_x, clip_z_normal_y, clip_z_normal_z, + clip_intersection, clip_show_planes, clip_object_color_caps, + explode_active, explode_value, + zebra_active, zebra_stripe_count, zebra_stripe_direction, + zebra_color_scheme, zebra_opacity, zebra_mapping_mode + ) VALUES ( + ?1, + ?2, ?3, ?4, + ?5, ?6, ?7, + ?8, ?9, ?10, ?11, + ?12, ?13, ?14, + ?15, ?16, ?17, ?18, ?19, + ?20, ?21, ?22, + ?23, ?24, ?25, ?26, + ?27, ?28, + ?29, ?30, ?31, + ?32, ?33, ?34, + ?35, ?36, ?37, ?38, ?39, + ?40, ?41, ?42, ?43, ?44, + ?45, ?46, ?47, ?48, ?49, + ?50, ?51, ?52, + ?53, ?54, + ?55, ?56, ?57, + ?58, ?59, ?60 + )", + params![ + element_id, + cam.control, cam.ortho as i32, cam.up, + cam.position[0], cam.position[1], cam.position[2], + cam.quaternion[0], cam.quaternion[1], cam.quaternion[2], cam.quaternion[3], + cam.target[0], cam.target[1], cam.target[2], + cam.zoom, cam.pan_speed, cam.rotate_speed, cam.zoom_speed, cam.holroyd as i32, + disp.wireframe as i32, disp.transparent as i32, disp.black_edges as i32, + grid_uniform, grid_xy, grid_xz, grid_yz, + disp.axes_visible as i32, disp.axes_at_origin as i32, + mat.metalness, mat.roughness, mat.default_opacity, + mat.edge_color, mat.ambient_intensity, mat.direct_intensity, + clip.x.enabled as i32, clip.x.value, + clip.x.normal.as_ref().map(|n| n[0]), + clip.x.normal.as_ref().map(|n| n[1]), + clip.x.normal.as_ref().map(|n| n[2]), + clip.y.enabled as i32, clip.y.value, + clip.y.normal.as_ref().map(|n| n[0]), + clip.y.normal.as_ref().map(|n| n[1]), + clip.y.normal.as_ref().map(|n| n[2]), + clip.z.enabled as i32, clip.z.value, + clip.z.normal.as_ref().map(|n| n[0]), + clip.z.normal.as_ref().map(|n| n[1]), + clip.z.normal.as_ref().map(|n| n[2]), + clip.intersection as i32, clip.show_planes as i32, clip.object_color_caps as i32, + expl.active as i32, expl.value, + zeb.active as i32, zeb.stripe_count, zeb.stripe_direction, + zeb.color_scheme, zeb.opacity, zeb.mapping_mode, + ], + )?; + Ok(()) +} + +// ─── backgrounds & strokes (polymorphic) ───────────────────────────────────── + +fn write_background( + tx: &Transaction, + owner_type: &str, + owner_id: &str, + sort_order: i32, + bg: &ElementBackground, +) -> SerializeResult<()> { + let c = &bg.content; + tx.execute( + "INSERT INTO backgrounds ( + owner_type, owner_id, sort_order, + preference, src, visible, opacity, + tiling_size_in_percent, tiling_angle, tiling_spacing, tiling_offset_x, tiling_offset_y, + hatch_style, hatch_pattern_name, hatch_pattern_scale, hatch_pattern_angle, + hatch_pattern_origin_x, hatch_pattern_origin_y, hatch_pattern_origin_mirror, + hatch_pattern_double, + hatch_custom_pattern_name, hatch_custom_pattern_desc, + image_filter_brightness, image_filter_contrast + ) VALUES ( + ?1, ?2, ?3, ?4, ?5, ?6, ?7, + ?8, ?9, ?10, ?11, ?12, + ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20, ?21, ?22, ?23, ?24 + )", + params![ + owner_type, owner_id, sort_order, + c.preference.map(|p| p as i32), c.src, c.visible as i32, c.opacity, + c.tiling.as_ref().map(|t| t.size_in_percent), + c.tiling.as_ref().map(|t| t.angle), + c.tiling.as_ref().and_then(|t| t.spacing), + c.tiling.as_ref().and_then(|t| t.offset_x), + c.tiling.as_ref().and_then(|t| t.offset_y), + c.hatch.as_ref().map(|h| h.hatch_style as i32), + c.hatch.as_ref().map(|h| h.pattern_name.clone()), + c.hatch.as_ref().map(|h| h.pattern_scale), + c.hatch.as_ref().map(|h| h.pattern_angle), + c.hatch.as_ref().map(|h| h.pattern_origin.x), + c.hatch.as_ref().map(|h| h.pattern_origin.y), + c.hatch.as_ref().and_then(|h| h.pattern_origin.mirroring.map(|m| m as i32)), + c.hatch.as_ref().map(|h| h.pattern_double as i32), + c.hatch.as_ref().and_then(|h| h.custom_pattern.as_ref().map(|cp| cp.name.clone())), + c.hatch.as_ref().and_then(|h| h.custom_pattern.as_ref().and_then(|cp| cp.description.clone())), + c.image_filter.as_ref().map(|f| f.brightness), + c.image_filter.as_ref().map(|f| f.contrast), + ], + )?; + + if let Some(ref hatch) = c.hatch { + if let Some(ref cp) = hatch.custom_pattern { + let bg_id: i64 = tx.query_row( + "SELECT last_insert_rowid()", [], |row| row.get(0), + )?; + write_hatch_pattern_lines(tx, "background", bg_id, &cp.lines)?; + } + } -fn serialize_version_graph_metadata<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - meta: &types::VersionGraphMetadata, -) -> WIPOffset> { - fb::VersionGraphMetadata::create( - builder, - &fb::VersionGraphMetadataArgs { - last_pruned: meta.last_pruned, - total_size: meta.total_size, - }, - ) + Ok(()) } -fn serialize_version_graph<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - graph: &types::VersionGraph, -) -> WIPOffset> { - let user_checkpoint_version_id_offset = - builder.create_string(&graph.user_checkpoint_version_id); - let latest_version_id_offset = builder.create_string(&graph.latest_version_id); - let checkpoints_offsets: Vec<_> = graph - .checkpoints - .iter() - .map(|c| serialize_checkpoint(builder, c)) - .collect(); - let checkpoints_vec = builder.create_vector(&checkpoints_offsets); - let deltas_offsets: Vec<_> = graph - .deltas - .iter() - .map(|d| serialize_delta(builder, d)) - .collect(); - let deltas_vec = builder.create_vector(&deltas_offsets); - let metadata_offset = serialize_version_graph_metadata(builder, &graph.metadata); - - fb::VersionGraph::create( - builder, - &fb::VersionGraphArgs { - user_checkpoint_version_id: Some(user_checkpoint_version_id_offset), - latest_version_id: Some(latest_version_id_offset), - checkpoints: Some(checkpoints_vec), - deltas: Some(deltas_vec), - metadata: Some(metadata_offset), - }, - ) -} +fn write_stroke( + tx: &Transaction, + owner_type: &str, + owner_id: &str, + sort_order: i32, + st: &ElementStroke, +) -> SerializeResult<()> { + let c = &st.content; + let dash_blob: Option> = st.style.dash.as_ref().map(|d| { + d.iter().flat_map(|v| v.to_le_bytes()).collect() + }); + let sides_blob: Option> = st.stroke_sides.as_ref().and_then(|s| { + s.values.as_ref().map(|v| v.iter().flat_map(|val| val.to_le_bytes()).collect()) + }); -// ============================================================================= -// EXTERNAL FILES -// ============================================================================= - -fn serialize_duc_external_file_data<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - file: &types::DucExternalFileData, -) -> WIPOffset> { - let mime_type_offset = builder.create_string(&file.mime_type); - let id_offset = builder.create_string(&file.id); - let data_vec = builder.create_vector(&file.data); - fb::DucExternalFileData::create( - builder, - &fb::DucExternalFileDataArgs { - mime_type: Some(mime_type_offset), - id: Some(id_offset), - data: Some(data_vec), - created: file.created, - last_retrieved: file.last_retrieved, - }, - ) -} + tx.execute( + "INSERT INTO strokes ( + owner_type, owner_id, sort_order, + preference, src, visible, opacity, + tiling_size_in_percent, tiling_angle, tiling_spacing, tiling_offset_x, tiling_offset_y, + hatch_style, hatch_pattern_name, hatch_pattern_scale, hatch_pattern_angle, + hatch_pattern_origin_x, hatch_pattern_origin_y, hatch_pattern_origin_mirror, + hatch_pattern_double, + hatch_custom_pattern_name, hatch_custom_pattern_desc, + image_filter_brightness, image_filter_contrast, + width, + style_preference, style_cap, style_join, style_dash, style_dash_line_override, style_dash_cap, style_miter_limit, + placement, + sides_preference, sides_values + ) VALUES ( + ?1, ?2, ?3, + ?4, ?5, ?6, ?7, + ?8, ?9, ?10, ?11, ?12, + ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20, ?21, ?22, ?23, ?24, + ?25, + ?26, ?27, ?28, ?29, ?30, ?31, ?32, + ?33, + ?34, ?35 + )", + params![ + owner_type, owner_id, sort_order, + c.preference.map(|p| p as i32), c.src, c.visible as i32, c.opacity, + c.tiling.as_ref().map(|t| t.size_in_percent), + c.tiling.as_ref().map(|t| t.angle), + c.tiling.as_ref().and_then(|t| t.spacing), + c.tiling.as_ref().and_then(|t| t.offset_x), + c.tiling.as_ref().and_then(|t| t.offset_y), + c.hatch.as_ref().map(|h| h.hatch_style as i32), + c.hatch.as_ref().map(|h| h.pattern_name.clone()), + c.hatch.as_ref().map(|h| h.pattern_scale), + c.hatch.as_ref().map(|h| h.pattern_angle), + c.hatch.as_ref().map(|h| h.pattern_origin.x), + c.hatch.as_ref().map(|h| h.pattern_origin.y), + c.hatch.as_ref().and_then(|h| h.pattern_origin.mirroring.map(|m| m as i32)), + c.hatch.as_ref().map(|h| h.pattern_double as i32), + c.hatch.as_ref().and_then(|h| h.custom_pattern.as_ref().map(|cp| cp.name.clone())), + c.hatch.as_ref().and_then(|h| h.custom_pattern.as_ref().and_then(|cp| cp.description.clone())), + c.image_filter.as_ref().map(|f| f.brightness), + c.image_filter.as_ref().map(|f| f.contrast), + st.width, + st.style.preference.map(|p| p as i32), + st.style.cap.map(|p| p as i32), + st.style.join.map(|p| p as i32), + dash_blob, + st.style.dash_line_override, + st.style.dash_cap.map(|p| p as i32), + st.style.miter_limit, + st.placement.map(|p| p as i32), + st.stroke_sides.as_ref().and_then(|s| s.preference.map(|p| p as i32)), + sides_blob, + ], + )?; + + if let Some(ref hatch) = c.hatch { + if let Some(ref cp) = hatch.custom_pattern { + let st_id: i64 = tx.query_row( + "SELECT last_insert_rowid()", [], |row| row.get(0), + )?; + write_hatch_pattern_lines(tx, "stroke", st_id, &cp.lines)?; + } + } -fn serialize_duc_external_file_entry<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - entry: &types::DucExternalFileEntry, -) -> WIPOffset> { - let key_offset = builder.create_string(&entry.key); - let value_offset = serialize_duc_external_file_data(builder, &entry.value); - fb::DucExternalFileEntry::create( - builder, - &fb::DucExternalFileEntryArgs { - key: Some(key_offset), - value: Some(value_offset), - }, - ) -} + Ok(()) +} + +fn write_hatch_pattern_lines( + tx: &Transaction, + owner_type: &str, + owner_id: i64, + lines: &[HatchPatternLine], +) -> SerializeResult<()> { + let mut stmt = tx.prepare_cached( + "INSERT INTO hatch_pattern_lines ( + owner_type, owner_id, sort_order, + angle, origin_x, origin_y, origin_mirroring, + offset_x, offset_y, dash_pattern + ) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10)" + )?; + for (i, line) in lines.iter().enumerate() { + let offset_x = line.offset.first().copied().unwrap_or(0.0); + let offset_y = line.offset.get(1).copied().unwrap_or(0.0); + let dash_blob: Option> = if line.dash_pattern.is_empty() { + None + } else { + Some(line.dash_pattern.iter().flat_map(|v| v.to_le_bytes()).collect()) + }; + stmt.execute(params![ + owner_type, + owner_id, + i as i32, + line.angle, + line.origin.x, + line.origin.y, + line.origin.mirroring.map(|m| m as i32), + offset_x, + offset_y, + dash_blob, + ])?; + } + Ok(()) +} + +// ─── external_files ────────────────────────────────────────────────────────── + +fn write_external_files( + tx: &Transaction, + files: &Option>, +) -> SerializeResult<()> { + let Some(files) = files else { return Ok(()) }; + let mut stmt = tx.prepare_cached( + "INSERT OR REPLACE INTO external_files (id, mime_type, data, created, last_retrieved, version) + VALUES (?1, ?2, ?3, ?4, ?5, ?6)" + )?; + for (_key, data) in files { + stmt.execute(params![data.id, data.mime_type, data.data, data.created, data.last_retrieved, data.version])?; + } + Ok(()) +} + +// ─── version_graph ─────────────────────────────────────────────────────────── + +fn write_version_graph(tx: &Transaction, vg: &Option) -> SerializeResult<()> { + let Some(vg) = vg else { return Ok(()) }; + + tx.execute( + "UPDATE version_graph SET + current_version = ?1, + current_schema_version = ?2, + user_checkpoint_version_id = ?3, + latest_version_id = ?4, + chain_count = ?5, + last_pruned = ?6, + total_size = ?7 + WHERE id = 1", + params![ + vg.metadata.current_version, + vg.metadata.current_schema_version, + vg.user_checkpoint_version_id, + vg.latest_version_id, + vg.metadata.chain_count, + vg.metadata.last_pruned, + vg.metadata.total_size, + ], + )?; + + { + let mut stmt = tx.prepare_cached( + "INSERT OR REPLACE INTO version_chains + (id, schema_version, start_version, end_version, migration_id, root_checkpoint_id) + VALUES (?1, ?2, ?3, ?4, ?5, ?6)" + )?; + for chain in &vg.chains { + let migration_id: Option = if let Some(ref mig) = chain.migration { + let mid: i64 = tx.query_row( + "INSERT INTO schema_migrations + (from_schema_version, to_schema_version, migration_name, migration_checksum, applied_at, boundary_checkpoint_id) + VALUES (?1, ?2, ?3, ?4, ?5, ?6) + RETURNING id", + params![ + mig.from_schema_version, + mig.to_schema_version, + mig.migration_name, + mig.migration_checksum, + mig.applied_at, + mig.boundary_checkpoint_id, + ], + |row| row.get(0), + )?; + Some(mid) + } else { + None + }; + + stmt.execute(params![ + chain.id, + chain.schema_version, + chain.start_version, + chain.end_version, + migration_id, + chain.root_checkpoint_id, + ])?; + } + } -// ============================================================================= -// ROOT TYPE -// ============================================================================= - -fn serialize_exported_data_state<'bldr>( - builder: &mut FlatBufferBuilder<'bldr>, - state: &types::ExportedDataState, -) -> WIPOffset> { - let type_offset = builder.create_string(&state.data_type); - let source_offset = builder.create_string(&state.source); - - // Use schema version injected by build.rs (env var DUC_SCHEMA_VERSION) - // This ensures the serialized file carries the schema version declared in schema/duc.fbs - const DUC_SCHEMA_VERSION: &str = env!("DUC_SCHEMA_VERSION"); - let version_offset = builder.create_string(DUC_SCHEMA_VERSION); - - let thumbnail_vec = state.thumbnail.as_ref().map(|v| builder.create_vector(v)); - - let dictionary_vec = state.dictionary.as_ref().map(|v| { - let offsets: Vec<_> = v - .iter() - .map(|e| serialize_dictionary_entry(builder, e)) - .collect(); - builder.create_vector(&offsets) - }); + { + let mut cp_stmt = tx.prepare_cached( + "INSERT OR REPLACE INTO checkpoints + (id, parent_id, chain_id, version_number, schema_version, timestamp, + description, is_manual_save, is_schema_boundary, user_id, data, size_bytes) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12)" + )?; + for cp in &vg.checkpoints { + let chain_id = vg.chains.iter() + .find(|c| c.schema_version == cp.schema_version) + .map(|c| c.id.as_str()) + .unwrap_or(""); + cp_stmt.execute(params![ + cp.base.id, + cp.base.parent_id, + chain_id, + cp.version_number, + cp.schema_version, + cp.base.timestamp, + cp.base.description, + cp.base.is_manual_save as i32, + cp.is_schema_boundary as i32, + cp.base.user_id, + cp.data, + cp.size_bytes, + ])?; + } + } - let elements_offsets: Vec<_> = state - .elements - .iter() - .map(|e| serialize_element_wrapper(builder, e)) - .collect(); - let elements_vec: WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - > = builder.create_vector(&elements_offsets); - - let blocks_offsets: Vec<_> = state - .blocks - .iter() - .map(|b| serialize_duc_block(builder, b)) - .collect(); - let blocks_vec: WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - > = builder.create_vector(&blocks_offsets); - - let block_instances_offsets: Vec<_> = state - .block_instances - .iter() - .map(|bi| serialize_duc_block_instance(builder, bi)) - .collect(); - let block_instances_vec: WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - > = builder.create_vector(&block_instances_offsets); - - let block_collections_offsets: Vec<_> = state - .block_collections - .iter() - .map(|bc| serialize_duc_block_collection(builder, bc)) - .collect(); - let block_collections_vec: WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - > = builder.create_vector(&block_collections_offsets); - - let groups_offsets: Vec<_> = state - .groups - .iter() - .map(|g| serialize_duc_group(builder, g)) - .collect(); - let groups_vec = builder.create_vector(&groups_offsets); - - let regions_offsets: Vec<_> = state - .regions - .iter() - .map(|r| serialize_duc_region(builder, r)) - .collect(); - let regions_vec: WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - > = builder.create_vector(®ions_offsets); - - let layers_offsets: Vec<_> = state - .layers - .iter() - .map(|l| serialize_duc_layer(builder, l)) - .collect(); - let layers_vec: WIPOffset< - flatbuffers::Vector<'bldr, flatbuffers::ForwardsUOffset>>, - > = builder.create_vector(&layers_offsets); - - let standards_offsets: Vec<_> = state - .standards - .iter() - .map(|s| serialize_standard(builder, s)) - .collect(); - let standards_vec = builder.create_vector(&standards_offsets); - - let duc_local_state_offset = state - .duc_local_state - .as_ref() - .map(|s| serialize_duc_local_state(builder, s)); - let duc_global_state_offset = state - .duc_global_state - .as_ref() - .map(|s| serialize_duc_global_state(builder, s)); - - let external_files_vec = state.external_files.as_ref().map(|v| { - let offsets: Vec<_> = v - .iter() - .map(|f| serialize_duc_external_file_entry(builder, f)) - .collect(); - builder.create_vector(&offsets) - }); + { + let mut d_stmt = tx.prepare_cached( + "INSERT OR REPLACE INTO deltas + (id, parent_id, base_checkpoint_id, chain_id, delta_sequence, version_number, + schema_version, timestamp, description, is_manual_save, user_id, changeset, size_bytes) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13)" + )?; + for (i, delta) in vg.deltas.iter().enumerate() { + let chain_id = vg.chains.iter() + .find(|c| c.schema_version == delta.schema_version) + .map(|c| c.id.as_str()) + .unwrap_or(""); + d_stmt.execute(params![ + delta.base.id, + delta.base.parent_id, + delta.base_checkpoint_id, + chain_id, + (i + 1) as i64, + delta.version_number, + delta.schema_version, + delta.base.timestamp, + delta.base.description, + delta.base.is_manual_save as i32, + delta.base.user_id, + delta.payload, + delta.size_bytes, + ])?; + } + } - let version_graph_offset = state - .version_graph - .as_ref() - .map(|vg| serialize_version_graph(builder, vg)); - - let id_offset = state.id.as_ref().map(|s| builder.create_string(s)); - - fb::ExportedDataState::create( - builder, - &fb::ExportedDataStateArgs { - type_: Some(type_offset), - version_legacy: 0, // Deprecated in schema, using 0 - source: Some(source_offset), - version: Some(version_offset), - thumbnail: thumbnail_vec, - dictionary: dictionary_vec, - elements: Some(elements_vec), - blocks: Some(blocks_vec), - blockInstances: Some(block_instances_vec), - blockCollections: Some(block_collections_vec), - groups: Some(groups_vec), - regions: Some(regions_vec), - layers: Some(layers_vec), - standards: Some(standards_vec), - duc_local_state: duc_local_state_offset, - duc_global_state: duc_global_state_offset, - external_files: external_files_vec, - version_graph: version_graph_offset, - id: id_offset, - }, - ) + Ok(()) } diff --git a/packages/ducrs/src/types.rs b/packages/ducrs/src/types.rs index 8245d102..23603ad1 100644 --- a/packages/ducrs/src/types.rs +++ b/packages/ducrs/src/types.rs @@ -1,181 +1,319 @@ -use crate::generated::duc::{ - ANGULAR_UNITS_FORMAT, AXIS, BEZIER_MIRRORING, BLENDING, BLOCK_ATTACHMENT, BOOLEAN_OPERATION, - COLUMN_TYPE, DATUM_BRACKET_STYLE, DECIMAL_SEPARATOR, DIMENSION_FIT_RULE, - DIMENSION_TEXT_PLACEMENT, DIMENSION_TYPE, DIMENSION_UNITS_FORMAT, DOCUMENT_GRID_ALIGN_ITEMS, - ELEMENT_CONTENT_PREFERENCE, - FEATURE_MODIFIER, GDT_SYMBOL, GRID_DISPLAY_TYPE, GRID_TYPE, HATCH_STYLE, IMAGE_STATUS, - LEADER_CONTENT_TYPE, LINE_HEAD, LINE_SPACING_TYPE, MARK_ELLIPSE_CENTER, MATERIAL_CONDITION, - OBJECT_SNAP_MODE, PARAMETRIC_SOURCE_TYPE, PRUNING_LEVEL, SNAP_MARKER_SHAPE, SNAP_MODE, - SNAP_OVERRIDE_BEHAVIOR, STACKED_TEXT_ALIGN, STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT, - STROKE_PREFERENCE, STROKE_SIDE_PREFERENCE, TABLE_CELL_ALIGNMENT, TABLE_FLOW_DIRECTION, - TEXT_ALIGN, TEXT_FIELD_SOURCE_PROPERTY, TEXT_FIELD_SOURCE_TYPE, TEXT_FLOW_DIRECTION, - TOLERANCE_DISPLAY, TOLERANCE_ZONE_TYPE, UNIT_SYSTEM, VERTICAL_ALIGN, VIEWPORT_SHADE_PLOT, -}; - -// =============== ENUMS (Custom for Rust convenience) =============== - -#[derive(Debug, Clone, Copy, PartialEq)] -pub enum ElementType { - Rectangle, - Ellipse, - Polygon, - Table, - Text, - Line, - Arrow, - FreeDraw, - Image, - Frame, - Plot, - Viewport, - XRay, - Leader, - Dimension, - FeatureControlFrame, - Doc, - Parametric, - Model, - Embeddable, - Pdf, - Mermaid, -} - -impl ElementType { - pub fn as_str(&self) -> &'static str { - match self { - ElementType::Rectangle => "rectangle", - ElementType::Ellipse => "ellipse", - ElementType::Polygon => "polygon", - ElementType::Table => "table", - ElementType::Text => "text", - ElementType::Line => "line", - ElementType::Arrow => "arrow", - ElementType::FreeDraw => "freedraw", - ElementType::Image => "image", - ElementType::Frame => "frame", - ElementType::Plot => "plot", - ElementType::Viewport => "viewport", - ElementType::XRay => "xray", - ElementType::Leader => "leader", - ElementType::Dimension => "dimension", - ElementType::FeatureControlFrame => "featurecontrolframe", - ElementType::Doc => "doc", - ElementType::Parametric => "parametric", - ElementType::Model => "model", - ElementType::Embeddable => "embeddable", - ElementType::Pdf => "pdf", - ElementType::Mermaid => "mermaid", - } - } -} - -// Element variant enum that wraps all element types -#[derive(Debug, Clone, PartialEq)] -pub enum DucElementVariant { - Rectangle(DucRectangleElement), - Ellipse(DucEllipseElement), - Polygon(DucPolygonElement), - Linear(DucLinearElement), - Arrow(DucArrowElement), - Text(DucTextElement), - Image(DucImageElement), - Frame(DucFrameElement), - FreeDraw(DucFreeDrawElement), - Table(DucTableElement), - Plot(DucPlotElement), - Viewport(DucViewportElement), - XRay(DucXRayElement), - Leader(DucLeaderElement), - Dimension(DucDimensionElement), - FeatureControlFrame(DucFeatureControlFrameElement), - Doc(DucDocElement), - Parametric(DucParametricElement), - Model(DucModelElement), - Embeddable(DucEmbeddableElement), - Pdf(DucPdfElement), - Mermaid(DucMermaidElement), -} - -impl DucElementVariant { - pub fn get_base(&self) -> &DucElementBase { - match self { - DucElementVariant::Rectangle(elem) => &elem.base, - DucElementVariant::Ellipse(elem) => &elem.base, - DucElementVariant::Polygon(elem) => &elem.base, - DucElementVariant::Linear(elem) => &elem.linear_base.base, - DucElementVariant::Arrow(elem) => &elem.linear_base.base, - DucElementVariant::Text(elem) => &elem.base, - DucElementVariant::Image(elem) => &elem.base, - DucElementVariant::Frame(elem) => &elem.stack_element_base.base, - DucElementVariant::FreeDraw(elem) => &elem.base, - DucElementVariant::Table(elem) => &elem.base, - DucElementVariant::Plot(elem) => &elem.stack_element_base.base, - DucElementVariant::Viewport(elem) => &elem.linear_base.base, - DucElementVariant::XRay(elem) => &elem.base, - DucElementVariant::Leader(elem) => &elem.linear_base.base, - DucElementVariant::Dimension(elem) => &elem.base, - DucElementVariant::FeatureControlFrame(elem) => &elem.base, - DucElementVariant::Doc(elem) => &elem.base, - DucElementVariant::Parametric(elem) => &elem.base, - DucElementVariant::Model(elem) => &elem.base, - DucElementVariant::Embeddable(elem) => &elem.base, - DucElementVariant::Pdf(elem) => &elem.base, - DucElementVariant::Mermaid(elem) => &elem.base, - } - } +/** + * Aligns text vertically within its bounding box. + */ +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum VERTICAL_ALIGN { + /** Aligns text to the top of its bounding box. */ + TOP = 10, + /** Aligns text to the middle of its bounding box. */ + MIDDLE = 11, + /** Aligns text to the bottom of its bounding box. */ + BOTTOM = 12, +} + +/** + * Aligns text horizontally within its bounding box. + */ +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum TEXT_ALIGN { + /** Aligns text to the left of its bounding box. */ + LEFT = 10, + /** Centers text horizontally within its bounding box. */ + CENTER = 11, + /** Aligns text to the right of its bounding box. */ + RIGHT = 12, +} + +/** + * Determines how line spacing is interpreted. + */ +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum LINE_SPACING_TYPE { + /** + * The line spacing is the larger of the `value` or the tallest character's natural height. + * This ensures text doesn't overlap but respects a minimum spacing. + */ + AT_LEAST = 10, + /** + * Forces the line spacing to the specified `value`, even if characters + * (especially tall ones like ascenders/descenders or special symbols) overlap. + * Useful for precise layout control where overlapping might be acceptable or handled externally. + */ + EXACTLY = 11, + /** + * The base line height (often derived from the font's intrinsic metrics and font size) + * is multiplied by the `value` (e.g., a `value` of 1.5 would mean 150% of the base line height). + * This is very common for relative spacing. + */ + MULTIPLE = 12, +} + +/** + * Placement of stroke relative to the element boundary. + */ +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum STROKE_PLACEMENT { + /** Places the stroke inside the element's boundary. */ + INSIDE = 10, + /** Centers the stroke on the element's boundary. */ + CENTER = 11, + /** Places the stroke outside the element's boundary. */ + OUTSIDE = 12, +} + +/** + * Preferred stroke rendering style. + */ +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum STROKE_PREFERENCE { + /** Renders the stroke as a continuous solid line. */ + SOLID = 10, + /** Renders the stroke as a series of dashes. */ + DASHED = 11, + /** Renders the stroke as a series of dots. */ + DOTTED = 12, + /** Renders the stroke using a custom pattern. */ + CUSTOM = 13, +} + +/** + * Applies stroke to specific sides of an element. + */ +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum STROKE_SIDE_PREFERENCE { + /** Applies the stroke to the top side. */ + TOP = 10, + /** Applies the stroke to the bottom side. */ + BOTTOM = 11, + /** Applies the stroke to the left side. */ + LEFT = 12, + /** Applies the stroke to the right side. */ + RIGHT = 13, + /** Applies the stroke to custom-defined sides. */ + CUSTOM = 14, + /** Applies the stroke to all sides. */ + ALL = 15, +} + +/** + * Shape used at the end of stroked segments. + */ +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum STROKE_CAP { + /** A butt cap cuts off the line at the endpoint. */ + BUTT = 10, + /** A round cap adds a rounded end to the line. */ + ROUND = 11, + /** A square cap adds a square end to the line. */ + SQUARE = 12, +} + +/** + * Join style for adjacent stroked segments. + */ +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum STROKE_JOIN { + /** A miter join creates a sharp corner. */ + MITER = 10, + /** A round join creates a rounded corner. */ + ROUND = 11, + /** A bevel join creates a flattened corner. */ + BEVEL = 12, +} + +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum LINE_HEAD { + /** An arrow-shaped line end. */ + ARROW = 10, + /** A bar-shaped line end. */ + BAR = 11, + /** A circular line end. */ + CIRCLE = 12, + /** An outlined circular line end. */ + CIRCLE_OUTLINED = 13, + /** A triangle-shaped line end. */ + TRIANGLE = 14, + /** An outlined triangle-shaped line end. */ + TRIANGLE_OUTLINED = 15, + /** A diamond-shaped line end. */ + DIAMOND = 16, + /** An outlined diamond-shaped line end. */ + DIAMOND_OUTLINED = 17, + /** A cross-shaped line end. */ + CROSS = 18, + /** An open arrow-shaped line end. */ + OPEN_ARROW = 19, + /** A reversed arrow-shaped line end. */ + REVERSED_ARROW = 20, + /** A reversed triangle-shaped line end. */ + REVERSED_TRIANGLE = 21, + /** A reversed outlined triangle-shaped line end. */ + REVERSED_TRIANGLE_OUTLINED = 22, + /** A cone-shaped line end. */ + CONE = 23, + /** A half-cone shaped line end. */ + HALF_CONE = 24, +} + +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum BEZIER_MIRRORING { + /** No mirroring of Bezier handles. */ + NONE = 10, + /** Bezier handles mirror their angle. */ + ANGLE = 11, + /** Bezier handles mirror both their angle and length. */ + ANGLE_LENGTH = 12, +} + +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum BLENDING { + /** Multiplies the colors of overlapping elements. */ + MULTIPLY = 11, + /** Screens the colors of overlapping elements. */ + SCREEN = 12, + /** Overlays the colors of overlapping elements. */ + OVERLAY = 13, + /** Darkens the colors of overlapping elements. */ + DARKEN = 14, + /** Lightens the colors of overlapping elements. */ + LIGHTEN = 15, + /** Calculates the difference between the colors of overlapping elements. */ + DIFFERENCE = 16, + /** Calculates the exclusion of the colors of overlapping elements. */ + EXCLUSION = 17, +} + +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum ELEMENT_CONTENT_PREFERENCE { + /** Fills the element with a solid color. */ + SOLID = 12, + /** Fills the element with a solid color or gradient (similar to FILL). */ + FILL = 14, + /** Scales the content to fit within the element's bounds, maintaining aspect ratio. */ + FIT = 15, + /** Tiles the content within the element's bounds. */ + TILE = 16, + /** Stretches the content to fill the element's bounds, potentially distorting aspect ratio. */ + STRETCH = 17, + /** Fills the element with a hatch pattern. */ + HATCH = 18, +} + +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum HATCH_STYLE { + /** Normal hatch, fills closed boundaries. */ + NORMAL = 10, + /** Outermost boundary only, ignores internal islands. */ + OUTER = 11, + /** Ignores internal structures when hatching. */ + IGNORE = 12, +} + +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum IMAGE_STATUS { + /** Image is pending upload/saving. */ + PENDING = 10, + /** Image is saved and available. */ + SAVED = 11, + /** An error occurred with the image. */ + ERROR = 12, +} + +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum PRUNING_LEVEL { + /** Conservative pruning, retains more history. */ + CONSERVATIVE = 10, + /** Balanced pruning, optimizes between history and size. */ + BALANCED = 20, + /** Aggressive pruning, retains less history for smaller size. */ + AGGRESSIVE = 30, +} + +/** + * Defines the types of boolean operations that can be performed. + */ +#[allow(non_camel_case_types)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde_repr::Serialize_repr, serde_repr::Deserialize_repr)] +#[repr(i32)] +pub enum BOOLEAN_OPERATION { + /** Combines all child shapes into a single shape. */ + UNION = 10, + /** Subtracts all subsequent shapes from the first shape. Order is critical. */ + SUBTRACT = 11, + /** Creates a shape from the overlapping areas of all child shapes. */ + INTERSECT = 12, + /** Creates a shape from the non-overlapping areas (XOR). */ + EXCLUDE = 13, } // =============== UTILITY & GEOMETRY TYPES =============== -#[derive(Debug, Clone, PartialEq)] +/** A generic key-value pair for string dictionaries. */ +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DictionaryEntry { pub key: String, pub value: String, } -#[derive(Debug, Clone, PartialEq)] +/** A generic key-value pair for more complex structures like DucBlock attribute values. */ +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct StringValueEntry { pub key: String, pub value: String, } -#[derive(Debug, Clone, PartialEq)] -pub struct Identifier { - pub id: String, - pub name: String, - pub description: Option, -} - -#[derive(Debug, Clone, PartialEq)] +/** A high-precision 2D point in the World Coordinate System. */ +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct GeometricPoint { pub x: f64, pub y: f64, } -#[derive(Debug, Clone, PartialEq)] -pub struct DucUcs { - pub origin: GeometricPoint, - pub angle: f64, -} - -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucPoint { pub x: f64, pub y: f64, + /** Only meaningful if the point is referenced in exactly two lines */ pub mirroring: Option, } -#[derive(Debug, Clone, PartialEq)] -pub struct DucView { - pub scroll_x: f64, - pub scroll_y: f64, - pub zoom: f64, - pub twist_angle: f64, - pub center_point: DucPoint, - pub scope: String, -} - -#[derive(Debug, Clone, PartialEq)] +/** Represents margins for layouts and cells. */ +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct Margins { pub top: f64, pub right: f64, @@ -183,9 +321,124 @@ pub struct Margins { pub left: f64, } +// =============== 3D VIEWER STATE =============== + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Viewer3DClipPlane { + pub enabled: bool, + pub value: f64, + pub normal: Option<[f64; 3]>, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Viewer3DMaterial { + pub metalness: f32, + pub roughness: f32, + pub default_opacity: f32, + /** Packed RGB color (e.g. 0xFFFFFF) */ + pub edge_color: u32, + pub ambient_intensity: f32, + pub direct_intensity: f32, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Viewer3DZebra { + pub active: bool, + pub stripe_count: i32, + pub stripe_direction: f64, + /** Available: "blackwhite" | "colorful" | "grayscale" */ + pub color_scheme: String, + pub opacity: f32, + /** Available: "reflection" | "normal" */ + pub mapping_mode: String, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Viewer3DCamera { + /** Available: "orbit" | "trackball" */ + pub control: String, + pub ortho: bool, + /** Available: "Z" | "Y" */ + pub up: String, + pub position: [f64; 3], + /** Camera rotation as quaternion [x, y, z, w] — avoids gimbal lock, better for interpolation */ + pub quaternion: [f64; 4], + /** The point the camera orbits around / looks at */ + pub target: [f64; 3], + pub zoom: f64, + pub pan_speed: f32, + pub rotate_speed: f32, + pub zoom_speed: f32, + pub holroyd: bool, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Viewer3DGridPlanes { + pub xy: bool, + pub xz: bool, + pub yz: bool, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "type", content = "value", rename_all = "camelCase")] +pub enum Viewer3DGrid { + /** All planes share the same visibility flag */ + Uniform(bool), + /** Per-plane visibility control */ + PerPlane(Viewer3DGridPlanes), +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Viewer3DDisplay { + pub wireframe: bool, + pub transparent: bool, + pub black_edges: bool, + pub grid: Viewer3DGrid, + /** Whether to show the XYZ axes indicator */ + pub axes_visible: bool, + /** If true, axes are positioned at world origin (0,0,0); if false, at object center */ + pub axes_at_origin: bool, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Viewer3DClipping { + pub x: Viewer3DClipPlane, + pub y: Viewer3DClipPlane, + pub z: Viewer3DClipPlane, + pub intersection: bool, + pub show_planes: bool, + pub object_color_caps: bool, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Viewer3DExplode { + pub active: bool, + pub value: f64, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Viewer3DState { + pub camera: Viewer3DCamera, + pub display: Viewer3DDisplay, + pub material: Viewer3DMaterial, + pub clipping: Viewer3DClipping, + pub explode: Viewer3DExplode, + pub zebra: Viewer3DZebra, +} + // =============== STYLING & CONTENT =============== -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct TilingProperties { pub size_in_percent: f32, pub angle: f64, @@ -194,41 +447,60 @@ pub struct TilingProperties { pub offset_y: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct HatchPatternLine { + /** Line angle in radians */ pub angle: f64, + /** Line origin point */ pub origin: DucPoint, + /** Offset between parallel lines [x, y] */ pub offset: Vec, + /** Dash pattern (empty array = solid line) */ pub dash_pattern: Vec, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct CustomHatchPattern { + /** Pattern name */ pub name: String, + /** Pattern description */ pub description: Option, + /** Pattern line definitions */ pub lines: Vec, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucHatchStyle { + /** Default hatch style */ pub hatch_style: HATCH_STYLE, + /** Pattern name (for predefined) or reference to custom pattern */ pub pattern_name: String, + /** Pattern scale factor */ pub pattern_scale: f32, + /** Pattern rotation angle */ pub pattern_angle: f64, + /** Pattern origin point */ pub pattern_origin: DucPoint, + /** Double pattern (second pattern at 90 degrees) */ pub pattern_double: bool, pub custom_pattern: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucImageFilter { pub brightness: f32, pub contrast: f32, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct ElementContentBase { pub preference: Option, + /** Can be a color, gradient, image, DucBlock, (fileId or url), frame element's content `@el/${elementId}` */ pub src: String, pub visible: bool, pub opacity: f64, @@ -237,24 +509,29 @@ pub struct ElementContentBase { pub image_filter: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct StrokeStyle { pub preference: Option, pub cap: Option, pub join: Option, pub dash: Option>, + /** Override the dash line into a custom shape (DucBlockInstance id) */ pub dash_line_override: Option, pub dash_cap: Option, pub miter_limit: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct StrokeSides { pub preference: Option, + /** [0, 1] for x and y || [0, 1, 2, 3] for top, bottom, left, right */ pub values: Option>, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct ElementStroke { pub content: ElementContentBase, pub width: f64, @@ -263,12 +540,15 @@ pub struct ElementStroke { pub stroke_sides: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct ElementBackground { pub content: ElementContentBase, } -#[derive(Debug, Clone, PartialEq)] +/** Base style properties shared by many elements. */ +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucElementStylesBase { pub roundness: f64, pub blending: Option, @@ -279,90 +559,181 @@ pub struct DucElementStylesBase { // =============== BASE ELEMENT & COMMON ELEMENT COMPONENTS =============== -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct BoundElement { pub id: String, - pub element_type: String, // Renamed 'type' to 'element_type' to avoid keyword conflict + #[serde(rename = "type")] + pub element_type: String, } -#[derive(Debug, Clone, PartialEq)] +/** The foundational table for all scene elements, containing common properties. */ +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucElementBase { pub id: String, + #[serde(flatten)] pub styles: DucElementStylesBase, pub x: f64, pub y: f64, pub width: f64, pub height: f64, pub angle: f64, + /** + * The scope where the element is currently. + * mm, cm, m, in, ft, yd, mi, etc... + */ pub scope: String, pub label: String, pub description: Option, pub is_visible: bool, + /** + * Random integer used to seed shape generation. + * Doesn't differ across renders. + */ pub seed: i32, + /** + * Integer that is sequentially incremented on each change. Used to reconcile + * elements during collaboration or when saving to server. + */ pub version: i32, + /** + * Random integer that is regenerated on each change. + * Used for deterministic reconciliation of updates during collaboration, + * in case the versions (see above) are identical. + */ pub version_nonce: i32, + /** Epoch timestamp (ms) of last element update */ pub updated: i64, + /** + * String in a fractional form defined by https://github.com/rocicorp/fractional-indexing. + * Used for ordering in multiplayer scenarios, such as during reconciliation or undo / redo. + * Could be null for new elements which were not yet assigned to the scene. + */ pub index: Option, + /** Whether the element is a plot (i.e. visible on plotting) */ pub is_plot: bool, - pub is_annotative: bool, + /** Whether the element is deleted */ pub is_deleted: bool, + /** + * List of groups the element belongs to. + * Ordered from deepest to shallowest. + */ pub group_ids: Vec, + /** + * List of blocks this element helps *define*. + * If this is populated, `instance_id` should be null. + */ pub block_ids: Vec, + /** + * List of regions the element belongs to. + * Used to define boolean operations between elements. + * Ordered from deepest to shallowest. + */ pub region_ids: Vec, + /** + * The ID of the `DucBlockInstance` this element belongs to. + * If not null, `block_ids` is empty (the relationship to the Block is via the Instance). + */ pub instance_id: Option, + /** The layer the element belongs to */ pub layer_id: Option, + /** The frame or plot the element belongs to */ pub frame_id: Option, + /** + * Other elements that are bound to this element. + * If we mutate this element, the bound elements will be updated automatically + * for transform properties like x, y, angle, etc. + */ pub bound_elements: Option>, + /** + * z-index of the element in the scene. + * Explicit stacking order, higher values are rendered on top. + */ pub z_index: f32, pub link: Option, pub locked: bool, + /** Contains a JSON of custom key-value data. */ pub custom_data: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucHead { - pub head_type: Option, // Renamed 'type' to 'head_type' to avoid keyword conflict + #[serde(rename = "type")] + pub head_type: Option, + /** If the head is a block, this is the id of the block */ pub block_id: Option, pub size: f64, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct PointBindingPoint { + /** The index of the target point within the element. */ pub index: i32, + /** + * The offset from the point. Ranges from -1 to 1: 0 corresponds to the actual point. + * -1 and 1 represent the percentage of the distance between the point at `index` + * and the previous or next point in the points array, respectively. + */ pub offset: f64, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucPointBinding { pub element_id: String, + /** + * Determines where along the edge of the bound element the arrow endpoint should attach. + * This value ranges from -1 to 1: -1 → Attaches to the far left/top; 0 → Attaches to the center; 1 → Attaches to the far right/bottom. + * Focus ensures that the arrow dynamically adjusts as the bound element moves, resizes, or rotates. + */ pub focus: f32, + /** The gap distance between the bound element and the binding element. */ pub gap: f64, + /** + * Represents a fixed point inside the bound element, defined as a normalized coordinate. + * This value is an array [x, y], where: x (0.0 - 1.0) → Horizontal position; y (0.0 - 1.0) → Vertical position. + * If null, focus is used. If set, it overrides focus. + */ pub fixed_point: Option, pub point: Option, + /** The head of the line. */ pub head: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucLineReference { + /** Index of the point in the points array */ pub index: i32, + /** Bezier handle of the point on the line segment */ pub handle: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucLine { pub start: DucLineReference, pub end: DucLineReference, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucPath { pub line_indices: Vec, + /** Override the background and stroke from the base if different than null */ pub background: Option, + /** Override the background and stroke from the base if different than null */ pub stroke: Option, } -#[derive(Debug, Clone, PartialEq)] +/** The base for linear elements like lines and arrows. */ +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucLinearElementBase { + #[serde(flatten)] pub base: DucElementBase, pub points: Vec, pub lines: Vec, @@ -372,13 +743,14 @@ pub struct DucLinearElementBase { pub end_binding: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucStackLikeStyles { pub opacity: f64, - pub labeling_color: String, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucStackBase { pub label: String, pub description: Option, @@ -386,200 +758,243 @@ pub struct DucStackBase { pub is_plot: bool, pub is_visible: bool, pub locked: bool, + #[serde(flatten)] pub styles: DucStackLikeStyles, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucStackElementBase { + #[serde(flatten)] pub base: DucElementBase, pub stack_base: DucStackBase, pub clip: bool, pub label_visible: bool, - pub standard_override: Option, } // =============== ELEMENT-SPECIFIC STYLES =============== -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct LineSpacing { + /** + * The numerical value for the line spacing. Its interpretation depends on the `type` property. + * Can also be interpreted as ScaleFactor. + */ pub value: f64, + /** + * Determines how the line spacing factor is applied. + */ + #[serde(rename = "type")] pub line_type: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucTextStyle { + /** + * Whether the text is left-to-right or right-to-left. + */ pub is_ltr: bool, + /** The primary font family to use for the text, in CSS font-family format */ pub font_family: String, + /** + * Fallback font family, in CSS font-family format, for broader compatibility across all systems and languages. + * Useful for emojis, non-latin characters, etc. + */ pub big_font_family: String, + /** Horizontal alignment of the text within its bounding box */ pub text_align: TEXT_ALIGN, + /** Vertical alignment of the text within its bounding box */ pub vertical_align: VERTICAL_ALIGN, + /** + * Unitless line height multiplier (follows W3C standard). + * Actual line height in drawing units = fontSize x lineHeight. + */ pub line_height: f32, + /** Defines the line spacing properties for text. */ pub line_spacing: LineSpacing, + /** + * Italic angle in radians for oblique text rendering. + * Positive values slant right, negative values slant left. + */ pub oblique_angle: f64, + /** + * Text height in drawing units (primary size parameter). + * This determines the height of capital letters. + */ pub font_size: f64, - pub paper_text_height: Option, + /** + * Character width as a ratio of text height. + * Controls horizontal spacing and character proportions. + */ pub width_factor: f32, pub is_upside_down: bool, + /** Render backwards/mirrored */ pub is_backwards: bool, } -#[derive(Debug, Clone, PartialEq)] -pub struct DucTableCellStyle { - pub base_style: DucElementStylesBase, - pub text_style: DucTextStyle, - pub margins: Margins, - pub alignment: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucTableStyle { - pub flow_direction: TABLE_FLOW_DIRECTION, - pub header_row_style: DucTableCellStyle, - pub data_row_style: DucTableCellStyle, - pub data_column_style: DucTableCellStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucLeaderStyle { - pub heads_override: Option>, - pub dogleg: Option, - pub text_style: DucTextStyle, - pub text_attachment: VERTICAL_ALIGN, - pub block_attachment: BLOCK_ATTACHMENT, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DimensionToleranceStyle { - pub enabled: bool, - pub display_method: TOLERANCE_DISPLAY, - pub upper_value: f64, - pub lower_value: f64, - pub precision: i32, - pub text_style: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DimensionFitStyle { - pub rule: DIMENSION_FIT_RULE, - pub text_placement: DIMENSION_TEXT_PLACEMENT, - pub force_text_inside: bool, -} +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DucTableStyle {} -#[derive(Debug, Clone, PartialEq)] -pub struct DimensionLineStyle { - pub stroke: ElementStroke, - pub text_gap: f64, -} +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DucDocStyle {} -#[derive(Debug, Clone, PartialEq)] -pub struct DimensionExtLineStyle { - pub stroke: ElementStroke, - pub overshoot: f64, - pub offset: f64, -} +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DucPlotStyle {} -#[derive(Debug, Clone, PartialEq)] -pub struct DimensionSymbolStyle { - pub heads_override: Option>, - pub center_mark_type: MARK_ELLIPSE_CENTER, - pub center_mark_size: f64, -} +// =============== ELEMENT DEFINITIONS =============== -#[derive(Debug, Clone, PartialEq)] -pub struct DucDimensionStyle { - pub dim_line: DimensionLineStyle, - pub ext_line: DimensionExtLineStyle, - pub text_style: DucTextStyle, - pub symbols: DimensionSymbolStyle, - pub tolerance: DimensionToleranceStyle, - pub fit: DimensionFitStyle, +#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum ElementType { + Rectangle, + Ellipse, + Polygon, + Table, + Text, + Line, + Arrow, + FreeDraw, + Image, + Frame, + Plot, + Doc, + Model, + Embeddable, + Pdf, } -#[derive(Debug, Clone, PartialEq)] -pub struct FCFLayoutStyle { - pub padding: f64, - pub segment_spacing: f64, - pub row_spacing: f64, +impl ElementType { + pub fn as_str(&self) -> &'static str { + match self { + ElementType::Rectangle => "rectangle", + ElementType::Ellipse => "ellipse", + ElementType::Polygon => "polygon", + ElementType::Table => "table", + ElementType::Text => "text", + ElementType::Line => "line", + ElementType::Arrow => "arrow", + ElementType::FreeDraw => "freedraw", + ElementType::Image => "image", + ElementType::Frame => "frame", + ElementType::Plot => "plot", + ElementType::Doc => "doc", + ElementType::Model => "model", + ElementType::Embeddable => "embeddable", + ElementType::Pdf => "pdf", + } + } } -#[derive(Debug, Clone, PartialEq)] -pub struct FCFSymbolStyle { - pub scale: f32, +// Element variant enum that wraps all element types +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum DucElementVariant { + Rectangle(DucRectangleElement), + Ellipse(DucEllipseElement), + Polygon(DucPolygonElement), + Linear(DucLinearElement), + Arrow(DucArrowElement), + Text(DucTextElement), + Image(DucImageElement), + Frame(DucFrameElement), + FreeDraw(DucFreeDrawElement), + Table(DucTableElement), + Plot(DucPlotElement), + Doc(DucDocElement), + Model(DucModelElement), + Embeddable(DucEmbeddableElement), + Pdf(DucPdfElement), } -#[derive(Debug, Clone, PartialEq)] -pub struct FCFDatumStyle { - pub bracket_style: DATUM_BRACKET_STYLE, +impl DucElementVariant { + pub fn get_base(&self) -> &DucElementBase { + match self { + DucElementVariant::Rectangle(elem) => &elem.base, + DucElementVariant::Ellipse(elem) => &elem.base, + DucElementVariant::Polygon(elem) => &elem.base, + DucElementVariant::Linear(elem) => &elem.linear_base.base, + DucElementVariant::Arrow(elem) => &elem.linear_base.base, + DucElementVariant::Text(elem) => &elem.base, + DucElementVariant::Image(elem) => &elem.base, + DucElementVariant::Frame(elem) => &elem.stack_element_base.base, + DucElementVariant::FreeDraw(elem) => &elem.base, + DucElementVariant::Table(elem) => &elem.base, + DucElementVariant::Plot(elem) => &elem.stack_element_base.base, + DucElementVariant::Doc(elem) => &elem.base, + DucElementVariant::Model(elem) => &elem.base, + DucElementVariant::Embeddable(elem) => &elem.base, + DucElementVariant::Pdf(elem) => &elem.base, + } + } } -#[derive(Debug, Clone, PartialEq)] -pub struct DucFeatureControlFrameStyle { - pub text_style: DucTextStyle, - pub layout: FCFLayoutStyle, - pub symbols: FCFSymbolStyle, - pub datum_style: FCFDatumStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct ParagraphFormatting { - pub first_line_indent: f64, - pub hanging_indent: f64, - pub left_indent: f64, - pub right_indent: f64, - pub space_before: f64, - pub space_after: f64, - pub tab_stops: Vec, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct StackFormatProperties { - pub upper_scale: f64, - pub lower_scale: f64, - pub alignment: STACKED_TEXT_ALIGN, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct StackFormat { - pub auto_stack: bool, - pub stack_chars: Vec, - pub properties: StackFormatProperties, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucDocStyle { - pub text_style: DucTextStyle, - pub paragraph: ParagraphFormatting, - pub stack_format: StackFormat, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucViewportStyle { - pub scale_indicator_visible: bool, +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "type")] +pub enum DucElementEnum { + #[serde(rename = "rectangle")] + DucRectangleElement(DucRectangleElement), + #[serde(rename = "polygon")] + DucPolygonElement(DucPolygonElement), + #[serde(rename = "ellipse")] + DucEllipseElement(DucEllipseElement), + #[serde(rename = "embeddable")] + DucEmbeddableElement(DucEmbeddableElement), + #[serde(rename = "pdf")] + DucPdfElement(DucPdfElement), + #[serde(rename = "table")] + DucTableElement(DucTableElement), + #[serde(rename = "image")] + DucImageElement(DucImageElement), + #[serde(rename = "text")] + DucTextElement(DucTextElement), + #[serde(rename = "line")] + DucLinearElement(DucLinearElement), + #[serde(rename = "arrow")] + DucArrowElement(DucArrowElement), + #[serde(rename = "freedraw")] + DucFreeDrawElement(DucFreeDrawElement), + #[serde(rename = "frame")] + DucFrameElement(DucFrameElement), + #[serde(rename = "plot")] + DucPlotElement(DucPlotElement), + #[serde(rename = "doc")] + DucDocElement(DucDocElement), + #[serde(rename = "model")] + DucModelElement(DucModelElement), } -#[derive(Debug, Clone, PartialEq)] -pub struct DucPlotStyle {} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucXRayStyle { - pub color: String, +/** A wrapper to hold an element from the union. */ +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(transparent)] +pub struct ElementWrapper { + pub element: DucElementEnum, } -// =============== ELEMENT DEFINITIONS =============== - -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucRectangleElement { + #[serde(flatten)] pub base: DucElementBase, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucPolygonElement { + #[serde(flatten)] pub base: DucElementBase, + /** Number of sides of the polygon */ pub sides: i32, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucEllipseElement { + #[serde(flatten)] pub base: DucElementBase, pub ratio: f32, pub start_angle: f64, @@ -587,134 +1002,63 @@ pub struct DucEllipseElement { pub show_aux_crosshair: bool, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucEmbeddableElement { + #[serde(flatten)] pub base: DucElementBase, } -/// Configuration for PDF grid layout -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DocumentGridConfig { + /** 1 = single, 2 = two-up, n = grid */ pub columns: i32, + /** Horizontal spacing (px) */ pub gap_x: f64, + /** Vertical spacing (px) */ pub gap_y: f64, - pub align_items: DocumentGridAlignItems, + /** Cover page behavior for 2+ columns */ pub first_page_alone: bool, + /** + * The scale factor of the element (Drawing Units / Real World Units). + * The scale factor is strictly a ratio and is unitless. + * Example: 1:300 => 0.00333, 1:1 => 1.0, 5:1 => 5.0 + */ pub scale: f64, } -/// Vertical alignment for document grid layout -#[derive(Debug, Clone, Copy, PartialEq)] -pub enum DocumentGridAlignItems { - Start, - Center, - End, -} - -impl From for DocumentGridAlignItems { - fn from(value: DOCUMENT_GRID_ALIGN_ITEMS) -> Self { - match value { - DOCUMENT_GRID_ALIGN_ITEMS::START => DocumentGridAlignItems::Start, - DOCUMENT_GRID_ALIGN_ITEMS::CENTER => DocumentGridAlignItems::Center, - DOCUMENT_GRID_ALIGN_ITEMS::END => DocumentGridAlignItems::End, - _ => DocumentGridAlignItems::Start, - } - } -} - -impl From for DOCUMENT_GRID_ALIGN_ITEMS { - fn from(value: DocumentGridAlignItems) -> Self { - match value { - DocumentGridAlignItems::Start => DOCUMENT_GRID_ALIGN_ITEMS::START, - DocumentGridAlignItems::Center => DOCUMENT_GRID_ALIGN_ITEMS::CENTER, - DocumentGridAlignItems::End => DOCUMENT_GRID_ALIGN_ITEMS::END, - } - } -} - -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucPdfElement { + #[serde(flatten)] pub base: DucElementBase, pub file_id: Option, pub grid_config: DocumentGridConfig, } -#[derive(Debug, Clone, PartialEq)] -pub struct DucMermaidElement { +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DucDocElement { + #[serde(flatten)] pub base: DucElementBase, - pub source: String, - pub theme: Option, - pub svg_path: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucTableColumn { - pub id: String, - pub width: f64, - pub style_overrides: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucTableRow { - pub id: String, - pub height: f64, - pub style_overrides: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucTableCellSpan { - pub columns: i32, - pub rows: i32, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucTableCell { - pub row_id: String, - pub column_id: String, - pub data: String, - pub span: Option, - pub locked: bool, - pub style_overrides: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucTableAutoSize { - pub columns: bool, - pub rows: bool, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucTableColumnEntry { - pub key: String, - pub value: DucTableColumn, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucTableRowEntry { - pub key: String, - pub value: DucTableRow, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucTableCellEntry { - pub key: String, - pub value: DucTableCell, + pub style: DucDocStyle, + pub text: String, + pub grid_config: DocumentGridConfig, + pub file_id: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucTableElement { + #[serde(flatten)] pub base: DucElementBase, pub style: DucTableStyle, - pub column_order: Vec, - pub row_order: Vec, - pub columns: Vec, - pub rows: Vec, - pub cells: Vec, - pub header_row_count: i32, - pub auto_size: DucTableAutoSize, + pub file_id: Option, // Source of truth is the linked xlsx file } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct ImageCrop { pub x: f64, pub y: f64, @@ -724,360 +1068,136 @@ pub struct ImageCrop { pub natural_height: f64, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucImageElement { + #[serde(flatten)] pub base: DucElementBase, pub file_id: Option, pub status: IMAGE_STATUS, + /** X and Y scale factors, used for image axis flipping */ + #[serde(rename = "scaleFlip")] pub scale: Vec, pub crop: Option, pub filter: Option, } -#[derive(Debug, Clone, PartialEq)] -pub struct DucTextDynamicElementSource { - pub element_id: String, - pub property: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucTextDynamicDictionarySource { - pub key: String, -} - -#[derive(Debug, Clone, PartialEq)] -pub enum DucTextDynamicSourceData { - DucTextDynamicElementSource(DucTextDynamicElementSource), - DucTextDynamicDictionarySource(DucTextDynamicDictionarySource), -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucTextDynamicSource { - pub text_source_type: Option, - pub source: DucTextDynamicSourceData, - pub formatting: Option, - pub cached_value: String, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucTextDynamicPart { - pub tag: String, - pub source: DucTextDynamicSource, - pub formatting: Option, - pub cached_value: String, -} - -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucTextElement { + #[serde(flatten)] pub base: DucElementBase, pub style: DucTextStyle, + /** + * The display text, which can contain zero or more placeholders in the + * format `{{tag}}`. Each tag corresponds to an object in the `dynamic` array. + */ pub text: String, - pub dynamic: Vec, + /** + * Text sizing behavior: + * - `true`: Width adjusts to fit text content (single line or natural wrapping) + * - `false`: Text wraps to fit within the element's fixed width + */ pub auto_resize: bool, + /** The ID of an element that this text is contained within (e.g., for labels on shapes) */ pub container_id: Option, + /** A non-rendered, original version of the text, e.g., before finishing writing the text */ pub original_text: String, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucLinearElement { + #[serde(flatten)] pub linear_base: DucLinearElementBase, + /** + * If true, the element's shape will wipe out the content below the element. + */ pub wipeout_below: bool, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucArrowElement { + #[serde(flatten)] pub linear_base: DucLinearElementBase, pub elbowed: bool, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucFreeDrawEnds { pub cap: bool, pub taper: f32, pub easing: String, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucFreeDrawElement { + #[serde(flatten)] pub base: DucElementBase, pub points: Vec, pub size: f64, pub thinning: f32, pub smoothing: f32, pub streamline: f32, + /** Key that maps to an easing function */ pub easing: String, pub start: Option, pub end: Option, pub pressures: Vec, pub simulate_pressure: bool, pub last_committed_point: Option, + /** Optional cached SVG string */ pub svg_path: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucFrameElement { + #[serde(flatten)] pub stack_element_base: DucStackElementBase, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct PlotLayout { + /** Margins inset from the edge of the paper. */ pub margins: Margins, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucPlotElement { + #[serde(flatten)] pub stack_element_base: DucStackElementBase, pub style: DucPlotStyle, + /** The layout definition for this plot, including paper size and margins. */ pub layout: PlotLayout, } -#[derive(Debug, Clone, PartialEq)] -pub struct DucViewportElement { - pub linear_base: DucLinearElementBase, - pub stack_base: DucStackBase, - pub style: DucViewportStyle, - pub view: DucView, - pub scale: f32, - pub shade_plot: VIEWPORT_SHADE_PLOT, - pub frozen_group_ids: Vec, - pub standard_override: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucXRayElement { - pub base: DucElementBase, - pub style: DucXRayStyle, - pub origin: GeometricPoint, - pub direction: GeometricPoint, - pub start_from_origin: bool, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct LeaderTextBlockContent { - pub text: String, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct LeaderBlockContent { - pub block_id: String, - pub attribute_values: Option>, - pub element_overrides: Option>, -} - -#[derive(Debug, Clone, PartialEq)] -pub enum LeaderContentData { - LeaderTextBlockContent(LeaderTextBlockContent), - LeaderBlockContent(LeaderBlockContent), -} - -#[derive(Debug, Clone, PartialEq)] -pub struct LeaderContent { - pub leader_content_type: LEADER_CONTENT_TYPE, - pub content: LeaderContentData, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucLeaderElement { - pub linear_base: DucLinearElementBase, - pub style: DucLeaderStyle, - pub content: Option, - pub content_anchor: GeometricPoint, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DimensionDefinitionPoints { - pub origin1: GeometricPoint, - pub origin2: Option, - pub location: GeometricPoint, - pub center: Option, - pub jog: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DimensionBindings { - pub origin1: Option, - pub origin2: Option, - pub center: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DimensionBaselineData { - pub base_dimension_id: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DimensionContinueData { - pub continue_from_dimension_id: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucDimensionElement { - pub base: DucElementBase, - pub style: DucDimensionStyle, - pub dimension_type: DIMENSION_TYPE, - pub definition_points: DimensionDefinitionPoints, - pub oblique_angle: f32, - pub ordinate_axis: Option, - pub bindings: Option, - pub text_override: Option, - pub text_position: Option, - pub tolerance_override: Option, - pub baseline_data: Option, - pub continue_data: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DatumReference { - pub letters: String, - pub modifier: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct ToleranceClause { - pub value: String, - pub zone_type: Option, - pub feature_modifiers: Vec, - pub material_condition: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct FeatureControlFrameSegment { - pub symbol: GDT_SYMBOL, - pub tolerance: ToleranceClause, - pub datums: Vec>, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct FCFBetweenModifier { - pub start: String, - pub end: String, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct FCFProjectedZoneModifier { - pub value: f64, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct FCFFrameModifiers { - pub all_around: bool, - pub all_over: bool, - pub continuous_feature: bool, - pub between: Option, - pub projected_tolerance_zone: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct FCFDatumDefinition { - pub letter: String, - pub feature_binding: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct FCFSegmentRow { - pub segments: Vec, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucFeatureControlFrameElement { - pub base: DucElementBase, - pub style: DucFeatureControlFrameStyle, - pub rows: Vec, - pub frame_modifiers: Option, - pub leader_element_id: Option, - pub datum_definition: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct TextColumn { - pub width: f64, - pub gutter: f64, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct ColumnLayout { - pub column_type: COLUMN_TYPE, - pub definitions: Vec, - pub auto_height: bool, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucDocElement { - pub base: DucElementBase, - pub style: DucDocStyle, - pub text: String, - pub dynamic: Vec, - pub flow_direction: TEXT_FLOW_DIRECTION, - pub columns: ColumnLayout, - pub auto_resize: bool, - pub file_id: Option, - pub grid_config: DocumentGridConfig, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct ParametricSource { - pub source_type: PARAMETRIC_SOURCE_TYPE, - pub code: String, - pub file_id: Option, -} - -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucModelElement { + #[serde(flatten)] pub base: DucElementBase, - pub source: String, + /* The specific type of 3D model, e.g., "PYTHON", "DXF", "IFC", "STL", "OBJ", "STEP", etc. */ + pub model_type: Option, + /** Defines the source code of the model using build123d python code */ + pub code: Option, + /** The last known SVG path representation of the 3D model for quick rendering on the canvas */ pub svg_path: Option, + /** Possibly connected external files, such as STEP, STL, DXF, etc. */ pub file_ids: Vec, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucParametricElement { - pub base: DucElementBase, - pub source: ParametricSource, -} - -// =============== ELEMENT UNION & WRAPPER =============== - -#[derive(Debug, Clone, PartialEq)] -pub enum DucElementEnum { - DucRectangleElement(DucRectangleElement), - DucPolygonElement(DucPolygonElement), - DucEllipseElement(DucEllipseElement), - DucEmbeddableElement(DucEmbeddableElement), - DucPdfElement(DucPdfElement), - DucMermaidElement(DucMermaidElement), - DucTableElement(DucTableElement), - DucImageElement(DucImageElement), - DucTextElement(DucTextElement), - DucLinearElement(DucLinearElement), - DucArrowElement(DucArrowElement), - DucFreeDrawElement(DucFreeDrawElement), - DucFrameElement(DucFrameElement), - DucPlotElement(DucPlotElement), - DucViewportElement(DucViewportElement), - DucXRayElement(DucXRayElement), - DucLeaderElement(DucLeaderElement), - DucDimensionElement(DucDimensionElement), - DucFeatureControlFrameElement(DucFeatureControlFrameElement), - DucDocElement(DucDocElement), - DucParametricElement(DucParametricElement), - DucModelElement(DucModelElement), -} - -#[derive(Debug, Clone, PartialEq)] -pub struct ElementWrapper { - pub element: DucElementEnum, + /** The last known 3D viewer state for the model */ + pub viewer_state: Option, } // =============== BLOCK DEFINITIONS =============== -#[derive(Debug, Clone, PartialEq)] -pub struct DucBlockAttributeDefinition { - pub tag: String, - pub prompt: Option, - pub default_value: String, - pub is_constant: bool, -} -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucBlockDuplicationArray { pub rows: i32, pub cols: i32, @@ -1085,98 +1205,128 @@ pub struct DucBlockDuplicationArray { pub col_spacing: f64, } -#[derive(Debug, Clone, PartialEq)] -pub struct DucBlockAttributeDefinitionEntry { - pub key: String, - pub value: DucBlockAttributeDefinition, -} - -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucBlockMetadata { pub source: Option, pub usage_count: i32, + /** Epoch timestamp (ms) of block creation */ pub created_at: i64, + /** Epoch timestamp (ms) of last block update */ pub updated_at: i64, + /** + * JSON string to represent localization data. + * Structure: Record + * + * where key string is BCP 47 standard language tag (e.g., "en-US", "fr-FR") + * where BlockLocalizationEntry is: + * + * { + * title: string; + * description?: string; + * } + */ pub localization: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucBlock { pub id: String, pub label: String, pub description: Option, pub version: i32, - pub attribute_definitions: Vec, pub metadata: Option, + #[serde(with = "serde_bytes", default, skip_serializing_if = "Option::is_none")] pub thumbnail: Option>, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucBlockInstance { pub id: String, + /** The reference to the DucBlock definition this instance is based on */ pub block_id: String, + /** The version that should match the block_id's version, incremented on each change */ pub version: i32, pub element_overrides: Option>, - pub attribute_values: Option>, pub duplication_array: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucBlockCollectionEntry { pub id: String, + /** + * True if pointing to another collection, False if pointing to a block. + */ pub is_collection: bool, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucBlockCollection { pub id: String, pub label: String, pub children: Vec, pub metadata: Option, + #[serde(with = "serde_bytes", default, skip_serializing_if = "Option::is_none")] pub thumbnail: Option>, } -#[derive(Debug, Clone, PartialEq)] -pub struct DucBlockAttribute { - pub name: String, - pub details: DucBlockAttributeDetails, +// =============== GROUPS & REGIONS =============== + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DucGroup { + pub id: String, + #[serde(flatten)] + pub stack_base: DucStackBase, } -#[derive(Debug, Clone, PartialEq)] -pub struct DucBlockAttributeDetails { - pub tag: String, - pub default_value: String, - pub prompt: String, - pub position: GeometricPoint, +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DucRegion { + pub id: String, + #[serde(flatten)] + pub stack_base: DucStackBase, + /** The boolean operation to apply to all child elements. */ + pub boolean_operation: BOOLEAN_OPERATION, } // =============== APP & DOCUMENT STATE =============== -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucGlobalState { + /** The name of the drawing */ pub name: Option, + /** The background color of the drawing */ pub view_background_color: String, + /** The master unit system for the entire drawing, used for block/file insertion scaling. */ pub main_scope: String, - pub dash_spacing_scale: f32, - pub is_dash_spacing_affected_by_viewport_scale: bool, + /** + * Exponent threshold for determining when to change measurement scope (up or down). + * This value defines a +/- tolerance range around the exponent of the current scope. + */ pub scope_exponent_threshold: i8, - pub dimensions_associative_by_default: bool, - pub use_annotative_scaling: bool, - pub display_precision_linear: i32, - pub display_precision_angular: i32, + /** The level of pruning to the versions from the version graph. */ pub pruning_level: PRUNING_LEVEL, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucLocalState { + /** + * The current scope of the design. + * mm, cm, m, in, ft, yd, mi, etc... + */ pub scope: String, - pub active_standard_id: String, pub scroll_x: f64, pub scroll_y: f64, pub zoom: f64, - pub active_grid_settings: Option>, - pub active_snap_settings: Option, pub is_binding_enabled: bool, + /** Current item is usually a quick access state to apply as default to certain things when drawing */ pub current_item_stroke: Option, pub current_item_background: Option, pub current_item_opacity: f32, @@ -1186,393 +1336,46 @@ pub struct DucLocalState { pub current_item_start_line_head: Option, pub current_item_end_line_head: Option, pub current_item_roundness: f64, + /** Pen mode is enabled, creates a better experience for drawing with a pen */ pub pen_mode: bool, + /** In view mode the user is not allowed to edit the canvas. */ pub view_mode_enabled: bool, + /** Object snapping on the environment is enabled */ pub objects_snap_mode_enabled: bool, + /** Available grids are visible */ pub grid_mode_enabled: bool, + /** Whether to disable the fill on all shapes */ pub outline_mode_enabled: bool, + /** + * When enabled, the version graph is not updated automatically. + * The user needs to manually update the graph for new versions to be saved in version control. + */ pub manual_save_mode: bool, + pub decimal_places: i32, } -#[derive(Debug, Clone, PartialEq)] -pub struct DucGroup { - pub id: String, - pub stack_base: DucStackBase, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucRegion { - pub id: String, - pub stack_base: DucStackBase, - pub boolean_operation: BOOLEAN_OPERATION, -} - -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucLayerOverrides { pub stroke: ElementStroke, pub background: ElementBackground, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucLayer { pub id: String, + #[serde(flatten)] pub stack_base: DucStackBase, pub readonly: bool, + /** A container for the default styling properties that elements on this layer will inherit */ pub overrides: Option, } -// =============== STANDARDS & SETTINGS =============== - -#[derive(Debug, Clone, PartialEq)] -pub struct UnitSystemBase { - pub system: UNIT_SYSTEM, - pub format: Option, - pub precision: i32, - pub suppress_leading_zeros: bool, - pub suppress_trailing_zeros: bool, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct LinearUnitSystem { - pub base: UnitSystemBase, - pub format: DIMENSION_UNITS_FORMAT, - pub decimal_separator: DECIMAL_SEPARATOR, - pub suppress_zero_feet: bool, - pub suppress_zero_inches: bool, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct AngularUnitSystem { - pub base: UnitSystemBase, - pub format: ANGULAR_UNITS_FORMAT, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct AlternateUnits { - pub base: UnitSystemBase, - pub format: DIMENSION_UNITS_FORMAT, - pub is_visible: bool, - pub multiplier: f32, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct PrimaryUnits { - pub linear: LinearUnitSystem, - pub angular: AngularUnitSystem, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct StandardUnits { - pub primary_units: PrimaryUnits, - pub alternate_units: AlternateUnits, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct UnitPrecision { - pub linear: Option, - pub angular: Option, - pub area: Option, - pub volume: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct StandardOverrides { - pub main_scope: Option, - pub elements_stroke_width_override: Option, - pub common_style_id: Option, - pub stack_like_style_id: Option, - pub text_style_id: Option, - pub dimension_style_id: Option, - pub leader_style_id: Option, - pub feature_control_frame_style_id: Option, - pub table_style_id: Option, - pub doc_style_id: Option, - pub viewport_style_id: Option, - pub plot_style_id: Option, - pub hatch_style_id: Option, - pub active_grid_settings_id: Option>, - pub active_snap_settings_id: Option, - pub dash_line_override: Option, - pub unit_precision: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DucCommonStyle { - pub background: ElementBackground, - pub stroke: ElementStroke, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedCommonStyle { - pub id: Identifier, - pub style: DucCommonStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedStackLikeStyle { - pub id: Identifier, - pub style: DucStackLikeStyles, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedTextStyle { - pub id: Identifier, - pub style: DucTextStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedDimensionStyle { - pub id: Identifier, - pub style: DucDimensionStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedLeaderStyle { - pub id: Identifier, - pub style: DucLeaderStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedFCFStyle { - pub id: Identifier, - pub style: DucFeatureControlFrameStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedTableStyle { - pub id: Identifier, - pub style: DucTableStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedDocStyle { - pub id: Identifier, - pub style: DucDocStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedViewportStyle { - pub id: Identifier, - pub style: DucViewportStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedHatchStyle { - pub id: Identifier, - pub style: DucHatchStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedXRayStyle { - pub id: Identifier, - pub style: DucXRayStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct StandardStyles { - pub common_styles: Vec, - pub stack_like_styles: Vec, - pub text_styles: Vec, - pub dimension_styles: Vec, - pub leader_styles: Vec, - pub feature_control_frame_styles: Vec, - pub table_styles: Vec, - pub doc_styles: Vec, - pub viewport_styles: Vec, - pub hatch_styles: Vec, - pub xray_styles: Vec, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct GridStyle { - pub color: String, - pub opacity: f64, - pub dash_pattern: Vec, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct PolarGridSettings { - pub radial_divisions: i32, - pub radial_spacing: f64, - pub show_labels: bool, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IsometricGridSettings { - pub left_angle: f64, - pub right_angle: f64, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct GridSettings { - pub grid_type: GRID_TYPE, - pub readonly: bool, - pub display_type: GRID_DISPLAY_TYPE, - pub is_adaptive: bool, - pub x_spacing: f64, - pub y_spacing: f64, - pub subdivisions: i32, - pub origin: GeometricPoint, - pub rotation: f64, - pub follow_ucs: bool, - pub major_style: GridStyle, - pub minor_style: GridStyle, - pub show_minor: bool, - pub min_zoom: f64, - pub max_zoom: f64, - pub auto_hide: bool, - pub polar_settings: Option, - pub isometric_settings: Option, - pub enable_snapping: bool, - pub construction_snap_enabled: bool, - pub snap_to_grid_intersections: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct SnapOverride { - pub key: String, - pub behavior: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DynamicSnapSettings { - pub enabled_during_drag: bool, - pub enabled_during_rotation: bool, - pub enabled_during_scale: bool, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct PolarTrackingSettings { - pub enabled: bool, - pub angles: Vec, - pub increment_angle: Option, - pub track_from_last_point: bool, - pub show_polar_coordinates: bool, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct TrackingLineStyle { - pub color: String, - pub opacity: f64, - pub dash_pattern: Option>, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct LayerSnapFilters { - pub include_layers: Option>, - pub exclude_layers: Option>, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct SnapMarkerStyle { - pub shape: SNAP_MARKER_SHAPE, - pub color: String, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct SnapMarkerStyleEntry { - pub key: OBJECT_SNAP_MODE, - pub value: SnapMarkerStyle, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct SnapMarkerSettings { - pub enabled: bool, - pub size: i32, - pub duration: Option, - pub styles: Vec, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct SnapSettings { - pub readonly: bool, - pub twist_angle: f64, - pub snap_tolerance: i32, - pub object_snap_aperture: i32, - pub is_ortho_mode_on: bool, - pub polar_tracking: PolarTrackingSettings, - pub is_object_snap_on: bool, - pub active_object_snap_modes: Vec, - pub snap_priority: Vec, - pub show_tracking_lines: bool, - pub tracking_line_style: Option, - pub dynamic_snap: DynamicSnapSettings, - pub temporary_overrides: Option>, - pub incremental_distance: Option, - pub magnetic_strength: Option, - pub layer_snap_filters: Option, - pub element_type_filters: Option>, - pub snap_mode: SNAP_MODE, - pub snap_markers: SnapMarkerSettings, - pub construction_snap_enabled: bool, - pub snap_to_grid_intersections: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedGridSettings { - pub id: Identifier, - pub settings: GridSettings, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedSnapSettings { - pub id: Identifier, - pub settings: SnapSettings, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedUcs { - pub id: Identifier, - pub ucs: DucUcs, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct IdentifiedView { - pub id: Identifier, - pub view: DucView, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct StandardViewSettings { - pub views: Vec, - pub ucs: Vec, - pub grid_settings: Vec, - pub snap_settings: Vec, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct DimensionValidationRules { - pub min_text_height: Option, - pub max_text_height: Option, - pub allowed_precisions: Vec, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct LayerValidationRules { - pub prohibited_layer_names: Option>, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct StandardValidation { - pub dimension_rules: Option, - pub layer_rules: Option, -} - -#[derive(Debug, Clone, PartialEq)] -pub struct Standard { - pub identifier: Identifier, - pub version: String, - pub readonly: bool, - pub overrides: Option, - pub styles: Option, - pub view_settings: Option, - pub units: Option, - pub validation: Option, -} - // =============== VERSION CONTROL =============== -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct VersionBase { pub id: String, pub parent_id: Option, @@ -1582,55 +1385,113 @@ pub struct VersionBase { pub user_id: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct Checkpoint { + #[serde(flatten)] pub base: VersionBase, + pub version_number: i64, + pub schema_version: i32, + pub is_schema_boundary: bool, + #[serde(with = "serde_bytes")] pub data: Vec, pub size_bytes: i64, } #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] -pub struct JSONPatchOperation { - pub op: String, - pub path: String, - pub from: Option, - pub value: Option, -} - -#[derive(Debug, Clone, PartialEq)] +#[serde(rename_all = "camelCase")] pub struct Delta { + #[serde(flatten)] pub base: VersionBase, - pub patch: Vec, + pub version_number: i64, + pub schema_version: i32, + pub base_checkpoint_id: String, + /** Compressed binary data for the delta (zlib). When present, patch_string is ignored. */ + #[serde(with = "serde_bytes")] + pub payload: Vec, + pub size_bytes: i64, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SchemaMigration { + pub from_schema_version: i32, + pub to_schema_version: i32, + pub migration_name: String, + pub migration_checksum: Option, + pub applied_at: i64, + pub boundary_checkpoint_id: Option, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct VersionChain { + pub id: String, + pub schema_version: i32, + pub start_version: i64, + pub end_version: Option, + pub migration: Option, + pub root_checkpoint_id: Option, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct VersionGraphMetadata { + pub current_version: i64, + pub current_schema_version: i32, + pub chain_count: i32, pub last_pruned: i64, pub total_size: i64, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct VersionGraph { + /** The ID of the user-designated checkpoint version. */ pub user_checkpoint_version_id: String, + /** The ID of the latest version in the graph. */ pub latest_version_id: String, + pub chains: Vec, + /** An array of all checkpoint versions. */ pub checkpoints: Vec, + /** An array of all delta versions (patches). */ pub deltas: Vec, pub metadata: VersionGraphMetadata, } // =============== EXTERNAL FILES =============== -#[derive(Debug, Clone, PartialEq)] +/// Lightweight metadata for an external file (no data blob). +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ExternalFileMetadata { + pub id: String, + pub mime_type: String, + pub created: i64, + pub last_retrieved: Option, + pub version: Option, +} + +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucExternalFileData { pub mime_type: String, pub id: String, + /** The actual file content bytes. */ + #[serde(with = "serde_bytes")] pub data: Vec, + /** Epoch timestamp in milliseconds when the file was created. */ pub created: i64, + /** + * Epoch timestamp in milliseconds when the file was last retrieved from storage to be loaded onto the scene. + * Used to determine whether to delete unused files from storage. + */ pub last_retrieved: Option, pub version: Option, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct DucExternalFileEntry { pub key: String, pub value: DucExternalFileData, @@ -1638,13 +1499,19 @@ pub struct DucExternalFileEntry { // =============== ROOT TYPE =============== -#[derive(Debug, Clone, PartialEq)] +/** Root data structure for the stored data state */ +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] pub struct ExportedDataState { - pub data_type: String, - pub source: String, + /** Actual file id */ + pub id: Option, pub version: String, + pub source: String, + #[serde(rename = "type")] + pub data_type: String, + pub dictionary: Option>, + #[serde(with = "serde_bytes", default, skip_serializing_if = "Option::is_none")] pub thumbnail: Option>, - pub dictionary: Option>, pub elements: Vec, pub blocks: Vec, pub block_instances: Vec, @@ -1652,10 +1519,14 @@ pub struct ExportedDataState { pub groups: Vec, pub regions: Vec, pub layers: Vec, - pub standards: Vec, + /** The user's current session state for a specific project */ + #[serde(rename = "localState")] pub duc_local_state: Option, + /** Project-wide settings that are saved with the document and shared by all users */ + #[serde(rename = "globalState")] pub duc_global_state: Option, - pub external_files: Option>, + /** In case it is needed to embed the version control into the file format */ pub version_graph: Option, - pub id: Option, + #[serde(rename = "files")] + pub external_files: Option>, } diff --git a/packages/ducrs/src/units.rs b/packages/ducrs/src/units.rs deleted file mode 100644 index 243d283c..00000000 --- a/packages/ducrs/src/units.rs +++ /dev/null @@ -1,372 +0,0 @@ -use std::collections::HashMap; -use std::fmt; - -// Assuming you have a UNIT_SYSTEM type from your flatbuffers -// You'll need to adjust this based on your actual flatbuffers implementation -#[derive(Debug, Clone, Copy, PartialEq)] -pub enum UnitSystem { - Metric, - Imperial, -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub enum ZoomDirection { - Up, - Down, - Neutral, -} - -// Constants -pub const MIN_ZOOM: f64 = 1e-32; -pub const MAX_ZOOM: f64 = 1e32; -pub const NEUTRAL_SCOPE: SupportedMeasures = SupportedMeasures::Metric(MetricMeasure::M); - -// Metric measures enum -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum MetricMeasure { - Qm, // Quectometer - Rm, // Rontometer - Ym, // Yoctometer - Zm, // Zeptometer - Am, // Attometer - Fm, // Femtometer - Pm, // Picometer - A, // Angstrom - Nm, // Nanometer - Um, // Micrometer (using Um instead of µm for simplicity) - Mm, // Millimeter - Cm, // Centimeter - Dm, // Decimeter - M, // Meter - Dam, // Decameter - Hm, // Hectometer - Km, // Kilometer - MMm, // Megameter (using MMm to avoid confusion with Millimeter) - Gm, // Gigameter - Tm, // Terameter - PPm, // Petameter (using PPm to avoid confusion with Picometer) - Em, // Exameter - ZZm, // Zettameter (using ZZm to avoid confusion with Zeptometer) - YYm, // Yottameter (using YYm to avoid confusion with Yoctometer) - RRm, // Ronnameter (using RRm to avoid confusion with Rontometer) - QQm, // Quettameter (using QQm to avoid confusion with Quectometer) -} - -// Imperial measures enum -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum ImperialMeasure { - Uin, // Microinches - Th, // Thou - Mil, // Mils - Ln, // Line - InUs, // US Survey Inch - In, // Inches - H, // Hand - FtUs, // US Survey Feet - Ft, // Feet - YdUs, // US Survey Yard - Yd, // Yards - Rd, // Rods - Ch, // Chains - Fur, // Furlongs - MiUs, // US Survey Mile - Mi, // Miles - Lea, // Leagues - Au, // Astronomical Unit - Ly, // Light Year - Pc, // Parsec -} - -// Combined measure enum -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum SupportedMeasures { - Metric(MetricMeasure), - Imperial(ImperialMeasure), -} - -impl fmt::Display for MetricMeasure { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - MetricMeasure::Qm => write!(f, "qm"), - MetricMeasure::Rm => write!(f, "rm"), - MetricMeasure::Ym => write!(f, "ym"), - MetricMeasure::Zm => write!(f, "zm"), - MetricMeasure::Am => write!(f, "am"), - MetricMeasure::Fm => write!(f, "fm"), - MetricMeasure::Pm => write!(f, "pm"), - MetricMeasure::A => write!(f, "Å"), - MetricMeasure::Nm => write!(f, "nm"), - MetricMeasure::Um => write!(f, "µm"), - MetricMeasure::Mm => write!(f, "mm"), - MetricMeasure::Cm => write!(f, "cm"), - MetricMeasure::Dm => write!(f, "dm"), - MetricMeasure::M => write!(f, "m"), - MetricMeasure::Dam => write!(f, "dam"), - MetricMeasure::Hm => write!(f, "hm"), - MetricMeasure::Km => write!(f, "km"), - MetricMeasure::MMm => write!(f, "Mm"), - MetricMeasure::Gm => write!(f, "Gm"), - MetricMeasure::Tm => write!(f, "Tm"), - MetricMeasure::PPm => write!(f, "Pm"), - MetricMeasure::Em => write!(f, "Em"), - MetricMeasure::ZZm => write!(f, "Zm"), - MetricMeasure::YYm => write!(f, "Ym"), - MetricMeasure::RRm => write!(f, "Rm"), - MetricMeasure::QQm => write!(f, "Qm"), - } - } -} - -impl fmt::Display for ImperialMeasure { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - ImperialMeasure::Uin => write!(f, "µin"), - ImperialMeasure::Th => write!(f, "th"), - ImperialMeasure::Mil => write!(f, "mil"), - ImperialMeasure::Ln => write!(f, "ln"), - ImperialMeasure::InUs => write!(f, "in-us"), - ImperialMeasure::In => write!(f, "in"), - ImperialMeasure::H => write!(f, "h"), - ImperialMeasure::FtUs => write!(f, "ft-us"), - ImperialMeasure::Ft => write!(f, "ft"), - ImperialMeasure::YdUs => write!(f, "yd-us"), - ImperialMeasure::Yd => write!(f, "yd"), - ImperialMeasure::Rd => write!(f, "rd"), - ImperialMeasure::Ch => write!(f, "ch"), - ImperialMeasure::Fur => write!(f, "fur"), - ImperialMeasure::MiUs => write!(f, "mi-us"), - ImperialMeasure::Mi => write!(f, "mi"), - ImperialMeasure::Lea => write!(f, "lea"), - ImperialMeasure::Au => write!(f, "au"), - ImperialMeasure::Ly => write!(f, "ly"), - ImperialMeasure::Pc => write!(f, "pc"), - } - } -} - -impl fmt::Display for SupportedMeasures { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - SupportedMeasures::Metric(m) => write!(f, "{}", m), - SupportedMeasures::Imperial(i) => write!(f, "{}", i), - } - } -} - -// Create scale factors HashMap -lazy_static::lazy_static! { - pub static ref SCALE_FACTORS: HashMap = { - let mut m = HashMap::new(); - - // Metric scales - m.insert(SupportedMeasures::Metric(MetricMeasure::Qm), 1e-30); - m.insert(SupportedMeasures::Metric(MetricMeasure::Rm), 1e-27); - m.insert(SupportedMeasures::Metric(MetricMeasure::Ym), 1e-24); - m.insert(SupportedMeasures::Metric(MetricMeasure::Zm), 1e-21); - m.insert(SupportedMeasures::Metric(MetricMeasure::Am), 1e-18); - m.insert(SupportedMeasures::Metric(MetricMeasure::Fm), 1e-15); - m.insert(SupportedMeasures::Metric(MetricMeasure::Pm), 1e-12); - m.insert(SupportedMeasures::Metric(MetricMeasure::A), 1e-10); - m.insert(SupportedMeasures::Metric(MetricMeasure::Nm), 1e-9); - m.insert(SupportedMeasures::Metric(MetricMeasure::Um), 1e-6); - m.insert(SupportedMeasures::Metric(MetricMeasure::Mm), 1e-3); - m.insert(SupportedMeasures::Metric(MetricMeasure::Cm), 1e-2); - m.insert(SupportedMeasures::Metric(MetricMeasure::Dm), 1e-1); - m.insert(SupportedMeasures::Metric(MetricMeasure::M), 1.0); - m.insert(SupportedMeasures::Metric(MetricMeasure::Dam), 1e1); - m.insert(SupportedMeasures::Metric(MetricMeasure::Hm), 1e2); - m.insert(SupportedMeasures::Metric(MetricMeasure::Km), 1e3); - m.insert(SupportedMeasures::Metric(MetricMeasure::MMm), 1e6); - m.insert(SupportedMeasures::Metric(MetricMeasure::Gm), 1e9); - m.insert(SupportedMeasures::Metric(MetricMeasure::Tm), 1e12); - m.insert(SupportedMeasures::Metric(MetricMeasure::PPm), 1e15); - m.insert(SupportedMeasures::Metric(MetricMeasure::Em), 1e18); - m.insert(SupportedMeasures::Metric(MetricMeasure::ZZm), 1e21); - m.insert(SupportedMeasures::Metric(MetricMeasure::YYm), 1e24); - m.insert(SupportedMeasures::Metric(MetricMeasure::RRm), 1e27); - m.insert(SupportedMeasures::Metric(MetricMeasure::QQm), 1e30); - - // Imperial scales - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Uin), 2.54e-8); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Th), 0.0000254); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Mil), 0.0000254); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Ln), 0.00211667); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::InUs), 0.0254000508); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::In), 0.0254); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::H), 0.1016); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::FtUs), 0.3048006096); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Ft), 0.3048); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::YdUs), 0.9144018288); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Yd), 0.9144); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Rd), 5.0292); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Ch), 20.1168); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Fur), 201.168); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::MiUs), 1609.34721869); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Mi), 1609.344); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Lea), 4828.032); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Au), 149597870700.0); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Ly), 9460730472580800.0); - m.insert(SupportedMeasures::Imperial(ImperialMeasure::Pc), 30856775814913670.0); - - m - }; -} - -/// Get translation factor between two measures (unit scopes). -/// Calculates the multiplicative factor needed to convert a value from `from_measure` to `to_measure`. -pub fn get_translation_factor( - from_measure: SupportedMeasures, - to_measure: SupportedMeasures, -) -> Result { - let from_factor = SCALE_FACTORS - .get(&from_measure) - .ok_or_else(|| format!("Unknown measure: {}", from_measure))?; - - let to_factor = SCALE_FACTORS - .get(&to_measure) - .ok_or_else(|| format!("Unknown measure: {}", to_measure))?; - - // Handle potential division by zero - if *to_factor == 0.0 { - return Err(format!( - "Attempted to divide by zero scale factor for unit: {}", - to_measure - )); - } - - Ok(from_factor / to_factor) -} - -/// Parse a unit string into a SupportedMeasures enum -pub fn parse_unit_string(unit: &str) -> Result { - match unit { - // Metric units - "qm" => Ok(SupportedMeasures::Metric(MetricMeasure::Qm)), - "rm" => Ok(SupportedMeasures::Metric(MetricMeasure::Rm)), - "ym" => Ok(SupportedMeasures::Metric(MetricMeasure::Ym)), - "zm" => Ok(SupportedMeasures::Metric(MetricMeasure::Zm)), - "am" => Ok(SupportedMeasures::Metric(MetricMeasure::Am)), - "fm" => Ok(SupportedMeasures::Metric(MetricMeasure::Fm)), - "pm" => Ok(SupportedMeasures::Metric(MetricMeasure::Pm)), - "Å" => Ok(SupportedMeasures::Metric(MetricMeasure::A)), - "nm" => Ok(SupportedMeasures::Metric(MetricMeasure::Nm)), - "µm" | "um" => Ok(SupportedMeasures::Metric(MetricMeasure::Um)), - "mm" => Ok(SupportedMeasures::Metric(MetricMeasure::Mm)), - "cm" => Ok(SupportedMeasures::Metric(MetricMeasure::Cm)), - "dm" => Ok(SupportedMeasures::Metric(MetricMeasure::Dm)), - "m" => Ok(SupportedMeasures::Metric(MetricMeasure::M)), - "dam" => Ok(SupportedMeasures::Metric(MetricMeasure::Dam)), - "hm" => Ok(SupportedMeasures::Metric(MetricMeasure::Hm)), - "km" => Ok(SupportedMeasures::Metric(MetricMeasure::Km)), - "Mm" => Ok(SupportedMeasures::Metric(MetricMeasure::MMm)), - "Gm" => Ok(SupportedMeasures::Metric(MetricMeasure::Gm)), - "Tm" => Ok(SupportedMeasures::Metric(MetricMeasure::Tm)), - "Pm" => Ok(SupportedMeasures::Metric(MetricMeasure::PPm)), - "Em" => Ok(SupportedMeasures::Metric(MetricMeasure::Em)), - "Zm" => Ok(SupportedMeasures::Metric(MetricMeasure::ZZm)), - "Ym" => Ok(SupportedMeasures::Metric(MetricMeasure::YYm)), - "Rm" => Ok(SupportedMeasures::Metric(MetricMeasure::RRm)), - "Qm" => Ok(SupportedMeasures::Metric(MetricMeasure::QQm)), - - // Imperial units - "µin" | "uin" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Uin)), - "th" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Th)), - "mil" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Mil)), - "ln" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Ln)), - "in-us" => Ok(SupportedMeasures::Imperial(ImperialMeasure::InUs)), - "in" => Ok(SupportedMeasures::Imperial(ImperialMeasure::In)), - "h" => Ok(SupportedMeasures::Imperial(ImperialMeasure::H)), - "ft-us" => Ok(SupportedMeasures::Imperial(ImperialMeasure::FtUs)), - "ft" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Ft)), - "yd-us" => Ok(SupportedMeasures::Imperial(ImperialMeasure::YdUs)), - "yd" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Yd)), - "rd" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Rd)), - "ch" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Ch)), - "fur" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Fur)), - "mi-us" => Ok(SupportedMeasures::Imperial(ImperialMeasure::MiUs)), - "mi" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Mi)), - "lea" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Lea)), - "au" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Au)), - "ly" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Ly)), - "pc" => Ok(SupportedMeasures::Imperial(ImperialMeasure::Pc)), - - _ => Err(format!("Unknown unit: {}", unit)), - } -} - -// Arrays for iteration if needed -pub const METRIC_MEASURES: [MetricMeasure; 26] = [ - MetricMeasure::Qm, - MetricMeasure::Rm, - MetricMeasure::Ym, - MetricMeasure::Zm, - MetricMeasure::Am, - MetricMeasure::Fm, - MetricMeasure::Pm, - MetricMeasure::A, - MetricMeasure::Nm, - MetricMeasure::Um, - MetricMeasure::Mm, - MetricMeasure::Cm, - MetricMeasure::Dm, - MetricMeasure::M, - MetricMeasure::Dam, - MetricMeasure::Hm, - MetricMeasure::Km, - MetricMeasure::MMm, - MetricMeasure::Gm, - MetricMeasure::Tm, - MetricMeasure::PPm, - MetricMeasure::Em, - MetricMeasure::ZZm, - MetricMeasure::YYm, - MetricMeasure::RRm, - MetricMeasure::QQm, -]; - -pub const IMPERIAL_MEASURES: [ImperialMeasure; 20] = [ - ImperialMeasure::Uin, - ImperialMeasure::Th, - ImperialMeasure::Mil, - ImperialMeasure::Ln, - ImperialMeasure::InUs, - ImperialMeasure::In, - ImperialMeasure::H, - ImperialMeasure::FtUs, - ImperialMeasure::Ft, - ImperialMeasure::YdUs, - ImperialMeasure::Yd, - ImperialMeasure::Rd, - ImperialMeasure::Ch, - ImperialMeasure::Fur, - ImperialMeasure::MiUs, - ImperialMeasure::Mi, - ImperialMeasure::Lea, - ImperialMeasure::Au, - ImperialMeasure::Ly, - ImperialMeasure::Pc, -]; - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_translation_factor() { - // Test meter to kilometer - let result = get_translation_factor( - SupportedMeasures::Metric(MetricMeasure::M), - SupportedMeasures::Metric(MetricMeasure::Km), - ); - assert!(result.is_ok()); - assert!((result.unwrap() - 0.001).abs() < f64::EPSILON); - - // Test inch to foot - let result = get_translation_factor( - SupportedMeasures::Imperial(ImperialMeasure::In), - SupportedMeasures::Imperial(ImperialMeasure::Ft), - ); - assert!(result.is_ok()); - assert!((result.unwrap() - (0.0254 / 0.3048)).abs() < 1e-10); - } -} \ No newline at end of file diff --git a/packages/ducsvg/tests/duc-to-svg.unit.test.ts b/packages/ducsvg/tests/duc-to-svg.unit.test.ts index 32d8927f..9af77ed7 100644 --- a/packages/ducsvg/tests/duc-to-svg.unit.test.ts +++ b/packages/ducsvg/tests/duc-to-svg.unit.test.ts @@ -10,12 +10,6 @@ ensureDir(join(__dirname, OUTPUT_DIR)); describe('ducToSvg Integration Tests', () => { const assets = [ 'blocks_instances.duc', - 'complex_tables.duc', - 'hatching_patterns.duc', - 'mixed_elements.duc', - 'override_capabilities.duc', - 'pdf_image_elements.duc', - 'plot_elements.duc', 'universal.duc', ]; @@ -34,9 +28,9 @@ describe('ducToSvg Integration Tests', () => { expect(page.svg).toBeDefined(); validateSvg(page.svg); - const outName = file.replace(/\.duc$/, `_page_${page.pageIndex}.svg`); + const outName = file.replace(/\.duc$/, `_page_${page.svg.pageIndex}.svg`); saveSvgOutput(`${OUTPUT_DIR}/${outName}`, page.svg); } - }, 30000); // 30 second timeout for PDF processing + }, 60000); // 60 second timeout for PDF/SVG processing } }); \ No newline at end of file diff --git a/schema/duc.fbs b/schema/duc.fbs deleted file mode 100644 index 8c14a77c..00000000 --- a/schema/duc.fbs +++ /dev/null @@ -1,2772 +0,0 @@ -// SCHEMA_VERSION=2.0.0 - -/** - * Official FlatBuffers Compiler: https://flatbuffers.ar.je/ - * Official FlatBuffers Documentation: https://flatbuffers.dev/tutorial/ - * - * To maintain backward compatibility when evolving FlatBuffers schemas, follow these guidelines: - * - * - **Should be fine to rename fields** - * - **Add new fields at the END of tables**: This ensures older code can still read the data without issues. - * - **DONT REMOVE FIELDS**: Instead of deleting unused fields, mark them as deprecated to prevent their use in new code while maintaining compatibility with existing data. - * - **DONT CHANGE FIELD TYPES**: Modifying a field's type can lead to incompatibilities. If necessary, add a new field with the desired type and depreciate the old one. - * - **BE CAREFUL WITH DEFAULT VALUES**: Changing default values can cause inconsistencies when reading older data. It's best to set appropriate defaults initially and avoid altering them. - * - **STRING or TABLE CANNOT FALLBACK TO NULL**: these fields cannot be null. They already have a default null value. - * - **DEFINE JSON FIELDS AS UBYTE ARRAY**: On our architecture of the fbs file, we always store JSON as a zlib compressed binary ([ubyte]) to save space and improve performance.** - */ - -namespace Duc; - -file_identifier "DUC_"; - -/** - * ============================================================================= - * ENUMS - * ============================================================================= - */ - -/** - * Usually we start from the value 10 on enums because on some languages, 0 is treated as false and 1 is treated as true on if statements - */ -enum VERTICAL_ALIGN:ubyte { - /** Aligns text to the top of its bounding box. */ - TOP = 10, - /** Aligns text to the middle of its bounding box. */ - MIDDLE = 11, - /** Aligns text to the bottom of its bounding box. */ - BOTTOM = 12 -} - -enum TEXT_ALIGN:ubyte { - /** Aligns text to the left of its bounding box. */ - LEFT = 10, - /** Centers text horizontally within its bounding box. */ - CENTER = 11, - /** Aligns text to the right of its bounding box. */ - RIGHT = 12 -} - -enum LINE_SPACING_TYPE:ubyte { - /** - * The line spacing is the larger of the `value` or the tallest character's natural height. - * This ensures text doesn't overlap but respects a minimum spacing. - */ - AT_LEAST = 10, - /** - * Forces the line spacing to the specified `value`, even if characters - * (especially tall ones like ascenders/descenders or special symbols) overlap. - * Useful for precise layout control where overlapping might be acceptable or handled externally. - */ - EXACTLY = 11, - /** - * The base line height (often derived from the font's intrinsic metrics and font size) - * is multiplied by the `value` (e.g., a `value` of 1.5 would mean 150% of the base line height). - * This is very common for relative spacing. - */ - MULTIPLE = 12 -} - -enum STACKED_TEXT_ALIGN:ubyte { - /** Aligns stacked text segments to their center. */ - CENTER = 10, - /** Aligns stacked text segments along their decimal points. */ - DECIMAL = 11, - /** Aligns stacked text segments around a slash character. */ - SLASH = 12 -} - -/** Defines the type of source a dynamic part can link to. */ -enum TEXT_FIELD_SOURCE_TYPE:ubyte { - /** Links to a property of another element in the scene. */ - ELEMENT = 10, - /** Links to a value in a global key-value store (a drawing dictionary/variables). */ - DICTIONARY = 20, -} - -enum TEXT_FIELD_SOURCE_PROPERTY:ubyte { - /** Represents the area property of an element. */ - AREA = 10, - /** Represents the perimeter property of an element. */ - PERIMETER = 11, - /** Represents the volume property of an element. */ - VOLUME = 12, - /** Represents the length property of an element. */ - LENGTH = 13, - /** Represents the width property of an element. */ - WIDTH = 14, - /** Represents the height property of an element. */ - HEIGHT = 15, - /** Represents the radius property of an element. */ - RADIUS = 16, - /** Represents the diameter property of an element. */ - DIAMETER = 17, - /** Represents the X coordinate property of an element. */ - X_COORDINATE = 18, - /** Represents the Y coordinate property of an element. */ - Y_COORDINATE = 19, - /** Represents the label property of an element. */ - LABEL = 20, -} - -enum STROKE_PLACEMENT:ubyte { - /** Places the stroke inside the element's boundary. */ - INSIDE = 10, - /** Centers the stroke on the element's boundary. */ - CENTER = 11, - /** Places the stroke outside the element's boundary. */ - OUTSIDE = 12 -} - -enum STROKE_WIDTH:ubyte { - /** A thin stroke width. */ - THIN = 1, - /** A bold stroke width. */ - BOLD = 2, - /** An extra bold stroke width. */ - EXTRA_BOLD = 4 -} - -enum ELEMENT_CONTENT_PREFERENCE:ubyte { - /** Fills the element with a solid color. */ - SOLID = 12, - /** Fills the element with a solid color or gradient (similar to FILL). */ - FILL = 14, - /** Scales the content to fit within the element's bounds, maintaining aspect ratio. */ - FIT = 15, - /** Tiles the content within the element's bounds. */ - TILE = 16, - /** Stretches the content to fill the element's bounds, potentially distorting aspect ratio. */ - STRETCH = 17, - /** Fills the element with a hatch pattern. */ - HATCH = 18 -} - -enum STROKE_PREFERENCE:ubyte { - /** Renders the stroke as a continuous solid line. */ - SOLID = 10, - /** Renders the stroke as a series of dashes. */ - DASHED = 11, - /** Renders the stroke as a series of dots. */ - DOTTED = 12, - /** Renders the stroke using a custom pattern. */ - CUSTOM = 13 -} - -enum STROKE_SIDE_PREFERENCE:ubyte { - /** Applies the stroke to the top side. */ - TOP = 10, - /** Applies the stroke to the bottom side. */ - BOTTOM = 11, - /** Applies the stroke to the left side. */ - LEFT = 12, - /** Applies the stroke to the right side. */ - RIGHT = 13, - /** Applies the stroke to custom-defined sides. */ - CUSTOM = 14, - /** Applies the stroke to all sides. */ - ALL = 15 -} - -enum STROKE_CAP:ubyte { - /** A butt cap cuts off the line at the endpoint. */ - BUTT = 10, - /** A round cap adds a rounded end to the line. */ - ROUND = 11, - /** A square cap adds a square end to the line. */ - SQUARE = 12 -} - -enum STROKE_JOIN:ubyte { - /** A miter join creates a sharp corner. */ - MITER = 10, - /** A round join creates a rounded corner. */ - ROUND = 11, - /** A bevel join creates a flattened corner. */ - BEVEL = 12 -} - -enum LINE_HEAD:ubyte { - /** An arrow-shaped line end. */ - ARROW = 10, - /** A bar-shaped line end. */ - BAR = 11, - /** A circular line end. */ - CIRCLE = 12, - /** An outlined circular line end. */ - CIRCLE_OUTLINED = 13, - /** A triangle-shaped line end. */ - TRIANGLE = 14, - /** An outlined triangle-shaped line end. */ - TRIANGLE_OUTLINED = 15, - /** A diamond-shaped line end. */ - DIAMOND = 16, - /** An outlined diamond-shaped line end. */ - DIAMOND_OUTLINED = 17, - /** A cross-shaped line end. */ - CROSS = 18, - /** An open arrow-shaped line end. */ - OPEN_ARROW = 19, - /** A reversed arrow-shaped line end. */ - REVERSED_ARROW = 20, - /** A reversed triangle-shaped line end. */ - REVERSED_TRIANGLE = 21, - /** A reversed outlined triangle-shaped line end. */ - REVERSED_TRIANGLE_OUTLINED = 22, - /** A cone-shaped line end. */ - CONE = 23, - /** A half-cone shaped line end. */ - HALF_CONE = 24 -} - -enum BEZIER_MIRRORING:ubyte { - /** No mirroring of Bezier handles. */ - NONE = 10, - /** Bezier handles mirror their angle. */ - ANGLE = 11, - /** Bezier handles mirror both their angle and length. */ - ANGLE_LENGTH = 12 -} - -enum HANDLE_TYPE:ubyte { - /** An "in" handle for Bezier curves, controlling the curve as it enters the point. */ - HANDLE_IN = 10, - /** An "out" handle for Bezier curves, controlling the curve as it leaves the point. */ - HANDLE_OUT = 11 -} - -enum YOUTUBE_STATES:byte { - /** The YouTube player is unstarted. */ - UNSTARTED = -1, - /** The YouTube player has ended. */ - ENDED = 0, - /** The YouTube player is currently playing. */ - PLAYING = 1, - /** The YouTube player is paused. */ - PAUSED = 2, - /** The YouTube player is buffering. */ - BUFFERING = 3, - /** The YouTube player is cued. */ - CUED = 5 -} - -enum BLENDING:ubyte { - /** Multiplies the colors of overlapping elements. */ - MULTIPLY = 11, - /** Screens the colors of overlapping elements. */ - SCREEN = 12, - /** Overlays the colors of overlapping elements. */ - OVERLAY = 13, - /** Darkens the colors of overlapping elements. */ - DARKEN = 14, - /** Lightens the colors of overlapping elements. */ - LIGHTEN = 15, - /** Calculates the difference between the colors of overlapping elements. */ - DIFFERENCE = 16, - /** Calculates the exclusion of the colors of overlapping elements. */ - EXCLUSION = 17 -} - -enum GRID_DISPLAY_TYPE:ubyte { - /** Displays the grid as lines. */ - LINES = 10, - /** Displays the grid as dots. */ - DOTS = 11, - /** Displays the grid as crosses. */ - CROSSES = 12, - /** Displays the grid adaptively based on zoom level. */ - ADAPTIVE = 13 -} - -enum GRID_TYPE:ubyte { - /** A rectangular grid. */ - RECTANGULAR = 10, - /** An isometric grid. */ - ISOMETRIC = 11, - /** A polar grid. */ - POLAR = 12, - /** A triangular grid. */ - TRIANGULAR = 13, - /** A custom grid. */ - CUSTOM = 14 -} - -enum OBJECT_SNAP_MODE:ubyte { - NONE, - /** Snaps to the endpoint of a line or arc. */ - ENDPOINT = 10, - /** Snaps to the midpoint of a line or arc. */ - MIDPOINT = 11, - /** Snaps to the center of a circle, arc, or ellipse. */ - CENTER = 12, - /** Snaps to quadrant points of circles, arcs, or ellipses. */ - QUADRANT = 13, - /** Snaps to the intersection of two objects. */ - INTERSECTION = 14, - /** Snaps to an imaginary extension line of an object. */ - EXTENSION = 15, - /** Snaps to a point perpendicular to another object. */ - PERPENDICULAR = 16, - /** Snaps to a tangent point on a circle or arc. */ - TANGENT = 17, - /** Snaps to the nearest point on an object. */ - NEAREST = 18, - /** Snaps to a point object (node). */ - NODE = 19, - /** Snaps to the insertion point of a block or text. */ - INSERT = 20, - /** Snaps to a point parallel to another object. */ - PARALLEL = 21, - /** Snaps to the apparent intersection of two objects that do not actually intersect in 3D space. */ - APPARENT = 22, - /** Snaps from a reference point. */ - FROM = 23, - /** Filters snap points by X, Y, or Z coordinates. */ - POINT_FILTER = 24, - /** Snaps to a temporary tracking point. */ - TEMPORARY = 25, - /** Snaps to a point midway between two selected points. */ - BETWEEN_TWO_POINTS = 26, - /** Snaps to a point directly on a curve. */ - POINT_ON_CURVE = 27, - /** Snaps to the geometric center of an object. */ - GEOMETRIC = 28 -} - -enum SNAP_MODE:ubyte { - /** Running object snap, continuously active. */ - RUNNING = 10, - /** Single object snap, active for one selection only. */ - SINGLE = 11 -} - -enum SNAP_OVERRIDE_BEHAVIOR:ubyte { - /** Disables all snapping. */ - DISABLE = 10, - /** Forces snapping to the grid. */ - FORCE_GRID = 11, - /** Forces snapping to objects. */ - FORCE_OBJECT = 12 -} - -enum SNAP_MARKER_SHAPE:ubyte { - /** Displays the snap marker as a square. */ - SQUARE = 10, - /** Displays the snap marker as a circle. */ - CIRCLE = 11, - /** Displays the snap marker as a triangle. */ - TRIANGLE = 12, - /** Displays the snap marker as an 'X'. */ - X = 13 -} - -enum TABLE_CELL_ALIGNMENT:ubyte { - /** Aligns content to the top-left of the cell. */ - TOP_LEFT = 10, - /** Aligns content to the top-center of the cell. */ - TOP_CENTER = 11, - /** Aligns content to the top-right of the cell. */ - TOP_RIGHT = 12, - /** Aligns content to the middle-left of the cell. */ - MIDDLE_LEFT = 13, - /** Aligns content to the middle-center of the cell. */ - MIDDLE_CENTER = 14, - /** Aligns content to the middle-right of the cell. */ - MIDDLE_RIGHT = 15, - /** Aligns content to the bottom-left of the cell. */ - BOTTOM_LEFT = 16, - /** Aligns content to the bottom-center of the cell. */ - BOTTOM_CENTER = 17, - /** Aligns content to the bottom-right of the cell. */ - BOTTOM_RIGHT = 18 -} - -enum TABLE_FLOW_DIRECTION:ubyte { - /** New rows are added downwards. */ - DOWN = 10, - /** New rows are added upwards. */ - UP = 11 -} - -enum TOLERANCE_DISPLAY:ubyte { - /** No tolerance displayed. */ - NONE = 10, - /** Displays symmetrical tolerance (e.g., ±0.05). */ - SYMMETRICAL = 11, - /** Displays deviation tolerance (e.g., +0.1/-0.05). */ - DEVIATION = 12, - /** Displays upper and lower limits directly. */ - LIMITS = 13, - /** Displays a basic, boxed dimension. */ - BASIC = 14 -} - -enum DIMENSION_TYPE:ubyte { - /** A horizontal or vertical linear dimension. */ - LINEAR = 10, - /** A linear dimension aligned with two points. */ - ALIGNED = 11, - /** An angular dimension. */ - ANGULAR = 12, - /** Measures the length of an arc. */ - ARC_LENGTH = 13, - /** A radial dimension for circles or arcs. */ - RADIUS = 14, - /** A diameter dimension for circles or arcs. */ - DIAMETER = 15, - /** A center mark for circles or arcs. */ - CENTER_MARK = 16, - /** A linear dimension rotated at a specific angle. */ - ROTATED = 17, - /** Measures spacing between objects. */ - SPACING = 18, - /** Continues a dimension from a previous linear dimension. */ - CONTINUE = 19, - /** Creates dimensions from a common baseline. */ - BASELINE = 20, - /** A linear dimension with a jogged dimension line. */ - JOGGED_LINEAR = 21, - /** An ordinate dimension (measures X or Y coordinate from an origin). */ - ORDINATE = 22 -} - -enum MARK_ELLIPSE_CENTER:ubyte { - /** Marks the center with a cross. */ - MARK = 10, - /** Marks the center with intersecting lines. */ - LINE = 11 -} - -enum TEXT_FLOW_DIRECTION:ubyte { - /** Text flows from left to right. */ - LEFT_TO_RIGHT = 10, - /** Text flows from right to left. */ - RIGHT_TO_LEFT = 11, - /** Text flows from top to bottom. */ - TOP_TO_BOTTOM = 12, - /** Text flows from bottom to top. */ - BOTTOM_TO_TOP = 13 -} - -enum COLUMN_TYPE:ubyte { - /** No columns, single column layout. */ - NO_COLUMNS = 10, - /** Fixed number of columns with defined widths. */ - STATIC_COLUMNS = 11, - /** Text flows automatically between columns based on height. */ - DYNAMIC_COLUMNS = 12 -} - -enum GDT_SYMBOL:ubyte { - /** Geometric characteristic symbol for straightness. "⏤" */ - STRAIGHTNESS = 10, - /** Geometric characteristic symbol for flatness. "⏥" */ - FLATNESS = 11, - /** Geometric characteristic symbol for circularity. "○" */ - CIRCULARITY = 12, - /** Geometric characteristic symbol for cylindricity. "⌭" */ - CYLINDRICITY = 13, - - /** Geometric characteristic symbol for perpendicularity. "⊥" */ - PERPENDICULARITY = 14, - /** Geometric characteristic symbol for angularity. "∠" */ - ANGULARITY = 15, - /** Geometric characteristic symbol for parallelism. "∥" */ - PARALLELISM = 16, - - /** Geometric characteristic symbol for position. "⌖" */ - POSITION = 17, - /** Geometric characteristic symbol for true position (alternative name for POSITION). "⌖" */ - TRUE_POSITION = 18, - /** Geometric characteristic symbol for concentricity. "◎" */ - CONCENTRICITY = 19, - /** Geometric characteristic symbol for coaxiality. "◯" */ - COAXIALITY = 20, - /** Geometric characteristic symbol for symmetry. "⌯" */ - SYMMETRY = 21, - - /** Geometric characteristic symbol for circular runout. "↗" */ - CIRCULAR_RUNOUT = 22, - /** Geometric characteristic symbol for total runout. "↗↗" */ - TOTAL_RUNOUT = 23, - - /** Geometric characteristic symbol for profile of a line. "⌒" */ - PROFILE_OF_LINE = 24, - /** Geometric characteristic symbol for profile of a surface. "⌓" */ - PROFILE_OF_SURFACE = 25, - - /** Geometric characteristic symbol for statistical tolerance. "◊" */ - STATISTICAL = 26, - /** Geometric characteristic symbol for all around. "⭕" */ - ALL_AROUND = 27, - /** Geometric characteristic symbol for all over. "🔄" */ - ALL_OVER = 28, - /** Geometric characteristic symbol for between. "↔" */ - BETWEEN = 29 -} - -enum MATERIAL_CONDITION:ubyte { - /** Maximum Material Condition (MMC). "Ⓜ" */ - MAXIMUM = 10, - /** Least Material Condition (LMC). "Ⓛ" */ - LEAST = 11, - /** Regardless of Feature Size (RFS). "Ⓢ" */ - REGARDLESS = 12 -} - -enum FEATURE_MODIFIER:ubyte { - NONE, - /** Free State modifier. "Ⓕ" */ - FREE_STATE = 10, - /** Tangent Plane modifier. "Ⓣ" */ - TANGENT_PLANE = 11, - /** Projected Tolerance Zone modifier. "Ⓟ" */ - PROJECTED_TOLERANCE_ZONE = 12, - /** Diameter symbol. "⌀" */ - DIAMETER = 13, - /** Spherical diameter symbol. "S⌀" */ - SPHERICAL_DIAMETER = 14, - /** Radius symbol. "R" */ - RADIUS = 15, - /** Spherical radius symbol. "SR" */ - SPHERICAL_RADIUS = 16, - /** Controlled Radius symbol. "CR" */ - CONTROLLED_RADIUS = 17, - /** Square symbol. "□" */ - SQUARE = 18, - /** Translation modifier for position. "⧗" */ - TRANSLATION = 19, - /** All Around modifier. "⭕" */ - ALL_AROUND = 20, - /** All Over modifier. "🔄" */ - ALL_OVER = 21, - /** Statistical modifier. "◊" */ - STATISTICAL = 22, - /** Continuous Feature modifier. "CF" */ - CONTINUOUS_FEATURE = 23, - /** Unequally Disposed Tolerance modifier. "UEQ" */ - UNEQUALLY_DISPOSED = 24 -} - -enum TOLERANCE_ZONE_TYPE:ubyte { - /** Cylindrical tolerance zone. */ - CYLINDRICAL = 10, - /** Spherical tolerance zone. */ - SPHERICAL = 11, - /** Rectangular tolerance zone. */ - RECTANGULAR = 12, - /** Linear tolerance zone. */ - LINEAR = 13, - /** Circular tolerance zone. */ - CIRCULAR = 14 -} - -enum DATUM_TARGET_TYPE:ubyte { - /** Datum target is a point. */ - POINT = 10, - /** Datum target is a line. */ - LINE = 11, - /** Datum target is an area. */ - AREA = 12, - /** Datum target is movable. */ - MOVABLE = 13 -} - -enum TOLERANCE_TYPE:ubyte { - /** Single tolerance specification. */ - SINGLE = 10, - /** Composite tolerance (multiple rows, related). */ - COMPOSITE = 11, - /** Multiple single-segment tolerances (independent). */ - MULTIPLE = 12 -} - -enum DATUM_BRACKET_STYLE:ubyte { - /** Square bracket style for datum references. */ - SQUARE = 10, - /** Round bracket style for datum references. */ - ROUND = 11, - /** No bracket style for datum references. */ - NONE = 12 -} - -enum DIMENSION_UNITS_FORMAT:ubyte { - /** Decimal format for dimension units. */ - DECIMAL = 10, - /** Engineering format (feet and decimal inches). */ - ENGINEERING = 11, - /** Architectural format (feet and fractional inches). */ - ARCHITECTURAL = 12, - /** Fractional inches format. */ - FRACTIONAL = 13, - /** Scientific format. */ - SCIENTIFIC = 14 -} - -enum DIMENSION_FIT_RULE:ubyte { - /** Moves text and arrows outside if they don't fit. */ - TEXT_AND_ARROWS = 10, - /** Moves arrows only outside if they don't fit. */ - ARROWS_ONLY = 11, - /** Moves text only outside if it doesn't fit. */ - TEXT_ONLY = 12, - /** Automatically determines best fit for text and arrows. */ - BEST_FIT = 13 -} - -enum DIMENSION_TEXT_PLACEMENT:ubyte { - /** Places text beside the dimension line. */ - BESIDE_LINE = 10, - /** Places text over the dimension line. */ - OVER_LINE = 11, - /** Places text over the dimension line with a leader. */ - OVER_LINE_WITH_LEADER = 12 -} - -enum ANGULAR_UNITS_FORMAT:ubyte { - /** Angular units in decimal degrees. */ - DECIMAL_DEGREES = 10, - /** Angular units in degrees, minutes, and seconds. */ - DEGREES_MINUTES_SECONDS = 11, - /** Angular units in grads. */ - GRADS = 12, - /** Angular units in radians. */ - RADIANS = 13, - /** Angular units in surveyor's units. */ - SURVEYOR = 14 -} - -enum UNIT_SYSTEM:ubyte { - /** Metric unit system. */ - METRIC = 10, - /** Imperial unit system. */ - IMPERIAL = 11 -} - -enum DECIMAL_SEPARATOR:ubyte { - /** Uses a dot as the decimal separator. "." */ - DOT = 10, - /** Uses a comma as the decimal separator. "," */ - COMMA = 11 -} - -enum VIEWPORT_SHADE_PLOT:ubyte { - /** Plots the viewport as displayed on screen. */ - AS_DISPLAYED = 10, - /** Plots the viewport in wireframe mode. */ - WIREFRAME = 11, - /** Plots the viewport with hidden lines removed. */ - HIDDEN = 12, - /** Plots the viewport as a rendered image. */ - RENDERED = 13 -} - -enum HATCH_STYLE:ubyte { - /** Normal hatch, fills closed boundaries. */ - NORMAL = 10, - /** Outermost boundary only, ignores internal islands. */ - OUTER = 11, - /** Ignores internal structures when hatching. */ - IGNORE = 12 -} - -enum IMAGE_STATUS:ubyte { - /** Image is pending upload/saving. */ - PENDING = 10, - /** Image is saved and available. */ - SAVED = 11, - /** An error occurred with the image. */ - ERROR = 12 -} - -enum BLOCK_ATTACHMENT:ubyte { - /** Attaches the block instance to the center of the block's extents. */ - CENTER_EXTENTS = 10, - /** Attaches the block instance to its insertion point. */ - INSERTION_POINT = 11 -} - -enum AXIS:ubyte { - /** X-axis. */ - X = 10, - /** Y-axis. */ - Y = 20, - /** Z-axis. */ - Z = 30 -} - -enum PRUNING_LEVEL:ubyte { - /** Conservative pruning, retains more history. */ - CONSERVATIVE = 10, - /** Balanced pruning, optimizes between history and size. */ - BALANCED = 20, - /** Aggressive pruning, retains less history for smaller size. */ - AGGRESSIVE = 30 -} - -// deprecated -enum PARAMETRIC_SOURCE_TYPE:ubyte { - CODE = 10, - FILE = 11 -} - -enum DOCUMENT_GRID_ALIGN_ITEMS:ubyte { - START = 10, - CENTER = 11, - END = 12 -} - -enum LEADER_CONTENT_TYPE:ubyte { - /** Leader content is text. */ - TEXT = 10, - /** Leader content is a block. */ - BLOCK = 11 -} - -/** Defines the types of boolean operations that can be performed. */ -enum BOOLEAN_OPERATION:ubyte { - /** Combines all child shapes into a single shape. */ - UNION = 10, - /** Subtracts all subsequent shapes from the first shape. Order is critical. */ - SUBTRACT = 11, - /** Creates a shape from the overlapping areas of all child shapes. */ - INTERSECT = 12, - /** Creates a shape from the non-overlapping areas (XOR). */ - EXCLUDE = 13, -} - -/** - * ============================================================================= - * UTILITY & GEOMETRY TYPES - * ============================================================================= - */ - -/** A generic key-value pair for string dictionaries. */ -table DictionaryEntry { - key: string (key); - value: string; -} - -/** A generic key-value pair for more complex structures like DucBlock attribute values. */ -table StringValueEntry { - key: string (key); - value: string; -} - -/** A generic identifier used across various components like Standards, Layers, etc. */ -table Identifier { - /** Unique identifier for this standard */ - id: string (key); - /** Human-readable name */ - name: string; - /** Description of the standard */ - description: string; -} - -/** A high-precision 2D point in the World Coordinate System. */ -struct GeometricPoint { - x: double; - y: double; -} - -/** Defines a User Coordinate System (UCS) with an origin and rotation. */ -table DucUcs { - /** - * The origin point of the UCS in World Coordinate System (WCS) coordinates. - * This defines the (0,0) point of the new local system. - */ - origin: GeometricPoint; - /** - * The rotation angle of the UCS's X-axis, measured in radians, - * relative to the World Coordinate System's X-axis. - * An angle of 0 means the UCS is aligned with the WCS. - */ - angle: double; // Radian -} - -/** Defines a view with scroll, zoom, and center point. */ -table DucView { - scroll_x: double; - scroll_y: double; - zoom: double; - twist_angle: double; // Radian - /** The specific spot on that plane that you want to be in the middle of your screen when this view is active */ - center_point: DucPoint; - scope: string; // Scope -} - -/** Represents margins for layouts and cells. */ -table Margins { - top: double; - right: double; - bottom: double; - left: double; -} - -/** - * ============================================================================= - * STYLING & CONTENT - * ============================================================================= - */ - -table TilingProperties { - size_in_percent: float; - angle: double; // Radian - spacing: double = null; - offset_x: double = null; - offset_y: double = null; -} - -table HatchPatternLine { - /** Line angle in radians */ - angle: double; // Radian - /** Line origin point */ - origin: DucPoint; - /** Offset between parallel lines [x, y] */ - offset: [double]; // [x, y] - /** Dash pattern (empty array = solid line) */ - dash_pattern: [double]; -} - -table CustomHatchPattern { - /** Pattern name */ - name: string; - /** Pattern description */ - description: string; - /** Pattern line definitions */ - lines: [HatchPatternLine]; -} - -table DucHatchStyle { - /** Default hatch style */ - hatch_style: HATCH_STYLE = null; - /** Pattern name (for predefined) or reference to custom pattern */ - pattern_name: string; - /** Pattern scale factor */ - pattern_scale: float; - /** Pattern rotation angle */ - pattern_angle: double; // Radian - /** Pattern origin point */ - pattern_origin: DucPoint; - /** Double pattern (second pattern at 90 degrees) */ - pattern_double: bool; - custom_pattern: CustomHatchPattern; -} - -table DucImageFilter { - brightness: float; // Percentage - contrast: float; // Percentage -} - -table ElementContentBase { - preference: ELEMENT_CONTENT_PREFERENCE = null; - /** Can be a color, gradient, image, DucBlock, (fileId or url), frame element's content `@el/${elementId}` */ - src: string; - visible: bool; - opacity: double; - - tiling: TilingProperties; - hatch: DucHatchStyle; - image_filter: DucImageFilter; -} - -table StrokeStyle { - preference: STROKE_PREFERENCE = null; - /** - * The cap of the stroke - */ - cap: STROKE_CAP = null; - /** - * The join of the stroke - */ - join: STROKE_JOIN = null; - /** - * The dash of the stroke - */ - dash: [double]; - /** Override the dash line into a custom shape */ - dash_line_override: string; // DucBlockInstance ID - /** - * The cap of the dash - */ - dash_cap: STROKE_CAP = null; - /** - * The miter limit of the stroke - */ - miter_limit: double = null; -} - -table StrokeSides { - preference: STROKE_SIDE_PREFERENCE = null; - /** [0, 1] for x and y || [0, 1, 2, 3] for top, bottom, left, right */ - values: [double]; // [0,1] or [0,1,2,3] -} - -table ElementStroke { - content: ElementContentBase; - width: double; - style: StrokeStyle; - placement: STROKE_PLACEMENT = null; - stroke_sides: StrokeSides; -} - -table ElementBackground { - content: ElementContentBase; -} - -/** Base style properties shared by many elements. */ -table _DucElementStylesBase { - roundness: double; - blending: BLENDING = null; - background: [ElementBackground]; - stroke: [ElementStroke]; - opacity: double; -} - - -/** - * ============================================================================= - * BASE ELEMENT & COMMON ELEMENT COMPONENTS - * ============================================================================= - */ - -table BoundElement { - id: string; - type: string; // Represents DucElementType -} - -/** The foundational table for all scene elements, containing common properties. */ -table _DucElementBase { - id: string (key); - styles: _DucElementStylesBase; - - x: double; - y: double; - width: double; - height: double; - angle: double; // Radian - - /** - * The scope where the element is currently - * mm, cm, m, in, ft, yd, mi, etc... - */ - scope: string; // Scope - label: string; - description: string; - is_visible: bool; - - /** - * Random integer used to seed shape generation - * doesn't differ across renders. - */ - seed: int; - /** - * Integer that is sequentially incremented on each change. Used to reconcile - * elements during collaboration or when saving to server. - */ - version: int; - /** - * Random integer that is regenerated on each change. - * Used for deterministic reconciliation of updates during collaboration, - * in case the versions (see above) are identical. - */ - version_nonce: int; - /** Epoch timestamp (ms) of last element update */ - updated: long; // Epoch timestamp (ms) - /** - * String in a fractional form defined by https://github.com/rocicorp/fractional-indexing. - * Used for ordering in multiplayer scenarios, such as during reconciliation or undo / redo. - * Always kept in sync with the array order by `syncMovedIndices` and `syncInvalidIndices`. - * Could be null, i.e. for new elements which were not yet assigned to the scene. - */ - index: string; // FractionalIndex - - /** Whether the element is a plot (i.e. visible on plotting) */ - is_plot: bool; - /** Whether the element is annotative (scales with DucViewport) */ - is_annotative: bool; - /** Whether the element is deleted */ - is_deleted: bool; - - /** - * List of groups the element belongs to. - * Ordered from deepest to shallowest. - */ - group_ids: [string]; - /** - * List of regions the element belongs. - * Used to define boolean operations between elements. - * Ordered from deepest to shallowest. - */ - region_ids: [string]; - /** The layer the element belongs to */ - layer_id: string; - /** The frame or plot the element belongs to */ - frame_id: string; - - /** - * other elements that are bound to this element - * if we mutate this element, the bound elements will be updated automatically - * for transform properties like x, y, angle, etc. - */ - bound_elements: [BoundElement]; - /** - * z-index of the element in the scene - * Explicit stacking order, higher values are rendered on top - */ - z_index: float; - - link: string; - locked: bool; - - custom_data_string: string (deprecated); - /** - * List of blocks this element helps *define*. - * If this is populated, `instanceId` should be null. - */ - block_ids: [string]; - - /** - * The ID of the `DucBlockInstance` this element belongs to. - * If not null, `block_ids` is empty (the relationship to the Block is via the Instance). - */ - instance_id: string; - - /** Contains a JSON of custom key-value data. */ - custom_data: [ubyte]; -} - -table DucPoint { - x: double; - y: double; - /** Only meaningful if the point is referenced in exactly two lines */ - mirroring: BEZIER_MIRRORING = null; -} - -table DucHead { - type: LINE_HEAD = null; - /** If the head is a block, this is the id of the block */ - block_id: string; - size: double; -} - -table PointBindingPoint { - /** The index of the target point within the element. */ - index: int; - /** - * The offset from the point. Ranges from -1 to 1: 0 corresponds to the actual point. - * -1 and 1 represent the percentage of the distance between the point at `index` - * and the previous or next point in the points array, respectively. - */ - offset: double; -} - -table DucPointBinding { - element_id: string; - /** - * Determines where along the edge of the bound element the arrow endpoint should attach. - * This value ranges from -1 to 1: -1 -> Attaches to the far left/top; 0 -> Attaches to the center; 1 -> Attaches to the far right/bottom. - * Focus ensures that the arrow dynamically adjusts as the bound element moves, resizes, or rotates. - */ - focus: float; - /** The gap distance between the bound element and the binding element. */ - gap: double; - /** - * Represents a fixed point inside the bound element, defined as a normalized coordinate. - * This value is an array [x, y], where: x (0.0 - 1.0) -> Horizontal position; y (0.0 - 1.0) -> Vertical position. - * FixedPoint ensures the arrow stays pinned to a precise location inside the element. - * If null, focus is used. If set, it overrides focus. - */ - fixed_point: GeometricPoint; - point: PointBindingPoint; - /** - * The head of the line. - * Reference: https://www.figma.com/design/5rYcUlscflBabQ9di2iFJ5/duc-Architecture?node-id=313-43&t=gNEFgevk9KZ3oAun-1 - */ - head: DucHead; -} - -table DucLineReference { - /** index of the point in the points array */ - index: int; - /** Bezier handle of the point on the line segment */ - handle: GeometricPoint; -} - -table DucLine { - start: DucLineReference; - end: DucLineReference; -} - -table DucPath { - line_indices: [int]; - /** Override the background and stroke from the base in case is different than null */ - background: ElementBackground; - /** Override the background and stroke from the base in case is different than null */ - stroke: ElementStroke; -} - -/** The base for linear elements like lines and arrows. */ -table _DucLinearElementBase { - base: _DucElementBase; - points: [DucPoint]; - lines: [DucLine]; - path_overrides: [DucPath]; - last_committed_point: DucPoint; - start_binding: DucPointBinding; - end_binding: DucPointBinding; -} - -table DucStackLikeStyles { - opacity: double; - labeling_color: string; -} - -table _DucStackBase { - label: string; - description: string; - is_collapsed: bool; - is_plot: bool; - is_visible: bool; - locked: bool; - styles: DucStackLikeStyles; -} - -table _DucStackElementBase { - base: _DucElementBase; - stack_base: _DucStackBase; - clip: bool; - label_visible: bool; - /** Everything inside the stack will use this standard */ - standard_override: string; // Standard ID -} - - -/** - * ============================================================================= - * ELEMENT-SPECIFIC STYLES - * ============================================================================= - */ - -table LineSpacing { - /** - * The numerical value for the line spacing. Its interpretation depends on the `type` property. - * Can also be interpreted as ScaleFactor - */ - value: double; // Can also be interpreted as ScaleFactor - /** - * Determines how the line spacing factor is applied. - * - `AT_LEAST`: The line spacing is the larger of the `value` or the tallest character's natural height. - * This ensures text doesn't overlap but respects a minimum spacing. - * - `EXACTLY`: Forces the line spacing to the specified `value`, even if characters - * (especially tall ones like ascenders/descenders or special symbols) overlap. - * Useful for precise layout control where overlapping might be acceptable or handled externally. - * - `MULTIPLE`: The base line height (often derived from the font's intrinsic metrics and font size) - * is multiplied by the `value` (e.g., a `value` of 1.5 would mean 150% of the base line height). - * This is very common for relative spacing. - */ - type: LINE_SPACING_TYPE = null; -} - -table DucTextStyle { - base_style: _DucElementStylesBase (deprecated); // use _DucElementStylesBase from _DucElementBase instead. - /** - * Whether the text is left-to-right or right-to-left - */ - is_ltr: bool; - /** The primary font family to use for the text */ - font_family: string; - /** - * Fallback font family for broader compatibility across all systems and languages - * Useful for emojis, non-latin characters, etc. - */ - big_font_family: string; - - /** Horizontal alignment of the text within its bounding box */ - text_align: TEXT_ALIGN = null; - /** Vertical alignment of the text within its bounding box */ - vertical_align: VERTICAL_ALIGN = null; - - /** - * Unitless line height multiplier (follows W3C standard). - * Actual line height in drawing units = fontSize × lineHeight - * Use `getLineHeightInPx` helper for pixel calculations. - * @example 1.2 means 20% extra space between lines - */ - line_height: float; // Unitless multiplier - /** Defines the line spacing properties for text. */ - line_spacing: LineSpacing; - - /** - * Italic angle in radians for oblique text rendering - * Positive values slant right, negative values slant left - */ - oblique_angle: double; // Radian - /** - * Text height in drawing units (primary size parameter) - * This determines the height of capital letters - */ - font_size: double; - /** Desired height on printed page (for annotative text) */ - paper_text_height: double; - /** - * Character width as a ratio of text height - * Controls horizontal spacing and character proportions - * @example 0.7 means each character is 70% as wide as the text is tall - */ - width_factor: float; // ScaleFactor - - /** Render upside down */ - is_upside_down: bool; - /** Render backwards/mirrored */ - is_backwards: bool; -} - -table DucTableCellStyle { - base_style: _DucElementStylesBase; - /** The text style for content within the cell */ - text_style: DucTextStyle; - /** Margin space inside the cell, between the content and the border */ - margins: Margins; - /** The alignment of content within the cell */ - alignment: TABLE_CELL_ALIGNMENT = null; -} - -table DucTableStyle { - base_style: _DucElementStylesBase (deprecated); // use _DucElementStylesBase from _DucElementBase instead. - /** The direction in which new rows are added */ - flow_direction: TABLE_FLOW_DIRECTION = null; - /** Default style for the header row(s) */ - header_row_style: DucTableCellStyle; - /** Default style for the data row(s) */ - data_row_style: DucTableCellStyle; - /** Default style for the data column(s) */ - data_column_style: DucTableCellStyle; -} - -table DucLeaderStyle { - base_style: _DucElementStylesBase (deprecated); // use _DucElementStylesBase from _DucElementBase instead. - /** - * Override the heads of the leader - * The tuple represents [startHead, endHead] - */ - heads_override: [DucHead]; // [start, end] - /** The "dogleg" or "landing" segment that connects the leader line to the content. */ - dogleg: double; - /** Default styling for text content. */ - text_style: DucTextStyle; - /** - * How the text content attaches to the leader's landing line. - * 'top': Text is below the line. 'middle': Text is centered on the line. - */ - text_attachment: VERTICAL_ALIGN = null; - /** How the block content attaches to the leader's landing line. */ - block_attachment: BLOCK_ATTACHMENT = null; -} - -table DimensionToleranceStyle { - /** Whether to display tolerances by default */ - enabled: bool; - /** Default display method (e.g., Symmetrical, Limits) */ - display_method: TOLERANCE_DISPLAY = null; - /** Default upper tolerance value */ - upper_value: double; - /** Default lower tolerance value */ - lower_value: double; - /** Decimal places for tolerance values */ - precision: int; - /** The text style for the tolerance values, inheriting from the main textStyle */ - text_style: DucTextStyle; -} - -table DimensionFitStyle { - /** Determines what to move when text and arrows don't fit between extension lines */ - rule: DIMENSION_FIT_RULE = null; - /** If text is moved, determines its placement relative to the dimension line */ - text_placement: DIMENSION_TEXT_PLACEMENT = null; - /** Forces text to always be placed between extension lines */ - force_text_inside: bool; -} - -table DimensionLineStyle { - stroke: ElementStroke; - /** Gap between the dimension line and the text when text is placed inside */ - text_gap: double; -} - -table DimensionExtLineStyle { - stroke: ElementStroke; - /** Distance to extend the line beyond the dimension line */ - overshoot: double; - /** Gap between the feature origin and the start of the extension line */ - offset: double; -} - -table DimensionSymbolStyle { - /** - * Override the arrow heads for each dimension line - * The tuple represents [startHead, endHead] - */ - heads_override: [DucHead]; // [start, end] - /** Center mark configuration for radial/diameter dimensions */ - center_mark_type: MARK_ELLIPSE_CENTER = null; - center_mark_size: double; -} - -table DucDimensionStyle { - /** Style for the main dimension line and its arrowheads */ - dim_line: DimensionLineStyle; - /** Style for the extension lines that connect the dimension to the feature */ - ext_line: DimensionExtLineStyle; - /** The text style used for the dimension's measurement and annotations */ - text_style: DucTextStyle; - /** Configuration for arrowheads and other symbols */ - symbols: DimensionSymbolStyle; - /** Default settings for dimensional tolerances */ - tolerance: DimensionToleranceStyle; - /** Rules for how to arrange text and arrows when space is limited */ - fit: DimensionFitStyle; -} - -table FCFLayoutStyle { - /** Padding between the content and the outer frame border */ - padding: double; - /** Spacing between segments (vertical lines) in a row */ - segment_spacing: double; - /** Spacing between rows in a composite frame */ - row_spacing: double; -} - -table FCFSymbolStyle { - /** Scale factor for symbols relative to the text height */ - scale: float; -} - -table FCFDatumStyle { - /** The style of bracket to draw around datum letters */ - bracket_style: DATUM_BRACKET_STYLE = null; -} - -table DucFeatureControlFrameStyle { - base_style: _DucElementStylesBase (deprecated); // use _DucElementStylesBase from _DucElementBase instead. - /** The base text style for numbers and letters within the frame */ - text_style: DucTextStyle; - /** Layout and spacing properties */ - layout: FCFLayoutStyle; - /** Configuration for GD&T symbols */ - symbols: FCFSymbolStyle; - /** Styling for datum references */ - datum_style: FCFDatumStyle; -} - -table ParagraphFormatting { - /** Indentation for the first line of each paragraph */ - first_line_indent: double; - /** Indentation for all lines except the first (hanging indent) */ - hanging_indent: double; - /** Indentation from the left edge of the element's bounding box */ - left_indent: double; - /** Indentation from the right edge of the element's bounding box */ - right_indent: double; - /** Extra spacing added before each paragraph */ - space_before: double; - /** Extra spacing added after each paragraph */ - space_after: double; - /** A list of tab stop positions from the left indent */ - tab_stops: [double]; -} - -table StackFormatProperties { - /** Scale of the upper text relative to the main font size */ - upper_scale: double; // e.g., 0.7 - /** Scale of the lower text relative to the main font size */ - lower_scale: double; // e.g., 0.7 - /** Alignment of stacked text (e.g., center, decimal) */ - alignment: STACKED_TEXT_ALIGN = null; -} - -table StackFormat { - /** Enable automatic stacking of text around specified characters */ - auto_stack: bool; - /** Characters that trigger stacking (e.g., "/", "#", "^") */ - stack_chars: [string]; - /** Properties for how stacked text is rendered */ - properties: StackFormatProperties; -} - -table DucDocStyle { - text_style: DucTextStyle; - paragraph: ParagraphFormatting; - stack_format: StackFormat; -} - -table DucViewportStyle { - base_style: _DucElementStylesBase (deprecated); // use _DucElementStylesBase from _DucElementBase instead. - scale_indicator_visible: bool; -} - -table DucPlotStyle { - base_style: _DucElementStylesBase (deprecated); // use _DucElementStylesBase from _DucElementBase instead. -} - -table DucXRayStyle { - base_style: _DucElementStylesBase (deprecated); // use _DucElementStylesBase from _DucElementBase instead. - /** The color of the x-ray */ - color: string; -} - -/** - * ============================================================================= - * ELEMENT DEFINITIONS - * ============================================================================= - */ - -table DucRectangleElement { - base: _DucElementBase; -} - -table DucPolygonElement { - base: _DucElementBase; - /** number of sides of the polygon */ - sides: int; -} - -table DucEllipseElement { - base: _DucElementBase; - ratio: float; // Percentage - start_angle: double; // Radian - end_angle: double; // Radian - show_aux_crosshair: bool; -} - -table DucEmbeddableElement { - base: _DucElementBase; -} - -table DocumentGridConfig { - /** 1 = single, 2 = two-up, n = grid */ - columns: int; - /** horizontal spacing (px) */ - gap_x: double; - /** vertical spacing (px) */ - gap_y: double; - /** vertical alignment within row */ - align_items: DOCUMENT_GRID_ALIGN_ITEMS = null; - /** cover page behavior for 2+ columns */ - first_page_alone: bool; - /** - * The scale factor of the element, represented as a single floating-point number. - * This is calculated as: (Drawing Units ÷ Real World Units). - * - * The scale factor is strictly a ratio and is unitless. - * - * @example - * // Reduction (Architecture / Maps) - Drawing is smaller than reality - * // 1:300 scale -> 1 / 300 = 0.00333333 - * // 1/4" = 1'-0" -> 1 / 48 = 0.02083333 (Imperial 1:48) - * - * @example - * // Neutral - Drawing is exact real-world size - * // 1:1 scale -> 1 / 1 = 1.0 - * - * @example - * // Enlargement (Machining / Details) - Drawing is bigger than reality - * // 5:1 scale -> 5 / 1 = 5.0 - * - * @remarks - * To calculate the real-world size from a measurement taken on the PDF: - * `realWorldSize = pdfMeasurement / scale` - */ - scale: double; -} - -table DucPdfElement { - base: _DucElementBase; - file_id: string; - /** Configuration for rendering the document in a grid layout */ - grid_config: DocumentGridConfig; -} - -table DucMermaidElement { - base: _DucElementBase; - source: string; - /** - * if not provided, the theme will be the same as the document's theme, or default to 'default' - * we decided to go with a string type because of the unpredictably of having different themes - */ - theme: string; - /** optional cached SVG string */ - svg_path: string; -} - -table DucTableColumn { - id: string (key); - width: double; - /** Style overrides for this column */ - style_overrides: DucTableCellStyle; -} - -table DucTableRow { - id: string (key); - height: double; - /** Style overrides for this row */ - style_overrides: DucTableCellStyle; -} - -table DucTableCellSpan { - columns: int; - rows: int; -} - -table DucTableCell { - row_id: string; - column_id: string; - /** - * The content of the cell, stored as a Markdown string. This allows for rich text - * within cells without complicating the table's main data structure. - */ - data: string; // Markdown content - /** - * Defines if and how this cell merges with adjacent cells. - * A span of 1 means no merging. - * The root cell of a merge (top-left) holds the content and span data. - * Other cells covered by the span are effectively hidden. - */ - span: DucTableCellSpan; - /** Whether the content of this cell can be edited */ - locked: bool; - /** - * Style overrides for this specific cell. - * Any property set here will take precedence over row, column, and table styles. - */ - style_overrides: DucTableCellStyle; -} - -table DucTableColumnEntry { - key: string (key); - value: DucTableColumn; -} - -table DucTableRowEntry { - key: string (key); - value: DucTableRow; -} - -table DucTableCellEntry { - key: string (key); // "rowId:columnId" - value: DucTableCell; -} - -table DucTableAutoSize { - columns: bool; - rows: bool; -} - -table DucTableElement { - base: _DucElementBase; - style: DucTableStyle; - - /** An ordered list of column IDs, defining the horizontal layout */ - column_order: [string]; - /** An ordered list of row IDs, defining the vertical layout */ - row_order: [string]; - - /** A record of all column definitions, keyed by their ID */ - columns: [DucTableColumnEntry]; - /** A record of all row definitions, keyed by their ID */ - rows: [DucTableRowEntry]; - /** - * A record of all cell data, keyed by a composite "rowId:columnId" string. - * This flat structure is efficient for lookups and updates. - */ - cells: [DucTableCellEntry]; - - /** Number of top rows to be treated as headers, using the headerRowStyle */ - header_row_count: int; - /** Whether table auto-sizes to content */ - auto_size: DucTableAutoSize; -} - -table ImageCrop { - x: double; - y: double; - width: double; - height: double; - natural_width: double; - natural_height: double; -} - -table DucImageElement { - base: _DucElementBase; - file_id: string; - /** whether respective file is persisted */ - status: IMAGE_STATUS = null; - /** X and Y scale factors <-1, 1>, used for image axis flipping */ - scale: [double]; // [x, y] - /** whether an element is cropped */ - crop: ImageCrop; - filter: DucImageFilter; -} - -/** Dynamic text field source types */ -table DucTextDynamicElementSource { - /** The unique ID of the source element. */ - element_id: string; - /** The specific property to retrieve from the source element. */ - property: TEXT_FIELD_SOURCE_PROPERTY = null; -} - -table DucTextDynamicDictionarySource { - /** The key to look up in the global drawing dictionary. */ - key: string; -} - -union DucTextDynamicSourceData { - DucTextDynamicElementSource, - DucTextDynamicDictionarySource -} - -table DucTextDynamicSource { - text_source_type: TEXT_FIELD_SOURCE_TYPE = null; - source: DucTextDynamicSourceData; -} - -table DucTextDynamicPart { - /** - * A unique key for this part, which matches the placeholder in the text string. - * E.g., for a placeholder `{{PartNumber}}`, the tag would be "PartNumber". - */ - tag: string; - /** The source of the data for this dynamic part. */ - source: DucTextDynamicSource; - /** Formatting rules for displaying the final value. */ - formatting: PrimaryUnits; - /** The last known value, used as a fallback or for initial display. */ - cached_value: string; -} - -table DucTextElement { - base: _DucElementBase; - style: DucTextStyle; - /** - * The display text, which can contain zero or more placeholders in the - * format `{{tag}}`. Each tag corresponds to an object in the `dynamic` array. - * Example: "Part: {{PN}} on Layer: {{LAYER}}" - */ - text: string; // Markdown - /** - * An array of metadata objects that define the behavior of the placeholders - * found in the `text` property. If this is empty, the text is treated - * as purely static. - */ - dynamic: [DucTextDynamicPart]; - /** - * Text sizing behavior: - * - `true`: Width adjusts to fit text content (single line or natural wrapping) - * - `false`: Text wraps to fit within the element's fixed width - */ - auto_resize: bool; - /** The ID of an element that this text is contained within (e.g., for labels on shapes) */ - container_id: string; - /** A non-rendered, original version of the text, e.g., before finishing writing the text */ - original_text: string; -} - -table DucLinearElement { - linear_base: _DucLinearElementBase; - /** - * If true, the element's shape will wipe out the content below the element - */ - wipeout_below: bool; -} - -table DucArrowElement { - linear_base: _DucLinearElementBase; - elbowed: bool; -} - -table DucFreeDrawEnds { - cap: bool; - taper: float; - easing: string; -} - -table DucFreeDrawElement { - base: _DucElementBase; - points: [DucPoint]; - size: double; - thinning: float; // Percentage - smoothing: float; // Percentage - streamline: float; // Percentage - easing: string; // key that maps to an easing function - start: DucFreeDrawEnds; - end: DucFreeDrawEnds; - pressures: [float]; - simulate_pressure: bool; - last_committed_point: DucPoint; - /** optional cached SVG string */ - svg_path: string; -} - -table DucBlockAttributeDefinition { - /** The unique identifier for this attribute within the block (e.g., "PART_NUMBER"). */ - tag: string; - /** The prompt displayed to the user when inserting the block (e.g., "Enter the part number:"). */ - prompt: string; - /** The default value for this attribute. */ - default_value: string; - /** If true, the attribute's value is fixed and cannot be changed after insertion. */ - is_constant: bool; -} - -table DucBlockAttributeDefinitionEntry { - key: string (key); - value: DucBlockAttributeDefinition; -} - -/** - * Defines the "Blueprint" for a reusable component. - * - * **Element Relationship Logic:** - * The connection between this Block Definition and `_DucElementBase` depends on the state: - * - * 1. **Definition State (Source):** - * - Elements that define the geometry of this block have this `id` inside their `element.block_ids`. - * - Their `element.instance_id` is `null`. - * - * 2. **Instance State (Usage):** - * - When instantiated via `DucBlockInstance`, the rendered elements have `element.instance_id` set (not null). - * - Crucially, these instance elements have **empty** `element.block_ids`. - * - The relationship is resolved indirectly: `Element.instance_id` -> `DucBlockInstance.block_id` -> `DucBlock.id`. - */ -table DucBlock { - id: string(key); - label: string; - description: string; - version: int; - /** - * A record of attribute definitions for this block, keyed by their tag. - * This defines the "slots" for data that each instance can fill. - */ - attribute_definitions: [DucBlockAttributeDefinitionEntry]; - metadata: DucBlockMetadata; - thumbnail: [ubyte]; -} - -table DucBlockMetadata { - source: string; - usage_count: int; - /** Epoch timestamp (ms) of block creation */ - created_at: long; // Epoch timestamp (ms) - /** Epoch timestamp (ms) of last block update */ - updated_at: long; // Epoch timestamp (ms) - /** JSON string to represent localization data - * Structure: Record - * - * where key string is BCP 47 standard language tag (e.g., "en-US", "fr-FR") - * where BlockLocalizationEntry is: - * - * { - * title: string; - * description?: string; - * } - */ - localization_string: string (deprecated); - localization: [ubyte]; - -} - - -table DucBlockDuplicationArray { - rows: int; - cols: int; - row_spacing: double; - col_spacing: double; -} - -table DucBlockInstanceElement { - base: _DucElementBase (deprecated); - block_id: string (deprecated); - element_overrides: [StringValueEntry] (deprecated); - attribute_values: [StringValueEntry] (deprecated); - duplication_array: DucBlockDuplicationArray (deprecated); -} - -table DucBlockInstance { - id: string; - /** The reference to the DucBlock definition this instance is based on */ - block_id: string; - /** - * A record of the actual values for the attributes of this specific instance, - * keyed by the attribute tag defined in the DucBlock. - * <=> - */ - element_overrides: [StringValueEntry]; - /** - * A record of the actual values for the attributes of this specific instance, - * keyed by the attribute tag defined in the DucBlock. - */ - attribute_values: [StringValueEntry]; - duplication_array: DucBlockDuplicationArray; - - /** The version that should match the block_id's version, incremented on each change */ - version: int; -} - - -table DucBlockCollection { - id: string; - label: string; - - children: [DucBlockCollectionEntry]; - metadata: DucBlockMetadata; - thumbnail: [ubyte]; -} - -table DucBlockCollectionEntry { - id: string; - /** - * True if pointing to another collection, False if pointing to a block. - */ - is_collection: bool; -} - -table DucFrameElement { - stack_element_base: _DucStackElementBase; -} - -table PlotLayout { - /** Margins inset from the edge of the paper. */ - margins: Margins; -} - -table DucPlotElement { - stack_element_base: _DucStackElementBase; - style: DucPlotStyle; - /** The layout definition for this plot, including paper size and margins. */ - layout: PlotLayout; -} - -table DucViewportElement { - linear_base: _DucLinearElementBase; - stack_base: _DucStackBase; - style: DucViewportStyle; - /** View configuration */ - view: DucView; - /** Viewport scale settings */ - scale: float; // ViewportScale - /** Shade plot setting */ - shade_plot: VIEWPORT_SHADE_PLOT = null; - /** Frozen layers in this viewport */ - frozen_group_ids: [string]; - /** Everything inside the viewport will use this standard */ - standard_override: string; // Standard ID -} - -table DucXRayElement { - base: _DucElementBase; - style: DucXRayStyle; - origin: DucPoint; - direction: DucPoint; - /** - * If true, the x-ray will start from the origin. - * If false, the x-ray will be a full infinite line. - */ - start_from_origin: bool; -} - -table LeaderTextBlockContent { - /** The rich text or markdown string for the content. */ - text: string; -} - -table LeaderBlockContent { - /** The ID of the DucBlock definition to use as content. */ - block_id: string; - /** - * The attribute values and element overrides for this specific block instance. - * This is a subset of the properties from DucBlockInstance. - */ - attribute_values: [StringValueEntry]; - element_overrides: [StringValueEntry]; -} - -union LeaderContentData { - LeaderTextBlockContent, - LeaderBlockContent -} - -table LeaderContent { - leader_content_type: LEADER_CONTENT_TYPE = null; - content: LeaderContentData; -} - -table DucLeaderElement { - linear_base: _DucLinearElementBase; - style: DucLeaderStyle; - /** - * The content attached to the leader. Stored internally to keep the element atomic. - */ - content: LeaderContent; - /** - * The anchor point for the content block, in world coordinates. - * The leader's dogleg/landing connects to this point. - */ - content_anchor: GeometricPoint; -} - -table DimensionDefinitionPoints { - /** - * Primary origin point (e.g., start of a linear dimension, point on a circle for radius). - * DXF DefPoint1 - */ - origin1: GeometricPoint; - /** - * Secondary origin point (e.g., end of a linear dimension, end of an arc). - * DXF DefPoint2 - */ - origin2: GeometricPoint; - /** - * A point that defines the position of the dimension line or arc. - * DXF DefPoint3 - */ - location: GeometricPoint; - /** - * Center point (for radial/angular/diameter) or vertex (for angular). - * DXF DefPoint4 - */ - center: GeometricPoint; - /** - * A point defining a jog in the dimension line. - * DXF DefPoint5 - */ - jog: GeometricPoint; -} - -table DimensionBindings { - /** - * Defines how the definition points are associated with other elements when `isAssociative` is true. - * The keys correspond to the keys in `definitionPoints`. - */ - origin1: DucPointBinding; - origin2: DucPointBinding; - center: DucPointBinding; -} - -table DimensionBaselineData { - /** If this is a baseline dimension, contains data linking it to the base */ - base_dimension_id: string; -} - -table DimensionContinueData { - /** If this is a continued dimension, contains data linking it to the previous one */ - continue_from_dimension_id: string; -} - -table DucDimensionElement { - base: _DucElementBase; - style: DucDimensionStyle; - - /** The type of dimension, which determines how definition points are interpreted */ - dimension_type: DIMENSION_TYPE = null; - /** The core geometric points that define what is being measured */ - definition_points: DimensionDefinitionPoints; - - /** - * The oblique angle for the extension lines, used for isometric-style dimensions. - * An angle of 0 means they are perpendicular to the dimension line. - */ - oblique_angle: float; // Radian - /** For 'ordinate' dimensions, specifies whether it measures the X or Y coordinate. */ - ordinate_axis: AXIS = null; - - bindings: DimensionBindings; - - /** - * User-override for the dimension text content. - * - If `null`, the measured value is automatically calculated and displayed. - * - If a string, this value is displayed instead. - * Use `<>` within the string (e.g., "R<>") to include the calculated measurement. - */ - text_override: string; - /** - * User-override for the text position. - * - If `null`, the position is automatically determined by the 'fit' rules in the style. - * - If a point, the text is moved to this exact location. - */ - text_position: GeometricPoint; - - /** Instance-specific overrides for tolerance, taking precedence over the style's defaults */ - tolerance_override: DimensionToleranceStyle; - - baseline_data: DimensionBaselineData; - continue_data: DimensionContinueData; - - // calculated_value: double; // This is readonly runtime data, should not be serialized -} - -table DatumReference { - /** The datum letter or letters (e.g., "A", "B", "A-B") */ - letters: string; - /** Material condition modifier, if any (e.g., Maximum, Least) */ - modifier: MATERIAL_CONDITION = null; -} - -table ToleranceClause { - /** The primary tolerance value, represented as a string to support various formats */ - value: string; - /** The type of tolerance zone (e.g., Cylindrical, Spherical) */ - zone_type: TOLERANCE_ZONE_TYPE = null; - /** A list of modifiers that apply directly to the feature, like Diameter or Projected Zone */ - feature_modifiers: [FEATURE_MODIFIER]; - /** Material condition modifier for the tolerance itself */ - material_condition: MATERIAL_CONDITION = null; -} - -table FeatureControlFrameSegment { - /** The geometric characteristic symbol (e.g., Position, Flatness, Profile) */ - symbol: GDT_SYMBOL = null; - /** The tolerance specification for this segment */ - tolerance: ToleranceClause; - /** The datum reference frame, ordered by priority */ - datums: [DatumReference]; // [primary, secondary, tertiary] -} - -table FCFBetweenModifier { - /** Identifier for start point, e.g., "A" */ - start: string; - /** Identifier for end point, e.g., "B" */ - end: string; -} - -table FCFProjectedZoneModifier { - value: double; -} - -table FCFFrameModifiers { - all_around: bool; - all_over: bool; - continuous_feature: bool; - between: FCFBetweenModifier; - projected_tolerance_zone: FCFProjectedZoneModifier; -} - -table FCFDatumDefinition { - /** The datum letter this symbol defines (e.g., "A", "B") */ - letter: string; - /** - * An optional binding directly to a point on the feature being identified as the datum. - * Used when a leader is not present. - */ - feature_binding: DucPointBinding; -} - -table FCFSegmentRow { - segments: [FeatureControlFrameSegment]; -} - -table DucFeatureControlFrameElement { - base: _DucElementBase; - style: DucFeatureControlFrameStyle; - - /** - * An array of rows. Most FCFs have one row. Composite frames have multiple rows. - * Each row is an array of segments that are drawn horizontally. - */ - rows: [FCFSegmentRow]; - /** Modifiers that apply to the entire feature control frame. */ - frame_modifiers: FCFFrameModifiers; - /** - * A reference to a leader element that points to this FCF. - * The leader element itself holds the geometry and start/end bindings. - * This provides a simple, one-way link. - */ - leader_element_id: string; - /** - * If present, this element acts as a **Datum Feature Symbol**, defining the specified - * datum letter and attached to a feature. The `rows` property would be empty. - */ - datum_definition: FCFDatumDefinition; -} - -table TextColumn { - /** The width of the column in drawing units. */ - width: double; - /** The space between this column and the next, also known as the gutter. */ - gutter: double; -} - -table ColumnLayout { - /** - * - `NONE`: A single column. - * - `STATIC_COLUMNS`: A fixed number of columns with defined widths/heights. - * - `DYNAMIC_COLUMNS`: Text flows automatically between columns based on height. - */ - type: COLUMN_TYPE = null; - /** An array defining each column's properties */ - definitions: [TextColumn]; - /** Whether column height adjusts automatically in dynamic mode */ - auto_height: bool; -} - -table DucDocElement { - base: _DucElementBase; - style: DucDocStyle; - /** - * The content of the document, stored as a code string. - * This approach allows to use a rich text editor that can compile to PDF using Typst code - * - * It can also contain wildcards like `{@fieldname}` for dynamic data insertion. - * Example: "This is **bold text** and this is a {color:red}red word{/color}." - * - * It can also contain zero or more placeholders in the format `{{tag}}`. - * Example: "This document was last saved on {{SaveDate}} by {{Author}}." - */ - text: string; - /** - * An array of metadata objects that define the behavior of the placeholders - * found in the `text` property. If this is empty, the text is treated - * as purely static. - */ - dynamic: [DucTextDynamicPart]; - /** Direction of text flow for multi-column layouts */ - flow_direction: TEXT_FLOW_DIRECTION = null; - /** Defines the structural properties of the columns. */ - columns: ColumnLayout; - /** - * Text sizing behavior: - * - `true`: Width and/or height adjust to fit text content. - * - `false`: Text wraps or is clipped to fit the element's fixed bounds. - */ - auto_resize: bool; - /** Configuration for rendering the document in a grid layout */ - grid_config: DocumentGridConfig; - /** External file reference */ - file_id: string; -} - -// deprecated -table ParametricSource { - type: PARAMETRIC_SOURCE_TYPE = null; - code: string; - file_id: string; -} - -// deprecated -table DucParametricElement { - base: _DucElementBase; - source: ParametricSource; -} - -table DucModelElement { - base: _DucElementBase; - /** Defines the source of the model using build123d python code */ - source: string; - /** The last known SVG path representation of the 3D model for quick rendering on the canvas */ - svg_path: string; - /** Possibly connected external files, such as STEP, STL or other reference models */ - file_ids: [string]; -} - -/** - * ============================================================================= - * ELEMENT UNION & WRAPPER - * ============================================================================= - */ - -/** A union of all possible scene elements. */ -union Element { - DucRectangleElement, - DucPolygonElement, - DucEllipseElement, - DucEmbeddableElement, - DucPdfElement, - DucMermaidElement, // deprecated - DucTableElement, - DucImageElement, - DucTextElement, - DucLinearElement, - DucArrowElement, - DucFreeDrawElement, - DucBlockInstanceElement, - DucFrameElement, - DucPlotElement, - DucViewportElement, - DucXRayElement, - DucLeaderElement, - DucDimensionElement, - DucFeatureControlFrameElement, - DucDocElement, - DucParametricElement, // deprecated - DucModelElement -} - -/** A wrapper to hold an element from the union. */ -table ElementWrapper { - element: Element; -} - - -/** - * ============================================================================= - * APP & DOCUMENT STATE - * ============================================================================= - */ - -table DucGlobalState { - /** The name of the drawing */ - name: string; - /** The background color of the drawing */ - view_background_color: string; - /** The master unit system for the entire drawing, used for block/file insertion scaling. */ - main_scope: string; // Scope - /** The global linetype scale for the entire drawing. */ - dash_spacing_scale: float; // ScaleFactor - /** Governs if linetype scale is affected by paper space viewport scale. */ - is_dash_spacing_affected_by_viewport_scale: bool; - /** - * Exponent threshold for determining when to change measurement scope (up or down). - * This value defines a +/- tolerance range around the exponent of the current scope. - * A scope change is triggered if the exponent of *either* the calculated real viewport width - * or the calculated real viewport height falls outside this tolerance range relative to the current scope's exponent. - * Example scenario: - * appState.scopeExponentThreshold = 2 - * appState.scope = "mm" // (approximately 1e-3 relative to reference unit (meter)) - * appState.zoom = dynamic value representing the current zoom level - * The real viewport size is calculated as: viewportSize * zoom - * This system ensures measurements remain representable with appropriate precision - * as users zoom in and out, automatically adjusting between units like mm, μm, nm, etc. - */ - scope_exponent_threshold: byte; - /** A rule for whether newly created dimensions should be associative by default. */ - dimensions_associative_by_default: bool; - /** A fundamental choice for the drawing's scaling architecture. */ - use_annotative_scaling: bool; - /** - * Default display precision for various unit types. The user can override - * this temporarily in their session state (DucState). - */ - display_precision_linear: int; - display_precision_angular: int; - - /** The level of pruning to the versions from the version graph. */ - pruning_level: PRUNING_LEVEL = null; -} - -table DucLocalState { - /** - * The current scope of the design - * mm, cm, m, in, ft, yd, mi, etc... - */ - scope: string; // Scope - /** The active standard for the design */ - active_standard_id: string; - - scroll_x: double; - scroll_y: double; - zoom: double; - - /** list of active grids ordered by z index, most on top is first */ - active_grid_settings: [string]; // Identifier["id"][] - active_snap_settings: string; // Identifier["id"] - - is_binding_enabled: bool; - - /** Current item is usually a quick access state to apply as default to certain things when drawing */ - current_item_stroke: ElementStroke; - current_item_background: ElementBackground; - current_item_opacity: float; // Percentage - current_item_font_family: string; - current_item_font_size: double; - current_item_text_align: TEXT_ALIGN = null; - current_item_start_line_head: DucHead; - current_item_end_line_head: DucHead; - current_item_roundness: double; - - /** Pen mode is enabled, creates a better experience for drawing with a pen */ - pen_mode: bool; - /** In view mode the user is not allowed to edit the canvas. */ - view_mode_enabled: bool; - /** Object snapping on the environment is enabled */ - objects_snap_mode_enabled: bool; - /** Available grids are visible */ - grid_mode_enabled: bool; - /** Whether to disable the fill on all shapes */ - outline_mode_enabled: bool; - /** When enabled, the version graph is not updated automatically. The user needs to manually update the graph for new versions to be saved in version control. */ - manual_save_mode: bool; -} - -table DucGroup { - id: string (key); - stack_base: _DucStackBase; -} - -table DucRegion { - id: string (key); - stack_base: _DucStackBase; - /** The boolean operation to apply to all child elements. */ - boolean_operation: BOOLEAN_OPERATION = null; -} - -table DucLayerOverrides { - stroke: ElementStroke; - background: ElementBackground; -} - -table DucLayer { - id: string (key); - stack_base: _DucStackBase; - readonly: bool; - /** A container for the default styling properties that elements on this layer will inherit */ - overrides: DucLayerOverrides; -} - -/** - * ============================================================================= - * STANDARDS & SETTINGS - * ============================================================================= - */ - -table _UnitSystemBase { - /** Unit system */ - system: UNIT_SYSTEM = null; - /** Precision (decimal places) */ - precision: int; - /** Suppress leading zeros */ - suppress_leading_zeros: bool; - /** Suppress trailing zeros */ - suppress_trailing_zeros: bool; -} - -table LinearUnitSystem { - base: _UnitSystemBase; - /** Unit format */ - format: DIMENSION_UNITS_FORMAT = null; - /** Decimal separator character */ - decimal_separator: DECIMAL_SEPARATOR = null; - /** Suppress zero feet */ - suppress_zero_feet: bool; - /** Suppress zero inches */ - suppress_zero_inches: bool; -} - -table AngularUnitSystem { - base: _UnitSystemBase; - /** Unit format */ - format: ANGULAR_UNITS_FORMAT = null; -} - -table AlternateUnits { - base: _UnitSystemBase; - format: DIMENSION_UNITS_FORMAT = null; - /** Whether to display alternate units */ - is_visible: bool; - /** Multiplier for alternate units */ - multiplier: float; -} - -table PrimaryUnits { - /** Linear units */ - linear: LinearUnitSystem; - /** Angular units */ - angular: AngularUnitSystem; -} - -table StandardUnits { - primary_units: PrimaryUnits; - alternate_units: AlternateUnits; -} - -table UnitPrecision { - linear: int; - angular: int; - area: int; - volume: int; -} - -table StandardOverrides { - main_scope: string; - elements_stroke_width_override: double; - common_style_id: string; - stack_like_style_id: string; - text_style_id: string; - dimension_style_id: string; - leader_style_id: string; - feature_control_frame_style_id: string; - table_style_id: string; - doc_style_id: string; - viewport_style_id: string; - plot_style_id: string; - hatch_style_id: string; - active_grid_settings_id: [string]; - active_snap_settings_id: string; - dash_line_override: string; - /** Default precision for various dimension types */ - unit_precision: UnitPrecision; -} - -table DucCommonStyle { - background: ElementBackground; - stroke: ElementStroke; -} -table IdentifiedCommonStyle { id: Identifier; style: DucCommonStyle; } -table IdentifiedStackLikeStyle { id: Identifier; style: DucStackLikeStyles; } -table IdentifiedTextStyle { id: Identifier; style: DucTextStyle; } -table IdentifiedDimensionStyle { id: Identifier; style: DucDimensionStyle; } -table IdentifiedLeaderStyle { id: Identifier; style: DucLeaderStyle; } -table IdentifiedFCFStyle { id: Identifier; style: DucFeatureControlFrameStyle; } -table IdentifiedTableStyle { id: Identifier; style: DucTableStyle; } -table IdentifiedDocStyle { id: Identifier; style: DucDocStyle; } -table IdentifiedViewportStyle { id: Identifier; style: DucViewportStyle; } -table IdentifiedHatchStyle { id: Identifier; style: DucHatchStyle; } -table IdentifiedXRayStyle { id: Identifier; style: DucXRayStyle; } - -table StandardStyles { - common_styles: [IdentifiedCommonStyle]; - stack_like_styles: [IdentifiedStackLikeStyle]; - text_styles: [IdentifiedTextStyle]; - dimension_styles: [IdentifiedDimensionStyle]; - leader_styles: [IdentifiedLeaderStyle]; - feature_control_frame_styles: [IdentifiedFCFStyle]; - table_styles: [IdentifiedTableStyle]; - doc_styles: [IdentifiedDocStyle]; - viewport_styles: [IdentifiedViewportStyle]; - hatch_styles: [IdentifiedHatchStyle]; - xray_styles: [IdentifiedXRayStyle]; -} - -table GridStyle { - color: string; - opacity: double; - /** for dashed lines */ - dash_pattern: [double]; -} - -table PolarGridSettings { - /** Number of radial divisions (spokes) */ - radial_divisions: int; - /** Radial spacing between concentric circles */ - radial_spacing: double; - /** Whether to show angle labels */ - show_labels: bool; -} - -table IsometricGridSettings { - /** Left plane angle (typically 30 degrees) */ - left_angle: double; // Radian - /** Right plane angle (typically 30 degrees) */ - right_angle: double; // Radian -} - -table GridSettings { - /** Grid coordinate system type */ - type: GRID_TYPE = null; - /** Whether this grid is read-only */ - readonly: bool; - /** How the grid is displayed */ - display_type: GRID_DISPLAY_TYPE = null; - /** Whether the grid spacing is adaptive (changes with zoom level) or fixed. */ - is_adaptive: bool; - /** Spacing between major grid lines along X-axis */ - x_spacing: double; - /** Spacing between major grid lines along Y-axis */ - y_spacing: double; - /** Number of minor divisions between major lines */ - subdivisions: int; - /** Grid origin point */ - origin: GeometricPoint; - /** Grid rotation angle */ - rotation: double; // Radian - /** Whether grid follows the active UCS */ - follow_ucs: bool; - /** Major grid line/dot styling */ - major_style: GridStyle; - /** Minor grid line/dot styling */ - minor_style: GridStyle; - /** Show minor subdivisions */ - show_minor: bool; - /** Minimum zoom level where grid becomes visible */ - min_zoom: double; - /** Maximum zoom level where grid remains visible */ - max_zoom: double; - /** Whether to auto-hide when too dense */ - auto_hide: bool; - /** Polar grid settings (when type is POLAR) */ - polar_settings: PolarGridSettings; - /** Isometric grid settings (when type is ISOMETRIC) */ - isometric_settings: IsometricGridSettings; - /** Whether this grid affects snapping */ - enable_snapping: bool; -} - -table SnapOverride { - key: string; // keyboard key - behavior: SNAP_OVERRIDE_BEHAVIOR = null; -} - -table DynamicSnapSettings { - enabled_during_drag: bool; - enabled_during_rotation: bool; - enabled_during_scale: bool; -} - -table PolarTrackingSettings { - enabled: bool; - angles: [double]; // Radian - /** Additional increment angle for polar tracking */ - increment_angle: double; // Radian - /** Whether to track from last point or from base */ - track_from_last_point: bool; - /** Display polar distance and angle */ - show_polar_coordinates: bool; -} - -table TrackingLineStyle { - color: string; - opacity: double; - dash_pattern: [double]; -} - -table LayerSnapFilters { - include_layers: [string]; - exclude_layers: [string]; -} - -table SnapMarkerStyle { - shape: SNAP_MARKER_SHAPE = null; - color: string; -} - -table SnapMarkerStyleEntry { - key: OBJECT_SNAP_MODE = null; - value: SnapMarkerStyle; -} - -table SnapMarkerSettings { - enabled: bool; - size: int; - /** for temporary markers (ms) */ - duration: int; // ms - styles: [SnapMarkerStyleEntry]; -} - -table SnapSettings { - /** Whether this snap settings is read-only */ - readonly: bool; - /** - * The snap angle for rotated snap grids (e.g., for isometric snapping). - * In radians. - */ - twist_angle: double; // Radian; - /** Snap tolerance in pixels - how close cursor must be to trigger snap */ - snap_tolerance: int; - /** Aperture size for object snap detection (in pixels) */ - object_snap_aperture: int; - /** Whether orthogonal mode is enabled (constrains to 0/90 degrees) */ - is_ortho_mode_on: bool; - /** Polar tracking configuration */ - polar_tracking: PolarTrackingSettings; - /** - * Whether object snap (Osnap) is enabled. - * Osnap allows snapping to geometric points on existing objects. - */ - is_object_snap_on: bool; - /** Set of active object snap modes */ - active_object_snap_modes: [OBJECT_SNAP_MODE]; - /** Priority order when multiple snaps are available at cursor position */ - snap_priority: [OBJECT_SNAP_MODE]; - /** Whether to show tracking lines/vectors */ - show_tracking_lines: bool; - /** Tracking line display settings */ - tracking_line_style: TrackingLineStyle; - /** Snap behavior during element creation/modification */ - dynamic_snap: DynamicSnapSettings; - /** Temporary snap override settings (e.g., holding shift) */ - temporary_overrides: [SnapOverride]; - /** Incremental snap distance (for relative movements) */ - incremental_distance: double; - /** Magnetic snap strength (0-100) */ - magnetic_strength: double; - /** Layer-specific snap settings */ - layer_snap_filters: LayerSnapFilters; - /** Element type filters for object snap */ - element_type_filters: [string]; - /** Running object snap vs single pick mode */ - snap_mode: SNAP_MODE = null; - /** Visual feedback settings */ - snap_markers: SnapMarkerSettings; - /** Construction/guide line snapping */ - construction_snap_enabled: bool; - /** Snap to grid intersections only */ - snap_to_grid_intersections: bool; -} - -table IdentifiedGridSettings { id: Identifier; settings: GridSettings; } -table IdentifiedSnapSettings { id: Identifier; settings: SnapSettings; } -table IdentifiedUcs { id: Identifier; ucs: DucUcs; } -table IdentifiedView { id: Identifier; view: DucView; } - -table StandardViewSettings { - views: [IdentifiedView]; - ucs: [IdentifiedUcs]; - grid_settings: [IdentifiedGridSettings]; - snap_settings: [IdentifiedSnapSettings]; -} - -table DimensionValidationRules { - min_text_height: double; - max_text_height: double; - allowed_precisions: [int]; -} - -table LayerValidationRules { - prohibited_layer_names: [string]; -} - -table StandardValidation { - dimension_rules: DimensionValidationRules; - layer_rules: LayerValidationRules; -} - -table Standard { - identifier: Identifier; - /** Version of the standard */ - version: string; - /** Whether this is a built-in standard (read-only) */ - readonly: bool; - /** Overrides for all elements projected to this standard */ - overrides: StandardOverrides; - /** Styles */ - styles: StandardStyles; - /** Views and canvas interaction settings */ - view_settings: StandardViewSettings; - /** Units */ - units: StandardUnits; - /** Validation rules */ - validation: StandardValidation; -} - - -/** - * ============================================================================= - * VERSION CONTROL - * ============================================================================= - */ - -table VersionBase { - id: string; - parent_id: string; - timestamp: long; - description: string; - is_manual_save: bool; - user_id: string; -} - -table Checkpoint { - base: VersionBase; - data: [ubyte]; - size_bytes: long; -} - -table JSONPatchOperation { - op: string; - path: string; - from: string; - /** Can be any JSON type. It is stored here as a serialized JSON string. */ - value: string; -} - -table Delta { - base: VersionBase; - patch_string: [JSONPatchOperation] (deprecated); - size_bytes: long; - - /** Compressed binary data for the delta (zlib). When present, patch is ignored. */ - patch: [ubyte]; -} - -table VersionGraphMetadata { - last_pruned: long; - total_size: long; -} - -table VersionGraph { - /** The ID of the user-designated checkpoint version. */ - user_checkpoint_version_id: string; - /** The ID of the latest version in the graph. */ - latest_version_id: string; - /** An array of all checkpoint versions. */ - checkpoints: [Checkpoint]; - /** An array of all delta versions (patches). */ - deltas: [Delta]; - metadata: VersionGraphMetadata; -} - -/** - * ============================================================================= - * EXTERNAL FILES - * ============================================================================= - */ - -table DucExternalFileData { - mime_type: string; - id: string (key); - /** The base64 encoded data URL of the file. This is the actual file content. */ - data: [ubyte]; - /** Epoch timestamp in milliseconds when the file was created. */ - created: long; - /** - * Epoch timestamp in milliseconds when the file was last retrieved from storage to be loaded onto the scene. - * We use this flag to determine whether to delete unused files from storage. - */ - last_retrieved: long = null; -} - -table DucExternalFileEntry { - key: string (key); - value: DucExternalFileData; -} - -/** - * ============================================================================= - * ROOT TYPE - * ============================================================================= - */ - -/** Root data structure for the stored data state */ -table ExportedDataState { - /** Untouchable fields even on Breaking Versions. */ - type: string; - version_legacy: int; - source: string; - version: string; - // - - thumbnail: [ubyte]; - dictionary: [DictionaryEntry]; - - elements: [ElementWrapper]; - blocks: [DucBlock]; - groups: [DucGroup]; - regions: [DucRegion]; - layers: [DucLayer]; - standards: [Standard]; - - /** The user's current session state for a specific project */ - duc_local_state: DucLocalState; - /** Project-wide settings that are saved with the document and shared by all users */ - duc_global_state: DucGlobalState; - - external_files: [DucExternalFileEntry]; - - /** In case it is needed to embed the version control into the file format */ - version_graph: VersionGraph; - - /** Actual file id */ - id: string; - - blockInstances: [DucBlockInstance]; - blockCollections: [DucBlockCollection]; -} - -root_type ExportedDataState; \ No newline at end of file diff --git a/schema/duc.sql b/schema/duc.sql new file mode 100644 index 00000000..b51df1c6 --- /dev/null +++ b/schema/duc.sql @@ -0,0 +1,827 @@ +-- "DUC_" in ASCII +-- Apply in order: duc.sql → version_control.sql → search.sql +PRAGMA application_id = 1146569567; +PRAGMA user_version = 3000000; +PRAGMA journal_mode = WAL; +PRAGMA foreign_keys = ON; +PRAGMA synchronous = NORMAL; + + +-- =========================================================================== +-- ENUM REFERENCE (integer codes stored in columns) +-- =========================================================================== +-- VERTICAL_ALIGN: TOP=10, MIDDLE=11, BOTTOM=12 +-- TEXT_ALIGN: LEFT=10, CENTER=11, RIGHT=12 +-- LINE_SPACING_TYPE: AT_LEAST=10, EXACTLY=11, MULTIPLE=12 +-- STROKE_PLACEMENT: INSIDE=10, CENTER=11, OUTSIDE=12 +-- STROKE_PREFERENCE: SOLID=10, DASHED=11, DOTTED=12, CUSTOM=13 +-- STROKE_SIDE_PREFERENCE: TOP=10, BOTTOM=11, LEFT=12, RIGHT=13, CUSTOM=14, ALL=15 +-- STROKE_CAP: BUTT=10, ROUND=11, SQUARE=12 +-- STROKE_JOIN: MITER=10, ROUND=11, BEVEL=12 +-- LINE_HEAD: ARROW=10, BAR=11, CIRCLE=12, CIRCLE_OUTLINED=13, +-- TRIANGLE=14, TRIANGLE_OUTLINED=15, DIAMOND=16, +-- DIAMOND_OUTLINED=17, CROSS=18, OPEN_ARROW=19, +-- REVERSED_ARROW=20, REVERSED_TRIANGLE=21, +-- REVERSED_TRIANGLE_OUTLINED=22, CONE=23, HALF_CONE=24 +-- BEZIER_MIRRORING: NONE=10, ANGLE=11, ANGLE_LENGTH=12 +-- BLENDING: MULTIPLY=11, SCREEN=12, OVERLAY=13, DARKEN=14, +-- LIGHTEN=15, DIFFERENCE=16, EXCLUSION=17 +-- ELEMENT_CONTENT_PREF: SOLID=12, FILL=14, FIT=15, TILE=16, STRETCH=17, HATCH=18 +-- HATCH_STYLE: NORMAL=10, OUTER=11, IGNORE=12 +-- IMAGE_STATUS: PENDING=10, SAVED=11, ERROR=12 +-- PRUNING_LEVEL: CONSERVATIVE=10, BALANCED=20, AGGRESSIVE=30 +-- BOOLEAN_OPERATION: UNION=10, SUBTRACT=11, INTERSECT=12, EXCLUDE=13 +-- ELEMENT_TYPE (text): rectangle, ellipse, polygon, table, text, line, +-- arrow, freedraw, image, frame, plot, doc, model, +-- embeddable, pdf + + +-- =========================================================================== +-- DOCUMENT STATE +-- =========================================================================== + +-- Project-wide settings shared by all users, saved with the document. +CREATE TABLE duc_global_state ( + id INTEGER PRIMARY KEY CHECK (id = 1), + name TEXT, -- drawing name + view_background_color TEXT NOT NULL, -- drawing background color + main_scope TEXT NOT NULL, -- master unit (mm, cm, m, in, ft…) + scope_exponent_threshold INTEGER NOT NULL DEFAULT 3, -- +/- tolerance for scope switching + pruning_level INTEGER NOT NULL DEFAULT 20 -- PRUNING_LEVEL enum +); + +-- Per-user session state (not shared). DucHead fields flattened inline. +-- Current item stroke/background stored in backgrounds/strokes tables with owner_type='local_state'. +CREATE TABLE duc_local_state ( + id INTEGER PRIMARY KEY CHECK (id = 1), + scope TEXT NOT NULL DEFAULT 'mm', -- current unit scope (mm, cm, m, in, ft…) + scroll_x REAL NOT NULL DEFAULT 0.0, + scroll_y REAL NOT NULL DEFAULT 0.0, + zoom REAL NOT NULL DEFAULT 1.0, + is_binding_enabled INTEGER NOT NULL DEFAULT 1, + current_item_opacity REAL NOT NULL DEFAULT 1.0, + current_item_font_family TEXT NOT NULL DEFAULT 'Roboto Mono', + current_item_font_size REAL NOT NULL DEFAULT 20.0, + current_item_text_align INTEGER NOT NULL DEFAULT 10, -- TEXT_ALIGN + current_item_roundness REAL NOT NULL DEFAULT 0.0, + -- DucHead for start_line_head (flattened, all NULL = no head) + start_head_type INTEGER, -- LINE_HEAD enum + start_head_block_id TEXT, -- block id if head is a block + start_head_size REAL, + -- DucHead for end_line_head (flattened) + end_head_type INTEGER, + end_head_block_id TEXT, + end_head_size REAL, + -- Mode flags + pen_mode INTEGER NOT NULL DEFAULT 0, -- better pen input + view_mode_enabled INTEGER NOT NULL DEFAULT 0, -- read-only canvas + objects_snap_mode_enabled INTEGER NOT NULL DEFAULT 1, -- object snapping + grid_mode_enabled INTEGER NOT NULL DEFAULT 1, -- grid visibility + outline_mode_enabled INTEGER NOT NULL DEFAULT 0, -- disable fill on all shapes + manual_save_mode INTEGER NOT NULL DEFAULT 0, -- manual version graph updates + decimal_places INTEGER NOT NULL DEFAULT 2 +); + + +-- =========================================================================== +-- DOCUMENT METADATA +-- =========================================================================== + +-- Root document metadata (ExportedDataState top-level fields). +CREATE TABLE duc_document ( + id TEXT PRIMARY KEY, -- actual file id + version TEXT NOT NULL, -- format version string + source TEXT NOT NULL, -- originating application + data_type TEXT NOT NULL, -- file data type identifier + thumbnail BLOB -- binary thumbnail image +) WITHOUT ROWID; + +-- Key-value string dictionary for the document. +CREATE TABLE document_dictionary ( + key TEXT PRIMARY KEY, + value TEXT NOT NULL +) WITHOUT ROWID; + + +-- =========================================================================== +-- STACK-LIKE PROPERTIES (shared base for layers, groups, regions) +-- =========================================================================== +-- Class-table inheritance: each container stores its shared display/visibility +-- properties here; type-specific columns live in the child table. +-- To delete a container, DELETE FROM stack_properties WHERE id = ?; +-- this cascades to the child table (layers/groups/regions). + +CREATE TABLE stack_properties ( + id TEXT PRIMARY KEY, + label TEXT NOT NULL DEFAULT '', + description TEXT, + is_collapsed INTEGER NOT NULL DEFAULT 0, + is_plot INTEGER NOT NULL DEFAULT 0, + is_visible INTEGER NOT NULL DEFAULT 1, + locked INTEGER NOT NULL DEFAULT 0, + opacity REAL NOT NULL DEFAULT 1.0 +) WITHOUT ROWID; + +CREATE INDEX idx_stack_properties_label ON stack_properties(label); + + +-- =========================================================================== +-- LAYERS +-- =========================================================================== + +-- Drawing layers. Elements reference their layer via layer_id. +-- Override stroke/background stored in backgrounds/strokes tables with owner_type='layer'. +-- Shared display properties (label, visibility, opacity …) in stack_properties (same id). +CREATE TABLE layers ( + id TEXT PRIMARY KEY REFERENCES stack_properties(id) ON DELETE CASCADE, + readonly INTEGER NOT NULL DEFAULT 0 +) WITHOUT ROWID; + + +-- =========================================================================== +-- GROUPS & REGIONS +-- =========================================================================== + +-- Groups: logical grouping of elements. Elements reference via element_group_memberships. +-- Shared display properties in stack_properties (same id). +CREATE TABLE groups ( + id TEXT PRIMARY KEY REFERENCES stack_properties(id) ON DELETE CASCADE +) WITHOUT ROWID; + +-- Regions: boolean-operation grouping. Elements reference via element_region_memberships. +-- Shared display properties in stack_properties (same id). +CREATE TABLE regions ( + id TEXT PRIMARY KEY REFERENCES stack_properties(id) ON DELETE CASCADE, + boolean_operation INTEGER NOT NULL -- BOOLEAN_OPERATION: UNION=10, SUBTRACT=11, INTERSECT=12, EXCLUDE=13 +) WITHOUT ROWID; + + +-- =========================================================================== +-- BLOCKS (reusable component definitions, instances, collections) +-- =========================================================================== + +-- DucBlockMetadata: shared metadata for blocks and block collections. +-- Uses polymorphic owner pattern (consistent with backgrounds/strokes). +-- owner_type: 'block' → owner_id = blocks.id +-- 'collection' → owner_id = block_collections.id +CREATE TABLE block_metadata ( + owner_type TEXT NOT NULL, + owner_id TEXT NOT NULL, + source TEXT, -- origin source + usage_count INTEGER NOT NULL DEFAULT 0, + created_at INTEGER NOT NULL, -- epoch ms + updated_at INTEGER NOT NULL, -- epoch ms + localization JSONB, -- JSON string: Record + thumbnail BLOB, -- binary thumbnail + PRIMARY KEY (owner_type, owner_id) +) WITHOUT ROWID; + +-- Block definitions (reusable components). +-- Metadata (source, timestamps, localization, thumbnail) in block_metadata with owner_type='block'. +CREATE TABLE blocks ( + id TEXT PRIMARY KEY, + label TEXT NOT NULL DEFAULT '', + description TEXT, + version INTEGER NOT NULL DEFAULT 1 +); -- no WITHOUT ROWID: implicit integer rowid needed for FTS5 content sync + +CREATE INDEX idx_blocks_label ON blocks(label); + +-- Block instances placed on the canvas. +CREATE TABLE block_instances ( + id TEXT PRIMARY KEY, + block_id TEXT NOT NULL REFERENCES blocks(id), + version INTEGER NOT NULL DEFAULT 1, -- should match block's version + -- DucBlockDuplicationArray flattened (NULL if no array): + dup_rows INTEGER, + dup_cols INTEGER, + dup_row_spacing REAL, + dup_col_spacing REAL +) WITHOUT ROWID; + +CREATE INDEX idx_block_instances_block ON block_instances(block_id); + +-- Per-instance element overrides (Vec). +CREATE TABLE block_instance_overrides ( + instance_id TEXT NOT NULL REFERENCES block_instances(id) ON DELETE CASCADE, + key TEXT NOT NULL, + value TEXT NOT NULL, + PRIMARY KEY (instance_id, key) +) WITHOUT ROWID; + +-- Hierarchical block collections (folders of blocks or nested collections). +-- Metadata (source, timestamps, localization, thumbnail) in block_metadata with owner_type='collection'. +CREATE TABLE block_collections ( + id TEXT PRIMARY KEY, + label TEXT NOT NULL DEFAULT '' +) WITHOUT ROWID; + +CREATE INDEX idx_block_collections_label ON block_collections(label); + +-- Children of a block collection (block or nested collection reference). +CREATE TABLE block_collection_entries ( + collection_id TEXT NOT NULL REFERENCES block_collections(id), + child_id TEXT NOT NULL, -- id of block or sub-collection + is_collection INTEGER NOT NULL DEFAULT 0, + PRIMARY KEY (collection_id, child_id) +) WITHOUT ROWID; + +CREATE INDEX idx_block_collection_entries_child ON block_collection_entries(child_id); + + +-- =========================================================================== +-- CONTENT STYLING: BACKGROUNDS & STROKES (polymorphic owner pattern) +-- =========================================================================== +-- These two tables hold ALL background and stroke content across the schema. +-- owner_type identifies the parent context; owner_id is the PK of the owning row. +-- +-- owner_type values: +-- 'element' → owner_id = elements.id (many per element, ordered by sort_order) +-- 'path_override' → owner_id = linear_path_overrides.id (at most one per path override) +-- 'layer' → owner_id = layers.id (at most one per layer, for override) +-- 'local_state' → owner_id = '1' (at most one, current item default) + +-- ElementBackground: wraps ElementContentBase. +CREATE TABLE backgrounds ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + owner_type TEXT NOT NULL, + owner_id TEXT NOT NULL, + sort_order INTEGER NOT NULL DEFAULT 0, + -- ElementContentBase + preference INTEGER, -- ELEMENT_CONTENT_PREFERENCE + src TEXT NOT NULL DEFAULT '', -- color, gradient, image, fileId, url, @el/${id} + visible INTEGER NOT NULL DEFAULT 1, + opacity REAL NOT NULL DEFAULT 1.0, + -- TilingProperties (all NULL = no tiling) + tiling_size_in_percent REAL, + tiling_angle REAL, + tiling_spacing REAL, + tiling_offset_x REAL, + tiling_offset_y REAL, + -- DucHatchStyle (hatch_style NULL = no hatch) + hatch_style INTEGER, -- HATCH_STYLE + hatch_pattern_name TEXT, + hatch_pattern_scale REAL, + hatch_pattern_angle REAL, + hatch_pattern_origin_x REAL, + hatch_pattern_origin_y REAL, + hatch_pattern_origin_mirror INTEGER, -- BEZIER_MIRRORING + hatch_pattern_double INTEGER, + hatch_custom_pattern_name TEXT, -- CustomHatchPattern.name (NULL = predefined) + hatch_custom_pattern_desc TEXT, -- CustomHatchPattern.description + -- DucImageFilter (all NULL = no filter) + image_filter_brightness REAL, + image_filter_contrast REAL +); + +CREATE INDEX idx_backgrounds_owner ON backgrounds(owner_type, owner_id); +CREATE INDEX idx_backgrounds_src ON backgrounds(src) WHERE src != ''; + +-- ElementStroke: wraps ElementContentBase + stroke-specific fields. +CREATE TABLE strokes ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + owner_type TEXT NOT NULL, + owner_id TEXT NOT NULL, + sort_order INTEGER NOT NULL DEFAULT 0, + -- ElementContentBase (same as backgrounds) + preference INTEGER, -- ELEMENT_CONTENT_PREFERENCE + src TEXT NOT NULL DEFAULT '', + visible INTEGER NOT NULL DEFAULT 1, + opacity REAL NOT NULL DEFAULT 1.0, + tiling_size_in_percent REAL, + tiling_angle REAL, + tiling_spacing REAL, + tiling_offset_x REAL, + tiling_offset_y REAL, + hatch_style INTEGER, + hatch_pattern_name TEXT, + hatch_pattern_scale REAL, + hatch_pattern_angle REAL, + hatch_pattern_origin_x REAL, + hatch_pattern_origin_y REAL, + hatch_pattern_origin_mirror INTEGER, + hatch_pattern_double INTEGER, + hatch_custom_pattern_name TEXT, + hatch_custom_pattern_desc TEXT, + image_filter_brightness REAL, + image_filter_contrast REAL, + -- Stroke-specific + width REAL NOT NULL DEFAULT 1.0, + -- StrokeStyle + style_preference INTEGER, -- STROKE_PREFERENCE + style_cap INTEGER, -- STROKE_CAP + style_join INTEGER, -- STROKE_JOIN + style_dash BLOB, -- packed f64 array (dash pattern) + style_dash_line_override TEXT, -- DucBlockInstance id to override dash shape + style_dash_cap INTEGER, -- STROKE_CAP for dash ends + style_miter_limit REAL, + -- Placement + placement INTEGER, -- STROKE_PLACEMENT + -- StrokeSides + sides_preference INTEGER, -- STROKE_SIDE_PREFERENCE + sides_values BLOB -- packed f64 array: [x,y] or [top,bottom,left,right] +); + +CREATE INDEX idx_strokes_owner ON strokes(owner_type, owner_id); +CREATE INDEX idx_strokes_src ON strokes(src) WHERE src != ''; + +-- Lines within a CustomHatchPattern (belongs to a background or stroke row). +-- owner_type: 'background' → owner_id = backgrounds.id +-- 'stroke' → owner_id = strokes.id +CREATE TABLE hatch_pattern_lines ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + owner_type TEXT NOT NULL, -- 'background' or 'stroke' + owner_id INTEGER NOT NULL, -- backgrounds.id or strokes.id + sort_order INTEGER NOT NULL DEFAULT 0, + angle REAL NOT NULL DEFAULT 0.0, -- line angle in radians + origin_x REAL NOT NULL DEFAULT 0.0, -- line origin point + origin_y REAL NOT NULL DEFAULT 0.0, + origin_mirroring INTEGER, -- BEZIER_MIRRORING + offset_x REAL NOT NULL DEFAULT 0.0, -- offset between parallel lines + offset_y REAL NOT NULL DEFAULT 0.0, + dash_pattern BLOB -- packed f64 array; NULL/empty = solid +); + +CREATE INDEX idx_hatch_lines_owner ON hatch_pattern_lines(owner_type, owner_id); + + +-- =========================================================================== +-- ELEMENTS (the core scene graph) +-- =========================================================================== + +-- Base table for ALL scene elements. Type-specific data in satellite tables. +-- Backgrounds and strokes stored in backgrounds/strokes tables with owner_type='element'. +CREATE TABLE elements ( + id TEXT PRIMARY KEY, + element_type TEXT NOT NULL, -- rectangle, ellipse, polygon, text, line, arrow, + -- freedraw, image, frame, plot, doc, model, embeddable, pdf + + -- Transform + x REAL NOT NULL DEFAULT 0.0, + y REAL NOT NULL DEFAULT 0.0, + width REAL NOT NULL DEFAULT 0.0, + height REAL NOT NULL DEFAULT 0.0, + angle REAL NOT NULL DEFAULT 0.0, + + -- Metadata + scope TEXT NOT NULL DEFAULT 'mm', -- unit scope (mm, cm, m, in, ft…) + label TEXT NOT NULL DEFAULT '', + description TEXT, + is_visible INTEGER NOT NULL DEFAULT 1, + seed INTEGER NOT NULL DEFAULT 0, -- random seed for shape generation (stable across renders) + version INTEGER NOT NULL DEFAULT 1, -- incremented on each change, for collaboration reconciliation + version_nonce INTEGER NOT NULL DEFAULT 0, -- random nonce for deterministic reconciliation when versions match + updated INTEGER NOT NULL DEFAULT 0, -- epoch ms of last update + "index" TEXT, -- fractional index (rocicorp/fractional-indexing) for multiplayer ordering + + -- Flags + is_plot INTEGER NOT NULL DEFAULT 1, -- visible on plotting + is_deleted INTEGER NOT NULL DEFAULT 0, + + -- Styles (DucElementStylesBase) — backgrounds/strokes in their own tables + roundness REAL NOT NULL DEFAULT 0.0, + blending INTEGER, -- BLENDING enum (NULL = normal) + opacity REAL NOT NULL DEFAULT 1.0, + + -- Relationships + instance_id TEXT REFERENCES block_instances(id), + layer_id TEXT REFERENCES layers(id), + frame_id TEXT, -- frame or plot the element belongs to + + -- Rendering + z_index REAL NOT NULL DEFAULT 0.0, -- stacking order (higher = on top) + link TEXT, + locked INTEGER NOT NULL DEFAULT 0, + custom_data JSONB -- JSON string: arbitrary key-value data +); -- no WITHOUT ROWID: implicit integer rowid needed for FTS5 content sync + +CREATE INDEX idx_elements_type ON elements(element_type); +CREATE INDEX idx_elements_layer ON elements(layer_id); +CREATE INDEX idx_elements_frame ON elements(frame_id); +CREATE INDEX idx_elements_instance ON elements(instance_id); +CREATE INDEX idx_elements_deleted ON elements(is_deleted); +CREATE INDEX idx_elements_updated ON elements(updated); +CREATE INDEX idx_elements_z_index ON elements(z_index); +CREATE INDEX idx_elements_label ON elements(label) WHERE label != ''; +CREATE INDEX idx_elements_scope ON elements(scope); +-- Spatial bounding-box index for rectangle-range queries on non-deleted elements +CREATE INDEX idx_elements_spatial ON elements(x, y, width, height) WHERE is_deleted = 0; + + +-- =========================================================================== +-- ELEMENT RELATIONSHIP TABLES +-- =========================================================================== + +-- Groups the element belongs to (Vec group_ids, deepest→shallowest). +CREATE TABLE element_group_memberships ( + element_id TEXT NOT NULL REFERENCES elements(id) ON DELETE CASCADE, + group_id TEXT NOT NULL REFERENCES groups(id), + sort_order INTEGER NOT NULL DEFAULT 0, -- 0 = deepest + PRIMARY KEY (element_id, group_id) +) WITHOUT ROWID; + +CREATE INDEX idx_elem_groups_group ON element_group_memberships(group_id); + +-- Blocks this element helps define (Vec block_ids). +-- Mutually exclusive with instance_id on the element. +CREATE TABLE element_block_memberships ( + element_id TEXT NOT NULL REFERENCES elements(id) ON DELETE CASCADE, + block_id TEXT NOT NULL REFERENCES blocks(id), + sort_order INTEGER NOT NULL DEFAULT 0, + PRIMARY KEY (element_id, block_id) +) WITHOUT ROWID; + +CREATE INDEX idx_elem_blocks_block ON element_block_memberships(block_id); + +-- Regions the element belongs to (Vec region_ids, deepest→shallowest). +CREATE TABLE element_region_memberships ( + element_id TEXT NOT NULL REFERENCES elements(id) ON DELETE CASCADE, + region_id TEXT NOT NULL REFERENCES regions(id), + sort_order INTEGER NOT NULL DEFAULT 0, + PRIMARY KEY (element_id, region_id) +) WITHOUT ROWID; + +CREATE INDEX idx_elem_regions_region ON element_region_memberships(region_id); + +-- Other elements bound to this element (auto-updated on transform mutations). +CREATE TABLE element_bound_elements ( + element_id TEXT NOT NULL REFERENCES elements(id) ON DELETE CASCADE, + bound_element_id TEXT NOT NULL, -- id of the bound element + bound_type TEXT NOT NULL, -- element_type of the bound element + sort_order INTEGER NOT NULL DEFAULT 0, + PRIMARY KEY (element_id, bound_element_id) +) WITHOUT ROWID; + +CREATE INDEX idx_bound_elements_bound ON element_bound_elements(bound_element_id); + + +-- =========================================================================== +-- ELEMENT TYPE EXTENSIONS (satellite tables) +-- =========================================================================== + +-- Polygon-specific fields. +CREATE TABLE element_polygon ( + element_id TEXT PRIMARY KEY REFERENCES elements(id) ON DELETE CASCADE, + sides INTEGER NOT NULL DEFAULT 5 -- number of polygon sides +) WITHOUT ROWID; + +-- Ellipse-specific fields. +CREATE TABLE element_ellipse ( + element_id TEXT PRIMARY KEY REFERENCES elements(id) ON DELETE CASCADE, + ratio REAL NOT NULL DEFAULT 1.0, -- aspect ratio + start_angle REAL NOT NULL DEFAULT 0.0, -- arc start (radians) + end_angle REAL NOT NULL DEFAULT 6.283185307, -- arc end (2π) + show_aux_crosshair INTEGER NOT NULL DEFAULT 0 +) WITHOUT ROWID; + +-- Text element (DucTextElement + DucTextStyle flattened). +CREATE TABLE element_text ( + element_id TEXT PRIMARY KEY REFERENCES elements(id) ON DELETE CASCADE, + -- Content + text TEXT NOT NULL DEFAULT '', -- display text, may contain {{tag}} placeholders + original_text TEXT NOT NULL DEFAULT '', -- pre-edit version + auto_resize INTEGER NOT NULL DEFAULT 1, -- 1=width adjusts to content, 0=wraps to fixed width + container_id TEXT, -- parent element (e.g. label on shape) + -- DucTextStyle + is_ltr INTEGER NOT NULL DEFAULT 1, -- 1=left-to-right, 0=right-to-left + font_family TEXT NOT NULL DEFAULT 'Roboto Mono', + big_font_family TEXT NOT NULL DEFAULT 'sans-serif', -- fallback for emoji/non-latin + text_align INTEGER NOT NULL DEFAULT 10, -- TEXT_ALIGN + vertical_align INTEGER NOT NULL DEFAULT 10, -- VERTICAL_ALIGN + line_height REAL NOT NULL DEFAULT 1.2, -- unitless multiplier: px = fontSize × lineHeight + line_spacing_value REAL NOT NULL DEFAULT 1.2, -- LineSpacing.value (interpretation depends on type) + line_spacing_type INTEGER, -- LINE_SPACING_TYPE (NULL = default) + oblique_angle REAL NOT NULL DEFAULT 0.0, -- italic angle (radians, +right/-left) + font_size REAL NOT NULL DEFAULT 20.0, -- text height in drawing units (capital letter height) + width_factor REAL NOT NULL DEFAULT 1.0, -- char width as ratio of text height + is_upside_down INTEGER NOT NULL DEFAULT 0, + is_backwards INTEGER NOT NULL DEFAULT 0 -- render mirrored +); -- no WITHOUT ROWID: implicit integer rowid needed for FTS5 content sync + +CREATE INDEX idx_element_text_container ON element_text(container_id); +CREATE INDEX idx_element_text_font_family ON element_text(font_family); + +-- Linear element (shared by line + arrow). Points, lines, paths in child tables. +-- Bindings and last_committed_point flattened inline. +CREATE TABLE element_linear ( + element_id TEXT PRIMARY KEY REFERENCES elements(id) ON DELETE CASCADE, + -- Last committed point (flattened DucPoint, all NULL = none) + last_committed_point_x REAL, + last_committed_point_y REAL, + last_committed_point_mirror INTEGER, -- BEZIER_MIRRORING + -- Start binding (flattened DucPointBinding, element_id NULL = no binding) + start_binding_element_id TEXT, -- bound element + start_binding_focus REAL, -- -1..1: position along bound edge + start_binding_gap REAL, -- gap distance + start_binding_fixed_point_x REAL, -- normalized [0..1] override for focus + start_binding_fixed_point_y REAL, + start_binding_point_index INTEGER, -- PointBindingPoint.index + start_binding_point_offset REAL, -- PointBindingPoint.offset (-1..1) + start_binding_head_type INTEGER, -- LINE_HEAD + start_binding_head_block_id TEXT, -- block id if head is a block + start_binding_head_size REAL, + -- End binding (same structure) + end_binding_element_id TEXT, + end_binding_focus REAL, + end_binding_gap REAL, + end_binding_fixed_point_x REAL, + end_binding_fixed_point_y REAL, + end_binding_point_index INTEGER, + end_binding_point_offset REAL, + end_binding_head_type INTEGER, + end_binding_head_block_id TEXT, + end_binding_head_size REAL, + -- Line-specific + wipeout_below INTEGER NOT NULL DEFAULT 0, -- wipe content below (line only) + -- Arrow-specific + elbowed INTEGER NOT NULL DEFAULT 0 -- right-angle routing (arrow only) +) WITHOUT ROWID; + +CREATE INDEX idx_linear_start_binding ON element_linear(start_binding_element_id) + WHERE start_binding_element_id IS NOT NULL; +CREATE INDEX idx_linear_end_binding ON element_linear(end_binding_element_id) + WHERE end_binding_element_id IS NOT NULL; + +-- Points on a linear element (Vec). +CREATE TABLE linear_element_points ( + element_id TEXT NOT NULL REFERENCES elements(id) ON DELETE CASCADE, + sort_order INTEGER NOT NULL, -- preserves array ordering + x REAL NOT NULL, + y REAL NOT NULL, + mirroring INTEGER, -- BEZIER_MIRRORING (only meaningful if point at junction of 2 lines) + PRIMARY KEY (element_id, sort_order) +) WITHOUT ROWID; + +-- Line segments between points on a linear element (Vec). +CREATE TABLE linear_element_lines ( + element_id TEXT NOT NULL REFERENCES elements(id) ON DELETE CASCADE, + sort_order INTEGER NOT NULL, + start_index INTEGER NOT NULL, -- index into linear_element_points + start_handle_x REAL, -- bezier handle (NULL = no handle) + start_handle_y REAL, + end_index INTEGER NOT NULL, + end_handle_x REAL, + end_handle_y REAL, + PRIMARY KEY (element_id, sort_order) +) WITHOUT ROWID; + +-- Path overrides on a linear element (Vec). +-- Background/stroke overrides stored in backgrounds/strokes tables with owner_type='path_override'. +CREATE TABLE linear_path_overrides ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + element_id TEXT NOT NULL REFERENCES elements(id) ON DELETE CASCADE, + sort_order INTEGER NOT NULL +); + +CREATE INDEX idx_path_overrides_element ON linear_path_overrides(element_id); + +-- Line indices belonging to each path override. +CREATE TABLE linear_path_override_indices ( + path_override_id INTEGER NOT NULL REFERENCES linear_path_overrides(id) ON DELETE CASCADE, + sort_order INTEGER NOT NULL, + line_index INTEGER NOT NULL, -- index into linear_element_lines + PRIMARY KEY (path_override_id, sort_order) +) WITHOUT ROWID; + +-- Image element (DucImageElement). Scale, crop, filter flattened. +CREATE TABLE element_image ( + element_id TEXT PRIMARY KEY REFERENCES elements(id) ON DELETE CASCADE, + file_id TEXT, -- reference to external_files + status INTEGER NOT NULL DEFAULT 10, -- IMAGE_STATUS: PENDING=10, SAVED=11, ERROR=12 + -- Scale (Vec of length 2, used for axis flipping) + scale_x REAL NOT NULL DEFAULT 1.0, + scale_y REAL NOT NULL DEFAULT 1.0, + -- ImageCrop (all NULL = no crop) + crop_x REAL, + crop_y REAL, + crop_width REAL, + crop_height REAL, + crop_natural_width REAL, + crop_natural_height REAL, + -- DucImageFilter (all NULL = no filter) + filter_brightness REAL, + filter_contrast REAL +) WITHOUT ROWID; + +CREATE INDEX idx_element_image_file ON element_image(file_id); +CREATE INDEX idx_element_image_status ON element_image(status); + +-- FreeDraw element (DucFreeDrawElement). Points in child table. +-- Start/end/last_committed_point flattened. Pressures stored as binary BLOB. +CREATE TABLE element_freedraw ( + element_id TEXT PRIMARY KEY REFERENCES elements(id) ON DELETE CASCADE, + size REAL NOT NULL DEFAULT 2.0, + thinning REAL NOT NULL DEFAULT 0.6, + smoothing REAL NOT NULL DEFAULT 0.5, + streamline REAL NOT NULL DEFAULT 0.5, + easing TEXT NOT NULL DEFAULT 'easeOutSine', -- key mapping to easing fn + -- DucFreeDrawEnds start (all NULL = no start config) + start_cap INTEGER, + start_taper REAL, + start_easing TEXT, + -- DucFreeDrawEnds end + end_cap INTEGER, + end_taper REAL, + end_easing TEXT, + -- Pressure data + pressures BLOB, -- packed f32 array (binary pressure readings) + simulate_pressure INTEGER NOT NULL DEFAULT 1, + -- Last committed point (flattened DucPoint) + last_committed_point_x REAL, + last_committed_point_y REAL, + last_committed_point_mirror INTEGER, -- BEZIER_MIRRORING + -- Cached rendering + svg_path TEXT -- cached SVG path string +) WITHOUT ROWID; + +-- Points on a freedraw element (Vec). +CREATE TABLE freedraw_element_points ( + element_id TEXT NOT NULL REFERENCES elements(id) ON DELETE CASCADE, + sort_order INTEGER NOT NULL, + x REAL NOT NULL, + y REAL NOT NULL, + mirroring INTEGER, -- BEZIER_MIRRORING + PRIMARY KEY (element_id, sort_order) +) WITHOUT ROWID; + +-- Shared DucStackElementBase for element-based containers (frames, plots, viewports). +-- Each stack-like element gets one row here; type-specific columns live in child tables. +CREATE TABLE element_stack_properties ( + element_id TEXT PRIMARY KEY REFERENCES elements(id) ON DELETE CASCADE, + label TEXT NOT NULL DEFAULT '', + description TEXT, + is_collapsed INTEGER NOT NULL DEFAULT 0, + is_plot INTEGER NOT NULL DEFAULT 1, + is_visible INTEGER NOT NULL DEFAULT 1, + locked INTEGER NOT NULL DEFAULT 0, + opacity REAL NOT NULL DEFAULT 1.0, + clip INTEGER NOT NULL DEFAULT 0, + label_visible INTEGER NOT NULL DEFAULT 1 +) WITHOUT ROWID; + +-- Frame element (DucFrameElement). +-- All shared stack fields live in element_stack_properties. +-- This table reserves a place for future frame-only columns. +CREATE TABLE element_frame ( + element_id TEXT PRIMARY KEY REFERENCES element_stack_properties(element_id) ON DELETE CASCADE +) WITHOUT ROWID; + +-- Plot element (DucPlotElement). +-- Shared stack fields in element_stack_properties; only margins here. +CREATE TABLE element_plot ( + element_id TEXT PRIMARY KEY REFERENCES element_stack_properties(element_id) ON DELETE CASCADE, + margin_top REAL NOT NULL DEFAULT 0.0, + margin_right REAL NOT NULL DEFAULT 0.0, + margin_bottom REAL NOT NULL DEFAULT 0.0, + margin_left REAL NOT NULL DEFAULT 0.0 +) WITHOUT ROWID; + +-- Shared DocumentGridConfig for document-like elements (PDF, doc). +-- One row per element that needs grid layout + file reference. +CREATE TABLE document_grid_config ( + element_id TEXT PRIMARY KEY REFERENCES elements(id) ON DELETE CASCADE, + file_id TEXT, + grid_columns INTEGER NOT NULL DEFAULT 1, -- 1=single, 2=two-up, n=grid + grid_gap_x REAL NOT NULL DEFAULT 0.0, -- horizontal spacing (px) + grid_gap_y REAL NOT NULL DEFAULT 0.0, -- vertical spacing (px) + grid_first_page_alone INTEGER NOT NULL DEFAULT 0, -- cover page behavior for 2+ cols + grid_scale REAL NOT NULL DEFAULT 1.0 -- DU/real ratio (1:300→0.00333, 1:1→1, 5:1→5) +) WITHOUT ROWID; + +CREATE INDEX idx_doc_grid_config_file ON document_grid_config(file_id); + +-- PDF element (DucPdfElement). +-- Grid config and file reference stored in document_grid_config. +-- This table reserves a place for future PDF-only columns. +CREATE TABLE element_pdf ( + element_id TEXT PRIMARY KEY REFERENCES document_grid_config(element_id) ON DELETE CASCADE +) WITHOUT ROWID; + +-- Doc element (DucDocElement). +-- Grid config and file reference stored in document_grid_config. +CREATE TABLE element_doc ( + element_id TEXT PRIMARY KEY REFERENCES document_grid_config(element_id) ON DELETE CASCADE, + text TEXT NOT NULL DEFAULT '' +); -- no WITHOUT ROWID: implicit integer rowid needed for FTS5 content sync + +-- Table element. Source of truth is the linked xlsx file. +CREATE TABLE element_table ( + element_id TEXT PRIMARY KEY REFERENCES elements(id) ON DELETE CASCADE, + file_id TEXT -- reference to external xlsx file +) WITHOUT ROWID; + +CREATE INDEX idx_element_table_file ON element_table(file_id); + +-- Model element (3D parametric, DucModelElement). file_ids in child table. +-- Viewer state stored in model_viewer_state table. +CREATE TABLE element_model ( + element_id TEXT PRIMARY KEY REFERENCES elements(id) ON DELETE CASCADE, + model_type TEXT, -- e.g. PYTHON, DXF, IFC, STL, OBJ, STEP + code TEXT, -- build123d python source code + svg_path TEXT -- cached SVG for canvas rendering +); -- no WITHOUT ROWID: implicit integer rowid needed for FTS5 content sync + +CREATE INDEX idx_element_model_type ON element_model(model_type); + +-- 3D viewer state for a model element (Viewer3DState, all sub-structs flattened). +-- At most one row per model element. +CREATE TABLE model_viewer_state ( + element_id TEXT PRIMARY KEY REFERENCES elements(id) ON DELETE CASCADE, + -- Viewer3DCamera + camera_control TEXT NOT NULL DEFAULT 'orbit', -- 'orbit' | 'trackball' + camera_ortho INTEGER NOT NULL DEFAULT 0, + camera_up TEXT NOT NULL DEFAULT 'Z', -- 'Z' | 'Y' + camera_position_x REAL NOT NULL DEFAULT 0.0, + camera_position_y REAL NOT NULL DEFAULT 0.0, + camera_position_z REAL NOT NULL DEFAULT 0.0, + camera_quaternion_x REAL NOT NULL DEFAULT 0.0, + camera_quaternion_y REAL NOT NULL DEFAULT 0.0, + camera_quaternion_z REAL NOT NULL DEFAULT 0.0, + camera_quaternion_w REAL NOT NULL DEFAULT 1.0, + camera_target_x REAL NOT NULL DEFAULT 0.0, + camera_target_y REAL NOT NULL DEFAULT 0.0, + camera_target_z REAL NOT NULL DEFAULT 0.0, + camera_zoom REAL NOT NULL DEFAULT 1.0, + camera_pan_speed REAL NOT NULL DEFAULT 1.0, + camera_rotate_speed REAL NOT NULL DEFAULT 1.0, + camera_zoom_speed REAL NOT NULL DEFAULT 1.0, + camera_holroyd INTEGER NOT NULL DEFAULT 0, + -- Viewer3DDisplay + display_wireframe INTEGER NOT NULL DEFAULT 0, + display_transparent INTEGER NOT NULL DEFAULT 0, + display_black_edges INTEGER NOT NULL DEFAULT 0, + display_grid_uniform INTEGER, -- NULL = per-plane mode + display_grid_xy INTEGER NOT NULL DEFAULT 0, -- per-plane: XY visible + display_grid_xz INTEGER NOT NULL DEFAULT 0, -- per-plane: XZ visible + display_grid_yz INTEGER NOT NULL DEFAULT 0, -- per-plane: YZ visible + display_axes_visible INTEGER NOT NULL DEFAULT 0, + display_axes_at_origin INTEGER NOT NULL DEFAULT 0, + -- Viewer3DMaterial + material_metalness REAL NOT NULL DEFAULT 0.0, + material_roughness REAL NOT NULL DEFAULT 0.5, + material_default_opacity REAL NOT NULL DEFAULT 1.0, + material_edge_color INTEGER NOT NULL DEFAULT 0, -- packed RGB (e.g. 0xFFFFFF) + material_ambient_intensity REAL NOT NULL DEFAULT 0.5, + material_direct_intensity REAL NOT NULL DEFAULT 0.5, + -- Viewer3DClipping (x/y/z clip planes) + clip_x_enabled INTEGER NOT NULL DEFAULT 0, + clip_x_value REAL NOT NULL DEFAULT 0.0, + clip_x_normal_x REAL, -- NULL = no custom normal + clip_x_normal_y REAL, + clip_x_normal_z REAL, + clip_y_enabled INTEGER NOT NULL DEFAULT 0, + clip_y_value REAL NOT NULL DEFAULT 0.0, + clip_y_normal_x REAL, + clip_y_normal_y REAL, + clip_y_normal_z REAL, + clip_z_enabled INTEGER NOT NULL DEFAULT 0, + clip_z_value REAL NOT NULL DEFAULT 0.0, + clip_z_normal_x REAL, + clip_z_normal_y REAL, + clip_z_normal_z REAL, + clip_intersection INTEGER NOT NULL DEFAULT 0, + clip_show_planes INTEGER NOT NULL DEFAULT 0, + clip_object_color_caps INTEGER NOT NULL DEFAULT 0, + -- Viewer3DExplode + explode_active INTEGER NOT NULL DEFAULT 0, + explode_value REAL NOT NULL DEFAULT 0.0, + -- Viewer3DZebra + zebra_active INTEGER NOT NULL DEFAULT 0, + zebra_stripe_count INTEGER NOT NULL DEFAULT 10, + zebra_stripe_direction REAL NOT NULL DEFAULT 0.0, + zebra_color_scheme TEXT NOT NULL DEFAULT 'blackwhite', -- 'blackwhite' | 'colorful' | 'grayscale' + zebra_opacity REAL NOT NULL DEFAULT 1.0, + zebra_mapping_mode TEXT NOT NULL DEFAULT 'reflection' -- 'reflection' | 'normal' +) WITHOUT ROWID; + +-- External files connected to a model element (STEP, STL, DXF, etc.). +CREATE TABLE model_element_files ( + element_id TEXT NOT NULL REFERENCES elements(id) ON DELETE CASCADE, + file_id TEXT NOT NULL, + sort_order INTEGER NOT NULL DEFAULT 0, + PRIMARY KEY (element_id, file_id) +) WITHOUT ROWID; + +CREATE INDEX idx_model_files_file ON model_element_files(file_id); + +-- Embeddable element (no extra fields beyond base). +CREATE TABLE element_embeddable ( + element_id TEXT PRIMARY KEY REFERENCES elements(id) ON DELETE CASCADE +) WITHOUT ROWID; + + +-- =========================================================================== +-- EXTERNAL FILES +-- =========================================================================== + +-- Binary files referenced by elements (images, PDFs, xlsx, STEP, etc.). +CREATE TABLE external_files ( + id TEXT PRIMARY KEY, + mime_type TEXT NOT NULL, + data BLOB NOT NULL, -- actual file content bytes + created INTEGER NOT NULL, -- epoch ms + last_retrieved INTEGER, -- epoch ms; NULL if never loaded onto scene + version INTEGER +) WITHOUT ROWID; + +CREATE INDEX idx_external_files_mime ON external_files(mime_type); \ No newline at end of file diff --git a/schema/flatc-duc-generate.sh b/schema/flatc-duc-generate.sh deleted file mode 100755 index 7df0f016..00000000 --- a/schema/flatc-duc-generate.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -# Enable error handling -set -eo pipefail - -# Configure logging -LOG_DIR="../build_logs" -TARGET_DIR="../packages" - -TS_DIR="ducjs/src/flatbuffers" -PY_DIR="ducpy/src/ducpy" -RUST_DIR="ducrs/src/flatbuffers" - -TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S") -mkdir -p "$LOG_DIR" - -# Color setup (only if terminal supports it) -if [ -t 1 ]; then - TS_COLOR="\033[34m" # Dark Blue - PY_COLOR="\033[36m" # Light Blue - RUST_COLOR="\033[38;5;208m" # Orange - SUCCESS_COLOR="\033[32m" # Green - ERROR_COLOR="\033[31m" # Red - RESET="\033[0m" -else - TS_COLOR="" - PY_COLOR="" - RUST_COLOR="" - SUCCESS_COLOR="" - ERROR_COLOR="" - RESET="" -fi - -# Status flags -TS_SUCCESS=false -PY_SUCCESS=false -RUST_SUCCESS=false - - -# Create output directories -mkdir -p $TARGET_DIR/$TS_DIR $TARGET_DIR/$PY_DIR $TARGET_DIR/$RUST_DIR - -# Run builds and capture status -echo "Starting code generation for duc..." -echo "===========================" - -# TypeScript generation -echo "⚙️ Generating TypeScript bindings..." -if flatc --ts --ts-no-import-ext -o $TARGET_DIR/$TS_DIR duc.fbs 2>"$LOG_DIR/ts_$TIMESTAMP.log"; then - TS_SUCCESS=true -fi - -# Python generation -echo "⚙️ Generating Python bindings..." -if flatc --python -o $TARGET_DIR/$PY_DIR duc.fbs 2>"$LOG_DIR/py_$TIMESTAMP.log"; then - PY_SUCCESS=true -fi - -# Rust generation -echo "⚙️ Generating Rust bindings..." -if flatc --rust -o $TARGET_DIR/$RUST_DIR duc.fbs 2>"$LOG_DIR/rust_$TIMESTAMP.log"; then - RUST_SUCCESS=true -fi - -# Summary report with colors -echo "" -echo "Generation Results:" -echo "-------------------" -printf "${TS_COLOR}TypeScript:${RESET} %s\n" "$([ "$TS_SUCCESS" = true ] && echo "✅ Success" || echo "❌ Failed")" -printf "${PY_COLOR}Python: ${RESET} %s\n" "$([ "$PY_SUCCESS" = true ] && echo "✅ Success" || echo "❌ Failed")" -printf "${RUST_COLOR}Rust: ${RESET} %s\n" "$([ "$RUST_SUCCESS" = true ] && echo "✅ Success" || echo "❌ Failed")" - -# Exit with error if any failed -if ! $TS_SUCCESS || ! $PY_SUCCESS || ! $RUST_SUCCESS; then - echo "" - echo -e "${ERROR_COLOR}Error: Some generations failed - check logs in $LOG_DIR/${RESET}" - exit 1 -fi - -echo "" -echo -e "${SUCCESS_COLOR}All generations completed successfully 🎉${RESET}" -exit 0 \ No newline at end of file diff --git a/schema/search.sql b/schema/search.sql new file mode 100644 index 00000000..e943e91d --- /dev/null +++ b/schema/search.sql @@ -0,0 +1,125 @@ +-- =========================================================================== +-- FULL-TEXT SEARCH (FTS5 — auto-synced via triggers) +-- =========================================================================== +-- Uses content= to link FTS virtual tables to source tables. +-- Triggers keep the FTS index automatically in sync on every INSERT/UPDATE/DELETE. +-- No application-level sync needed. +-- +-- Depends on: duc.sql (elements, element_text, element_doc, element_model, blocks) +-- +-- Query examples: +-- SELECT rowid, rank FROM search_elements WHERE search_elements MATCH 'motor'; +-- SELECT rowid, rank FROM search_element_text WHERE search_element_text MATCH 'dimension'; + +-- FTS over element labels and descriptions. +CREATE VIRTUAL TABLE search_elements USING fts5( + label, + description, + content='elements', + content_rowid='rowid' +); + +CREATE TRIGGER trg_elements_ai AFTER INSERT ON elements BEGIN + INSERT INTO search_elements(rowid, label, description) + VALUES (NEW.rowid, NEW.label, NEW.description); +END; +CREATE TRIGGER trg_elements_ad AFTER DELETE ON elements BEGIN + INSERT INTO search_elements(search_elements, rowid, label, description) + VALUES ('delete', OLD.rowid, OLD.label, OLD.description); +END; +CREATE TRIGGER trg_elements_au AFTER UPDATE OF label, description ON elements BEGIN + INSERT INTO search_elements(search_elements, rowid, label, description) + VALUES ('delete', OLD.rowid, OLD.label, OLD.description); + INSERT INTO search_elements(rowid, label, description) + VALUES (NEW.rowid, NEW.label, NEW.description); +END; + +-- FTS over text element content. +CREATE VIRTUAL TABLE search_element_text USING fts5( + text, + original_text, + content='element_text', + content_rowid='rowid' +); + +CREATE TRIGGER trg_element_text_ai AFTER INSERT ON element_text BEGIN + INSERT INTO search_element_text(rowid, text, original_text) + VALUES (NEW.rowid, NEW.text, NEW.original_text); +END; +CREATE TRIGGER trg_element_text_ad AFTER DELETE ON element_text BEGIN + INSERT INTO search_element_text(search_element_text, rowid, text, original_text) + VALUES ('delete', OLD.rowid, OLD.text, OLD.original_text); +END; +CREATE TRIGGER trg_element_text_au AFTER UPDATE OF text, original_text ON element_text BEGIN + INSERT INTO search_element_text(search_element_text, rowid, text, original_text) + VALUES ('delete', OLD.rowid, OLD.text, OLD.original_text); + INSERT INTO search_element_text(rowid, text, original_text) + VALUES (NEW.rowid, NEW.text, NEW.original_text); +END; + +-- FTS over doc element content. +CREATE VIRTUAL TABLE search_element_doc USING fts5( + text, + content='element_doc', + content_rowid='rowid' +); + +CREATE TRIGGER trg_element_doc_ai AFTER INSERT ON element_doc BEGIN + INSERT INTO search_element_doc(rowid, text) + VALUES (NEW.rowid, NEW.text); +END; +CREATE TRIGGER trg_element_doc_ad AFTER DELETE ON element_doc BEGIN + INSERT INTO search_element_doc(search_element_doc, rowid, text) + VALUES ('delete', OLD.rowid, OLD.text); +END; +CREATE TRIGGER trg_element_doc_au AFTER UPDATE OF text ON element_doc BEGIN + INSERT INTO search_element_doc(search_element_doc, rowid, text) + VALUES ('delete', OLD.rowid, OLD.text); + INSERT INTO search_element_doc(rowid, text) + VALUES (NEW.rowid, NEW.text); +END; + +-- FTS over model element source code. +CREATE VIRTUAL TABLE search_element_model USING fts5( + code, + content='element_model', + content_rowid='rowid' +); + +CREATE TRIGGER trg_element_model_ai AFTER INSERT ON element_model BEGIN + INSERT INTO search_element_model(rowid, code) + VALUES (NEW.rowid, NEW.code); +END; +CREATE TRIGGER trg_element_model_ad AFTER DELETE ON element_model BEGIN + INSERT INTO search_element_model(search_element_model, rowid, code) + VALUES ('delete', OLD.rowid, OLD.code); +END; +CREATE TRIGGER trg_element_model_au AFTER UPDATE OF code ON element_model BEGIN + INSERT INTO search_element_model(search_element_model, rowid, code) + VALUES ('delete', OLD.rowid, OLD.code); + INSERT INTO search_element_model(rowid, code) + VALUES (NEW.rowid, NEW.code); +END; + +-- FTS over block labels and descriptions. +CREATE VIRTUAL TABLE search_blocks USING fts5( + label, + description, + content='blocks', + content_rowid='rowid' +); + +CREATE TRIGGER trg_blocks_ai AFTER INSERT ON blocks BEGIN + INSERT INTO search_blocks(rowid, label, description) + VALUES (NEW.rowid, NEW.label, NEW.description); +END; +CREATE TRIGGER trg_blocks_ad AFTER DELETE ON blocks BEGIN + INSERT INTO search_blocks(search_blocks, rowid, label, description) + VALUES ('delete', OLD.rowid, OLD.label, OLD.description); +END; +CREATE TRIGGER trg_blocks_au AFTER UPDATE OF label, description ON blocks BEGIN + INSERT INTO search_blocks(search_blocks, rowid, label, description) + VALUES ('delete', OLD.rowid, OLD.label, OLD.description); + INSERT INTO search_blocks(rowid, label, description) + VALUES (NEW.rowid, NEW.label, NEW.description); +END; diff --git a/schema/version_control.sql b/schema/version_control.sql new file mode 100644 index 00000000..93abb9d2 --- /dev/null +++ b/schema/version_control.sql @@ -0,0 +1,145 @@ +-- =========================================================================== +-- VERSION CONTROL +-- =========================================================================== +-- +-- Recovery model overview: +-- +-- Timeline: C0 ── D1 ── D2 ── D3 ── C4 ── D5 ── D6 ── C7(boundary) ═══ C8 ── D9 ... +-- ├──── schema_version = 1 ────────────────────┤ ├── schema_version = 2 ── +-- ├────────── chain 1 ─────────────────────────┤ ├────── chain 2 ───────── +-- +-- C = checkpoint (full snapshot, self-contained, always recoverable alone) +-- D = delta (lightweight patch, must be applied sequentially from its base checkpoint) +-- +-- To restore any version N: +-- 1. Find the nearest checkpoint C where C.version_number <= N and C.schema_version matches +-- 2. Replay deltas D where D.base_checkpoint_id = C.id AND D.delta_sequence <= needed, +-- ordered by delta_sequence +-- 3. Result is the document state at version N in that schema_version +-- +-- Schema migration boundaries: +-- - When schema changes, a boundary checkpoint is created in BOTH the old and new schema. +-- - The old-schema boundary checkpoint (is_schema_boundary=1) is the last valid snapshot +-- before migration. Its data_checksum allows integrity verification. +-- - The new-schema boundary checkpoint is linked via schema_migrations.boundary_checkpoint_id. +-- - Deltas NEVER cross schema boundaries. A delta's schema_version must match its +-- base_checkpoint's schema_version. The CHECK constraint enforces this implicitly. +-- +-- Visiting old versions across migrations: +-- - Checkpoints are self-contained → can always be loaded as-is for that schema_version. +-- - To bring old data forward: load old checkpoint → run migration_sql forward chain. +-- - reverse_migration_sql allows rolling back to a previous schema if needed. +-- - migration_checksum verifies the migration script hasn't been tampered with. +-- + +-- Schema migration log. +-- Each row documents how one schema version transitions to the next. +-- After applying a migration, a boundary checkpoint must be created +-- in the new schema version before recording more deltas. +CREATE TABLE schema_migrations ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + from_schema_version INTEGER NOT NULL, + to_schema_version INTEGER NOT NULL, + migration_name TEXT NOT NULL, + migration_sql TEXT, -- forward migration DDL/DML + reverse_migration_sql TEXT, -- rollback DDL/DML (NULL if irreversible) + migration_checksum TEXT, -- SHA-256 of migration_sql for integrity + applied_at INTEGER NOT NULL, -- epoch ms + boundary_checkpoint_id TEXT, -- checkpoint created in the NEW schema after migration + CHECK (to_schema_version > from_schema_version), + UNIQUE (from_schema_version, to_schema_version) +); + +CREATE INDEX idx_schema_migrations_to_version ON schema_migrations(to_schema_version); + +-- Singleton row: global version-control pointers and counters. +CREATE TABLE version_graph ( + id INTEGER PRIMARY KEY CHECK (id = 1), + current_version INTEGER NOT NULL DEFAULT 0, + current_schema_version INTEGER NOT NULL DEFAULT 1, + user_checkpoint_version_id TEXT, -- user-designated save point + latest_version_id TEXT, -- most recent version (checkpoint or delta) + chain_count INTEGER NOT NULL DEFAULT 1, + last_pruned INTEGER, -- epoch ms of last pruning pass + total_size INTEGER, -- aggregate bytes of all checkpoints + deltas + CHECK (current_schema_version >= 1), + CHECK (chain_count >= 1) +); + +-- Schema-versioned chain metadata. +-- Groups one contiguous run of versions that all share the same schema. +-- A new chain begins after every schema migration. +CREATE TABLE version_chains ( + id TEXT PRIMARY KEY, + schema_version INTEGER NOT NULL, + start_version INTEGER NOT NULL, + end_version INTEGER, -- NULL for the currently active chain + migration_id INTEGER REFERENCES schema_migrations(id), + root_checkpoint_id TEXT, -- first checkpoint of this chain + CHECK (schema_version >= 1), + CHECK (end_version IS NULL OR end_version >= start_version), + UNIQUE (schema_version, start_version) +) WITHOUT ROWID; + +CREATE INDEX idx_version_chains_schema_version ON version_chains(schema_version, start_version); + +-- Full-state snapshots at specific version numbers. +-- Each checkpoint is fully self-contained: loading `data` alone reconstructs the +-- complete document state at that version_number. +CREATE TABLE checkpoints ( + id TEXT PRIMARY KEY, + parent_id TEXT, -- previous checkpoint (for checkpoint chain traversal) + chain_id TEXT NOT NULL REFERENCES version_chains(id), + version_number INTEGER NOT NULL, + schema_version INTEGER NOT NULL, + timestamp INTEGER NOT NULL, -- epoch ms + description TEXT, + is_manual_save INTEGER NOT NULL DEFAULT 0, + is_schema_boundary INTEGER NOT NULL DEFAULT 0, -- 1 if created at a schema migration boundary + user_id TEXT, + data BLOB, -- full state snapshot (application-defined binary format) + data_checksum TEXT, -- SHA-256 of `data` for integrity verification on restore + storage_key TEXT, -- optional external storage reference if data is offloaded + size_bytes INTEGER, + CHECK (schema_version >= 1), + CHECK (is_schema_boundary IN (0, 1)), + UNIQUE (version_number) +) WITHOUT ROWID; + +CREATE INDEX idx_checkpoints_parent ON checkpoints(parent_id); +CREATE INDEX idx_checkpoints_chain ON checkpoints(chain_id, version_number); +CREATE INDEX idx_checkpoints_schema_version ON checkpoints(schema_version, version_number); +CREATE INDEX idx_checkpoints_boundary ON checkpoints(is_schema_boundary) + WHERE is_schema_boundary = 1; + +-- Incremental deltas (lightweight patches between checkpoints). +-- A delta is valid ONLY against the schema_version it was recorded with. +-- To apply: load base_checkpoint.data, then apply changesets in delta_sequence order. +CREATE TABLE deltas ( + id TEXT PRIMARY KEY, + parent_id TEXT, -- previous delta or NULL if first after checkpoint + base_checkpoint_id TEXT NOT NULL REFERENCES checkpoints(id), + chain_id TEXT NOT NULL REFERENCES version_chains(id), + delta_sequence INTEGER NOT NULL, -- 1-based ordinal within base_checkpoint group + version_number INTEGER NOT NULL, + schema_version INTEGER NOT NULL, + timestamp INTEGER NOT NULL, -- epoch ms + description TEXT, + is_manual_save INTEGER NOT NULL DEFAULT 0, + user_id TEXT, + changeset BLOB NOT NULL, -- zlib-compressed binary delta payload + changeset_checksum TEXT, -- SHA-256 of uncompressed changeset for integrity + size_bytes INTEGER, + CHECK (schema_version >= 1), + CHECK (delta_sequence >= 1), + UNIQUE (version_number) +) WITHOUT ROWID; + +CREATE INDEX idx_deltas_parent ON deltas(parent_id); +CREATE INDEX idx_deltas_chain ON deltas(chain_id, version_number); +CREATE INDEX idx_deltas_schema_version ON deltas(schema_version, version_number); +CREATE INDEX idx_deltas_base_checkpoint ON deltas(base_checkpoint_id, delta_sequence); + +-- Seed the singleton version graph row. +INSERT INTO version_graph (id, current_version, current_schema_version, chain_count) +VALUES (1, 0, 1, 1); diff --git a/scripts/build-ducpy-simple-index.py b/scripts/build-ducpy-simple-index.py new file mode 100644 index 00000000..4f6782a1 --- /dev/null +++ b/scripts/build-ducpy-simple-index.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python3 +"""Build a PEP 503 Simple Repository index for ducpy wheels hosted on GitHub Releases. + +This script queries GitHub Releases for all ducpy tags, downloads each wheel/sdist +to compute SHA256 digests, then generates a lightweight simple index where the +download links point back to the GitHub Release assets (no wheel files are copied +into the Pages deployment). + +Usage: + python3 scripts/build-ducpy-simple-index.py [output_dir] + + output_dir defaults to packages/ducpy/docs/_build/html +""" + +import hashlib +import json +import subprocess +import sys +import tempfile +from pathlib import Path + +REPO = "ducflair/duc" +PACKAGE_NAME = "ducpy" +REQUIRES_PYTHON = ">=3.10" + + +def get_ducpy_tags() -> list[str]: + result = subprocess.run( + ["gh", "release", "list", "--limit", "100", "--json", "tagName"], + capture_output=True, + text=True, + ) + if result.returncode != 0: + print(f"Warning: Failed to list releases: {result.stderr}", file=sys.stderr) + return [] + releases = json.loads(result.stdout) + return sorted( + [r["tagName"] for r in releases if r["tagName"].startswith(f"{PACKAGE_NAME}@")], + key=lambda t: t.split("@", 1)[1], + reverse=True, + ) + + +def get_release_assets(tag: str) -> list[dict]: + result = subprocess.run( + ["gh", "release", "view", tag, "--json", "assets"], + capture_output=True, + text=True, + ) + if result.returncode != 0: + return [] + assets = json.loads(result.stdout).get("assets", []) + return [a for a in assets if a["name"].endswith((".whl", ".tar.gz"))] + + +def compute_sha256(filepath: Path) -> str: + return hashlib.sha256(filepath.read_bytes()).hexdigest() + + +def build_index(output_dir: Path): + simple_dir = output_dir / "simple" + package_dir = simple_dir / PACKAGE_NAME + package_dir.mkdir(parents=True, exist_ok=True) + + rp_escaped = REQUIRES_PYTHON.replace(">", ">").replace("<", "<") + + # Root index listing available packages + (simple_dir / "index.html").write_text( + "\n" + "Simple Package Index\n" + "\n" + "

Simple Package Index

\n" + f'{PACKAGE_NAME}\n' + "\n" + ) + + tags = get_ducpy_tags() + print(f"Found {len(tags)} ducpy release(s)") + + links: list[str] = [] + + with tempfile.TemporaryDirectory() as tmpdir: + tmp = Path(tmpdir) + for tag in tags: + assets = get_release_assets(tag) + if not assets: + continue + for asset in assets: + name = asset["name"] + url = f"https://github.com/{REPO}/releases/download/{tag}/{name}" + + # Download temporarily to compute SHA256 + dl_path = tmp / name + dl = subprocess.run( + [ + "gh", "release", "download", tag, + "--pattern", name, + "--dir", str(tmp), + "--clobber", + ], + capture_output=True, + text=True, + ) + + sha_fragment = "" + if dl.returncode == 0 and dl_path.exists(): + sha_fragment = f"#sha256={compute_sha256(dl_path)}" + dl_path.unlink() + + links.append( + f'{name}' + ) + print(f" {tag}: {name}") + + # Package index with all wheel links + (package_dir / "index.html").write_text( + "\n" + "Links for ducpy\n" + "\n" + "

Links for ducpy

\n" + + "\n".join(links) + "\n" + "\n" + ) + + print(f"\nGenerated simple index with {len(links)} package(s)") + + +if __name__ == "__main__": + output_dir = Path(sys.argv[1]) if len(sys.argv) > 1 else Path("packages/ducpy/docs/_build/html") + build_index(output_dir) diff --git a/sst.config.ts b/sst.config.ts index 401e588e..93edeb68 100644 --- a/sst.config.ts +++ b/sst.config.ts @@ -54,16 +54,5 @@ export default $config({ }, }); - // Host the Python generated docs - new sst.aws.StaticSite("MyPythonDocs", { - build: { - command: "bun ducpy:docs:build", - output: "packages/ducpy/docs/_build/html", - }, - domain: domainName && { - name: `python.${domainName}`, - dns: sst.cloudflare.dns({ proxy: true }), - }, - }); }, }); diff --git a/turbo.json b/turbo.json index ab7051bf..c16d6a96 100644 --- a/turbo.json +++ b/turbo.json @@ -1,12 +1,18 @@ { - "$schema": "https://turbo.build/schema.json", + "$schema": "https://v2-8-11.turborepo.dev/schema.json", "tasks": { "ducjs#build": { "cache": false, + "dependsOn": [ + "ducrs#build" + ], "inputs": ["$TURBO_DEFAULT$", ".env.*", ".env.local"] }, "ducpy#build": { "cache": false, + "dependsOn": [ + "ducrs#build" + ], "inputs": ["$TURBO_DEFAULT$", ".env.*", ".env.local"] }, "ducrs#build": { @@ -29,6 +35,27 @@ "packages/ducpdf/tests/tests_output/**" ] }, + "ducjs#test": { + "cache": false, + "dependsOn": [ + "ducjs#build" + ], + "inputs": ["$TURBO_DEFAULT$", ".env.*", ".env.local"] + }, + "ducpy#test": { + "cache": false, + "dependsOn": [ + "ducpy#build" + ], + "inputs": ["$TURBO_DEFAULT$", ".env.*", ".env.local"] + }, + "ducrs#test": { + "cache": false, + "dependsOn": [ + "ducrs#build" + ], + "inputs": ["$TURBO_DEFAULT$", ".env.*", ".env.local"] + }, "ducsvg#build": { "cache": false, "dependsOn": [ @@ -55,6 +82,12 @@ "inputs": ["$TURBO_DEFAULT$", ".env.*", ".env.local"] }, + "ducpy#dev:docs": { + "cache": false, + "persistent": true, + "inputs": ["$TURBO_DEFAULT$"] + }, + "@duc/docs#build": { "env": [ "NEXT_PUBLIC_*",