Allow user to select DXF version.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-06-26 17:28:41 +03:00
parent ff0e5919a7
commit 9edc1a39db
16 changed files with 619 additions and 75 deletions

View File

@ -32,7 +32,7 @@ The path to output destination folder. By default the directory at which the app
.BR "*" " PDF files (*.pdf) = 1," .BR "*" " PDF files (*.pdf) = 1,"
.RE .RE
.RS .RS
.BR "*" " Images (*.png) = 2," .BR "*" " Image files (*.png) = 2,"
.RE .RE
.RS .RS
.BR "*" " Wavefront OBJ (*.obj) = 3," .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," .BR "*" " EPS files (*.eps) = 5,"
.RE .RE
.RS .RS
.BR "*" " DXF files (*.dxf) = 6." .BR "*" " AutoCAD DXF R10 (flat) files (*.dxf) = 6,"
.RE .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>" .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." .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>" .IP "-e, --gheight <The height value>"

View File

@ -32,7 +32,7 @@ The path to output destination folder. By default the directory at which the app
.BR "*" " PDF files (*.pdf) = 1," .BR "*" " PDF files (*.pdf) = 1,"
.RE .RE
.RS .RS
.BR "*" " Images (*.png) = 2," .BR "*" " Image files (*.png) = 2,"
.RE .RE
.RS .RS
.BR "*" " Wavefront OBJ (*.obj) = 3," .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," .BR "*" " EPS files (*.eps) = 5,"
.RE .RE
.RS .RS
.BR "*" " DXF files (*.dxf) = 6." .BR "*" " AutoCAD DXF R10 (flat) files (*.dxf) = 6,"
.RE .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>" .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." .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>" .IP "-e, --gheight <The height value>"

View File

@ -100,6 +100,10 @@ void VCommandLine::InitOptions(VCommandLineOptions &options, QMap<QString, int>
DialogSaveLayout::MakeHelpFormatList(), DialogSaveLayout::MakeHelpFormatList(),
translate("VCommandLine", "Format number"), "0")); 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++); optionsIndex.insert(LONG_OPTION_GRADATIONSIZE, index++);
options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_GRADATIONSIZE << LONG_OPTION_GRADATIONSIZE, options.append(new QCommandLineOption(QStringList() << SINGLE_OPTION_GRADATIONSIZE << LONG_OPTION_GRADATIONSIZE,
translate("VCommandLine", "Set size value a pattern file, that was opened " translate("VCommandLine", "Set size value a pattern file, that was opened "
@ -617,6 +621,15 @@ int VCommandLine::OptExportType() const
return r; return r;
} }
//---------------------------------------------------------------------------------------------------------------------
int VCommandLine::IsBinaryDXF() const
{
if (parser.isSet(*optionsUsed.value(optionsIndex.value(LONG_OPTION_BINARYDXF))))
{
return true;
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QStringList VCommandLine::OptInputFileNames() const QStringList VCommandLine::OptInputFileNames() const
{ {

View File

@ -75,6 +75,8 @@ public:
//@brief returns export type set, defaults 0 - svg //@brief returns export type set, defaults 0 - svg
int OptExportType() const; 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... //generator creation is moved here ... because most options are for it only, so no need to create extra getters...
//@brief creates VLayoutGenerator //@brief creates VLayoutGenerator
VLayoutGeneratorPtr DefaultGenerator() const; VLayoutGeneratorPtr DefaultGenerator() const;

View File

@ -47,7 +47,10 @@ bool DialogSaveLayout::tested = false;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *parent) 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); 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); connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save);
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample);
auto ShowExample = [this]()
{
ui->labelExample->setText(tr("Example:") + FileName() + QLatin1String("1") + Format());
};
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, ShowExample);
connect(ui->comboBoxFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(ui->comboBoxFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, ShowExample); this, &DialogSaveLayout::ShowExample);
connect(ui->pushButtonBrowse, &QPushButton::clicked, this, [this]() connect(ui->pushButtonBrowse, &QPushButton::clicked, this, [this]()
{ {
const QString dirPath = qApp->ValentinaSettings()->GetPathLayout(); 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.")); VException e(tr("Tried to use out of range format number."));
throw e; 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) if (i < 0)
{ {
VException e(tr("Selected not present format.")); VException e(tr("Selected not present format."));
@ -143,15 +140,104 @@ void DialogSaveLayout::SelectFormate(const int formate)
ui->comboBoxFormat->setCurrentIndex(i); 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 DialogSaveLayout::MakeHelpFormatList()
{ {
QString out("\n"); QString out("\n");
int cntr = 0; foreach(auto& v, InitFormats())
const QVector<std::pair<QString, QString>> availFormats = InitAvailFormats();
foreach(auto& v, availFormats)
{ {
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; return out;
} }
@ -183,6 +269,136 @@ void DialogSaveLayout::SetDestinationPath(const QString &cmdDestinationPath)
ui->lineEditPath->setText(path); 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() 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) 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)) if (QFile::exists(name))
{ {
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Name conflict"), QMessageBox::StandardButton res = QMessageBox::question(this, tr("Name conflict"),
@ -255,6 +471,55 @@ void DialogSaveLayout::PathChanged(const QString &text)
ui->lineEditPath->setPalette(palette); 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) 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; QVector<std::pair<QString, LayoutExportFormats>> 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"))); auto InitFormat = [&list](LayoutExportFormats format)
list.append(std::make_pair(QLatin1String("Images") + QLatin1String(" (*.png)"), QLatin1String(".png"))); {
list.append(std::make_pair(ExportFormatDescription(format), format));
};
InitFormat(LayoutExportFormats::SVG);
InitFormat(LayoutExportFormats::PDF);
InitFormat(LayoutExportFormats::PNG);
#ifndef V_NO_ASSERT // Temporarily unavailable #ifndef V_NO_ASSERT // Temporarily unavailable
list.append(std::make_pair(QLatin1String("Wavefront OBJ (*.obj)"), QLatin1String(".obj"))); InitFormat(LayoutExportFormats::OBJ);
#endif #endif
if (SupportPSTest()) if (SupportPSTest())
{ {
list.append(std::make_pair(QLatin1String("PS ") + tr("files") + QLatin1String(" (*.ps)"), InitFormat(LayoutExportFormats::PS);
QLatin1String(".ps"))); InitFormat(LayoutExportFormats::EPS);
list.append(std::make_pair(QLatin1String("EPS ") + tr("files") + QLatin1String(" (*.eps)"),
QLatin1String(".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; return list;
} }

View File

@ -42,38 +42,82 @@ namespace Ui
class DialogSaveLAyout; 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 class DialogSaveLayout : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DialogSaveLayout(int count, const QString &fileName = QString(), explicit DialogSaveLayout(int count, const QString &fileName = QString(), QWidget *parent = nullptr);
QWidget *parent = 0); virtual ~DialogSaveLayout();
~DialogSaveLayout();
QString Path() const; QString Path() const;
QString FileName() 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(); static QString MakeHelpFormatList();
void SetDestinationPath(const QString& cmdDestinationPath); void SetDestinationPath(const QString& cmdDestinationPath);
static QString ExportFormatDescription(LayoutExportFormats format);
static QString ExportFromatSuffix(LayoutExportFormats format);
protected: protected:
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private slots: private slots:
void Save(); void Save();
void PathChanged(const QString &text); void PathChanged(const QString &text);
void ShowExample();
private: private:
Q_DISABLE_COPY(DialogSaveLayout) Q_DISABLE_COPY(DialogSaveLayout)
Ui::DialogSaveLAyout *ui; Ui::DialogSaveLAyout *ui;
int count; int count;
bool isInitialized; 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 havePdf;
static bool tested; static bool tested;
static bool SupportPSTest(); static bool SupportPSTest();
static bool TestPdf(); static bool TestPdf();
static QVector<std::pair<QString, QString> > InitAvailFormats(); static QVector<std::pair<QString, LayoutExportFormats> > InitFormats();
}; };
#endif // DIALOGSAVELAYOUT_H #endif // DIALOGSAVELAYOUT_H

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>748</width> <width>748</width>
<height>150</height> <height>178</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -92,14 +92,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>File name:</string> <string>File name:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLineEdit" name="lineEditFileName"> <widget class="QLineEdit" name="lineEditFileName">
@ -135,6 +135,23 @@
</item> </item>
</layout> </layout>
</item> </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> </layout>
</item> </item>
<item> <item>

View File

@ -4690,7 +4690,8 @@ void MainWindow::DoExport(const VCommandLinePtr &expParams)
{ {
DialogSaveLayout dialog(scenes.size(), expParams->OptBaseName(), this); DialogSaveLayout dialog(scenes.size(), expParams->OptBaseName(), this);
dialog.SetDestinationPath(expParams->OptDestinationPath()); dialog.SetDestinationPath(expParams->OptDestinationPath());
dialog.SelectFormate(expParams->OptExportType()); dialog.SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));
dialog.SetBinaryDXFFormat(expParams->IsBinaryDXF());
ExportLayout(dialog); ExportLayout(dialog);
} }
catch (const VException &e) catch (const VException &e)

View File

@ -200,8 +200,6 @@ void MainWindowsNoGUI::ErrorConsoleMode(const LayoutErrors &state)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog) void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
{ {
const QString suf = dialog.Format().replace(".", "");
const QString path = dialog.Path(); const QString path = dialog.Path();
QDir dir(path); QDir dir(path);
dir.setPath(path); dir.setPath(path);
@ -215,51 +213,90 @@ void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
} }
qApp->ValentinaSettings()->SetPathLayout(path); qApp->ValentinaSettings()->SetPathLayout(path);
const QString mask = dialog.FileName(); const QString mask = dialog.FileName();
const LayoutExportFormats format = dialog.Format();
for (int i=0; i < scenes.size(); ++i) for (int i=0; i < scenes.size(); ++i)
{ {
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i)); QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
if (paper) 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(); QBrush *brush = new QBrush();
brush->setColor( QColor( Qt::white ) ); brush->setColor( QColor( Qt::white ) );
scenes[i]->setBackgroundBrush( *brush ); scenes[i]->setBackgroundBrush( *brush );
shadows[i]->setVisible(false); shadows[i]->setVisible(false);
paper->setPen(QPen(QBrush(Qt::white, Qt::NoBrush), 0.1, Qt::NoPen)); paper->setPen(QPen(QBrush(Qt::white, Qt::NoBrush), 0.1, Qt::NoPen));
const QStringList suffix = QStringList() << QLatin1String("svg")
<< QLatin1String("png") switch (format)
<< QLatin1String("pdf")
<< QLatin1String("eps")
<< QLatin1String("ps")
<< QLatin1String("obj")
<< QLatin1String("dxf");
switch (suffix.indexOf(suf))
{ {
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); paper->setVisible(false);
SvgFile(name, i); SvgFile(name, i);
paper->setVisible(true); paper->setVisible(true);
break; break;
case 1: //png case LayoutExportFormats::PDF:
PngFile(name, i);
break;
case 2: //pdf
PdfFile(name, i); PdfFile(name, i);
break; break;
case 3: //eps case LayoutExportFormats::PNG:
EpsFile(name, i); PngFile(name, i);
break; break;
case 4: //ps case LayoutExportFormats::OBJ:
PsFile(name, i);
break;
case 5: //obj
paper->setVisible(false); paper->setVisible(false);
ObjFile(name, i); ObjFile(name, i);
paper->setVisible(true); paper->setVisible(true);
break; break;
case 6: //dxf case LayoutExportFormats::PS:
DxfFile(name, i); 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; break;
default: default:
qDebug() << "Can't recognize file suffix." << Q_FUNC_INFO; 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_PUSH
QT_WARNING_DISABLE_GCC("-Wswitch-default") 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)); QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
if (paper) if (paper)
@ -772,6 +809,8 @@ void MainWindowsNoGUI::DxfFile(const QString &name, int i) const
generator.setFileName(name); generator.setFileName(name);
generator.setSize(paper->rect().size().toSize()); generator.setSize(paper->rect().size().toSize());
generator.setResolution(PrintDPI); generator.setResolution(PrintDPI);
generator.SetVersion(static_cast<DRW::Version>(version));
generator.SetBinaryFormat(binary);
switch (*pattern->GetPatternUnit()) switch (*pattern->GetPatternUnit())
{ {

View File

@ -120,7 +120,7 @@ private:
void PsFile(const QString &name, int i)const; void PsFile(const QString &name, int i)const;
void PdfToPs(const QStringList &params)const; void PdfToPs(const QStringList &params)const;
void ObjFile(const QString &name, int i)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 PreparePaper(int index) const;
void RestorePaper(int index) const; void RestorePaper(int index) const;

View File

@ -74,6 +74,7 @@ VDxfEngine::VDxfEngine()
resolution(static_cast<int>(PrintDPI)), resolution(static_cast<int>(PrintDPI)),
fileName(), fileName(),
m_version(DRW::AC1014), m_version(DRW::AC1014),
m_binary(false),
matrix(), matrix(),
input(), input(),
varMeasurement(VarMeasurement::Metric), varMeasurement(VarMeasurement::Metric),
@ -98,7 +99,7 @@ bool VDxfEngine::begin(QPaintDevice *pdev)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VDxfEngine::end() bool VDxfEngine::end()
{ {
const bool res = input->fileExport(m_version, false); const bool res = input->fileExport(m_version, m_binary);
return res; return res;
} }
@ -436,6 +437,18 @@ void VDxfEngine::SetVersion(DRW::Version version)
m_version = version; m_version = version;
} }
//---------------------------------------------------------------------------------------------------------------------
void VDxfEngine::SetBinaryFormat(bool binary)
{
m_binary = binary;
}
//---------------------------------------------------------------------------------------------------------------------
bool VDxfEngine::IsBinaryFormat() const
{
return m_binary;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
std::string VDxfEngine::getPenStyle() std::string VDxfEngine::getPenStyle()
{ {

View File

@ -78,6 +78,9 @@ public:
DRW::Version GetVersion() const; DRW::Version GetVersion() const;
void SetVersion(DRW::Version version); void SetVersion(DRW::Version version);
void SetBinaryFormat(bool binary);
bool IsBinaryFormat() const;
std::string getPenStyle(); std::string getPenStyle();
int getPenColor(); int getPenColor();
@ -90,6 +93,7 @@ private:
double resolution; double resolution;
QString fileName; QString fileName;
DRW::Version m_version; DRW::Version m_version;
bool m_binary;
QMatrix matrix; QMatrix matrix;
QSharedPointer<dx_iface> input; QSharedPointer<dx_iface> input;
VarMeasurement varMeasurement; VarMeasurement varMeasurement;

View File

@ -98,18 +98,67 @@ double VDxfPaintDevice::getResolution() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDxfPaintDevice::setResolution(double dpi) void VDxfPaintDevice::setResolution(double dpi)
{ {
if (engine->isActive())
{
qWarning("VDxfPaintDevice::setResolution(), cannot set dpi while Dxf is being generated");
return;
}
engine->setResolution(dpi); 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) void VDxfPaintDevice::setMeasurement(const VarMeasurement &var)
{ {
if (engine->isActive())
{
qWarning("VDxfPaintDevice::setMeasurement(), cannot set measurements while Dxf is being generated");
return;
}
engine->setMeasurement(var); engine->setMeasurement(var);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDxfPaintDevice::setInsunits(const VarInsunits &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); engine->setInsunits(var);
} }

View File

@ -36,6 +36,7 @@
#include <QtGlobal> #include <QtGlobal>
#include "dxfdef.h" #include "dxfdef.h"
#include "libdxfrw/drw_base.h"
class VDxfEngine; class VDxfEngine;
@ -55,6 +56,12 @@ public:
double getResolution() const; double getResolution() const;
void setResolution(double dpi); 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 setMeasurement(const VarMeasurement &var);
void setInsunits(const VarInsunits &var); void setInsunits(const VarInsunits &var);

View File

@ -49,6 +49,8 @@ const QString SINGLE_OPTION_PAGETEMPLATE = QStringLiteral("p");
const QString LONG_OPTION_EXP2FORMAT = QStringLiteral("format"); const QString LONG_OPTION_EXP2FORMAT = QStringLiteral("format");
const QString SINGLE_OPTION_EXP2FORMAT = QStringLiteral("f"); const QString SINGLE_OPTION_EXP2FORMAT = QStringLiteral("f");
const QString LONG_OPTION_BINARYDXF = QStringLiteral("bdxf");
const QString LONG_OPTION_ROTATE = QStringLiteral("rotate"); const QString LONG_OPTION_ROTATE = QStringLiteral("rotate");
const QString SINGLE_OPTION_ROTATE = QStringLiteral("r"); const QString SINGLE_OPTION_ROTATE = QStringLiteral("r");
@ -115,6 +117,7 @@ QStringList AllKeys()
<< LONG_OPTION_MEASUREFILE << SINGLE_OPTION_MEASUREFILE << LONG_OPTION_MEASUREFILE << SINGLE_OPTION_MEASUREFILE
<< LONG_OPTION_PAGETEMPLATE << SINGLE_OPTION_PAGETEMPLATE << LONG_OPTION_PAGETEMPLATE << SINGLE_OPTION_PAGETEMPLATE
<< LONG_OPTION_EXP2FORMAT << SINGLE_OPTION_EXP2FORMAT << LONG_OPTION_EXP2FORMAT << SINGLE_OPTION_EXP2FORMAT
<< LONG_OPTION_BINARYDXF
<< LONG_OPTION_ROTATE << SINGLE_OPTION_ROTATE << LONG_OPTION_ROTATE << SINGLE_OPTION_ROTATE
<< LONG_OPTION_CROP << SINGLE_OPTION_CROP << LONG_OPTION_CROP << SINGLE_OPTION_CROP
<< LONG_OPTION_UNITE << SINGLE_OPTION_UNITE << LONG_OPTION_UNITE << SINGLE_OPTION_UNITE

View File

@ -46,6 +46,8 @@ extern const QString SINGLE_OPTION_PAGETEMPLATE;
extern const QString LONG_OPTION_EXP2FORMAT; extern const QString LONG_OPTION_EXP2FORMAT;
extern const QString SINGLE_OPTION_EXP2FORMAT; extern const QString SINGLE_OPTION_EXP2FORMAT;
extern const QString LONG_OPTION_BINARYDXF;
extern const QString LONG_OPTION_ROTATE; extern const QString LONG_OPTION_ROTATE;
extern const QString SINGLE_OPTION_ROTATE; extern const QString SINGLE_OPTION_ROTATE;