Opened 14 years ago

Closed 14 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 14 years ago.
LWPOLYLINE-OCS.dxf (113.8 KB ) - added by pooyapm 14 years ago.
fix_3372.patch (757 bytes ) - added by Even Rouault 14 years ago.
Fix r18752

Download all attachments as: .zip

Change History (10)

by pooyapm, 14 years ago

Attachment: DXF-OCS.cpp added

comment:1 by warmerdam, 14 years ago

Milestone: 1.7.1
Priority: highnormal
Status: newassigned

Could you provide a file demonstrating LWPOLYLINEs using OCS?

comment:2 by warmerdam, 14 years ago

Component: defaultOGR_SF

by pooyapm, 14 years ago

Attachment: LWPOLYLINE-OCS.dxf added

in reply to:  2 comment:3 by pooyapm, 14 years ago

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 by warmerdam, 14 years ago

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 by Even Rouault, 14 years ago

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.

by Even Rouault, 14 years ago

Attachment: fix_3372.patch added

Fix r18752

comment:6 by Even Rouault, 14 years ago

I meant failure on *telascience* slavebot

comment:7 by warmerdam, 14 years ago

Resolution: fixed
Status: reopenedclosed

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

Thanks

Note: See TracTickets for help on using tickets.