<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><span id="docs-internal-guid-98716146-8a32-7301-4cff-ade18828c6da"></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><font color="#252525" face="Times New Roman, Times, serif"><span style="white-space: pre-wrap;"><b>Week 12 Report [Final]
<a href="http://gsoc2016gdaldwg.blogspot.ru/2016/08/week-12-report-final.html">blogpost link</a></b></span></font></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;"><br>
</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Brief
 description of the idea. </span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">The
 aim of my project was to extend GDAL supported formats with DWG.</span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">The
 state of the project as it was BEFORE your GSOC. </span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">There
 was a DWG support, but it was not built-in by default, and GDAL Driver was based on third-party library Teigha (which is not X/MIT licensed, not even close).</span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">The
 addition that your project brought to the software.</span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-align: center;">
<span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Libopencad (GDAL CAD Driver engine)</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-indent: 36pt;">
<span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Overview</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-indent: 36pt;">
<span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Libopencad 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.</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-indent: 36pt;">
<span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Library 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.</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-indent: 36pt;">
<span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Internal structure</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-indent: 36pt;">
<span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Library 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.</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-indent: 36pt;">
<span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Library supports 3 modes of reading -
</span><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(51, 51, 51); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">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).</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-indent: 36pt;">
<span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">When 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.</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-indent: 36pt;">
<span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Library 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.</span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Supported
 geometries list:</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Point, Circle, Ellipse, Arc,
 Text, Solid, Spline, Line, Polyline 2D, Polyline 3D, LWPolyline, Ray, Raster (Images), MText, MLine, XLine, Polyface Mesh, 3DFace.</span></p>
<br>
<br>
<br>
<p dir="ltr" style="line-height:1.9636363636363636;margin-top:0pt;margin-bottom:0pt;text-align: center;">
<span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(51, 51, 51); font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">GDAL CAD Driver</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-indent: 36pt;">
<span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(51, 51, 51); font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Overview</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-indent: 36pt;">
<span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(51, 51, 51); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">GDAL 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:</span></p>
<ol style="margin-top:0pt;margin-bottom:0pt;">
<li dir="ltr" style="list-style-type: decimal; font-size: 16px; font-family: "Times New Roman"; color: rgb(51, 51, 51); vertical-align: baseline; margin-left: 48px; background-color: transparent;">
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="vertical-align: baseline; white-space: pre-wrap; font-family: "Times New Roman", Times, serif; background-color: transparent;">OpenOptions are presented with 2 options:
</span></p>
</li></ol>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(51, 51, 51); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">- MODE
 - READ_ALL/READ_FAST/READ_FASTEST (means the same as library OpenOptions).</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(51, 51, 51); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">- 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.</span></p>
<ol style="margin-top:0pt;margin-bottom:0pt;" start="2">
<li dir="ltr" style="list-style-type: decimal; font-size: 16px; font-family: "Times New Roman"; color: rgb(51, 51, 51); vertical-align: baseline; margin-left: 48px; background-color: transparent;">
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="vertical-align: baseline; white-space: pre-wrap; font-family: "Times New Roman", Times, serif; background-color: transparent;">CAD header variables are mapped into metadata.</span></p>
</li><li dir="ltr" style="list-style-type: decimal; font-size: 16px; font-family: "Times New Roman"; color: rgb(51, 51, 51); vertical-align: baseline; margin-left: 48px; background-color: transparent;">
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="vertical-align: baseline; white-space: pre-wrap; font-family: "Times New Roman", Times, serif; background-color: transparent;">Unlike DXF driver, CAD driver stores vector data
 in the appropriate layers (not all entities in single layer).</span></p>
</li><li dir="ltr" style="list-style-type: decimal; font-size: 16px; font-family: "Times New Roman"; color: rgb(51, 51, 51); vertical-align: baseline; margin-left: 48px; background-color: transparent;">
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="vertical-align: baseline; white-space: pre-wrap; font-family: "Times New Roman", Times, serif; background-color: transparent;">Raster subdatasets are also supported.</span></p>
</li><li dir="ltr" style="list-style-type: decimal; font-size: 16px; font-family: "Times New Roman"; color: rgb(51, 51, 51); vertical-align: baseline; margin-left: 48px; background-color: transparent;">
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="vertical-align: baseline; white-space: pre-wrap; font-family: "Times New Roman", Times, serif; background-color: transparent;">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.</span></p>
</li><li dir="ltr" style="list-style-type: decimal; font-size: 16px; font-family: "Times New Roman"; color: rgb(51, 51, 51); vertical-align: baseline; margin-left: 48px; background-color: transparent;">
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="vertical-align: baseline; white-space: pre-wrap; font-family: "Times New Roman", Times, serif; background-color: transparent;">CAD Geometry attributes mapping is completely
 done into OGRLayerDefn. So, any ACAD BlockReference attributes will be seen in OGRLayerDefn.</span></p>
</li></ol>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Add
 all the links (hopefully permanent) to access the relevant code and documentation for the user to get started with testing your application.</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">During
 the planning stage, I decided to separate my project into 2 parts: separated CAD formats support library (named libopencad), and GDAL driver, which uses it. Library can be used by itself for any reason, and will be maintained after GSoC.</span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Links:</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><a href="https://github.com/sandyre/libopencad" style="text-decoration:none;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(17, 85, 204); text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Libopencad
 repository</span></a><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;"> (installation is described in REAME.MD)</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><a href="https://github.com/sandyre/gdal_libopencad" style="text-decoration:none;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(17, 85, 204); text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Libopencad
 + GDAL fork</span></a></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><a href="http://gsoc2016gdaldwg.blogspot.ru/" style="text-decoration:none;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(17, 85, 204); text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">Blog
 with all reports and notices</span></a></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><a href="https://github.com/OSGeo/gdal/pull/145" style="text-decoration:none;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(17, 85, 204); text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">PR
 with my work into GDAL-trunk.</span></a></p>
<p dir="ltr" style="line-height:1.8359999999999999;margin-top:0pt;margin-bottom:0pt;">
<a href="https://trac.osgeo.org/gdal/wiki/DWG_driver" style="text-decoration:none;"><span style="font-size: 14.6667px; font-family: "Times New Roman", Times, serif; color: rgb(17, 85, 204); text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">GDAL
 Wiki driver page</span></a></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman", Times, serif; color: rgb(37, 37, 37); font-weight: 700; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;">A
 slide / image should serve to show the main elements of your project.</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman"; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;"></p>
<p dir="ltr" style="margin-top: 0pt; margin-bottom: 0pt; font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px; line-height: 1.38;">
<span style="font-family: "Times New Roman"; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;"><span style="font-family: "Times New Roman", Times, serif;">Raster and vector layers by the same driver (left - ArcGIS, right - QGIS):
</span><a href="https://pbs.twimg.com/media/Cm2N_-nVIAA8jBn.jpg"><span style="font-family: "Times New Roman", Times, serif;">image link</span></a></span></p>
<p dir="ltr" style="margin-top: 0pt; margin-bottom: 0pt; font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px; line-height: 1.38;">
<span style="font-family: "Times New Roman"; vertical-align: baseline; white-space: pre-wrap; background-color: transparent;"><span style="font-family: "Times New Roman", Times, serif;">A little comparison between original data source (ACAD) and QGIS with new
 DWG driver: </span><a href="https://pbs.twimg.com/media/CmwXIBnWcAAz22X.jpg"><span style="font-family: "Times New Roman", Times, serif;">image link</span></a></span></p>
</span>
<p></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 16px; font-family: "Times New Roman"; color: rgb(37, 37, 37); vertical-align: baseline; white-space: pre-wrap; background-color: transparent;"><span style="font-family: "Times New Roman", Times, serif;">Blockreference
 attributes mapping into OGRLayerDef: </span><a href="https://pbs.twimg.com/media/CocvxggWYAACiIg.jpg"><span style="font-family: "Times New Roman", Times, serif;">image link</span></a></span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><br>
</p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-family: "Times New Roman", Times, serif;">Best regards,</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-family: "Times New Roman", Times, serif;">Alexandr Borzykh</span></p>
</span>
<p></p>
</div>
</body>
</html>