Allow user to select DXF version.
--HG-- branch : feature
This commit is contained in:
parent
ff0e5919a7
commit
9edc1a39db
30
dist/OBS_debian/debian.valentina.1
vendored
30
dist/OBS_debian/debian.valentina.1
vendored
|
@ -32,7 +32,7 @@ The path to output destination folder. By default the directory at which the app
|
|||
.BR "*" " PDF files (*.pdf) = 1,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " Images (*.png) = 2,"
|
||||
.BR "*" " Image files (*.png) = 2,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " Wavefront OBJ (*.obj) = 3,"
|
||||
|
@ -44,8 +44,34 @@ The path to output destination folder. By default the directory at which the app
|
|||
.BR "*" " EPS files (*.eps) = 5,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " DXF files (*.dxf) = 6."
|
||||
.BR "*" " AutoCAD DXF R10 (flat) files (*.dxf) = 6,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF R11/12 (flat) files (*.dxf) = 7,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF R13 (flat) files (*.dxf) = 8,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF R14 (flat) files (*.dxf) = 9,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF 2000 (flat) files (*.dxf) = 10,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF 2004 (flat) files (*.dxf) = 11,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF 2007 (flat) files (*.dxf) = 12,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF 2010 (flat) files (*.dxf) = 13,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF 2013 (flat) files (*.dxf) = 14."
|
||||
.RE
|
||||
.IP "--bdxf"
|
||||
.RB "Export dxf in binary form."
|
||||
.IP "-x, --gsize <The size value>"
|
||||
.RB "Set size value a pattern file, that was opened with standard measurements " "(export mode)" ". Valid values: 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56cm."
|
||||
.IP "-e, --gheight <The height value>"
|
||||
|
|
30
dist/debian/valentina.1
vendored
30
dist/debian/valentina.1
vendored
|
@ -32,7 +32,7 @@ The path to output destination folder. By default the directory at which the app
|
|||
.BR "*" " PDF files (*.pdf) = 1,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " Images (*.png) = 2,"
|
||||
.BR "*" " Image files (*.png) = 2,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " Wavefront OBJ (*.obj) = 3,"
|
||||
|
@ -44,8 +44,34 @@ The path to output destination folder. By default the directory at which the app
|
|||
.BR "*" " EPS files (*.eps) = 5,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " DXF files (*.dxf) = 6."
|
||||
.BR "*" " AutoCAD DXF R10 (flat) files (*.dxf) = 6,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF R11/12 (flat) files (*.dxf) = 7,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF R13 (flat) files (*.dxf) = 8,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF R14 (flat) files (*.dxf) = 9,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF 2000 (flat) files (*.dxf) = 10,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF 2004 (flat) files (*.dxf) = 11,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF 2007 (flat) files (*.dxf) = 12,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF 2010 (flat) files (*.dxf) = 13,"
|
||||
.RE
|
||||
.RS
|
||||
.BR "*" " AutoCAD DXF 2013 (flat) files (*.dxf) = 14."
|
||||
.RE
|
||||
.IP "--bdxf"
|
||||
.RB "Export dxf in binary form."
|
||||
.IP "-x, --gsize <The size value>"
|
||||
.RB "Set size value a pattern file, that was opened with standard measurements " "(export mode)" ". Valid values: 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56cm."
|
||||
.IP "-e, --gheight <The height value>"
|
||||
|
|
|
@ -100,6 +100,10 @@ void VCommandLine::InitOptions(VCommandLineOptions &options, QMap<QString, int>
|
|||
DialogSaveLayout::MakeHelpFormatList(),
|
||||
translate("VCommandLine", "Format number"), "0"));
|
||||
|
||||
optionsIndex.insert(LONG_OPTION_BINARYDXF, index++);
|
||||
options.append(new QCommandLineOption(QStringList() << LONG_OPTION_BINARYDXF,
|
||||
translate("VCommandLine", "Export dxf in binary form.")));
|
||||
|
||||
optionsIndex.insert(LONG_OPTION_GRADATIONSIZE, index++);
|
||||
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_GRADATIONSIZE << LONG_OPTION_GRADATIONSIZE,
|
||||
translate("VCommandLine", "Set size value a pattern file, that was opened "
|
||||
|
@ -617,6 +621,15 @@ int VCommandLine::OptExportType() const
|
|||
return r;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VCommandLine::IsBinaryDXF() const
|
||||
{
|
||||
if (parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_BINARYDXF))))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QStringList VCommandLine::OptInputFileNames() const
|
||||
{
|
||||
|
|
|
@ -75,6 +75,8 @@ public:
|
|||
//@brief returns export type set, defaults 0 - svg
|
||||
int OptExportType() const;
|
||||
|
||||
int IsBinaryDXF() const;
|
||||
|
||||
//generator creation is moved here ... because most options are for it only, so no need to create extra getters...
|
||||
//@brief creates VLayoutGenerator
|
||||
VLayoutGeneratorPtr DefaultGenerator() const;
|
||||
|
|
|
@ -47,7 +47,10 @@ bool DialogSaveLayout::tested = false;
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *parent)
|
||||
:QDialog(parent), ui(new Ui::DialogSaveLAyout), count(count), isInitialized(false), availFormats(InitAvailFormats())
|
||||
: QDialog(parent),
|
||||
ui(new Ui::DialogSaveLAyout),
|
||||
count(count),
|
||||
isInitialized(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -80,20 +83,14 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
|
|||
}
|
||||
}
|
||||
|
||||
foreach (auto& v , availFormats)
|
||||
foreach (auto& v, InitFormats())
|
||||
{
|
||||
ui->comboBoxFormat->addItem(v.first, QVariant(v.second));
|
||||
ui->comboBoxFormat->addItem(v.first, QVariant(static_cast<int>(v.second)));
|
||||
}
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save);
|
||||
|
||||
auto ShowExample = [this]()
|
||||
{
|
||||
ui->labelExample->setText(tr("Example:") + FileName() + QLatin1String("1") + Format());
|
||||
};
|
||||
|
||||
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, ShowExample);
|
||||
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample);
|
||||
connect(ui->comboBoxFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, ShowExample);
|
||||
this, &DialogSaveLayout::ShowExample);
|
||||
connect(ui->pushButtonBrowse, &QPushButton::clicked, this, [this]()
|
||||
{
|
||||
const QString dirPath = qApp->ValentinaSettings()->GetPathLayout();
|
||||
|
@ -126,15 +123,15 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
|
|||
}
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void DialogSaveLayout::SelectFormate(const int formate)
|
||||
void DialogSaveLayout::SelectFormat(LayoutExportFormats format)
|
||||
{
|
||||
if (formate >= availFormats.size())
|
||||
if (static_cast<int>(format) < 0 || format >= LayoutExportFormats::COUNT)
|
||||
{
|
||||
VException e(tr("Tried to use out of range format number."));
|
||||
throw e;
|
||||
}
|
||||
|
||||
const int i = ui->comboBoxFormat->findData(availFormats.at(formate).second);
|
||||
const int i = ui->comboBoxFormat->findData(static_cast<int>(format));
|
||||
if (i < 0)
|
||||
{
|
||||
VException e(tr("Selected not present format."));
|
||||
|
@ -143,15 +140,104 @@ void DialogSaveLayout::SelectFormate(const int formate)
|
|||
ui->comboBoxFormat->setCurrentIndex(i);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSaveLayout::SetBinaryDXFFormat(bool binary)
|
||||
{
|
||||
switch(Format())
|
||||
{
|
||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
||||
case LayoutExportFormats::DXF_AC1009_Flat:
|
||||
case LayoutExportFormats::DXF_AC1012_Flat:
|
||||
case LayoutExportFormats::DXF_AC1014_Flat:
|
||||
case LayoutExportFormats::DXF_AC1015_Flat:
|
||||
case LayoutExportFormats::DXF_AC1018_Flat:
|
||||
case LayoutExportFormats::DXF_AC1021_Flat:
|
||||
case LayoutExportFormats::DXF_AC1024_Flat:
|
||||
case LayoutExportFormats::DXF_AC1027_Flat:
|
||||
case LayoutExportFormats::DXF_AC1006_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1009_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1012_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1014_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1015_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1018_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1021_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1024_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1027_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1006_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1009_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1012_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1014_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1015_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1018_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1021_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1024_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
||||
ui->checkBoxBinaryDXF->setChecked(binary);
|
||||
break;
|
||||
case LayoutExportFormats::SVG:
|
||||
case LayoutExportFormats::PDF:
|
||||
case LayoutExportFormats::PNG:
|
||||
case LayoutExportFormats::OBJ:
|
||||
case LayoutExportFormats::PS:
|
||||
case LayoutExportFormats::EPS:
|
||||
default:
|
||||
ui->checkBoxBinaryDXF->setChecked(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool DialogSaveLayout::IsBinaryDXFFormat() const
|
||||
{
|
||||
switch(Format())
|
||||
{
|
||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
||||
case LayoutExportFormats::DXF_AC1009_Flat:
|
||||
case LayoutExportFormats::DXF_AC1012_Flat:
|
||||
case LayoutExportFormats::DXF_AC1014_Flat:
|
||||
case LayoutExportFormats::DXF_AC1015_Flat:
|
||||
case LayoutExportFormats::DXF_AC1018_Flat:
|
||||
case LayoutExportFormats::DXF_AC1021_Flat:
|
||||
case LayoutExportFormats::DXF_AC1024_Flat:
|
||||
case LayoutExportFormats::DXF_AC1027_Flat:
|
||||
case LayoutExportFormats::DXF_AC1006_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1009_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1012_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1014_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1015_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1018_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1021_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1024_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1027_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1006_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1009_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1012_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1014_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1015_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1018_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1021_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1024_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
||||
return ui->checkBoxBinaryDXF->isChecked();
|
||||
case LayoutExportFormats::SVG:
|
||||
case LayoutExportFormats::PDF:
|
||||
case LayoutExportFormats::PNG:
|
||||
case LayoutExportFormats::OBJ:
|
||||
case LayoutExportFormats::PS:
|
||||
case LayoutExportFormats::EPS:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogSaveLayout::MakeHelpFormatList()
|
||||
{
|
||||
QString out("\n");
|
||||
int cntr = 0;
|
||||
const QVector<std::pair<QString, QString>> availFormats = InitAvailFormats();
|
||||
foreach(auto& v, availFormats)
|
||||
foreach(auto& v, InitFormats())
|
||||
{
|
||||
out += QLatin1String("\t") + v.first+QLatin1String(" = ") + QString::number(cntr++) + QLatin1String("\n");
|
||||
out += QLatin1String("\t") + v.first + QLatin1String(" = ") + QString::number(static_cast<int>(v.second))
|
||||
+ QLatin1String("\n");
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
@ -183,6 +269,136 @@ void DialogSaveLayout::SetDestinationPath(const QString &cmdDestinationPath)
|
|||
ui->lineEditPath->setText(path);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogSaveLayout::ExportFormatDescription(LayoutExportFormats format)
|
||||
{
|
||||
const QString dxfSuffix = QStringLiteral("(*.dxf)");
|
||||
const QString dxfFlatFilesStr = tr("(flat) files");
|
||||
const QString filesStr = tr("files");
|
||||
|
||||
switch(format)
|
||||
{
|
||||
case LayoutExportFormats::SVG:
|
||||
return QString("Svg %1 (*.svg)").arg(filesStr);
|
||||
case LayoutExportFormats::PDF:
|
||||
return QString("PDF %1 (*.pdf)").arg(filesStr);
|
||||
case LayoutExportFormats::PNG:
|
||||
return tr("Image files") + QLatin1String(" (*.png)");
|
||||
case LayoutExportFormats::OBJ:
|
||||
return "Wavefront OBJ (*.obj)";
|
||||
case LayoutExportFormats::PS:
|
||||
return QString("PS %1 (*.ps)").arg(filesStr);
|
||||
case LayoutExportFormats::EPS:
|
||||
return QString("EPS %1 (*.eps)").arg(filesStr);
|
||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
||||
return QString("AutoCAD DXF R10 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1009_Flat:
|
||||
return QString("AutoCAD DXF R11/12 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1012_Flat:
|
||||
return QString("AutoCAD DXF R13 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1014_Flat:
|
||||
return QString("AutoCAD DXF R14 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1015_Flat:
|
||||
return QString("AutoCAD DXF 2000 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1018_Flat:
|
||||
return QString("AutoCAD DXF 2004 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1021_Flat:
|
||||
return QString("AutoCAD DXF 2007 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1024_Flat:
|
||||
return QString("AutoCAD DXF 2010 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1027_Flat:
|
||||
return QString("AutoCAD DXF 2013 %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1006_AAMA:
|
||||
return QString("AutoCAD DXF R10 AAMA %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1009_AAMA:
|
||||
return QString("AutoCAD DXF R11/12 AAMA %1 %2").arg(dxfFlatFilesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1012_AAMA:
|
||||
return QString("AutoCAD DXF R13 AAMA %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1014_AAMA:
|
||||
return QString("AutoCAD DXF R14 AAMA %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1015_AAMA:
|
||||
return QString("AutoCAD DXF 2000 AAMA %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1018_AAMA:
|
||||
return QString("AutoCAD DXF 2004 AAMA %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1021_AAMA:
|
||||
return QString("AutoCAD DXF 2007 AAMA %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1024_AAMA:
|
||||
return QString("AutoCAD DXF 2010 AAMA %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1027_AAMA:
|
||||
return QString("AutoCAD DXF 2013 AAMA %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1006_ASTM:
|
||||
return QString("AutoCAD DXF R10 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1009_ASTM:
|
||||
return QString("AutoCAD DXF R11/12 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1012_ASTM:
|
||||
return QString("AutoCAD DXF R13 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1014_ASTM:
|
||||
return QString("AutoCAD DXF R14 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1015_ASTM:
|
||||
return QString("AutoCAD DXF 2000 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1018_ASTM:
|
||||
return QString("AutoCAD DXF 2004 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1021_ASTM:
|
||||
return QString("AutoCAD DXF 2007 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1024_ASTM:
|
||||
return QString("AutoCAD DXF 2010 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
||||
return QString("AutoCAD DXF 2013 ASTM %1 %2").arg(filesStr, dxfSuffix);
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogSaveLayout::ExportFromatSuffix(LayoutExportFormats format)
|
||||
{
|
||||
switch(format)
|
||||
{
|
||||
case LayoutExportFormats::SVG:
|
||||
return ".svg";
|
||||
case LayoutExportFormats::PDF:
|
||||
return ".pdf";
|
||||
case LayoutExportFormats::PNG:
|
||||
return ".png";
|
||||
case LayoutExportFormats::OBJ:
|
||||
return ".obj";
|
||||
case LayoutExportFormats::PS:
|
||||
return ".ps";
|
||||
case LayoutExportFormats::EPS:
|
||||
return ".eps";
|
||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
||||
case LayoutExportFormats::DXF_AC1009_Flat:
|
||||
case LayoutExportFormats::DXF_AC1012_Flat:
|
||||
case LayoutExportFormats::DXF_AC1014_Flat:
|
||||
case LayoutExportFormats::DXF_AC1015_Flat:
|
||||
case LayoutExportFormats::DXF_AC1018_Flat:
|
||||
case LayoutExportFormats::DXF_AC1021_Flat:
|
||||
case LayoutExportFormats::DXF_AC1024_Flat:
|
||||
case LayoutExportFormats::DXF_AC1027_Flat:
|
||||
case LayoutExportFormats::DXF_AC1006_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1009_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1012_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1014_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1015_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1018_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1021_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1024_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1027_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1006_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1009_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1012_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1014_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1015_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1018_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1021_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1024_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
||||
return ".dxf";
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSaveLayout::~DialogSaveLayout()
|
||||
{
|
||||
|
@ -202,9 +418,9 @@ QString DialogSaveLayout::FileName() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogSaveLayout::Format() const
|
||||
LayoutExportFormats DialogSaveLayout::Format() const
|
||||
{
|
||||
return ui->comboBoxFormat->currentData().toString();
|
||||
return static_cast<LayoutExportFormats>(ui->comboBoxFormat->currentData().toInt());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -212,7 +428,7 @@ void DialogSaveLayout::Save()
|
|||
{
|
||||
for (int i=0; i < count; ++i)
|
||||
{
|
||||
const QString name = Path()+QLatin1Literal("/")+FileName()+QString::number(i+1)+Format();
|
||||
const QString name = Path()+QLatin1Literal("/")+FileName()+QString::number(i+1)+ExportFromatSuffix(Format());
|
||||
if (QFile::exists(name))
|
||||
{
|
||||
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Name conflict"),
|
||||
|
@ -255,6 +471,55 @@ void DialogSaveLayout::PathChanged(const QString &text)
|
|||
ui->lineEditPath->setPalette(palette);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSaveLayout::ShowExample()
|
||||
{
|
||||
const LayoutExportFormats currentFormat = Format();
|
||||
ui->labelExample->setText(tr("Example:") + FileName() + QLatin1String("1") + ExportFromatSuffix(currentFormat));
|
||||
|
||||
switch(currentFormat)
|
||||
{
|
||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
||||
case LayoutExportFormats::DXF_AC1009_Flat:
|
||||
case LayoutExportFormats::DXF_AC1012_Flat:
|
||||
case LayoutExportFormats::DXF_AC1014_Flat:
|
||||
case LayoutExportFormats::DXF_AC1015_Flat:
|
||||
case LayoutExportFormats::DXF_AC1018_Flat:
|
||||
case LayoutExportFormats::DXF_AC1021_Flat:
|
||||
case LayoutExportFormats::DXF_AC1024_Flat:
|
||||
case LayoutExportFormats::DXF_AC1027_Flat:
|
||||
case LayoutExportFormats::DXF_AC1006_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1009_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1012_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1014_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1015_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1018_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1021_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1024_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1027_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1006_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1009_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1012_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1014_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1015_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1018_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1021_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1024_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
||||
ui->checkBoxBinaryDXF->setEnabled(true);
|
||||
break;
|
||||
case LayoutExportFormats::SVG:
|
||||
case LayoutExportFormats::PDF:
|
||||
case LayoutExportFormats::PNG:
|
||||
case LayoutExportFormats::OBJ:
|
||||
case LayoutExportFormats::PS:
|
||||
case LayoutExportFormats::EPS:
|
||||
default:
|
||||
ui->checkBoxBinaryDXF->setEnabled(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSaveLayout::showEvent(QShowEvent *event)
|
||||
{
|
||||
|
@ -310,22 +575,55 @@ bool DialogSaveLayout::TestPdf()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<std::pair<QString, QString>> DialogSaveLayout::InitAvailFormats()
|
||||
QVector<std::pair<QString, LayoutExportFormats> > DialogSaveLayout::InitFormats()
|
||||
{
|
||||
QVector<std::pair<QString, QString>> list;
|
||||
list.append(std::make_pair(QLatin1String("Svg ") + tr("files") + QLatin1String(" (*.svg)"), QLatin1String(".svg")));
|
||||
list.append(std::make_pair(QLatin1String("PDF ") + tr("files") + QLatin1String(" (*.pdf)"), QLatin1String(".pdf")));
|
||||
list.append(std::make_pair(QLatin1String("Images") + QLatin1String(" (*.png)"), QLatin1String(".png")));
|
||||
QVector<std::pair<QString, LayoutExportFormats>> list;
|
||||
|
||||
auto InitFormat = [&list](LayoutExportFormats format)
|
||||
{
|
||||
list.append(std::make_pair(ExportFormatDescription(format), format));
|
||||
};
|
||||
|
||||
InitFormat(LayoutExportFormats::SVG);
|
||||
InitFormat(LayoutExportFormats::PDF);
|
||||
InitFormat(LayoutExportFormats::PNG);
|
||||
#ifndef V_NO_ASSERT // Temporarily unavailable
|
||||
list.append(std::make_pair(QLatin1String("Wavefront OBJ (*.obj)"), QLatin1String(".obj")));
|
||||
InitFormat(LayoutExportFormats::OBJ);
|
||||
#endif
|
||||
if (SupportPSTest())
|
||||
{
|
||||
list.append(std::make_pair(QLatin1String("PS ") + tr("files") + QLatin1String(" (*.ps)"),
|
||||
QLatin1String(".ps")));
|
||||
list.append(std::make_pair(QLatin1String("EPS ") + tr("files") + QLatin1String(" (*.eps)"),
|
||||
QLatin1String(".eps")));
|
||||
InitFormat(LayoutExportFormats::PS);
|
||||
InitFormat(LayoutExportFormats::EPS);
|
||||
}
|
||||
list.append(std::make_pair(QLatin1String("DXF ") + tr("files") + QLatin1String(" (*.dxf)"), QLatin1String(".dxf")));
|
||||
InitFormat(LayoutExportFormats::DXF_AC1006_Flat);
|
||||
InitFormat(LayoutExportFormats::DXF_AC1009_Flat);
|
||||
InitFormat(LayoutExportFormats::DXF_AC1012_Flat);
|
||||
InitFormat(LayoutExportFormats::DXF_AC1014_Flat);
|
||||
InitFormat(LayoutExportFormats::DXF_AC1015_Flat);
|
||||
InitFormat(LayoutExportFormats::DXF_AC1018_Flat);
|
||||
InitFormat(LayoutExportFormats::DXF_AC1021_Flat);
|
||||
InitFormat(LayoutExportFormats::DXF_AC1024_Flat);
|
||||
InitFormat(LayoutExportFormats::DXF_AC1027_Flat);
|
||||
|
||||
// We will support them anyway
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1006_AAMA);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1009_AAMA);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1012_AAMA);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1014_AAMA);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1015_AAMA);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1018_AAMA);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1021_AAMA);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1024_AAMA);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1027_AAMA);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1006_ASTM);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1009_ASTM);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1012_ASTM);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1014_ASTM);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1015_ASTM);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1018_ASTM);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1021_ASTM);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1024_ASTM);
|
||||
// InitFormat(LayoutExportFormats::DXF_AC1027_ASTM);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -42,38 +42,82 @@ namespace Ui
|
|||
class DialogSaveLAyout;
|
||||
}
|
||||
|
||||
enum class LayoutExportFormats : char
|
||||
{
|
||||
SVG = 0,
|
||||
PDF = 1,
|
||||
PNG = 2,
|
||||
OBJ = 3, /* Wavefront OBJ*/
|
||||
PS = 4,
|
||||
EPS = 5,
|
||||
DXF_AC1006_Flat = 6, /*< R10. */
|
||||
DXF_AC1009_Flat = 7, /*< R11 & R12. */
|
||||
DXF_AC1012_Flat = 8, /*< R13. */
|
||||
DXF_AC1014_Flat = 9, /*< R14. */
|
||||
DXF_AC1015_Flat = 10, /*< ACAD 2000. */
|
||||
DXF_AC1018_Flat = 11, /*< ACAD 2004. */
|
||||
DXF_AC1021_Flat = 12, /*< ACAD 2007. */
|
||||
DXF_AC1024_Flat = 13, /*< ACAD 2010. */
|
||||
DXF_AC1027_Flat = 14, /*< ACAD 2013. */
|
||||
DXF_AC1006_AAMA = 15, /*< R10. */
|
||||
DXF_AC1009_AAMA = 16, /*< R11 & R12. */
|
||||
DXF_AC1012_AAMA = 17, /*< R13. */
|
||||
DXF_AC1014_AAMA = 18, /*< R14. */
|
||||
DXF_AC1015_AAMA = 19, /*< ACAD 2000. */
|
||||
DXF_AC1018_AAMA = 20, /*< ACAD 2004. */
|
||||
DXF_AC1021_AAMA = 21, /*< ACAD 2007. */
|
||||
DXF_AC1024_AAMA = 22, /*< ACAD 2010. */
|
||||
DXF_AC1027_AAMA = 23, /*< ACAD 2013. */
|
||||
DXF_AC1006_ASTM = 24, /*< R10. */
|
||||
DXF_AC1009_ASTM = 25, /*< R11 & R12. */
|
||||
DXF_AC1012_ASTM = 26, /*< R13. */
|
||||
DXF_AC1014_ASTM = 27, /*< R14. */
|
||||
DXF_AC1015_ASTM = 28, /*< ACAD 2000. */
|
||||
DXF_AC1018_ASTM = 29, /*< ACAD 2004. */
|
||||
DXF_AC1021_ASTM = 30, /*< ACAD 2007. */
|
||||
DXF_AC1024_ASTM = 31, /*< ACAD 2010. */
|
||||
DXF_AC1027_ASTM = 32, /*< ACAD 2013. */
|
||||
COUNT /*Use only for validation*/
|
||||
};
|
||||
|
||||
class DialogSaveLayout : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogSaveLayout(int count, const QString &fileName = QString(),
|
||||
QWidget *parent = 0);
|
||||
~DialogSaveLayout();
|
||||
explicit DialogSaveLayout(int count, const QString &fileName = QString(), QWidget *parent = nullptr);
|
||||
virtual ~DialogSaveLayout();
|
||||
|
||||
QString Path() const;
|
||||
QString FileName() const;
|
||||
QString Format() const;
|
||||
void SelectFormate(const int formate);
|
||||
|
||||
LayoutExportFormats Format() const;
|
||||
void SelectFormat(LayoutExportFormats format);
|
||||
|
||||
void SetBinaryDXFFormat(bool binary);
|
||||
bool IsBinaryDXFFormat() const;
|
||||
|
||||
static QString MakeHelpFormatList();
|
||||
void SetDestinationPath(const QString& cmdDestinationPath);
|
||||
|
||||
static QString ExportFormatDescription(LayoutExportFormats format);
|
||||
static QString ExportFromatSuffix(LayoutExportFormats format);
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
||||
private slots:
|
||||
void Save();
|
||||
void PathChanged(const QString &text);
|
||||
void ShowExample();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogSaveLayout)
|
||||
Ui::DialogSaveLAyout *ui;
|
||||
int count;
|
||||
bool isInitialized;
|
||||
// Note. We can't make availFormats static because MSVC doesn't support C++11 list initialization
|
||||
QVector<std::pair<QString, QString>> availFormats;
|
||||
static bool havePdf;
|
||||
static bool tested;
|
||||
static bool SupportPSTest();
|
||||
static bool TestPdf();
|
||||
static QVector<std::pair<QString, QString> > InitAvailFormats();
|
||||
static QVector<std::pair<QString, LayoutExportFormats> > InitFormats();
|
||||
};
|
||||
|
||||
#endif // DIALOGSAVELAYOUT_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>748</width>
|
||||
<height>150</height>
|
||||
<height>178</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -92,14 +92,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>File name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditFileName">
|
||||
|
@ -135,6 +135,23 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="checkBoxBinaryDXF">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Binary form</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -4690,7 +4690,8 @@ void MainWindow::DoExport(const VCommandLinePtr &expParams)
|
|||
{
|
||||
DialogSaveLayout dialog(scenes.size(), expParams->OptBaseName(), this);
|
||||
dialog.SetDestinationPath(expParams->OptDestinationPath());
|
||||
dialog.SelectFormate(expParams->OptExportType());
|
||||
dialog.SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
|
||||
dialog.SetBinaryDXFFormat(expParams->IsBinaryDXF());
|
||||
ExportLayout(dialog);
|
||||
}
|
||||
catch (const VException &e)
|
||||
|
|
|
@ -200,8 +200,6 @@ void MainWindowsNoGUI::ErrorConsoleMode(const LayoutErrors &state)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
|
||||
{
|
||||
|
||||
const QString suf = dialog.Format().replace(".", "");
|
||||
const QString path = dialog.Path();
|
||||
QDir dir(path);
|
||||
dir.setPath(path);
|
||||
|
@ -215,51 +213,90 @@ void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
|
|||
}
|
||||
qApp->ValentinaSettings()->SetPathLayout(path);
|
||||
const QString mask = dialog.FileName();
|
||||
const LayoutExportFormats format = dialog.Format();
|
||||
|
||||
for (int i=0; i < scenes.size(); ++i)
|
||||
{
|
||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||
if (paper)
|
||||
{
|
||||
const QString name = path + QLatin1String("/") + mask+QString::number(i+1) + dialog.Format();
|
||||
const QString name = path + QLatin1String("/") + mask+QString::number(i+1)
|
||||
+ DialogSaveLayout::ExportFromatSuffix(format);
|
||||
QBrush *brush = new QBrush();
|
||||
brush->setColor( QColor( Qt::white ) );
|
||||
scenes[i]->setBackgroundBrush( *brush );
|
||||
shadows[i]->setVisible(false);
|
||||
paper->setPen(QPen(QBrush(Qt::white, Qt::NoBrush), 0.1, Qt::NoPen));
|
||||
const QStringList suffix = QStringList() << QLatin1String("svg")
|
||||
<< QLatin1String("png")
|
||||
<< QLatin1String("pdf")
|
||||
<< QLatin1String("eps")
|
||||
<< QLatin1String("ps")
|
||||
<< QLatin1String("obj")
|
||||
<< QLatin1String("dxf");
|
||||
switch (suffix.indexOf(suf))
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case 0: //svg
|
||||
case LayoutExportFormats::DXF_AC1006_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1009_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1012_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1014_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1015_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1018_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1021_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1024_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1027_AAMA:
|
||||
case LayoutExportFormats::DXF_AC1006_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1009_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1012_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1014_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1015_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1018_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1021_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1024_ASTM:
|
||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
||||
Q_UNREACHABLE(); // For now not supported
|
||||
case LayoutExportFormats::SVG:
|
||||
paper->setVisible(false);
|
||||
SvgFile(name, i);
|
||||
paper->setVisible(true);
|
||||
break;
|
||||
case 1: //png
|
||||
PngFile(name, i);
|
||||
break;
|
||||
case 2: //pdf
|
||||
case LayoutExportFormats::PDF:
|
||||
PdfFile(name, i);
|
||||
break;
|
||||
case 3: //eps
|
||||
EpsFile(name, i);
|
||||
case LayoutExportFormats::PNG:
|
||||
PngFile(name, i);
|
||||
break;
|
||||
case 4: //ps
|
||||
PsFile(name, i);
|
||||
break;
|
||||
case 5: //obj
|
||||
case LayoutExportFormats::OBJ:
|
||||
paper->setVisible(false);
|
||||
ObjFile(name, i);
|
||||
paper->setVisible(true);
|
||||
break;
|
||||
case 6: //dxf
|
||||
DxfFile(name, i);
|
||||
case LayoutExportFormats::PS:
|
||||
PsFile(name, i);
|
||||
break;
|
||||
case LayoutExportFormats::EPS:
|
||||
EpsFile(name, i);
|
||||
break;
|
||||
case LayoutExportFormats::DXF_AC1006_Flat:
|
||||
DxfFile(name, DRW::AC1006, dialog.IsBinaryDXFFormat(), i);
|
||||
break;
|
||||
case LayoutExportFormats::DXF_AC1009_Flat:
|
||||
DxfFile(name, DRW::AC1009, dialog.IsBinaryDXFFormat(), i);
|
||||
break;
|
||||
case LayoutExportFormats::DXF_AC1012_Flat:
|
||||
DxfFile(name, DRW::AC1012, dialog.IsBinaryDXFFormat(), i);
|
||||
break;
|
||||
case LayoutExportFormats::DXF_AC1014_Flat:
|
||||
DxfFile(name, DRW::AC1014, dialog.IsBinaryDXFFormat(), i);
|
||||
break;
|
||||
case LayoutExportFormats::DXF_AC1015_Flat:
|
||||
DxfFile(name, DRW::AC1015, dialog.IsBinaryDXFFormat(), i);
|
||||
break;
|
||||
case LayoutExportFormats::DXF_AC1018_Flat:
|
||||
DxfFile(name, DRW::AC1018, dialog.IsBinaryDXFFormat(), i);
|
||||
break;
|
||||
case LayoutExportFormats::DXF_AC1021_Flat:
|
||||
DxfFile(name, DRW::AC1021, dialog.IsBinaryDXFFormat(), i);
|
||||
break;
|
||||
case LayoutExportFormats::DXF_AC1024_Flat:
|
||||
DxfFile(name, DRW::AC1024, dialog.IsBinaryDXFFormat(), i);
|
||||
break;
|
||||
case LayoutExportFormats::DXF_AC1027_Flat:
|
||||
DxfFile(name, DRW::AC1027, dialog.IsBinaryDXFFormat(), i);
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Can't recognize file suffix." << Q_FUNC_INFO;
|
||||
|
@ -763,7 +800,7 @@ void MainWindowsNoGUI::ObjFile(const QString &name, int i) const
|
|||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||
|
||||
void MainWindowsNoGUI::DxfFile(const QString &name, int i) const
|
||||
void MainWindowsNoGUI::DxfFile(const QString &name, int version, bool binary, int i) const
|
||||
{
|
||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||
if (paper)
|
||||
|
@ -772,6 +809,8 @@ void MainWindowsNoGUI::DxfFile(const QString &name, int i) const
|
|||
generator.setFileName(name);
|
||||
generator.setSize(paper->rect().size().toSize());
|
||||
generator.setResolution(PrintDPI);
|
||||
generator.SetVersion(static_cast<DRW::Version>(version));
|
||||
generator.SetBinaryFormat(binary);
|
||||
|
||||
switch (*pattern->GetPatternUnit())
|
||||
{
|
||||
|
|
|
@ -120,7 +120,7 @@ private:
|
|||
void PsFile(const QString &name, int i)const;
|
||||
void PdfToPs(const QStringList ¶ms)const;
|
||||
void ObjFile(const QString &name, int i)const;
|
||||
void DxfFile(const QString &name, int i)const;
|
||||
void DxfFile(const QString &name, int version, bool binary, int i)const;
|
||||
|
||||
void PreparePaper(int index) const;
|
||||
void RestorePaper(int index) const;
|
||||
|
|
|
@ -74,6 +74,7 @@ VDxfEngine::VDxfEngine()
|
|||
resolution(static_cast<int>(PrintDPI)),
|
||||
fileName(),
|
||||
m_version(DRW::AC1014),
|
||||
m_binary(false),
|
||||
matrix(),
|
||||
input(),
|
||||
varMeasurement(VarMeasurement::Metric),
|
||||
|
@ -98,7 +99,7 @@ bool VDxfEngine::begin(QPaintDevice *pdev)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VDxfEngine::end()
|
||||
{
|
||||
const bool res = input->fileExport(m_version, false);
|
||||
const bool res = input->fileExport(m_version, m_binary);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -436,6 +437,18 @@ void VDxfEngine::SetVersion(DRW::Version version)
|
|||
m_version = version;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDxfEngine::SetBinaryFormat(bool binary)
|
||||
{
|
||||
m_binary = binary;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VDxfEngine::IsBinaryFormat() const
|
||||
{
|
||||
return m_binary;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
std::string VDxfEngine::getPenStyle()
|
||||
{
|
||||
|
|
|
@ -78,6 +78,9 @@ public:
|
|||
DRW::Version GetVersion() const;
|
||||
void SetVersion(DRW::Version version);
|
||||
|
||||
void SetBinaryFormat(bool binary);
|
||||
bool IsBinaryFormat() const;
|
||||
|
||||
std::string getPenStyle();
|
||||
int getPenColor();
|
||||
|
||||
|
@ -90,6 +93,7 @@ private:
|
|||
double resolution;
|
||||
QString fileName;
|
||||
DRW::Version m_version;
|
||||
bool m_binary;
|
||||
QMatrix matrix;
|
||||
QSharedPointer<dx_iface> input;
|
||||
VarMeasurement varMeasurement;
|
||||
|
|
|
@ -98,18 +98,67 @@ double VDxfPaintDevice::getResolution() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDxfPaintDevice::setResolution(double dpi)
|
||||
{
|
||||
if (engine->isActive())
|
||||
{
|
||||
qWarning("VDxfPaintDevice::setResolution(), cannot set dpi while Dxf is being generated");
|
||||
return;
|
||||
}
|
||||
engine->setResolution(dpi);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DRW::Version VDxfPaintDevice::GetVersion() const
|
||||
{
|
||||
return engine->GetVersion();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDxfPaintDevice::SetVersion(DRW::Version version)
|
||||
{
|
||||
if (engine->isActive())
|
||||
{
|
||||
qWarning("VDxfPaintDevice::SetVersion(), cannot set version while Dxf is being generated");
|
||||
return;
|
||||
}
|
||||
engine->SetVersion(version);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDxfPaintDevice::SetBinaryFormat(bool binary)
|
||||
{
|
||||
if (engine->isActive())
|
||||
{
|
||||
qWarning("VDxfPaintDevice::SetBinaryFormat(), cannot set binary format while Dxf is being generated");
|
||||
return;
|
||||
}
|
||||
engine->SetBinaryFormat(binary);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VDxfPaintDevice::IsBinaryFromat() const
|
||||
{
|
||||
return engine->IsBinaryFormat();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDxfPaintDevice::setMeasurement(const VarMeasurement &var)
|
||||
{
|
||||
if (engine->isActive())
|
||||
{
|
||||
qWarning("VDxfPaintDevice::setMeasurement(), cannot set measurements while Dxf is being generated");
|
||||
return;
|
||||
}
|
||||
engine->setMeasurement(var);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDxfPaintDevice::setInsunits(const VarInsunits &var)
|
||||
{
|
||||
if (engine->isActive())
|
||||
{
|
||||
qWarning("VDxfPaintDevice::setInsunits(), cannot set units while Dxf is being generated");
|
||||
return;
|
||||
}
|
||||
engine->setInsunits(var);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <QtGlobal>
|
||||
|
||||
#include "dxfdef.h"
|
||||
#include "libdxfrw/drw_base.h"
|
||||
|
||||
class VDxfEngine;
|
||||
|
||||
|
@ -55,6 +56,12 @@ public:
|
|||
double getResolution() const;
|
||||
void setResolution(double dpi);
|
||||
|
||||
DRW::Version GetVersion() const;
|
||||
void SetVersion(DRW::Version version);
|
||||
|
||||
void SetBinaryFormat(bool binary);
|
||||
bool IsBinaryFromat() const;
|
||||
|
||||
void setMeasurement(const VarMeasurement &var);
|
||||
void setInsunits(const VarInsunits &var);
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ const QString SINGLE_OPTION_PAGETEMPLATE = QStringLiteral("p");
|
|||
const QString LONG_OPTION_EXP2FORMAT = QStringLiteral("format");
|
||||
const QString SINGLE_OPTION_EXP2FORMAT = QStringLiteral("f");
|
||||
|
||||
const QString LONG_OPTION_BINARYDXF = QStringLiteral("bdxf");
|
||||
|
||||
const QString LONG_OPTION_ROTATE = QStringLiteral("rotate");
|
||||
const QString SINGLE_OPTION_ROTATE = QStringLiteral("r");
|
||||
|
||||
|
@ -115,6 +117,7 @@ QStringList AllKeys()
|
|||
<< LONG_OPTION_MEASUREFILE << SINGLE_OPTION_MEASUREFILE
|
||||
<< LONG_OPTION_PAGETEMPLATE << SINGLE_OPTION_PAGETEMPLATE
|
||||
<< LONG_OPTION_EXP2FORMAT << SINGLE_OPTION_EXP2FORMAT
|
||||
<< LONG_OPTION_BINARYDXF
|
||||
<< LONG_OPTION_ROTATE << SINGLE_OPTION_ROTATE
|
||||
<< LONG_OPTION_CROP << SINGLE_OPTION_CROP
|
||||
<< LONG_OPTION_UNITE << SINGLE_OPTION_UNITE
|
||||
|
|
|
@ -46,6 +46,8 @@ extern const QString SINGLE_OPTION_PAGETEMPLATE;
|
|||
extern const QString LONG_OPTION_EXP2FORMAT;
|
||||
extern const QString SINGLE_OPTION_EXP2FORMAT;
|
||||
|
||||
extern const QString LONG_OPTION_BINARYDXF;
|
||||
|
||||
extern const QString LONG_OPTION_ROTATE;
|
||||
extern const QString SINGLE_OPTION_ROTATE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user