Skip to content
Permalink
Browse files

[FEATURE]: Start implementation of native dxf export

  • Loading branch information
mhugent committed Sep 13, 2013
1 parent 040e9d5 commit 6dad30c2662ffebb99c254e1207e8bc90e852468
Showing with 130 additions and 0 deletions.
  1. +1 −0 python/core/core.sip
  2. +29 −0 python/core/qgsdxfexport.sip
  3. +1 −0 src/core/CMakeLists.txt
  4. +52 −0 src/core/qgsdxfexport.cpp
  5. +47 −0 src/core/qgsdxfexport.h
@@ -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
@@ -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 );
};
@@ -62,6 +62,7 @@ SET(QGIS_CORE_SRCS
qgsdbfilterproxymodel.cpp
qgsdiagramrendererv2.cpp
qgsdistancearea.cpp
qgsdxfexport.cpp
qgserror.cpp
qgsexpression.cpp
qgsexpression_texts.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...
}
@@ -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.
You can’t perform that action at this time.