Opened 9 years ago

Closed 9 years ago

#3372 closed defect (fixed)

dxf does not support OCS

Reported by: pooyapm Owned by: warmerdam
Priority: normal Milestone: 1.7.1
Component: OGR_SF Version: 1.7.0
Severity: normal Keywords: dxf
Cc:

Description

Many objects in DXF file use OCS (Object Coordinate Systems) instead of WCS (World coordinate Systems). For example, "LWPOLYLINE" uses OCS for it's vertices. OCS should be converted to WCS when an OGRGeometry is creating. OCS definition is documented in DXF reference. The attached file contains the necessary code for converting OCS to WCS conversion and edited OGRDXFLayer::TranslateLWPOLYLINE() function using this conversion.

Attachments (3)

DXF-OCS.cpp (4.0 KB) - added by pooyapm 9 years ago.
LWPOLYLINE-OCS.dxf (113.8 KB) - added by pooyapm 9 years ago.
fix_3372.patch (757 bytes) - added by Even Rouault 9 years ago.
Fix r18752

Download all attachments as: .zip

Change History (10)

Changed 9 years ago by pooyapm

Attachment: DXF-OCS.cpp added

comment:1 Changed 9 years ago by warmerdam

Milestone: 1.7.1
Priority: highnormal
Status: newassigned

Could you provide a file demonstrating LWPOLYLINEs using OCS?

comment:2 Changed 9 years ago by warmerdam

Component: defaultOGR_SF

Changed 9 years ago by pooyapm

Attachment: LWPOLYLINE-OCS.dxf added

comment:3 in reply to:  2 Changed 9 years ago by pooyapm

Replying to warmerdam: The attached file "LWPOLYLINE-OCS.dxf" contains 6 3DPOLYLINEs (in WCS) and 6 LWPOLYLINEs (in OCS). If you open DXF file using a text editor, you can see negative coordinates for some LWPOLYLINEs, but if open it using AutoCad?, all coordinates are positive (The file is part of a real map with UTM projection).

comment:4 Changed 9 years ago by warmerdam

Milestone: 1.7.1
Resolution: fixed
Status: assignedclosed

I have substantially reworked the patch and it is applied in trunk (r18752) and 1.7 (r18754).

I would appreciate it if you could test the result to see if it is correct.

It should now be possible to add OCS handling to other element types as appropriate just by calling ApplyOCSTransformer() on the geometry; however, I prefer not to do this without test files.

comment:5 Changed 9 years ago by Even Rouault

Resolution: fixed
Status: closedreopened

Attached a patch that fixes use of wrong index in CrossProduct?() (and also remove unused member variables) that likely explains the failure on epimetheus slavebot. ogr_dxf_9 should be updated accordingly.

Changed 9 years ago by Even Rouault

Attachment: fix_3372.patch added

Fix r18752

comment:6 Changed 9 years ago by Even Rouault

I meant failure on *telascience* slavebot

comment:7 Changed 9 years ago by warmerdam

Resolution: fixed
Status: reopenedclosed

Patched in trunk (r18756) and 1.7 branch (r18755).

Thanks

Note: See TracTickets for help on using tickets.