mapper icon indicating copy to clipboard operation
mapper copied to clipboard

OCAD graphic objects are imported as unknown symbol

Open lpechacek opened this issue 7 years ago • 10 comments

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

lpechacek avatar Sep 13 '17 07:09 lpechacek

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.

dg0yt avatar Sep 26 '17 17:09 dg0yt

Shared a sample file via e-mail.

lpechacek avatar Nov 03 '17 08:11 lpechacek

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 design in 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

krticka avatar Apr 13 '19 17:04 krticka

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

dl3sdo avatar Mar 28 '22 19:03 dl3sdo

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 avatar Mar 29 '22 12:03 lpechacek

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

lpechacek avatar Mar 29 '22 17:03 lpechacek

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

dl3sdo avatar Mar 29 '22 21:03 dl3sdo

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): https://github.com/dl3sdo/mapper/commit/a6ac39925015a564c68d3760832598fccc633abc

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 avatar Apr 03 '22 17:04 dl3sdo

I added the functionality of importing layout objects by re-using your code, Libor: https://github.com/dl3sdo/mapper/commit/3cd57146c0d694f9bcd434864b00799b787c6cb9 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 avatar Apr 04 '22 19:04 dl3sdo

@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 avatar Jan 05 '23 12:01 dl3sdo