pycadkit 0.3.2__tar.gz → 0.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pycadkit-0.3.2 → pycadkit-0.3.3}/Cargo.lock +10 -10
- {pycadkit-0.3.2 → pycadkit-0.3.3}/Cargo.toml +7 -7
- {pycadkit-0.3.2 → pycadkit-0.3.3}/PKG-INFO +1 -1
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/mod.rs +23 -15
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/raster.rs +10 -4
- pycadkit-0.3.3/crates/cadkit-dgn/src/writer/raster_builtin.rs +204 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/raster_template.rs +106 -3
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/tests/raster_template.rs +108 -91
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/tests/private_corpus.rs +80 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/LICENSE-APACHE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/LICENSE-MIT +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/NOTICE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/README.md +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit/Cargo.toml +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit/LICENSE-APACHE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit/LICENSE-MIT +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit/NOTICE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit/README.md +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit/examples/interchange.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit/src/lib.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/Cargo.toml +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/LICENSE-APACHE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/LICENSE-MIT +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/NOTICE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/README.md +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/aci.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/bytes.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/error.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/export.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/geom.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/geom_ops.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/lib.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/model.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/ops.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/options.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/polygon.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/svg.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/text.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-core/src/units.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/Cargo.toml +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/LICENSE-APACHE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/LICENSE-MIT +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/NOTICE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/README.md +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/examples/dgn_summary.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/examples/raster_structure.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/budget.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/cfb.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/fuzz_tests.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/le.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/level_names.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/lib.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/map/mod.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/map/v7.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/map/v8.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/native/decode_v8.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/native/element.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/native/linkage.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/native/mod.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/native/v7.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/native/v8.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/palette.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/text.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/container.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/encode.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/polyline.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/tables.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/tests/application.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/tests/microstation.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/tests/raster.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/tests/regressions.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/tests/text.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/tests.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/writer/text.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/src/zlib.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/tests/common/mod.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/tests/robustness.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/tests/v7_corpus.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/tests/v8_oracle.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/tests/v8_public.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dgn/tests/v8_range.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/Cargo.toml +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/LICENSE-APACHE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/LICENSE-MIT +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/NOTICE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/README.md +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/examples/docsummary.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/examples/dwgdump.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/bits.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/classes.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/codepage.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/container/lz77_r2004.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/container/lz77_r2007.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/container/mod.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/container/r13.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/container/r2004.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/container/r2007.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/container/reed_solomon.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/crc.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/handles.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/header.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/lib.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/mapping/entity.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/mapping/mod.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/native/entities.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/native/mod.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/object/annotation.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/object/curves.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/object/entities.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/object/hatch.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/object/misc.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/object/mod.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/object/registry.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/object/tables.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/reader.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/src/version.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/tests/corpus.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/tests/oracle.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dwg/tests/robustness.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/Cargo.toml +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/LICENSE-APACHE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/LICENSE-MIT +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/NOTICE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/README.md +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/examples/dump.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/lib.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/native/mod.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/native/text.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/ocs.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/reader/common.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/reader/entities.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/reader/hatch.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/reader/mod.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/reader/records.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/reader/tables.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/writer/curves.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/writer/entities.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/writer/mod.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/src/writer/out.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/tests/ascii_vs_binary.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/tests/common/mod.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/tests/compare_reader_with_ezdxf.py +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/tests/review_fixes.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/tests/robustness.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/tests/roundtrip.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/tests/synthetic_read.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/tests/synthetic_write.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-dxf/tests/validate_with_ezdxf.py +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/Cargo.toml +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/LICENSE-APACHE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/LICENSE-MIT +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/NOTICE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/README.md +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/src/curves.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/src/export.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/src/geometry.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/src/lib.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/src/mapping.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/src/native.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/src/tkgm.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/src/validate.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/src/xml.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/tests/roundtrip.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/tests/support/export_cases.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-gml/tests/support/tkgm_cases.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-py/Cargo.toml +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-py/LICENSE-APACHE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-py/LICENSE-MIT +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-py/NOTICE +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-py/README.md +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-py/src/lib.rs +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-py/tests/conftest.py +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-py/tests/test_cadkit.py +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/crates/cadkit-py/tests/test_citygml.py +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/pyproject.toml +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/python/cadkit/__init__.py +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/python/cadkit/__init__.pyi +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/python/cadkit/_cadkit.pyi +0 -0
- {pycadkit-0.3.2 → pycadkit-0.3.3}/python/cadkit/py.typed +0 -0
|
@@ -66,7 +66,7 @@ checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
|
|
|
66
66
|
|
|
67
67
|
[[package]]
|
|
68
68
|
name = "cadkit"
|
|
69
|
-
version = "0.3.
|
|
69
|
+
version = "0.3.3"
|
|
70
70
|
dependencies = [
|
|
71
71
|
"cadkit-core",
|
|
72
72
|
"cadkit-dgn",
|
|
@@ -78,7 +78,7 @@ dependencies = [
|
|
|
78
78
|
|
|
79
79
|
[[package]]
|
|
80
80
|
name = "cadkit-capi"
|
|
81
|
-
version = "0.3.
|
|
81
|
+
version = "0.3.3"
|
|
82
82
|
dependencies = [
|
|
83
83
|
"cadkit",
|
|
84
84
|
"serde",
|
|
@@ -87,7 +87,7 @@ dependencies = [
|
|
|
87
87
|
|
|
88
88
|
[[package]]
|
|
89
89
|
name = "cadkit-cli"
|
|
90
|
-
version = "0.3.
|
|
90
|
+
version = "0.3.3"
|
|
91
91
|
dependencies = [
|
|
92
92
|
"cadkit",
|
|
93
93
|
"clap",
|
|
@@ -96,7 +96,7 @@ dependencies = [
|
|
|
96
96
|
|
|
97
97
|
[[package]]
|
|
98
98
|
name = "cadkit-core"
|
|
99
|
-
version = "0.3.
|
|
99
|
+
version = "0.3.3"
|
|
100
100
|
dependencies = [
|
|
101
101
|
"serde",
|
|
102
102
|
"serde_json",
|
|
@@ -105,7 +105,7 @@ dependencies = [
|
|
|
105
105
|
|
|
106
106
|
[[package]]
|
|
107
107
|
name = "cadkit-dgn"
|
|
108
|
-
version = "0.3.
|
|
108
|
+
version = "0.3.3"
|
|
109
109
|
dependencies = [
|
|
110
110
|
"cadkit-core",
|
|
111
111
|
"cfb",
|
|
@@ -116,7 +116,7 @@ dependencies = [
|
|
|
116
116
|
|
|
117
117
|
[[package]]
|
|
118
118
|
name = "cadkit-dwg"
|
|
119
|
-
version = "0.3.
|
|
119
|
+
version = "0.3.3"
|
|
120
120
|
dependencies = [
|
|
121
121
|
"cadkit-core",
|
|
122
122
|
"cadkit-dxf",
|
|
@@ -126,7 +126,7 @@ dependencies = [
|
|
|
126
126
|
|
|
127
127
|
[[package]]
|
|
128
128
|
name = "cadkit-dxf"
|
|
129
|
-
version = "0.3.
|
|
129
|
+
version = "0.3.3"
|
|
130
130
|
dependencies = [
|
|
131
131
|
"cadkit-core",
|
|
132
132
|
"encoding_rs",
|
|
@@ -135,7 +135,7 @@ dependencies = [
|
|
|
135
135
|
|
|
136
136
|
[[package]]
|
|
137
137
|
name = "cadkit-gml"
|
|
138
|
-
version = "0.3.
|
|
138
|
+
version = "0.3.3"
|
|
139
139
|
dependencies = [
|
|
140
140
|
"cadkit-core",
|
|
141
141
|
"quick-xml",
|
|
@@ -145,7 +145,7 @@ dependencies = [
|
|
|
145
145
|
|
|
146
146
|
[[package]]
|
|
147
147
|
name = "cadkit-py"
|
|
148
|
-
version = "0.3.
|
|
148
|
+
version = "0.3.3"
|
|
149
149
|
dependencies = [
|
|
150
150
|
"cadkit",
|
|
151
151
|
"pyo3",
|
|
@@ -155,7 +155,7 @@ dependencies = [
|
|
|
155
155
|
|
|
156
156
|
[[package]]
|
|
157
157
|
name = "cadkit-wasm"
|
|
158
|
-
version = "0.3.
|
|
158
|
+
version = "0.3.3"
|
|
159
159
|
dependencies = [
|
|
160
160
|
"cadkit",
|
|
161
161
|
"js-sys",
|
|
@@ -4,7 +4,7 @@ members = ["crates/*"]
|
|
|
4
4
|
exclude = ["fuzz"]
|
|
5
5
|
|
|
6
6
|
[workspace.package]
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.3"
|
|
8
8
|
edition = "2024"
|
|
9
9
|
rust-version = "1.85"
|
|
10
10
|
license = "MIT OR Apache-2.0"
|
|
@@ -14,12 +14,12 @@ keywords = ["cad", "dwg", "dgn", "dxf", "citygml"]
|
|
|
14
14
|
categories = ["parser-implementations", "graphics", "encoding", "science::geo"]
|
|
15
15
|
|
|
16
16
|
[workspace.dependencies]
|
|
17
|
-
cadkit-core = { path = "crates/cadkit-core", version = "0.3.
|
|
18
|
-
cadkit-dgn = { path = "crates/cadkit-dgn", version = "0.3.
|
|
19
|
-
cadkit-dwg = { path = "crates/cadkit-dwg", version = "0.3.
|
|
20
|
-
cadkit-dxf = { path = "crates/cadkit-dxf", version = "0.3.
|
|
21
|
-
cadkit-gml = { path = "crates/cadkit-gml", version = "0.3.
|
|
22
|
-
cadkit = { path = "crates/cadkit", version = "0.3.
|
|
17
|
+
cadkit-core = { path = "crates/cadkit-core", version = "0.3.3" }
|
|
18
|
+
cadkit-dgn = { path = "crates/cadkit-dgn", version = "0.3.3" }
|
|
19
|
+
cadkit-dwg = { path = "crates/cadkit-dwg", version = "0.3.3" }
|
|
20
|
+
cadkit-dxf = { path = "crates/cadkit-dxf", version = "0.3.3" }
|
|
21
|
+
cadkit-gml = { path = "crates/cadkit-gml", version = "0.3.3" }
|
|
22
|
+
cadkit = { path = "crates/cadkit", version = "0.3.3" }
|
|
23
23
|
serde = { version = "1", features = ["derive"] }
|
|
24
24
|
serde_json = "1"
|
|
25
25
|
thiserror = "2"
|
|
@@ -4,13 +4,14 @@ mod container;
|
|
|
4
4
|
mod encode;
|
|
5
5
|
mod polyline;
|
|
6
6
|
mod raster;
|
|
7
|
+
mod raster_builtin;
|
|
7
8
|
mod raster_template;
|
|
8
9
|
mod tables;
|
|
9
10
|
mod text;
|
|
10
11
|
|
|
11
12
|
use crate::{
|
|
12
13
|
le,
|
|
13
|
-
native::v8::{self, AuxRecord, ModelHeader, PageHeader, RawElement},
|
|
14
|
+
native::v8::{self, AuxRecord, ModelHeader, PageHeader, RawElement, V8Model},
|
|
14
15
|
};
|
|
15
16
|
use cadkit_core::{
|
|
16
17
|
Attribute, Document, Entity, EntityKind, Error, GroupKind, Limits, Point3, ReadOptions, Result,
|
|
@@ -41,8 +42,9 @@ pub struct WriteOptions {
|
|
|
41
42
|
pub planarity_tolerance: f64,
|
|
42
43
|
/// Preserve unchanged raster attachments from the same seed, including their
|
|
43
44
|
/// opaque control and auxiliary records. Edited attachments are rejected; images
|
|
44
|
-
/// without an id are new attachments cloned from a seed attachment
|
|
45
|
-
/// [`seed_has_raster_template`]) whatever
|
|
45
|
+
/// without an id are new attachments cloned from a seed attachment, or from the
|
|
46
|
+
/// built-in group when the seed has none (see [`seed_has_raster_template`]), whatever
|
|
47
|
+
/// this option says.
|
|
46
48
|
pub preserve_seed_rasters: bool,
|
|
47
49
|
/// Keep the seed model's control records that reference no seed graphic (coordinate
|
|
48
50
|
/// system, model settings and similar) with their auxiliary data, byte for byte.
|
|
@@ -71,12 +73,13 @@ pub fn repack_v8(seed: &[u8], options: &ReadOptions) -> Result<Vec<u8>> {
|
|
|
71
73
|
container::rewrite(seed, &BTreeMap::new(), options)
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
/// Whether `seed`
|
|
75
|
-
/// complete raster attachment (the records 92, 93, 93, 90, 91 x 5 in the control pages,
|
|
76
|
+
/// Whether `seed` holds its own raster attachment template: its single model holds at least
|
|
77
|
+
/// one complete raster attachment (the records 92, 93, 93, 90, 91 x 5 in the control pages,
|
|
76
78
|
/// the frame 94 they point at and its XAttribute 170) that [`write_v8`] clones for every
|
|
77
|
-
/// [`EntityKind::Image`] without an id.
|
|
78
|
-
///
|
|
79
|
-
///
|
|
79
|
+
/// [`EntityKind::Image`] without an id. Without one, `write_v8` clones a built-in group
|
|
80
|
+
/// (bitonal display, 200 DPI unless `dgn.raster_dpi` is given) instead. Seeds with several
|
|
81
|
+
/// models return `false`, as `write_v8` accepts single-model seeds only. `Err` when the
|
|
82
|
+
/// seed is not a readable DGN V8 file.
|
|
80
83
|
pub fn seed_has_raster_template(seed: &[u8], options: &ReadOptions) -> Result<bool> {
|
|
81
84
|
let native = v8::read(seed, options)?;
|
|
82
85
|
Ok(match native.models.as_slice() {
|
|
@@ -85,6 +88,16 @@ pub fn seed_has_raster_template(seed: &[u8], options: &ReadOptions) -> Result<bo
|
|
|
85
88
|
})
|
|
86
89
|
}
|
|
87
90
|
|
|
91
|
+
/// Format version of new graphic pages: the seed's first page version, else 3.
|
|
92
|
+
fn graphic_page_version(model: &V8Model) -> u32 {
|
|
93
|
+
model
|
|
94
|
+
.graphic_pages
|
|
95
|
+
.first()
|
|
96
|
+
.map(|p| p.header.format_version)
|
|
97
|
+
.filter(|v| matches!(v, 2 | 3))
|
|
98
|
+
.unwrap_or(3)
|
|
99
|
+
}
|
|
100
|
+
|
|
88
101
|
fn compressed(bytes: &[u8]) -> Result<Vec<u8>> {
|
|
89
102
|
let mut encoder = ZlibEncoder::new(Vec::new(), Compression::default());
|
|
90
103
|
encoder.write_all(bytes)?;
|
|
@@ -320,12 +333,7 @@ pub fn write_v8(doc: &Document, seed: &[u8], options: &WriteOptions) -> Result<V
|
|
|
320
333
|
replacements.insert(stream.path.clone(), None);
|
|
321
334
|
}
|
|
322
335
|
}
|
|
323
|
-
let version = model
|
|
324
|
-
.graphic_pages
|
|
325
|
-
.first()
|
|
326
|
-
.map(|p| p.header.format_version)
|
|
327
|
-
.filter(|v| matches!(v, 2 | 3))
|
|
328
|
-
.unwrap_or(3);
|
|
336
|
+
let version = graphic_page_version(model);
|
|
329
337
|
let record_pages = put_pages(
|
|
330
338
|
&mut replacements,
|
|
331
339
|
&format!("Dgn-Md/{}/Dgn^G", model.storage),
|
|
@@ -1048,7 +1056,7 @@ impl State<'_> {
|
|
|
1048
1056
|
.rasters
|
|
1049
1057
|
.template
|
|
1050
1058
|
.as_ref()
|
|
1051
|
-
.ok_or_else(|| Error::
|
|
1059
|
+
.ok_or_else(|| Error::invalid(0, "raster template missing for a new attachment"))?;
|
|
1052
1060
|
let mut ids = [0u64; 10];
|
|
1053
1061
|
for id in &mut ids {
|
|
1054
1062
|
*id = self.tables.id()?;
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
//! those fields or leaving known dependencies pointing at regenerated graphic IDs. Control
|
|
6
6
|
//! records that reference a seed graphic are only kept together with that graphic, which
|
|
7
7
|
//! the writer can do for unchanged rasters alone. New attachments (images without an id)
|
|
8
|
-
//! are cloned from a seed attachment instead
|
|
8
|
+
//! are cloned from a seed attachment, or the built-in group, instead
|
|
9
|
+
//! ([`super::raster_template`]).
|
|
9
10
|
|
|
10
|
-
use super::raster_template::
|
|
11
|
+
use super::raster_template::Template;
|
|
11
12
|
use super::{WriteOptions, compressed, encode::*};
|
|
12
13
|
use crate::native::v8::{AuxPage, AuxRecord, PageHeader, RawElement, V8Model};
|
|
13
14
|
use cadkit_core::{Document, Entity, EntityKind, Error, ReadOptions, Result};
|
|
@@ -76,8 +77,13 @@ impl Preserved {
|
|
|
76
77
|
));
|
|
77
78
|
}
|
|
78
79
|
let template = if new > 0 {
|
|
79
|
-
// Captured from the parsed seed, before its model records are dropped
|
|
80
|
-
|
|
80
|
+
// Captured from the parsed seed, before its model records are dropped; a seed
|
|
81
|
+
// without an attachment gets the built-in group, its XAttribute paged like the
|
|
82
|
+
// new graphic pages.
|
|
83
|
+
Some(match Template::capture(model) {
|
|
84
|
+
Some(template) => template,
|
|
85
|
+
None => Template::builtin(super::graphic_page_version(model))?,
|
|
86
|
+
})
|
|
81
87
|
} else {
|
|
82
88
|
None
|
|
83
89
|
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
//! Built-in raster attachment group, used when the seed holds none to clone.
|
|
2
|
+
//!
|
|
3
|
+
//! The records follow the attachment layout of FORMAT_NOTES ("Raster attachments"). Every
|
|
4
|
+
//! byte below is either equal in all complete attachment groups surveyed (2,316 groups in
|
|
5
|
+
//! 2D and 3D files) or, for the undecoded display fields that differ between files, the
|
|
6
|
+
//! value of one combination observed together: bitonal display with a white foreground and
|
|
7
|
+
//! a black background, 200 DPI, the frame on colour 0 with weight 1 and the control records
|
|
8
|
+
//! on the default level (64). Ids, times, the range, the placement, the cross ids and the
|
|
9
|
+
//! strings are zero here; [`super::raster_template::Template::instantiate`] writes them.
|
|
10
|
+
|
|
11
|
+
use cadkit_core::{Error, Result};
|
|
12
|
+
|
|
13
|
+
/// A record as its length and its non-zero byte runs `(offset, hex)`.
|
|
14
|
+
pub(super) struct Sparse {
|
|
15
|
+
pub len: usize,
|
|
16
|
+
pub runs: &'static [(usize, &'static str)],
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
impl Sparse {
|
|
20
|
+
pub fn bytes(&self) -> Result<Vec<u8>> {
|
|
21
|
+
let mut out = vec![0; self.len];
|
|
22
|
+
for (offset, hex) in self.runs {
|
|
23
|
+
let run = decode(hex)?;
|
|
24
|
+
let end = offset
|
|
25
|
+
.checked_add(run.len())
|
|
26
|
+
.filter(|end| *end <= self.len)
|
|
27
|
+
.ok_or_else(|| Error::invalid(0, "built-in raster record run out of range"))?;
|
|
28
|
+
out.get_mut(*offset..end)
|
|
29
|
+
.ok_or_else(|| Error::invalid(0, "built-in raster record run out of range"))?
|
|
30
|
+
.copy_from_slice(&run);
|
|
31
|
+
}
|
|
32
|
+
Ok(out)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/// Hex digits, spaces ignored.
|
|
37
|
+
fn decode(hex: &str) -> Result<Vec<u8>> {
|
|
38
|
+
let digits: Vec<u8> = hex
|
|
39
|
+
.bytes()
|
|
40
|
+
.filter(|b| *b != b' ')
|
|
41
|
+
.map(|b| match b {
|
|
42
|
+
b'0'..=b'9' => Ok(b - b'0'),
|
|
43
|
+
b'a'..=b'f' => Ok(b - b'a' + 10),
|
|
44
|
+
_ => Err(Error::invalid(0, "built-in raster record is not hex")),
|
|
45
|
+
})
|
|
46
|
+
.collect::<Result<_>>()?;
|
|
47
|
+
if digits.len() % 2 != 0 {
|
|
48
|
+
return Err(Error::invalid(
|
|
49
|
+
0,
|
|
50
|
+
"built-in raster record has an odd digit count",
|
|
51
|
+
));
|
|
52
|
+
}
|
|
53
|
+
Ok(digits
|
|
54
|
+
.chunks_exact(2)
|
|
55
|
+
.map(|p| p.iter().fold(0, |a, d| a << 4 | d))
|
|
56
|
+
.collect())
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// Frame 94 (1024 bytes, no linkages): properties `0x0A00`, weight 1, 200 DPI at `0x118`
|
|
60
|
+
/// and `0x120`, and the undecoded display block from `0x128`, unit scales included.
|
|
61
|
+
pub(super) const FRAME: Sparse = Sparse {
|
|
62
|
+
len: 0x400,
|
|
63
|
+
runs: &[
|
|
64
|
+
(0x000, "5e00c010 00020000 0002"),
|
|
65
|
+
(0x029, "0a 00000000 0000 01"),
|
|
66
|
+
(0x06c, "05000000 0405"),
|
|
67
|
+
(0x0fc, "05"),
|
|
68
|
+
(0x11e, "6940 0000000000006940 008078ff"),
|
|
69
|
+
(0x136, "f03f 000000000000f03f 00090000 00090000 fe0a"),
|
|
70
|
+
(0x154, "02000000 00ff01"),
|
|
71
|
+
(0x358, "01000000 00000000 11000000 00000000 11"),
|
|
72
|
+
(
|
|
73
|
+
0x376,
|
|
74
|
+
"f03f 000000000000f03f 000000000000f03f 000000000000f03f 000000000000f03f \
|
|
75
|
+
000000000000f03f",
|
|
76
|
+
),
|
|
77
|
+
],
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/// 92 with its dependency linkage `0x271B` (root at `0x84`).
|
|
81
|
+
pub(super) const LINK: Sparse = Sparse {
|
|
82
|
+
len: 0x90,
|
|
83
|
+
runs: &[
|
|
84
|
+
(0x000, "5c00c020 48000000 3c000000 40"),
|
|
85
|
+
(0x020, "02000000 01000100 01"),
|
|
86
|
+
(0x078, "0b10d056 1b270100 000301"),
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/// The two 93 records, subtypes `0x1000C` and `0x1000D`.
|
|
91
|
+
pub(super) const OPTIONS: [Sparse; 2] = [
|
|
92
|
+
Sparse {
|
|
93
|
+
len: 0x68,
|
|
94
|
+
runs: &[(0x000, "5d00c060 34000000 34000000 40"), (0x030, "0c0001")],
|
|
95
|
+
},
|
|
96
|
+
Sparse {
|
|
97
|
+
len: 0x98,
|
|
98
|
+
runs: &[
|
|
99
|
+
(0x000, "5d00c060 4c000000 4c000000 40"),
|
|
100
|
+
(0x030, "0d000100 00000000 11000000 11"),
|
|
101
|
+
(
|
|
102
|
+
0x046,
|
|
103
|
+
"f03f 000000000000f03f 000000000000f03f 000000000000f03f 000000000000f03f \
|
|
104
|
+
000000000000f03f 00000040",
|
|
105
|
+
),
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
/// 90 up to its linkages (the strings and the dependency are appended per attachment).
|
|
111
|
+
pub(super) const REFERENCE: Sparse = Sparse {
|
|
112
|
+
len: 0x78,
|
|
113
|
+
runs: &[
|
|
114
|
+
(0x000, "5a00c020 f8000000 3c000000 40"),
|
|
115
|
+
(0x020, "05000000 03000500"),
|
|
116
|
+
],
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/// The 90 dependency linkage `0x271B` (root at 12).
|
|
120
|
+
pub(super) const REFERENCE_DEPENDENCY: Sparse = Sparse {
|
|
121
|
+
len: 0x18,
|
|
122
|
+
runs: &[(0x000, "0b10d056 1b270100 000301")],
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/// The five 91 records in stored order: placement `0x20007`, display `0x20008`
|
|
126
|
+
/// (foreground `FFFFFF`, background `000000`), `0x10009` and the two `0x1000B` holding
|
|
127
|
+
/// the constants "(RM-All)" and "(RM-Defined)".
|
|
128
|
+
pub(super) const SETTINGS: [Sparse; 5] = [
|
|
129
|
+
Sparse {
|
|
130
|
+
len: 0xb8,
|
|
131
|
+
runs: &[
|
|
132
|
+
(0x000, "5b00c040 5c000000 5c000000 40"),
|
|
133
|
+
(0x020, "070002"),
|
|
134
|
+
(0x073, "20"),
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
Sparse {
|
|
138
|
+
len: 0x60,
|
|
139
|
+
runs: &[
|
|
140
|
+
(0x000, "5b00c040 30000000 30000000 40"),
|
|
141
|
+
(0x020, "08000200 00000000 00407cff 0000ffff ffffffff"),
|
|
142
|
+
(0x046, "f03f 000000000000f03f"),
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
Sparse {
|
|
146
|
+
len: 0x230,
|
|
147
|
+
runs: &[
|
|
148
|
+
(0x000, "5b00c040 18010000 18010000 40"),
|
|
149
|
+
(0x020, "09000100 00000000 02000000 00ff01"),
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
Sparse {
|
|
153
|
+
len: 0x238,
|
|
154
|
+
runs: &[
|
|
155
|
+
(0x000, "5b00c040 1c010000 1c010000 40"),
|
|
156
|
+
(
|
|
157
|
+
0x020,
|
|
158
|
+
"0b000100 00000000 28005200 4d002d00 41006c00 6c002900",
|
|
159
|
+
),
|
|
160
|
+
(0x226, "ff"),
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
Sparse {
|
|
164
|
+
len: 0x238,
|
|
165
|
+
runs: &[
|
|
166
|
+
(0x000, "5b00c040 1c010000 1c010000 40"),
|
|
167
|
+
(
|
|
168
|
+
0x020,
|
|
169
|
+
"0b000100 00000000 28005200 4d002d00 44006500 66006900 6e006500 64002900",
|
|
170
|
+
),
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
];
|
|
174
|
+
|
|
175
|
+
/// Data of the XAttribute 170 sub-records; 3 and 4 (file name and URL) are written per
|
|
176
|
+
/// attachment.
|
|
177
|
+
pub(super) const XATTRIBUTE_SUBS: [Sparse; 8] = [
|
|
178
|
+
Sparse { len: 4, runs: &[] },
|
|
179
|
+
Sparse {
|
|
180
|
+
len: 0x42,
|
|
181
|
+
runs: &[(
|
|
182
|
+
0x000,
|
|
183
|
+
"02000000 01000000 01000000 ff 28005200 4d002d00 41006c00 6c002900 0000 \
|
|
184
|
+
01000000 01000000 00 28005200 4d002d00 44006500 66006900 6e006500 64002900",
|
|
185
|
+
)],
|
|
186
|
+
},
|
|
187
|
+
Sparse {
|
|
188
|
+
len: 0x28,
|
|
189
|
+
runs: &[(0x000, "01000000 01")],
|
|
190
|
+
},
|
|
191
|
+
Sparse { len: 0, runs: &[] },
|
|
192
|
+
Sparse { len: 0, runs: &[] },
|
|
193
|
+
Sparse { len: 2, runs: &[] },
|
|
194
|
+
Sparse { len: 2, runs: &[] },
|
|
195
|
+
Sparse { len: 4, runs: &[] },
|
|
196
|
+
];
|
|
197
|
+
|
|
198
|
+
/// Flags of the XAttribute 170 record header and its trailer.
|
|
199
|
+
pub(super) const XATTRIBUTE_FLAGS: u32 = 8;
|
|
200
|
+
pub(super) const XATTRIBUTE_TRAILER: [u8; 4] = [1, 0, 0, 0];
|
|
201
|
+
/// Flags (`u16` at 10) of every XAttribute 170 sub-record header.
|
|
202
|
+
pub(super) const XATTRIBUTE_SUB_FLAGS: u16 = 0x8000;
|
|
203
|
+
/// Offset of the frame id in the 92 dependency linkage.
|
|
204
|
+
pub(super) const LINK_ROOT: usize = 0x84;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
//! New raster attachments cloned from a raster attachment of the seed
|
|
1
|
+
//! New raster attachments cloned from a raster attachment of the seed, or from the built-in
|
|
2
|
+
//! group of [`super::raster_builtin`] when the seed holds none.
|
|
2
3
|
//!
|
|
3
4
|
//! A MicroStation raster attachment is a fixed group of ten records and one XAttribute
|
|
4
5
|
//! (FORMAT_NOTES, "Raster attachments"): control records 92, 93, 93, 90 and five 91 in
|
|
@@ -34,8 +35,6 @@ const PLACEMENT_MIN: usize = 0xb8;
|
|
|
34
35
|
const CONTROLS: usize = 9;
|
|
35
36
|
|
|
36
37
|
/// Errors with stable messages.
|
|
37
|
-
pub(super) const NO_TEMPLATE: &str =
|
|
38
|
-
"new DGN raster attachments need a seed raster attachment to clone";
|
|
39
38
|
const NEEDS_PATH_AND_SIZE: &str = "new DGN raster attachments need path and size_px";
|
|
40
39
|
|
|
41
40
|
/// One complete raster attachment group of the seed, captured before the seed model is
|
|
@@ -107,6 +106,45 @@ impl Template {
|
|
|
107
106
|
(0..controls.len()).find_map(|i| group(&controls, i, &frames, &xattributes))
|
|
108
107
|
}
|
|
109
108
|
|
|
109
|
+
/// The built-in group of [`super::raster_builtin`], for seeds that hold no attachment;
|
|
110
|
+
/// its XAttribute goes in auxiliary pages of format `aux_version`.
|
|
111
|
+
pub fn builtin(aux_version: u32) -> Result<Self> {
|
|
112
|
+
use super::raster_builtin as b;
|
|
113
|
+
let mut subs = Vec::with_capacity(XA_SUBS);
|
|
114
|
+
for (index, data) in (0u16..).zip(&b::XATTRIBUTE_SUBS) {
|
|
115
|
+
let data = data.bytes()?;
|
|
116
|
+
let mut head = [0u8; 16];
|
|
117
|
+
put(&mut head, 0, &index.to_le_bytes())?;
|
|
118
|
+
put(&mut head, 2, &XA_SUB_MAGIC.to_le_bytes())?;
|
|
119
|
+
let len = u16::try_from(data.len())
|
|
120
|
+
.map_err(|_| Error::LimitExceeded("DGN raster XAttribute string".into()))?;
|
|
121
|
+
put(&mut head, 8, &len.to_le_bytes())?;
|
|
122
|
+
put(&mut head, 10, &b::XATTRIBUTE_SUB_FLAGS.to_le_bytes())?;
|
|
123
|
+
subs.push((head, data));
|
|
124
|
+
}
|
|
125
|
+
let [option_a, option_b] = &b::OPTIONS;
|
|
126
|
+
Ok(Self {
|
|
127
|
+
frame: b::FRAME.bytes()?,
|
|
128
|
+
link: b::LINK.bytes()?,
|
|
129
|
+
link_root: b::LINK_ROOT,
|
|
130
|
+
options: [option_a.bytes()?, option_b.bytes()?],
|
|
131
|
+
reference: b::REFERENCE.bytes()?,
|
|
132
|
+
reference_dependency: b::REFERENCE_DEPENDENCY.bytes()?,
|
|
133
|
+
settings: b::SETTINGS
|
|
134
|
+
.iter()
|
|
135
|
+
.map(b::Sparse::bytes)
|
|
136
|
+
.collect::<Result<_>>()?,
|
|
137
|
+
placement: 0,
|
|
138
|
+
xattribute: XAttribute {
|
|
139
|
+
reserved: 0,
|
|
140
|
+
flags: b::XATTRIBUTE_FLAGS,
|
|
141
|
+
subs,
|
|
142
|
+
trailer: b::XATTRIBUTE_TRAILER.to_vec(),
|
|
143
|
+
},
|
|
144
|
+
aux_version,
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
|
|
110
148
|
/// Records of a new attachment for `e`: ids are `ids[0..10]` in the order 94, 92, 93,
|
|
111
149
|
/// 93, 90, 91 x 5 (as MicroStation allocates them), the frame sits on `level`.
|
|
112
150
|
pub fn instantiate(
|
|
@@ -569,3 +607,68 @@ impl Placement {
|
|
|
569
607
|
Ok(())
|
|
570
608
|
}
|
|
571
609
|
}
|
|
610
|
+
|
|
611
|
+
#[cfg(test)]
|
|
612
|
+
impl Template {
|
|
613
|
+
/// Whether `self` and `other` agree outside the fields `instantiate` writes.
|
|
614
|
+
pub fn same_constants(&self, other: &Self) -> bool {
|
|
615
|
+
fn masked(b: &[u8], ranges: &[(usize, usize)]) -> Vec<u8> {
|
|
616
|
+
let mut b = b.to_vec();
|
|
617
|
+
for &(from, to) in [(0x10, 0x20)].iter().chain(ranges) {
|
|
618
|
+
b.iter_mut().take(to).skip(from).for_each(|x| *x = 0);
|
|
619
|
+
}
|
|
620
|
+
b
|
|
621
|
+
}
|
|
622
|
+
let same =
|
|
623
|
+
|a: &[u8], b: &[u8], ranges: &[(usize, usize)]| masked(a, ranges) == masked(b, ranges);
|
|
624
|
+
let frame = [(0x0c, 0x10), (0x38, 0x68), (0x78, 0xf8), (0x108, 0x118)];
|
|
625
|
+
let placement = [(0x28, 0x70), (0x88, 0xb8)];
|
|
626
|
+
let link = [(0x30, 0x38), (self.link_root, self.link_root + 8)];
|
|
627
|
+
let xattribute = |x: &XAttribute| {
|
|
628
|
+
let subs: Vec<_> = x
|
|
629
|
+
.subs
|
|
630
|
+
.iter()
|
|
631
|
+
.enumerate()
|
|
632
|
+
.map(|(i, (head, data))| {
|
|
633
|
+
let head = masked(head, &[(8, 10)]);
|
|
634
|
+
(
|
|
635
|
+
head,
|
|
636
|
+
if matches!(i, 3 | 4) {
|
|
637
|
+
vec![]
|
|
638
|
+
} else {
|
|
639
|
+
data.clone()
|
|
640
|
+
},
|
|
641
|
+
)
|
|
642
|
+
})
|
|
643
|
+
.collect();
|
|
644
|
+
(x.reserved, x.flags, subs, x.trailer.clone())
|
|
645
|
+
};
|
|
646
|
+
same(&self.frame, &other.frame, &frame)
|
|
647
|
+
&& self.link_root == other.link_root
|
|
648
|
+
&& same(&self.link, &other.link, &link)
|
|
649
|
+
&& self
|
|
650
|
+
.options
|
|
651
|
+
.iter()
|
|
652
|
+
.zip(&other.options)
|
|
653
|
+
.all(|(a, b)| same(a, b, &[]))
|
|
654
|
+
&& same(
|
|
655
|
+
&self.reference,
|
|
656
|
+
&other.reference,
|
|
657
|
+
&[(0x04, 0x08), (0x38, 0x40)],
|
|
658
|
+
)
|
|
659
|
+
&& same(
|
|
660
|
+
&self.reference_dependency,
|
|
661
|
+
&other.reference_dependency,
|
|
662
|
+
&[(12, 20)],
|
|
663
|
+
)
|
|
664
|
+
&& self.placement == other.placement
|
|
665
|
+
&& self.settings.len() == other.settings.len()
|
|
666
|
+
&& self
|
|
667
|
+
.settings
|
|
668
|
+
.iter()
|
|
669
|
+
.zip(&other.settings)
|
|
670
|
+
.enumerate()
|
|
671
|
+
.all(|(i, (a, b))| same(a, b, if i == self.placement { &placement } else { &[] }))
|
|
672
|
+
&& xattribute(&self.xattribute) == xattribute(&other.xattribute)
|
|
673
|
+
}
|
|
674
|
+
}
|