Opened 7 months ago
Closed 7 months 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)
Change History (9)
Changed 7 months ago by
Attachment: | OGR-DXF-more-ocs-fixes.diff added |
---|
comment:1 follow-up: 2 Changed 7 months ago by
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
?)
comment:2 Changed 7 months ago by
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 bePOLYGON 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.
comment:4 Changed 7 months ago by
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.
Patch