Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FEATURE]: Start implementation of native dxf export
  • Loading branch information
mhugent committed Sep 13, 2013
1 parent 040e9d5 commit 6dad30c
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/core/core.sip
Expand Up @@ -27,6 +27,7 @@
%Include qgsdatasourceuri.sip
%Include qgsdbfilterproxymodel.sip
%Include qgsdistancearea.sip
%Include qgsdxfexport.sip
%Include qgserror.sip
%Include qgsexpression.sip
%Include qgsfeature.sip
Expand Down
29 changes: 29 additions & 0 deletions python/core/qgsdxfexport.sip
@@ -0,0 +1,29 @@
/***************************************************************************
qgsdxfexport.sip
----------------
begin : September 2013
copyright : (C) 2013 by Marco Hugentobler
email : marco at sourcepole dot ch
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

class QgsDxfExport
{
%TypeHeaderCode
#include <qgsdxfexport.h>
%End
public:
QgsDxfExport();
~QgsDxfExport();

void addLayers( QList< QgsMapLayer* >& layers );
int writeToFile( QIODevice* d );
};
1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -62,6 +62,7 @@ SET(QGIS_CORE_SRCS
qgsdbfilterproxymodel.cpp
qgsdiagramrendererv2.cpp
qgsdistancearea.cpp
qgsdxfexport.cpp
qgserror.cpp
qgsexpression.cpp
qgsexpression_texts.cpp
Expand Down
52 changes: 52 additions & 0 deletions src/core/qgsdxfexport.cpp
@@ -0,0 +1,52 @@
/***************************************************************************
qgsdxfexport.cpp
----------------
begin : September 2013
copyright : (C) 2013 by Marco Hugentobler
email : marco at sourcepole dot ch
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsdxfexport.h"
#include <QIODevice>
#include <QTextStream>

QgsDxfExport::QgsDxfExport()
{
}

QgsDxfExport::~QgsDxfExport()
{

}

int QgsDxfExport::writeToFile( QIODevice* d )
{
if ( !d )
{
return 1;
}

if ( !d->open( QIODevice::WriteOnly ) )
{
return 2;
}

QTextStream outStream( d );
writeHeader( outStream );
return 0;
}

int QgsDxfExport::writeHeader( QTextStream& stream )
{
stream << "Hello, dxf!";
return 0; //soon...
}
47 changes: 47 additions & 0 deletions src/core/qgsdxfexport.h
@@ -0,0 +1,47 @@
/***************************************************************************
qgsdxfexport.h
--------------
begin : September 2013
copyright : (C) 2013 by Marco Hugentobler
email : marco at sourcepole dot ch
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSDXFEXPORT_H
#define QGSDXFEXPORT_H

#include <QList>

class QgsMapLayer;
class QIODevice;
class QTextStream;

class QgsDxfExport
{
public:
QgsDxfExport();
~QgsDxfExport();

void addLayers( QList< QgsMapLayer* >& layers ) { mLayers = layers; }
int writeToFile( QIODevice* d ); //maybe add progress dialog? //other parameters (e.g. scale, dpi)?

private:

QList< QgsMapLayer* > mLayers;

int writeHeader( QTextStream& stream );
//collect styles
//writeEntities

//Option: export feature once / multiple export (considering symbol layers / symbol levels)
};

#endif // QGSDXFEXPORT_H

0 comments on commit 6dad30c

Please sign in to comment.