Changes between Version 1 and Version 2 of DWG_driver

Aug 14, 2016, 10:57:36 AM (7 years ago)

Add details from final GSoC report


  • DWG_driver

    v1 v2  
    8282== Project progress ==
    84 '''All progress made can be viewed there:'''
     84The project separated into 2 parts: CAD formats support library (named libopencad), and GDAL driver, which uses it. Library can be used by itself for any reason.
    86 Github:  ​ (CAD support library)
     86=== Libopencad (GDAL CAD Driver engine) ===
    88 Blog: ​
     88==== Overview ====
     90Libopencad is a library written in C++11, which provides a way to read/write CAD (DWG/DXF/DXFB) files. It was designed to have a uniformal API to work with any CAD files. It has a base class - CADFile. Inheriting this class it’s possible to create a ‘driver’ for any CAD format, all you need to do - is to overwrite interface functions like ‘GetGeometry(index)’, and others. Now it has an implementation for DWG2000 (R15), but only for read.
     91Library comes with ‘cadinfo’ utility, which prints out everything library can get from file - header variables, CAD custom classes, presented layers and geometries with their attributes.
     93==== Internal structure ====
     95Library presents CAD objects in different ways - base class CADObject and other CAD...Object classes are exact analogues of how DWG format stores information about its objects. CADGeometry, and other classes which inherits it, are done for API access to CAD...Object classes.
     96Library supports 3 modes of reading - READ_ALL (means everything which can be extracted from CAD file will be read) READ_FAST (skipping some kind of meanless information - linetypes, CRC check, etc), READ_FASTEST (only geometries reading, additional info is skipped).
     97When parsing the file, library does not store any information it does not need. First, it reads file meta-information, and creates a file map. It only stores some info about presented layers, and header variables. Then, when calling application uses CADLayer.GetGeometry(index), it actually reads a geometry from file, using prepared file map. Sometimes it will be slower than having everything you have read in cache, but gives you more flexibility what you want to store in memory, and what you wont.
     98Library also has special classes which incapsulates I/O functions, so it’s possible to reimplement them for your needs - by default it uses std::fstream, but you can make it possible to work with network by make a class inherited from CADFileIO.
     100Supported geometries list:
     101Point, Circle, Ellipse, Arc, Text, Solid, Spline, Line, Polyline 2D, Polyline 3D, LWPolyline, Ray, Raster (Images), MText, MLine, XLine, Polyface Mesh, 3DFace.
     103=== GDAL CAD Driver ===
     105==== Overview ====
     107GDAL CAD Driver uses libopencad as a datasource. Not everything that libopencad can read from file is mapped into OGR infrastructure, but it will be done in near future. Current features are:
     1091. OpenOptions are presented with 2 options:
     110   - MODE - READ_ALL/READ_FAST/READ_FASTEST (means the same as library OpenOptions).
     111   - ADD_UNSUPPORTED_GEOMETRIES_DATA (YES/NO) - unstable feature, if some of the objects cannot be mapped into OGR representation (or its just not implemented yet), it will be presented as a CADUnknown object - OGRFeature without geometric representation, but with basic info - geometry type, some additional params.
     1122. CAD header variables are mapped into metadata.
     1133. Unlike DXF driver, CAD driver stores vector data in the appropriate layers (not all entities in single layer).
     1144. Raster subdatasets are also supported.
     1155. Coordinate system is extracted from DWG file (if it is presented in accordance with ESRI Docs for DWG files), or from %FILENAME%.prj file in the same directory.
     1166. CAD Geometry attributes mapping is completely done into OGRLayerDefn. So, any ACAD BlockReference attributes will be seen in OGRLayerDefn.
     118=== Images ===
     120[[Image(, 320px)]]
     122''Raster and vector layers by the same driver (left - ArcGIS, right - QGIS).''
     124[[Image(, 320px)]]
     126''A little comparison between original data source (ACAD) and QGIS with new DWG driver.''
     128== Links ==
     130CAD support library:  ​
     132Libopencad + GDAL fork:
     136Pull request: