mapper icon indicating copy to clipboard operation
mapper copied to clipboard

OCD area object pattern rotation not applied after import

Open dg0yt opened this issue 3 years ago • 7 comments

Steps to reproduce

  1. Import an OCD 8/9/10/11/12 file with rotated object patterns, e.g. vineyard
  2. Patterns are not shown with the user defined rotation.
  3. Activate "adjustable per object" for the fill patterns of the symbol.
  4. Now the patterns are shown correctly

Actual behaviour

Rotations are loaded but not applied, due to incorrect symbol configuration. They are lost on export.

Expected behaviour

The symbol properties must be set up correctly.

Configuration

Mapper Version: v0.9.5 Operating System: any

More information

Before https://github.com/OpenOrienteering/mapper/pull/1700/commits/918dd9b0df1cc752dd65e83c0c259585e946e557 (v0.9.4), all area symbols were created with rotatable patterns during OCD import. This worked for vineyards et al. That commit put the pattern rotation property into the object rotation flag. Maybe this is the wrong place.

Note that even OCD 12 format is affected, despite being the subject of investigation for GH-1677/GH-1700 which are the context of the commit.

dg0yt avatar Mar 30 '21 05:03 dg0yt

Interesting. I'm seeing exactly the opposite. Rotation is enabled on objects where it's supposed to be disabled. There's something fishy and I'll take a closer look. Thanks for the report!

lpechacek avatar Mar 30 '21 14:03 lpechacek

Interesting. I'm seeing exactly the opposite. Rotation is enabled on objects where it's supposed to be disabled.

Scratch that. I checked out the wrong sources. Long day it was yesterday.

I'm now looking at the base symbol flags setting in example .ocd files. I can see that point and text symbols follow the file format documentation and have the least significant bit set to one where rotation is allowed:

  symbol_position[3].symbol.base.description: "Fallstrich"
  symbol_position[3].symbol.base.flags: 1
  symbol_position[3].symbol.base.otp: point(1)
  symbol_position[3].symbol.base.sym_num: 104000
  symbol_position[4].symbol.base.description: "Kurvenzahl"
  symbol_position[4].symbol.base.flags: 1
  symbol_position[4].symbol.base.otp: text(4)
  symbol_position[4].symbol.base.sym_num: 105000

However, I cannot see a single area object that would have the rotation flag set:

  symbol_position[53].symbol.base.description: "Wald: Leichte Behinderung"
  symbol_position[53].symbol.base.flags: 0
  symbol_position[53].symbol.base.otp: area(3)
  symbol_position[53].symbol.base.sym_num: 406000
...
  symbol_position[58].symbol.base.description: "Wald in einer Richt. belaufb."
  symbol_position[58].symbol.base.flags: 0
  symbol_position[58].symbol.base.otp: area(3)
  symbol_position[58].symbol.base.sym_num: 411000
...
  symbol_position[63].symbol.base.description: "Weinberg"
  symbol_position[63].symbol.base.flags: 0
  symbol_position[63].symbol.base.otp: area(3)
  symbol_position[63].symbol.base.sym_num: 413000

Is the pattern rotation bit hidden elsewhere?

lpechacek avatar Mar 31 '21 09:03 lpechacek

AFAIU there is no such bit for fill pattern rotation, and that's why the fill pattern rotation area symbol property was unconditionally set to true before 918dd9b. This is different from the point symbol rotation property.

dg0yt avatar Mar 31 '21 10:03 dg0yt

Ack of a sort. The symbol north orientation semantic differs for the area and point+text symbols. For point and text, the north orientation means the same as in Mapper. For areas, the story goes like this:

  1. All area patterns are rotatable.
  2. There is a structure north orientation flag in OCAD. However, the flag indicates whether the pattern will get rotated upon map rotation. This property is reflected in the same bit of the base symbol flags field.

In short, all OCAD area patterns are rotatable, ~which turns issue #1677 invalid~, and commit 918dd9b has to be reverted. The OCAD concept of "lock the pattern angle against the map north" is foreign in Mapper, as far as I know, and cannot be represented.

Edit: Reading through issue 1677 again, I can see that it clearly describes the loss of area orientation bit. That means we should write bit 0 of the base symbol flags field on .ocd export, but it should not be stored in the Mapper's pattern rotation property.

lpechacek avatar Mar 31 '21 12:03 lpechacek

To make an example: individual rotation can be set for marsh or undergrowth objects in OCAD?

dg0yt avatar Apr 01 '21 17:04 dg0yt

To make an example: individual rotation can be set for marsh or undergrowth objects in OCAD?

Yes. I tried to rotate the undergrowth area pattern first and then I had to take a short break to recover. ocad-demo

The north orientation comes into play during map rotation. There is a checkbox (default ON) that can be unchecked, and then patterns of area symbols with the north orientation set are not rotated, while all other area patterns change their angle. This is the essence of #1677 which I misunderstood on the first attempt. image

Replicated with OCAD 8.12 demo edition.

lpechacek avatar Apr 01 '21 18:04 lpechacek

Replicated with OCAD 12.

dl3sdo avatar Apr 01 '21 21:04 dl3sdo