[FEATURE]: Start implementation of native dxf export

This commit is contained in:
Marco Hugentobler 2013-09-13 15:33:38 +02:00
parent 040e9d54cb
commit 6dad30c266
5 changed files with 130 additions and 0 deletions

View File

@ -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

View File

@ -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 );
};

View File

@ -62,6 +62,7 @@ SET(QGIS_CORE_SRCS
qgsdbfilterproxymodel.cpp
qgsdiagramrendererv2.cpp
qgsdistancearea.cpp
qgsdxfexport.cpp
qgserror.cpp
qgsexpression.cpp
qgsexpression_texts.cpp

52
src/core/qgsdxfexport.cpp Normal file
View File

@ -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
src/core/qgsdxfexport.h Normal file
View File

@ -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