2014-01-27 09:22:24 +01:00
|
|
|
/***************************************************************************
|
|
|
|
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:
|
|
|
|
enum SymbologyExport
|
|
|
|
{
|
2014-06-02 21:00:51 +02:00
|
|
|
NoSymbology, //export only data
|
2014-01-27 09:22:24 +01:00
|
|
|
FeatureSymbology, //Keeps the number of features and export symbology per feature (using the first symbol level)
|
|
|
|
SymbolLayerSymbology //Exports one feature per symbol layer (considering symbol levels)
|
|
|
|
};
|
|
|
|
|
|
|
|
QgsDxfExport();
|
|
|
|
~QgsDxfExport();
|
|
|
|
|
2014-09-08 15:24:33 +02:00
|
|
|
void addLayers( const QList< QPair<QgsVectorLayer *, int > > &layers );
|
2015-02-15 22:03:14 +01:00
|
|
|
int writeToFile( QIODevice *d, QString codec ); //maybe add progress dialog? other parameters (e.g. scale, dpi)?
|
2014-01-27 09:22:24 +01:00
|
|
|
|
|
|
|
void setSymbologyScaleDenominator( double d );
|
|
|
|
double symbologyScaleDenominator() const;
|
|
|
|
|
|
|
|
void setMapUnits( QGis::UnitType u );
|
|
|
|
QGis::UnitType mapUnits() const;
|
|
|
|
|
|
|
|
void setSymbologyExport( QgsDxfExport::SymbologyExport e );
|
|
|
|
QgsDxfExport::SymbologyExport symbologyExport() const;
|
|
|
|
|
2015-02-15 22:03:14 +01:00
|
|
|
void setExtent( const QgsRectangle &r );
|
2014-01-27 09:22:24 +01:00
|
|
|
QgsRectangle extent() const;
|
|
|
|
|
|
|
|
//get closest entry in dxf palette
|
|
|
|
static int closestColorMatch( QRgb pixel );
|
|
|
|
|
2014-09-08 15:24:33 +02:00
|
|
|
QString layerName( const QString &id, const QgsFeature &f ) const;
|
|
|
|
|
2014-01-27 09:22:24 +01:00
|
|
|
//! @note available in python bindings as writeGroupInt
|
|
|
|
void writeGroup( int code, int i ) /PyName=writeGroupInt/;
|
|
|
|
//! @note available in python bindings as writeGroupDouble
|
|
|
|
void writeGroup( int code, double d ) /PyName=writeGroupDouble/;
|
2015-02-15 22:03:14 +01:00
|
|
|
void writeGroup( int code, const QString &s );
|
2014-01-27 09:22:24 +01:00
|
|
|
void writeGroupCode( int code );
|
|
|
|
void writeInt( int i );
|
|
|
|
void writeDouble( double d );
|
2015-02-15 22:03:14 +01:00
|
|
|
void writeString( const QString &s );
|
2014-09-08 15:24:33 +02:00
|
|
|
void writeGroup( int code, const QgsPoint &p, double z = 0.0, bool skipz = false ) /PyName=writeGroupPoint/;
|
2015-01-14 23:55:35 +01:00
|
|
|
void writeGroup( QColor color, int exactMatch = 62, int rgbCode = 420, int transparencyCode = 440 );
|
2014-09-08 15:24:33 +02:00
|
|
|
|
|
|
|
int writeHandle( int code = 5, int handle = 0 );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
|
|
|
//draw dxf primitives
|
2015-02-15 22:03:14 +01:00
|
|
|
void writePolyline( const QgsPolyline &line, const QString &layer, const QString &lineStyleName, QColor color,
|
2014-01-27 09:22:24 +01:00
|
|
|
double width = -1, bool polygon = false );
|
|
|
|
|
2014-09-08 15:24:33 +02:00
|
|
|
void writePolygon( const QgsPolygon &polygon, const QString &layer, const QString &hatchPattern, QColor color );
|
|
|
|
|
2015-02-15 22:03:14 +01:00
|
|
|
void writeSolid( const QString &layer, QColor color, const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, const QgsPoint &pt4 );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
|
|
|
//write line (as a polyline)
|
2015-02-15 22:03:14 +01:00
|
|
|
void writeLine( const QgsPoint &pt1, const QgsPoint &pt2, const QString &layer, const QString &lineStyleName, QColor color, double width = -1 );
|
2014-09-08 15:24:33 +02:00
|
|
|
|
2015-02-15 22:03:14 +01:00
|
|
|
void writePoint( const QString &layer, QColor color, const QgsPoint &pt );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2015-01-14 23:55:35 +01:00
|
|
|
void writeFilledCircle( const QString &layer, QColor color, const QgsPoint &pt, double radius );
|
|
|
|
|
2015-02-15 22:03:14 +01:00
|
|
|
void writeCircle( const QString &layer, QColor color, const QgsPoint &pt, double radius, const QString &lineStyleName, double width );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2015-02-15 22:03:14 +01:00
|
|
|
void writeText( const QString &layer, const QString &text, const QgsPoint &pt, double size, double angle, QColor color );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
2015-02-15 22:03:14 +01:00
|
|
|
void writeMText( const QString &layer, const QString &text, const QgsPoint &pt, double width, double angle, QColor color );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
|
|
|
static double mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, QGis::UnitType mapUnits );
|
|
|
|
|
2015-02-15 22:03:14 +01:00
|
|
|
static QString dxfLayerName( const QString &name );
|
2014-01-27 09:22:24 +01:00
|
|
|
|
|
|
|
};
|