Skip to content

Commit

Permalink
[FEATURE] DWG import into geopackage using libdxfrw
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Dec 14, 2016
1 parent 58933aa commit d5c6b97
Show file tree
Hide file tree
Showing 58 changed files with 90,249 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/app/CMakeLists.txt
@@ -1,3 +1,5 @@
ADD_SUBDIRECTORY(dwg/libdxfrw)

SET(QGIS_APP_SRCS
qgisapp.cpp
qgisappinterface.cpp
Expand Down Expand Up @@ -166,6 +168,9 @@ SET(QGIS_APP_SRCS
openstreetmap/qgsosmimportdialog.cpp
openstreetmap/qgsosmexportdialog.cpp

dwg/qgsdwgimportdialog.cpp
dwg/qgsdwgimporter.cpp

pluginmanager/qgspluginmanager.cpp
pluginmanager/qgspluginmanager_texts.cpp
pluginmanager/qgsapppluginmanagerinterface.cpp
Expand Down Expand Up @@ -338,6 +343,8 @@ SET (QGIS_APP_MOC_HDRS
openstreetmap/qgsosmimportdialog.h
openstreetmap/qgsosmexportdialog.h

dwg/qgsdwgimportdialog.h

pluginmanager/qgspluginmanager.h
pluginmanager/qgsapppluginmanagerinterface.h
pluginmanager/qgspluginsortfilterproxymodel.h
Expand Down Expand Up @@ -559,6 +566,8 @@ INCLUDE_DIRECTORIES(
../python
gps
openstreetmap
dwg
dwg/libdxfrw
)
INCLUDE_DIRECTORIES(SYSTEM
${SPATIALITE_INCLUDE_DIR}
Expand Down Expand Up @@ -592,7 +601,8 @@ ENDIF (ANDROID)
REMOVE_DEFINITIONS("-DAPP_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("\"-DAPP_EXPORT=${DLLEXPORT}\"")

# Putting IMAGE_RCC_SRCS into qgis_app lib is cousing problems when the lib is loaded (by plugin for example) in test unit (qgis_composerpicturetest).
# Putting IMAGE_RCC_SRCS into qgis_app lib is causing problems when the lib is
# loaded (by plugin for example) in test unit (qgis_composerpicturetest).
ADD_LIBRARY(qgis_app SHARED ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${QGIS_APP_HDRS} ${QGIS_APP_MOC_HDRS})

TARGET_LINK_LIBRARIES(qgis_app
Expand All @@ -607,6 +617,7 @@ TARGET_LINK_LIBRARIES(qgis_app
qgis_core
qgis_gui
qgis_analysis
libdxfrw
)

IF (NOT ANDROID)
Expand Down
82 changes: 82 additions & 0 deletions src/app/dwg/libdxfrw/CMakeLists.txt
@@ -0,0 +1,82 @@
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/core
${QT_INCLUDE_DIR}
)

ADD_LIBRARY(libdxfrw STATIC
drw_classes.cpp
drw_entities.cpp
drw_header.cpp
drw_objects.cpp
libdwgr.cpp
libdxfrw.cpp
intern/drw_dbg.cpp
intern/drw_textcodec.cpp
intern/dwgbuffer.cpp
intern/dwgreader.cpp
intern/dwgreader15.cpp
intern/dwgreader18.cpp
intern/dwgreader21.cpp
intern/dwgreader24.cpp
intern/dwgreader27.cpp
intern/dwgutil.cpp
intern/dxfreader.cpp
intern/dxfwriter.cpp
intern/rscodec.cpp
)
SET_PROPERTY(TARGET libdxfrw PROPERTY POSITION_INDEPENDENT_CODE ON)

IF(FALSE)
IF(DOXYGEN_FOUND)
ADD_CUSTOM_TARGET(doxygen-dxfrw ALL
COMMAND ${DOXYGEN_EXECUTABLE} libdxfrw.dox
drw_base.h
drw_classes.cpp
drw_classes.h
drw_entities.cpp
drw_entities.h
drw_header.cpp
drw_header.h
drw_interface.h
drw_objects.cpp
drw_objects.h
libdwgr.cpp
libdwgr.h
libdxfrw.cpp
libdxfrw.h
intern/drw_cptable932.h
intern/drw_cptable936.h
intern/drw_cptable949.h
intern/drw_cptable950.h
intern/drw_cptables.h
intern/drw_dbg.cpp
intern/drw_dbg.h
intern/drw_textcodec.cpp
intern/drw_textcodec.h
intern/dwgbuffer.cpp
intern/dwgbuffer.h
intern/dwgreader.cpp
intern/dwgreader.h
intern/dwgreader15.cpp
intern/dwgreader15.h
intern/dwgreader18.cpp
intern/dwgreader18.h
intern/dwgreader21.cpp
intern/dwgreader21.h
intern/dwgreader24.cpp
intern/dwgreader24.h
intern/dwgreader27.cpp
intern/dwgreader27.h
intern/dwgutil.cpp
intern/dwgutil.h
intern/dxfreader.cpp
intern/dxfreader.h
intern/dxfwriter.cpp
intern/dxfwriter.h
intern/rscodec.cpp
intern/rscodec.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS libdxfrw
COMMENT "Generating libdxfrw documentation" VERBATIM)
ENDIF(DOXYGEN_FOUND)
ENDIF(FALSE)

2 comments on commit d5c6b97

@PedroVenancio
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jef-n

It works great on Windows, but it does not work here on Linux. It's not ready for Linux yet?

Another great work! Thank you very much!

@PedroVenancio
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Linux, when I try to import the DWG, it says:
"Could not open layer list" and then
"Drawing import failed ()".

Also, when I try to open (on Linux) a geopackage created with DWG/DXF Import on Windows, it says:
"Invalid Data Source: /home/pedro/.../xxx.gpkg is not a valid or recognized data source".

Please sign in to comment.