@@ -939,42 +939,8 @@ void QgsDxfExport::writeSymbolLayerLinestyle( QTextStream& stream, const QgsSymb
939
939
{
940
940
++mSymbolLayerCounter ;
941
941
QString name = QString ( " symbolLayer%1" ).arg ( mSymbolLayerCounter );
942
-
943
942
QVector<qreal> dashPattern = simpleLine->customDashVector ();
944
- double length = 0 ;
945
- QVector<qreal>::const_iterator dashIt = dashPattern.constBegin ();
946
- for ( ; dashIt != dashPattern.constEnd (); ++dashIt )
947
- {
948
- length += *dashIt;
949
- }
950
-
951
- stream << " 0\n " ;
952
- stream << " LTYPE\n " ;
953
- stream << " 2\n " ;
954
- stream << QString ( " %1\n " ).arg ( name );
955
- stream << " 70\n " ;
956
- stream << " 64\n " ;
957
- stream << " 3\n " ;
958
- stream << " \n " ;
959
- stream << " 72\n " ;
960
- stream << " 65\n " ;
961
- stream << " 73\n " ;
962
- stream << QString ( " %1\n " ).arg ( dashPattern.size () ); // number of segments
963
- stream << " 40\n " ; // total length of segments
964
- stream << QString ( " %1\n " ).arg ( length );
965
-
966
- dashIt = dashPattern.constBegin ();
967
- bool isSpace = false ;
968
- for ( ; dashIt != dashPattern.constEnd (); ++dashIt )
969
- {
970
- stream << " 49\n " ;
971
-
972
- // map units or mm?
973
- double segmentLength = ( isSpace ? -*dashIt : *dashIt );
974
- segmentLength *= mapUnitScaleFactor ( mSymbologyScaleDenominator , simpleLine->customDashPatternUnit (), mMapUnits );
975
- stream << QString ( " %1\n " ).arg ( segmentLength );
976
- isSpace = !isSpace;
977
- }
943
+ writeLinestyle ( stream, name, dashPattern, simpleLine->customDashPatternUnit () );
978
944
mLineStyles .insert ( symbolLayer, name );
979
945
}
980
946
}
@@ -997,3 +963,41 @@ int QgsDxfExport::nLineTypes( const QList<QgsSymbolLayerV2*>& symbolLayers )
997
963
}
998
964
return nLineTypes;
999
965
}
966
+
967
+ void QgsDxfExport::writeLinestyle ( QTextStream& stream, const QString& styleName, const QVector<qreal>& pattern, QgsSymbolV2::OutputUnit u )
968
+ {
969
+ double length = 0 ;
970
+ QVector<qreal>::const_iterator dashIt = pattern.constBegin ();
971
+ for ( ; dashIt != pattern.constEnd (); ++dashIt )
972
+ {
973
+ length += *dashIt;
974
+ }
975
+
976
+ stream << " 0\n " ;
977
+ stream << " LTYPE\n " ;
978
+ stream << " 2\n " ;
979
+ stream << QString ( " %1\n " ).arg ( styleName );
980
+ stream << " 70\n " ;
981
+ stream << " 64\n " ;
982
+ stream << " 3\n " ;
983
+ stream << " \n " ;
984
+ stream << " 72\n " ;
985
+ stream << " 65\n " ;
986
+ stream << " 73\n " ;
987
+ stream << QString ( " %1\n " ).arg ( pattern.size () ); // number of segments
988
+ stream << " 40\n " ; // total length of segments
989
+ stream << QString ( " %1\n " ).arg ( length );
990
+
991
+ dashIt = pattern.constBegin ();
992
+ bool isSpace = false ;
993
+ for ( ; dashIt != pattern.constEnd (); ++dashIt )
994
+ {
995
+ stream << " 49\n " ;
996
+
997
+ // map units or mm?
998
+ double segmentLength = ( isSpace ? -*dashIt : *dashIt );
999
+ segmentLength *= mapUnitScaleFactor ( mSymbologyScaleDenominator , u, mMapUnits );
1000
+ stream << QString ( " %1\n " ).arg ( segmentLength );
1001
+ isSpace = !isSpace;
1002
+ }
1003
+ }
0 commit comments