Opened 6 years ago

Closed 6 years ago

#7098 closed defect (fixed)

DXF: OCS fixes for HATCH and INSERT entities

Reported by: Alan Thomas Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords: dxf
Cc:

Description

The OCS transformation is correctly applied for HATCH entities, but because the elevations of these entities are ignored, the transformation is wrong for any HATCH not at zero elevation.

Additionally, in #7077 I added an OCS transformation for the insertion point of INSERTs. This is sufficient for simple OCS transformations like (0,0,-1), but it is not enough for an OCS like (0,1/sqrt(2),-1/sqrt(2)). In the latter case the entire block needs to be transformed from the OCS to the WCS. As usual the documentation is useless, so I used a process of trial-and-error, and comparison with AutoCAD's outputs, to arrive at the solution in the patch.

The patch:

  • adds support for the HATCH elevation field
  • performs additional OCS transformations for the geometry of blocks
  • promotes the geometry to 3D before performing the OCS transformation, to avoid losing the Z coordinates for entities that were initially 2D
  • includes a testcase that also tests OCS to WCS transformations for SOLID elements with nonzero Z coordinate as a follow-up to #7089

Attachments (3)

OGR-DXF-more-ocs-fixes.diff (31.8 KB ) - added by Alan Thomas 6 years ago.
Patch
OGR-DXF-more-ocs-fixes-v2.diff (32.5 KB ) - added by Alan Thomas 6 years ago.
Patch
OGR-DXF-more-ocs-fixes-v3.diff (34.5 KB ) - added by Alan Thomas 6 years ago.
Patch

Download all attachments as: .zip

Change History (9)

by Alan Thomas, 6 years ago

Attachment: OGR-DXF-more-ocs-fixes.diff added

Patch

comment:1 by Alan Thomas, 6 years ago

This patch is experiencing similar test failures to the patch in #7089, with weird WKT outputs like POLYGON ((0 0 0,0 1 0,1 0 0,0 0 0)) (shouldn't it either miss out the zero Z values, or be POLYGON Z?)

in reply to:  1 comment:2 by Even Rouault, 6 years ago

Replying to atlight:

This patch is experiencing similar test failures to the patch in #7089, with weird WKT outputs like POLYGON ((0 0 0,0 1 0,1 0 0,0 0 0)) (shouldn't it either miss out the zero Z values, or be POLYGON Z?)

See my answer in #7089 regarding this

But I observe the following test failures with your patch (note: I have already applied #7089, in case that makes a difference)

  TEST: ogr_dxf_12 ... fail
    line 440: not keeping polygon 2D
  TEST: ogr_dxf_15 ... fail
    line 630: not keeping polygon 2D
  TEST: ogr_dxf_34 ... fail
    line 2399: did not get expected geometry back: got POLYGON ((0 0 0,0 1 0,1 0 0,0 0 0))

It seems that we promote to 3D more eagerly now than with the previous version of the code.

by Alan Thomas, 6 years ago

Patch

comment:3 by Alan Thomas, 6 years ago

That patch should address the test failures properly.

comment:4 by Alan Thomas, 6 years ago

Actually don't merge that yet, this code is still wrong for blocks on an OCS that have rotation/scaling. I will try to fix that as well.

by Alan Thomas, 6 years ago

Patch

comment:5 by Alan Thomas, 6 years ago

Third time lucky, I hope!

comment:6 by Even Rouault, 6 years ago

Resolution: fixed
Status: newclosed

In 40523:

DXF: OCS fixes for HATCH and INSERT entities (patch by atlight, fixes #7098)

Note: See TracTickets for help on using tickets.