Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

OCAD graphic objects are imported as unknown symbol #959

Open
lpechacek opened this issue Sep 13, 2017 · 10 comments · May be fixed by #2124
Open

OCAD graphic objects are imported as unknown symbol #959

lpechacek opened this issue Sep 13, 2017 · 10 comments · May be fixed by #2124

Comments

@lpechacek
Copy link
Member

I've just received an OCAD 10 map where some of the fences are drawn as so called Graphic Objects. They get imported into OOM as lines with undefined symbol.

Looking into OCAD 10 format description, I seems to me that graphic objects are merely lines with defined color and width. It would be great is OOM either issued warning when encountering these objects or synthesized symbol definitions for them.

Configuration

Mapper Version: v0.7.0
Operating System: openSUSE Tumbleweed

@dg0yt
Copy link
Member

dg0yt commented Sep 26, 2017

This will need test files.

In order to not pollute the defined symbol set, an implicit symbol definition would need to embedded into the individual object. This should be aligned with other changes for dealing with graphic primitives, such as copy-and-paste between map and symbol editor.

@lpechacek
Copy link
Member Author

Shared a sample file via e-mail.

@krticka
Copy link
Contributor

krticka commented Apr 13, 2019

This issue is also connected with graphic area objects. For example I received Ocad file with map and separate file with design, where some texts were converted to graphics to avoid unwanted font substitution. When you open the file with de# Mapper, only outlines are visible. When you open the map file, and design file you open as template, all graphic objects are missing.
Design file in OCAD:
Ocad

Design file in Mapper:
Mapper

lpechacek added a commit to lpechacek/mapper that referenced this issue Aug 10, 2021
We create synthetic symbols for graphical objects on import. All the
symbols have the same name and number.

Closes OpenOrienteeringGH-959.
lpechacek added a commit to lpechacek/mapper that referenced this issue Aug 10, 2021
OCD format recognizes symbol-less map objects that, however, render in
map colors. They are called "graphic objects". We create synthetic
symbols for graphic objects on import. All the Mapper symbols have the
same name and number reflecting the anonymous nature of the source
graphic objects.

Closes OpenOrienteeringGH-959.
lpechacek added a commit to lpechacek/mapper that referenced this issue Aug 11, 2021
OCD format recognizes symbol-less map objects that, however, render in
map colors. They are called "graphic objects". We create synthetic
symbols for graphic objects on import. All the Mapper symbols have the
same name and number reflecting the anonymous nature of the source
graphic objects.

Closes OpenOrienteeringGH-959.
@dl3sdo
Copy link
Member

dl3sdo commented Mar 28, 2022

Hi Libor,
I tried to create a sample .ocd12 file for testing your commit but ended up with getting "layout vector objects" (-4).
When I changed your code to use -4 instead, the problem came up that the color value for layout vector objects is the color itself and not an already known color number. Adding a color on-the-fly should solve this issue. In addition there is also a text layout vector object available.
Regards, Matthias
p.s.: I just notice that layout vector objects" (-4) were not available in OCAD10. So this should eventually be discussed in another issue. However, there may be similar code to address both issues.
LayoutObjects
LayoutObjects.zip

@lpechacek
Copy link
Member Author

Thanks, Matthias, for testing the commit. Please mind that import of Layout objects poses substantially higher headache intensity. While graphic objects at least reuse the existing color table (see TOcadObject::Col), Layout objects can have arbitrary RGB colors. And Layout objects are not just lines, text, and areas but also images (string type 27).

Ad graphic objects, I've just noticed that OCAD 8 can convert any objects into its graphic primitives. I thought it was possible only for text, but the program can convert any point object or combined line (like an earth bank) into simple lines and curves. As part of the process, OCAD 8 creates an auxiliary symbol for the lines. Later OCAD versions possibly optimized the object to graphics conversion by eliminating the need for the supplementary symbol definition.

So, my conversion of graphic objects to the Mapper data model aligns with what OCAD 8 did. I'm not sure that we should go further down the rabbit hole. Conversion of (real) map objects to graphic objects prevents map conversion into alternate map keys. In my opinion, creating a map layout is not a Mapper function.

@lpechacek
Copy link
Member Author

lpechacek commented Mar 29, 2022

I tried to create a sample .ocd12 file for testing your commit but ended up with getting "layout vector objects" (-4).

And yes, I'm slow at getting the whole message. Ad creation of graphic objects for testing, I think you should draw a few complex lines (earth banks, streets), some point objects, and some text and convert them to graphic objects. That should create objects with symbol number -2. HTH

@dl3sdo
Copy link
Member

dl3sdo commented Mar 29, 2022

You are right, besides the option to directly draw "layout vector objects" there are menu items to "Convert into [Graphic|Image|Layout] Object".

@dl3sdo
Copy link
Member

dl3sdo commented Apr 3, 2022

Libor, thank you for your additions to import graphic objects. I created line and area objects, duplicated them and changed the duplicates to graphical objects. Your commits now allow to import these objects correctly.

I noticed that in Parameter String 1024 there is a flag that controls the visibility of these graphical objects.
I added a commit that imports this flag and applies it later on to the imported objects (I prefer thus to first import the flag and then import the objects, instead of changing the visibility afterwards):
dl3sdo@a6ac399

Please find attached my test files (also including layout vector objects) with enabled and disabled graphic object visibility.
LayoutGraphicalObjects.zip

I intend to have a look on importing layout objects as well.

@dl3sdo
Copy link
Member

dl3sdo commented Apr 4, 2022

I added the functionality of importing layout objects by re-using your code, Libor:
dl3sdo@3cd5714
The import of text attributes is still missing, but the format is clear (tabulator separated string attached to the text string itself).
If import of both object types shall become part of Mapper, then it's possible to merge the import functionality.

dl3sdo pushed a commit to dl3sdo/mapper that referenced this issue Jan 5, 2023
OCD format recognizes symbol-less map objects that, however, render in
map colors. They are called "graphic objects". We create synthetic
symbols for graphic objects on import. All the Mapper symbols have the
same name and number reflecting the anonymous nature of the source
graphic objects.

Closes OpenOrienteeringGH-959.
@dl3sdo
Copy link
Member

dl3sdo commented Jan 5, 2023

@lpechacek: first, Happy New Year!
I finished the import of text layout objects by considering text attributes.
Please review and test the implementation:
https://github.com/dl3sdo/mapper/tree/issue-959-graphic-objects

Here is another test file:
LayoutGraphicalObjects_Duplicates4.zip

dl3sdo pushed a commit to dl3sdo/mapper that referenced this issue Jan 9, 2023
OCD format recognizes symbol-less map objects that, however, render in
map colors. They are called "graphic objects". We create synthetic
symbols for graphic objects on import. All the Mapper symbols have the
same name and number reflecting the anonymous nature of the source
graphic objects.

Closes OpenOrienteeringGH-959.
@dl3sdo dl3sdo linked a pull request Jan 10, 2023 that will close this issue
dl3sdo pushed a commit to dl3sdo/mapper that referenced this issue Nov 19, 2024
OCD format recognizes symbol-less map objects that, however, render in
map colors. They are called "graphic objects". We create synthetic
symbols for graphic objects on import. All the Mapper symbols have the
same name and number reflecting the anonymous nature of the source
graphic objects.

Closes OpenOrienteeringGH-959.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants