42 #define DXF_HANDSEED 100
43 #define DXF_HANDMAX 9999999
44 #define DXF_HANDPLOTSTYLE 0xf
47 int QgsDxfExport::mDxfColors[][3] =
307 const char *QgsDxfExport::mDxfEncodings[][2] =
310 {
"8859_1",
"ISO-8859-1" },
311 {
"8859_2",
"ISO-8859-2" },
312 {
"8859_3",
"ISO-8859-3" },
313 {
"8859_4",
"ISO-8859-4" },
314 {
"8859_5",
"ISO-8859-5" },
315 {
"8859_6",
"ISO-8859-6" },
316 {
"8859_7",
"ISO-8859-7" },
317 {
"8859_8",
"ISO-8859-8" },
318 {
"8859_9",
"ISO-8859-9" },
320 {
"DOS850",
"CP850" },
331 {
"MACINTOSH",
"MacRoman" },
333 {
"KSC5601",
"ksc5601.1987-0" },
335 {
"DOS866",
"CP866" },
336 {
"ANSI_1250",
"CP1250" },
337 {
"ANSI_1251",
"CP1251" },
338 {
"ANSI_1252",
"CP1252" },
339 {
"GB2312",
"GB2312" },
340 {
"ANSI_1253",
"CP1253" },
341 {
"ANSI_1254",
"CP1254" },
342 {
"ANSI_1255",
"CP1255" },
343 {
"ANSI_1256",
"CP1256" },
344 {
"ANSI_1257",
"CP1257" },
345 {
"ANSI_874",
"CP874" },
346 {
"ANSI_932",
"Shift_JIS" },
347 {
"ANSI_936",
"CP936" },
348 {
"ANSI_949",
"cp949" },
349 {
"ANSI_950",
"CP950" },
352 {
"ANSI_1258",
"CP1258" },
356 : mSymbologyScaleDenominator( 1.0 )
357 , mSymbologyExport( NoSymbology )
358 , mMapUnits(
QGis::Meters )
359 , mSymbolLayerCounter( 0 )
372 mLayers = dxfExport.mLayers;
373 mSymbologyScaleDenominator = dxfExport.mSymbologyScaleDenominator;
374 mSymbologyExport = dxfExport.mSymbologyExport;
375 mMapUnits = dxfExport.mMapUnits;
376 mSymbolLayerCounter = 0;
420 int minDist = INT_MAX;
422 for (
int i = 1; i < ( int )(
sizeof( mDxfColors ) /
sizeof( *mDxfColors ) ) && minDist > 0; ++i )
424 int dist = color_distance( color.
rgba(), i );
425 if ( dist >= minDist )
432 if ( minDist == 0 && color.
alpha() == 255 && minDistAt != 7 )
439 int c = ( color.
red() & 0xff ) * 0x10000 + ( color.
green() & 0xff ) * 0x100 + ( color.
blue() & 0xff );
441 if ( transparencyCode != -1 && color.
alpha() < 255 )
460 mTextStream << s <<
"\n";
465 mTextStream << s <<
"\n";
475 if ( !d->
isOpen() && !d->
open( QIODevice::WriteOnly ) )
492 void QgsDxfExport::writeHeader(
QString codepage )
504 if ( !ext.isEmpty() )
543 handle = mNextHandleId++;
545 Q_ASSERT_X( handle <
DXF_HANDMAX,
"QgsDxfExport::writeHandle(int, int)",
"DXF handle too large" );
551 void QgsDxfExport::writeTables()
560 slList = symbolLayers();
571 writeDefaultLinetypes();
575 for ( ; slIt != slList.
constEnd(); ++slIt )
577 writeSymbolLayerLinetype( slIt->
first );
590 foreach (
QString block,
QStringList() <<
"*Model_Space" <<
"*Paper_Space" <<
"*Paper_Space0" )
601 for ( ; slIt != slList.
constEnd(); ++slIt )
607 if ( hasDataDefinedProperties( ml, slIt->second ) )
709 for ( ; layerIt != mLayers.
constEnd(); ++layerIt )
711 if ( !layerIsScaleBasedVisible( layerIt->
first ) )
714 if ( layerIt->
first )
716 if ( layerIt->second < 0 )
723 layerIt->
first->uniqueValues( layerIt->second, values );
775 writeGroup( 100,
"AcDbTextStyleTableRecord" );
791 void QgsDxfExport::writeBlocks()
796 foreach (
QString block,
QStringList() <<
"*Model_Space" <<
"*Paper_Space" <<
"*Paper_Space0" )
820 slList = symbolLayers();
824 for ( ; slIt != slList.
constEnd(); ++slIt )
836 if ( hasDataDefinedProperties( ml, slIt->second ) )
842 QString block(
QString(
"symbolLayer%1" ).arg( mBlockCounter++ ) );
843 mBlockHandle =
QString(
"%1" ).
arg( mBlockHandles[ block ], 0, 16 );
871 mPointSymbolBlocks.
insert( ml, block );
877 void QgsDxfExport::writeEntities()
882 mBlockHandle =
QString(
"%1" ).
arg( mBlockHandles[
"*Model_Space" ], 0, 16 );
885 QgsDxfPalLabeling labelEngine(
this, mExtent.
isEmpty() ? dxfExtent() : mExtent, mSymbologyScaleDenominator, mMapUnits );
890 for ( ; layerIt != mLayers.
end(); ++layerIt )
893 if ( !vl || !layerIsScaleBasedVisible( vl ) )
910 if ( !attributes.
contains( layerAttr ) )
911 attributes << layerAttr;
914 bool labelLayer = labelEngine.prepareLayer( vl, attributes, ctx ) != 0;
920 writeEntitiesSymbolLevels( vl );
937 sctx.setFeature( &fet );
945 if ( symbolList.
size() < 1 )
953 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
955 int nSymbolLayers = ( *symbolIt )->symbolLayerCount();
956 for (
int i = 0; i < nSymbolLayers; ++i )
958 addFeature( sctx,
layerName, ( *symbolIt )->symbolLayer( i ), *symbolIt );
975 labelEngine.registerFeature( vl->
id(), fet, ctx,
layerName );
983 labelEngine.drawLabeling( ctx );
987 void QgsDxfExport::writeEntitiesSymbolLevels(
QgsVectorLayer* layer )
1025 if ( !featureSymbol )
1031 if ( it == features.
end() )
1035 it.
value().append( fet );
1041 for (
int i = 0; i < symbols.
count(); i++ )
1047 if ( level < 0 || level >= 1000 )
1050 while ( level >= levels.
count() )
1052 levels[level].
append( item );
1057 for (
int l = 0; l < levels.
count(); l++ )
1060 for (
int i = 0; i < level.
count(); i++ )
1064 if ( levelIt == features.
end() )
1070 int llayer = item.
layer();
1073 for ( ; featureIt != featureList.
end(); ++featureIt )
1075 sctx.setFeature( &*featureIt );
1076 addFeature( sctx, layer->
name(), levelIt.
key()->symbolLayer( llayer ), levelIt.
key() );
1083 void QgsDxfExport::writeEndFile()
1110 ACAD_MLEADERSTYLE\n\
1118 ACAD_PLOTSETTINGS\n\
1122 ACAD_PLOTSTYLENAME\n\
1230 ACDBDICTIONARYWDFLT\n\
1250 AcDbDictionaryWithDefault\n\
1446 1.000000000000000E+20\n\
1448 1.000000000000000E+20\n\
1450 1.000000000000000E+20\n\
1452 -1.000000000000000E+20\n\
1454 -1.000000000000000E+20\n\
1456 -1.000000000000000E+20\n\
1718 163.1318914119703\n\
1886 AcDbSavedByObjectVersion\n\
1976 AcDbSavedByObjectVersion\n\
2066 AcDbSavedByObjectVersion\n\
2156 AcDbSavedByObjectVersion\n\
2246 AcDbSavedByObjectVersion\n\
2338 AcDbSavedByObjectVersion\n\
2428 AcDbSavedByObjectVersion\n\
2518 AcDbSavedByObjectVersion\n\
2608 AcDbSavedByObjectVersion\n\
2698 AcDbSavedByObjectVersion\n\
2788 AcDbSavedByObjectVersion\n\
2878 AcDbSavedByObjectVersion\n\
2968 AcDbSavedByObjectVersion\n\
3058 AcDbSavedByObjectVersion\n\
3150 AcDbSavedByObjectVersion\n\
3240 AcDbSavedByObjectVersion\n\
3250 void QgsDxfExport::startSection()
3255 void QgsDxfExport::endSection()
3268 msl->
sizeUnit(), mMapUnits ) / 2.0;
3281 if ( !symbolLayer || blockIt == mPointSymbolBlocks.
constEnd() )
3285 if ( msl && symbol )
3311 int n = line.
size();
3314 QgsDebugMsg(
QString(
"writePolyline: empty line layer=%1 lineStyleName=%2" ).arg( layer ).arg( lineStyleName ) );
3318 bool polygon = line[0] == line[ line.
size() - 1 ];
3323 QgsDebugMsg(
QString(
"writePolyline: line too short layer=%1 lineStyleName=%2" ).arg( layer ).arg( lineStyleName ) );
3339 for (
int i = 0; i < n; i++ )
3361 for (
int i = 0; i < polygon.
size(); ++i )
3368 for (
int j = 0; j < polygon[i].
size(); ++j )
3496 while ( t.
length() > 250 )
3521 p[0].
resize( pt3 != pt4 ? 5 : 4 );
3525 if ( p[0].size() == 5 )
3532 void QgsDxfExport::writeVertex(
const QgsPoint& pt,
const QString& layer )
3547 for ( ; layerIt != mLayers.
constEnd(); ++layerIt )
3549 if ( layerIt->
first )
3553 extent = layerIt->
first->extent();
3582 penColor = colorFromSymbolLayer( symbolLayer, ctx );
3586 Qt::PenStyle penStyle( Qt::SolidLine );
3587 Qt::BrushStyle brushStyle( Qt::NoBrush );
3589 double offset = 0.0;
3590 if ( mSymbologyExport !=
NoSymbology && symbolLayer )
3592 width = symbolLayer->
dxfWidth( *
this, ctx );
3593 offset = symbolLayer->
dxfOffset( *
this, ctx );
3601 QString lineStyleName =
"CONTINUOUS";
3604 lineStyleName = lineStyleFromSymbolLayer( symbolLayer );
3619 for ( ; it != multiPoint.
constEnd(); ++it )
3621 writePoint( *it, layer, penColor, fet, symbolLayer, symbol );
3627 if ( penStyle != Qt::NoPen )
3635 offsetLine = nonConstGeom;
3639 if ( offsetLine != nonConstGeom )
3641 delete nonConstGeom;
3648 QgsGeometry *offsetLine = offset == 0.0 ? nonConstGeom : nonConstGeom->
offsetCurve( offset, 0, GEOSBUF_JOIN_MITRE, 2.0 );
3650 offsetLine = nonConstGeom;
3654 for ( ; lIt != multiLine.
constEnd(); ++lIt )
3656 writePolyline( *lIt, layer, lineStyleName, penColor, width );
3659 if ( offsetLine != nonConstGeom )
3661 delete nonConstGeom;
3668 QgsGeometry *offsetPolygon = offset == 0.0 ? nonConstGeom : nonConstGeom->
buffer( -offset, 0, GEOSBUF_CAP_FLAT, GEOSBUF_JOIN_MITRE, 2.0 );
3669 if ( !offsetPolygon )
3670 offsetPolygon = nonConstGeom;
3674 for ( ; polyIt != polygon.
constEnd(); ++polyIt )
3676 writePolyline( *polyIt, layer, lineStyleName, penColor, width );
3679 if ( offsetPolygon != nonConstGeom )
3680 delete offsetPolygon;
3681 delete nonConstGeom;
3688 QgsGeometry *offsetPolygon = offset == 0.0 ? nonConstGeom : nonConstGeom->
buffer( -offset, 0, GEOSBUF_CAP_FLAT, GEOSBUF_JOIN_MITRE, 2.0 );
3689 if ( !offsetPolygon )
3690 offsetPolygon = nonConstGeom;
3694 for ( ; mpIt != mp.
constEnd(); ++mpIt )
3697 for ( ; polyIt != mpIt->constEnd(); ++polyIt )
3699 writePolyline( *polyIt, layer, lineStyleName, penColor, width );
3703 if ( offsetPolygon != nonConstGeom )
3704 delete offsetPolygon;
3705 delete nonConstGeom;
3709 if ( brushStyle != Qt::NoBrush )
3723 for ( ; mpIt != mp.
constEnd(); ++mpIt )
3736 return symbolLayer->
dxfColor( ctx );
3741 QString lineStyleName =
"CONTINUOUS";
3744 return lineStyleName;
3748 if ( lineTypeIt != mLineStyles.
constEnd() )
3750 lineStyleName = lineTypeIt.
value();
3751 return lineStyleName;
3755 return lineNameFromPenStyle( symbolLayer->
dxfPenStyle() );
3762 int current_distance = INT_MAX;
3763 for (
size_t i = 1; i <
sizeof( mDxfColors ) /
sizeof( *mDxfColors ); ++i )
3765 int dist = color_distance( pixel, i );
3766 if ( dist < current_distance )
3768 current_distance = dist;
3777 int QgsDxfExport::color_distance( QRgb p1,
int index )
3779 if ( index > 255 || index < 0 )
3784 double redDiff = qRed( p1 ) - mDxfColors[
index][0];
3785 double greenDiff = qGreen( p1 ) - mDxfColors[
index][1];
3786 double blueDiff = qBlue( p1 ) - mDxfColors[
index][2];
3788 QgsDebugMsg(
QString(
"color_distance( r:%1 g:%2 b:%3 <=> i:%4 r:%5 g:%6 b:%7 ) => %8" )
3789 .arg( qRed( p1 ) ).arg( qGreen( p1 ) ).arg( qBlue( p1 ) )
3791 .arg( mDxfColors[index][0] )
3792 .arg( mDxfColors[index][1] )
3793 .arg( mDxfColors[index][2] )
3794 .arg( redDiff * redDiff + greenDiff * greenDiff + blueDiff * blueDiff ) );
3796 return redDiff * redDiff + greenDiff * greenDiff + blueDiff * blueDiff;
3799 QRgb QgsDxfExport::createRgbEntry( qreal r, qreal g, qreal b )
3826 for ( ; lIt != mLayers.
end(); ++lIt )
3845 for ( ; symbolIt != symbols.
end(); ++symbolIt )
3847 int maxSymbolLayers = ( *symbolIt )->symbolLayerCount();
3850 maxSymbolLayers = 1;
3852 for (
int i = 0; i < maxSymbolLayers; ++i )
3854 symbolLayers.
append( qMakePair(( *symbolIt )->symbolLayer( i ), *symbolIt ) );
3859 return symbolLayers;
3862 void QgsDxfExport::writeDefaultLinetypes()
3870 writeGroup( 100,
"AcDbLinetypeTableRecord" );
3879 double das = dashSize();
3880 double dss = dashSeparatorSize();
3881 double dos = dotSize();
3884 dashVector[0] = das;
3885 dashVector[1] = dss;
3894 dashDotVector[0] = das;
3895 dashDotVector[1] = dss;
3896 dashDotVector[2] = dos;
3897 dashDotVector[3] = dss;
3901 dashDotDotVector[0] = das;
3902 dashDotDotVector[1] = dss;
3903 dashDotDotVector[2] = dos;
3904 dashDotDotVector[3] = dss;
3905 dashDotDotVector[4] = dos;
3906 dashDotDotVector[5] = dss;
3910 void QgsDxfExport::writeSymbolLayerLinetype(
const QgsSymbolLayerV2* symbolLayer )
3919 if ( customLinestyle.
size() > 0 )
3922 writeLinetype( name, customLinestyle, unit );
3923 mLineStyles.
insert( symbolLayer, name );
3931 for ( ; slIt != symbolLayers.
constEnd(); ++slIt )
3949 for ( ; dashIt != pattern.
constEnd(); ++dashIt )
3951 length += ( *dashIt *
mapUnitScaleFactor( mSymbologyScaleDenominator, u, mMapUnits ) );
3958 writeGroup( 100,
"AcDbLinetypeTableRecord" );
3968 for ( ; dashIt != pattern.
constEnd(); ++dashIt )
3971 double segmentLength = ( isGap ? -*dashIt : *dashIt );
3981 if ( !sl || !symbol )
3995 double QgsDxfExport::dashSize()
const
3997 double size = mSymbologyScaleDenominator * 0.002;
3998 return sizeToMapUnits( size );
4001 double QgsDxfExport::dotSize()
const
4003 double size = mSymbologyScaleDenominator * 0.0006;
4004 return sizeToMapUnits( size );
4007 double QgsDxfExport::dashSeparatorSize()
const
4009 double size = mSymbologyScaleDenominator * 0.0006;
4010 return sizeToMapUnits( size );
4013 double QgsDxfExport::sizeToMapUnits(
double s )
const
4019 QString QgsDxfExport::lineNameFromPenStyle( Qt::PenStyle style )
4027 case Qt::DashDotLine:
4029 case Qt::DashDotDotLine:
4030 return "DASHDOTDOT";
4033 return "CONTINUOUS";
4048 layerName.
replace(
"<",
"_" );
4049 layerName.
replace(
">",
"_" );
4050 layerName.
replace(
"/",
"_" );
4051 layerName.
replace(
"\\",
"_" );
4052 layerName.
replace(
"\"",
"_" );
4053 layerName.
replace(
":",
"_" );
4054 layerName.
replace(
";",
"_" );
4055 layerName.
replace(
"?",
"_" );
4056 layerName.
replace(
"*",
"_" );
4057 layerName.
replace(
"|",
"_" );
4058 layerName.
replace(
"=",
"_" );
4059 layerName.
replace(
"\'",
"_" );
4064 bool QgsDxfExport::layerIsScaleBasedVisible(
const QgsMapLayer* layer )
const
4072 return layer->
minimumScale() < mSymbologyScaleDenominator &&
4079 for ( ; layerIt != mLayers.
constEnd(); ++layerIt )
4081 if ( layerIt->
first && layerIt->
first->id() == id )
4092 if ( name != codec )
4096 for ( i = 0; i < ( int )(
sizeof( mDxfEncodings ) /
sizeof( *mDxfEncodings ) ) && name != mDxfEncodings[i][1]; ++i )
4099 if ( i == (
int )(
sizeof( mDxfEncodings ) /
sizeof( *mDxfEncodings ) ) )
4102 return mDxfEncodings[i][0];
4105 return QString::null;
4114 for ( i = 0; i < ( int )(
sizeof( mDxfEncodings ) /
sizeof( *mDxfEncodings ) ) && strcmp( codec.
data(), mDxfEncodings[i][1] ) != 0; ++i )
4117 if ( i < (
int )(
sizeof( mDxfEncodings ) /
sizeof( *mDxfEncodings ) ) )
4118 encodings << codec.
data();
static double mapUnitScaleFactor(double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, QGis::UnitType mapUnits)
void setCodec(QTextCodec *codec)
const QString & name() const
Gets the name of the field.
Wrapper for iterator of features from vector data provider or vector layer.
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
void writePoint(const QString &layer, QColor color, const QgsPoint &pt)
Write point.
A rectangle specified with double values.
Base class for all map layer types.
bool isEmpty() const
test if rectangle is empty.
iterator insert(const Key &key, const T &value)
virtual Qt::PenStyle dxfPenStyle() const
virtual double dxfWidth(const QgsDxfExport &e, const QgsSymbolV2RenderContext &context) const
const Key key(const T &value) const
virtual double dxfOffset(const QgsDxfExport &e, const QgsSymbolV2RenderContext &context) const
void addLayers(const QList< QPair< QgsVectorLayer *, int > > &layers)
void writeGroup(int code, int i)
void writePolygon(const QgsPolygon &polygon, const QString &layer, const QString &hatchPattern, QColor color)
Draw dxf polygon (HATCH)
QgsMultiPolyline asMultiPolyline() const
Return contents of the geometry as a multi linestring if wkbType is WKBMultiLineString, otherwise an empty list.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())
Query the provider for features specified in request.
bool useCustomDashPattern() const
QgsPolygon asPolygon() const
Return contents of the geometry as a polygon if wkbType is WKBPolygon, otherwise an empty list...
Q_DECL_DEPRECATED void writeSolid(const QString &layer, QColor color, const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, const QgsPoint &pt4)
Draw solid.
const_iterator constEnd() const
void setRendererScale(double scale)
float minimumScale() const
Returns the minimum scale denominator at which the layer is visible.
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
static QStringList encodings()
return list of available DXF encodings
A geometry is the spatial representation of a feature.
WkbType
Used for symbology operations.
QgsSymbolV2::OutputUnit sizeUnit() const
The QGis class provides global constants for use throughout the application.
virtual QList< QString > usedAttributes()=0
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
static int closestColorMatch(QRgb pixel)
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
void writeCircle(const QString &layer, QColor color, const QgsPoint &pt, double radius, const QString &lineStyleName, double width)
Write circle (as polyline)
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
QgsMultiPolygon asMultiPolygon() const
Return contents of the geometry as a multi polygon if wkbType is WKBMultiPolygon, otherwise an empty ...
QGis::WkbType wkbType() const
Returns the WKBType or WKBUnknown in case of error.
virtual void stopRender(QgsRenderContext &context)=0
void writeString(const QString &s)
const QString & name() const
Get the display name of the layer.
virtual QgsSymbolV2List symbols()=0
for symbol levels
QgsRectangle extent() const
bool exists(int i) const
Return if a field index is valid.
int count(const T &value) const
void combineExtentWith(QgsRectangle *rect)
expand the rectangle so that covers both the original rectangle and the given rectangle ...
void append(const T &value)
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the layer.
const QgsFeature * feature() const
Current feature being rendered - may be null.
const_iterator constEnd() const
void setDevice(QIODevice *device)
virtual QVector< qreal > dxfCustomDashPattern(QgsSymbolV2::OutputUnit &unit) const
qreal alpha() const
Get alpha transparency 1 for opaque, 0 for invisible.
float maximumScale() const
Returns the maximum scale denominator at which the layer is visible.
void writeGroupCode(int code)
This class wraps a request for features to a vector layer (or directly its vector data provider)...
int symbolLayerCount()
Returns total number of symbol layers contained in the symbol.
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
QGis::WkbType wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
void writeLine(const QgsPoint &pt1, const QgsPoint &pt2, const QString &layer, const QString &lineStyleName, QColor color, double width=-1)
Write line (as a polyline)
int writeToFile(QIODevice *d, QString codec)
const QgsField & at(int i) const
Get field at particular index (must be in range 0..N-1)
virtual QColor dxfBrushColor(const QgsSymbolV2RenderContext &context) const
virtual bool hasDataDefinedProperties() const
Checks whether the layer has any associated data defined properties.
QTextCodec * codec() const
QgsGeometry * buffer(double distance, int segments) const
Returns a buffer region around this geometry having the given width and with a specified number of se...
A class to represent a point.
static QString dxfEncoding(const QString &name)
return DXF encoding for Qt encoding
virtual QColor dxfColor(const QgsSymbolV2RenderContext &context) const
virtual bool writeDxf(QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, const QgsSymbolV2RenderContext *context, const QgsFeature *f, const QPointF &shift=QPointF(0.0, 0.0)) const
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
const T value(const Key &key) const
QByteArray toLocal8Bit() const
A class to represent a vector.
iterator find(const Key &key)
bool contains(QChar ch, Qt::CaseSensitivity cs) const
QColor fromRgbF(qreal r, qreal g, qreal b, qreal a)
QString qgsDoubleToString(const double &a, const int &precision=17)
int renderingPass() const
void startRender(QgsSymbolV2RenderContext &context) override
static QString dxfLayerName(const QString &name)
Return cleaned layer name for use in DXF.
QgsPolyline asPolyline() const
Return contents of the geometry as a polyline if wkbType is WKBLineString, otherwise an empty list...
QString & replace(int position, int n, QChar after)
const_iterator constBegin() const
QList< QByteArray > availableCodecs()
Contains information about the context of a rendering operation.
virtual Qt::BrushStyle dxfBrushStyle() const
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
QString mid(int position, int n) const
QList< QPolygonF > offsetLine(QPolygonF polyline, double dist, QGis::GeometryType geometryType)
calculate geometry shifted by a specified distance
virtual QgsSymbolV2List symbolsForFeature(QgsFeature &feat)
return list of symbols used for rendering the feature.
QgsGeometry * offsetCurve(double distance, int segments, int joinStyle, double mitreLimit) const
Returns an offset line at a given distance and side from an input line.
#define DXF_HANDPLOTSTYLE
QgsMultiPoint asMultiPoint() const
Return contents of the geometry as a multi point if wkbType is WKBMultiPoint, otherwise an empty list...
bool usingSymbolLevels() const
void writeFilledCircle(const QString &layer, QColor color, const QgsPoint &pt, double radius)
Write filled circle (as hatch)
void writeDouble(double d)
const QgsGeometry * constGeometry() const
Gets a const pointer to the geometry object associated with this feature.
static double fromUnitToUnitFactor(QGis::UnitType fromUnit, QGis::UnitType toUnit)
Returns the conversion factor between the specified units.
bool canEncode(QChar ch) const
UnitType
Map units that qgis supports.
QString left(int n) const
const QgsFields & pendingFields() const
returns field list in the to-be-committed state
QgsSymbolLayerV2 * symbolLayer(int layer)
Returns a specific symbol layers contained in the symbol.
const_iterator constEnd() const
virtual int capabilities()
returns bitwise OR-ed capabilities of the renderer
bool nextFeature(QgsFeature &f)
const_iterator constBegin() const
Geometry is not required. It may still be returned if e.g. required for a filter condition.
int writeHandle(int code=5, int handle=0)
QgsPoint asPoint() const
Return contents of the geometry as a point if wkbType is WKBPoint, otherwise returns [0...
void writePolyline(const QgsPolyline &line, const QString &layer, const QString &lineStyleName, QColor color, double width=-1)
Draw dxf primitives (LWPOLYLINE)
Represents a vector layer which manages a vector based data sets.
virtual QgsSymbolV2 * symbolForFeature(QgsFeature &feature)=0
to be overridden
QgsFeatureRequest & setFlags(Flags flags)
Set flags that affect how features will be fetched.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
virtual void stopRender(QgsSymbolV2RenderContext &context)=0
void writeMText(const QString &layer, const QString &text, const QgsPoint &pt, double width, double angle, QColor color)
Write mtext (MTEXT)
QgsFeatureRequest & setFilterRect(const QgsRectangle &rect)
Set rectangle from which features will be taken.
QString layerName(const QString &id, const QgsFeature &f) const
QgsDxfExport & operator=(const QgsDxfExport &dxfExport)
void writeText(const QString &layer, const QString &text, const QgsPoint &pt, double size, double angle, QColor color)
Write text (TEXT)