Skip to content

Commit

Permalink
DXF: do not discard Z value when reading a HATCH (fixes #2349)
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Mar 25, 2020
1 parent 198d510 commit 4b39d40
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions autotest/ogr/ogr_dxf.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3624,6 +3624,27 @@ def test_ogr_dxf_very_close_neg_to_zero_knot():
assert extent == pytest.approx((163.0306017054786, 166.6530957511469, assert extent == pytest.approx((163.0306017054786, 166.6530957511469,
78.40469559017359, 81.82569418640966), abs=1e-5) 78.40469559017359, 81.82569418640966), abs=1e-5)


###############################################################################


def test_ogr_dxf_polygon_3D():


tmpfile = '/vsimem/test_ogr_dxf_polygon_3D.dxf'
ds = ogr.GetDriverByName('DXF').CreateDataSource(tmpfile)
lyr = ds.CreateLayer('test')
f = ogr.Feature(lyr.GetLayerDefn())
g = ogr.CreateGeometryFromWkt('POLYGON((0 0 10,0 1 10,1 1 10,0 0 10))')
f.SetGeometry(g)
lyr.CreateFeature(f)
ds = None
ds = ogr.Open(tmpfile)
lyr = ds.GetLayer(0)
f = lyr.GetNextFeature()
got_g = f.GetGeometryRef()
assert got_g.Equals(g)
gdal.Unlink(tmpfile)



############################################################################### ###############################################################################
# cleanup # cleanup
Expand Down
3 changes: 3 additions & 0 deletions gdal/ogr/ogrsf_frmts/dxf/ogrdxf_hatch.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -592,6 +592,9 @@ OGRErr OGRDXFLayer::CollectPolylinePath( OGRGeometryCollection *poGC,
int nVertexCount = -1; int nVertexCount = -1;
bool bHaveBulges = false; bool bHaveBulges = false;


if( dfElevation != 0 )
oSmoothPolyline.setCoordinateDimension(3);

/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/* Read the boundary path type. */ /* Read the boundary path type. */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
Expand Down

0 comments on commit 4b39d40

Please sign in to comment.