daem-on / wtherion

A web-based Therion map editor
https://daem-on.github.io/wtherion/
MIT License
17 stars 2 forks source link

line context is not correctly produced (th2 to json to th2) #9

Closed CaverBruce closed 1 year ago

CaverBruce commented 2 years ago

Original th2

line arrow -context point label -scale xs
  5779.0 8828.0
  5768.0 8884.0 5702.0 9103.0 5702.0 9103.0
  smooth off
endline

Resultant th2

    line arrow  -context point
        5779 8828
        5768 8884 5702 9103 5702 9103
        smooth off
    endline

The object name and optional subsequent -scale property is missing.

daem-on commented 2 years ago

Yep this and #7 are both weird edge cases which could have been avoided if therion's file formats weren't absolutely terrible. Currently the importer assumes that "options" which follow a command look like this:

Option name, a space, option value, where the option value contains no spaces unless it's enclosed in brackets or quote marks.

Here and in #7 there are some options which do have a space in them and also are not enclosed in anything. This type of inconsistency makes it basically impossible to write an elegant and fast parser. Actually we were talking about adding the parser from the Mapiah project into wtherion, but I haven't heard anything about it since.

I'll try to find a better solution for the parser.

CaverBruce commented 1 year ago

Original th2 line arrow -context point label -scale xs 5779.0 8828.0 5768.0 8884.0 5702.0 9103.0 5702.0 9103.0 smooth off endline

resultant th2 line arrow -context point label -scale xs 5779 8828 5768 8884 5702 9103 5702 9103 smooth off endline Success, this issue can be closed