Skip to content

feat: allow to load an XML-stored model produced by mxGraph - #300

Merged
tbouffard merged 74 commits into
developmentfrom
feat/import_xml_mxGraph_model_with_object_codecs
Jan 16, 2024
Merged

feat: allow to load an XML-stored model produced by mxGraph#300
tbouffard merged 74 commits into
developmentfrom
feat/import_xml_mxGraph_model_with_object_codecs

Conversation

@tbouffard

@tbouffard tbouffard commented Jan 9, 2024

Copy link
Copy Markdown
Member

Implementation relies on both the declaration of aliases and the introduction of dedicated codecs.
Codec.getCodecByName now takes aliases into account, so that importing is fully functional.
The code of some CodecRegistry and Codec methods has been simplified (check for nullity of method parameters).

The cell style is converted thanks to a specific utility function that can serve as an example for those wishing to migrate their applications from mxGraph to maxGraph.

test

  • The Codec example has been restored from the stashed directory. It is now available as a story written in TypeScript.
  • The ModelChecker utility class was previously used only to validate the imported model after import from the maxGraph model. It is now shared and also used in mxGraph import tests. It has also been enhanced to check the total number of cells in the model.

Closes #293

### Tasks
- [x] import vertices and edges
- [x] import cells geometry
- [x] restore the stashed Codecs story and migrate it to TypeScript
- [x] correctly import the edge geometry when it includes an array of points
- [x] import the style. Require conversion from string to object
- [x] remove extra logs
- [x] update PR description

Screenshots of the Codec story

For comparison with mxGraph: https://jgraph.github.io/mxgraph/javascript/examples/codec.html

image

@tbouffard tbouffard added the enhancement New feature or request label Jan 9, 2024
# Conflicts:
#	packages/core/src/serialization/register.ts
…ded (hard coded)

We now have the same issue as with the maxgraph model. Geometry is not correctly decoded
Comment thread packages/core/__tests__/serialization/codecs/mxgraph/utils.test.ts Outdated
Comment thread packages/core/__tests__/serialization/codecs/mxgraph/utils.test.ts Outdated
Comment thread packages/core/src/serialization/codecs/mxGraph/mxGeometryCodec.ts Outdated
@tbouffard
tbouffard marked this pull request as ready for review January 15, 2024 10:34
@tbouffard
tbouffard marked this pull request as draft January 16, 2024 09:48
Comment thread packages/core/src/serialization/CodecRegistry.ts Outdated
[skip ci]
@tbouffard
tbouffard marked this pull request as ready for review January 16, 2024 10:03
@tbouffard
tbouffard merged commit 835bfe7 into development Jan 16, 2024
@tbouffard
tbouffard deleted the feat/import_xml_mxGraph_model_with_object_codecs branch January 16, 2024 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to load an XML-stored mxGraphModel produced by mxGraph

1 participant