qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.31k stars 2.96k forks source link

export dxf improvement #34841

Open SergeyChern opened 4 years ago

SergeyChern commented 4 years ago
  1. If text label contains CR LF signs and these signs are replaced to spaces (qgsdxfexport.cpp, function QgsDxfExport::drawLabel(...), strings 2317-2318). Result text is of one line, but label->getHeight() is height of multiline text. So, my idea is to calc count of lines in label than divide label's height by this count. Something like this: int lines_count = 1; int start_pos = txt.indexOf(QLatin1String("\r\n")); while (start_pos >= 0) { start_pos = txt.indexOf(QLatin1String("\r\n"), start_pos + 1); lines_count++; } txt.replace(QLatin1String("\r\n"), QLatin1String(" ")); start_pos = txt.indexOf('\r'); while (start_pos >= 0) { start_pos = txt.indexOf('\r', start_pos + 1); lines_count++; } txt.replace('\r', ' '); start_pos = txt.indexOf('\n'); while (start_pos >= 0) { start_pos = txt.indexOf('\n', start_pos + 1); lines_count++; } txt.replace('\n', ' '); writeText(dxfLayer, txt, QgsPoint(label->getX(), label->getY()), label->getHeight() / float(lines_count), label->getAlpha() * 180.0 / M_PI, tmpLyr.format().color());

  2. I've got AutoCAD error if layer name contains comma. Please, add replacement of comma to underscore in function QString QgsDxfExport::dxfLayerName( const QString &name ): layerName.replace( ',', '_');

  3. Some AutoCAD versions can't process transparency group code 440. Please, remove code below or make it optional in function void QgsDxfExport::writeGroup( const QColor &color, int exactMatchCode, int rgbCode, int transparencyCode ): if ( transparencyCode != -1 && color.alpha() < 255 ) writeGroup( transparencyCode, 0x2000000 | color.alpha() );

gioman commented 4 years ago

@SergeyChern could you propose patches with pull requests?

SergeyChern commented 4 years ago

@SergeyChern could you propose patches with pull requests?

Never did it, but tried

gacarrillor commented 5 months ago

The second one was already solved, see https://github.com/qgis/QGIS/issues/47381