Ticket #3372 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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

DXF-OCS.cpp Download (4.0 KB) - added by pooyapm 3 years ago.
LWPOLYLINE-OCS.dxf Download (113.8 KB) - added by pooyapm 3 years ago.
fix_3372.patch Download (0.7 KB) - added by rouault 3 years ago.
Fix r18752

Change History

Changed 3 years ago by pooyapm

  Changed 3 years ago by warmerdam

  • priority changed from high to normal
  • status changed from new to assigned
  • milestone 1.7.1 deleted

Could you provide a file demonstrating LWPOLYLINEs using OCS?

follow-up: ↓ 3   Changed 3 years ago by warmerdam

  • component changed from default to OGR_SF

Changed 3 years ago by pooyapm

in reply to: ↑ 2   Changed 3 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).

  Changed 3 years ago by warmerdam

  • status changed from assigned to closed
  • resolution set to fixed
  • milestone set to 1.7.1

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.

  Changed 3 years ago by rouault

  • status changed from closed to reopened
  • resolution fixed deleted

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 3 years ago by rouault

Fix r18752

  Changed 3 years ago by rouault

I meant failure on *telascience* slavebot

  Changed 3 years ago by warmerdam

  • status changed from reopened to closed
  • resolution set to fixed

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

Thanks

Note: See TracTickets for help on using tickets.