Salome HOME
updated copyright message
[modules/geom.git] / src / XAOPlugin / XAOPlugin_ExportDlg.cxx
index d3b32ee68e0cf3e82c2ca7e793f3c4be2aaaeee4..226dfd22e3a1a5a891f7381b5c7734beff9b0c12 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2023  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -54,6 +54,7 @@
 #include <QRadioButton>
 #include <QGridLayout>
 #include <QPushButton>
+#include <QCheckBox>
 #include <QMap>
 
 //=================================================================================
@@ -101,6 +102,7 @@ XAOPlugin_ExportDlg::XAOPlugin_ExportDlg(GeometryGUI* geometryGUI, QWidget* pare
   ledShape->setMinimumSize(QSize(100, 0));
 
   int line = 0, col = 0;
+  // adWidget(widget, fromRow, fromColumn, rowSpan, columnSpan)
   gridLayoutExport->addWidget(lblShape, line, col++, 1, 1);
   gridLayoutExport->addWidget(btnShapeSelect, line, col++, 1, 1);
   gridLayoutExport->addWidget(ledShape, line, col++, 1, 1);
@@ -121,10 +123,17 @@ XAOPlugin_ExportDlg::XAOPlugin_ExportDlg(GeometryGUI* geometryGUI, QWidget* pare
   ledAuthor = new QLineEdit(gbxExport);
 
   line++; col = 0;
-  gridLayoutExport->addWidget(lblAuthor, line, col++, 2, 1);
+  gridLayoutExport->addWidget(lblAuthor, line, col++, 1, 1);
   col++; // span
   gridLayoutExport->addWidget(ledAuthor, line, col++, 1, 1);
 
+  // Line 3
+  ckxUseSeparateFile = new QCheckBox(tr("XAOPLUGIN_EXPORT_SHAPEFILE"), gbxExport);
+
+  line++; col = 0;
+  gridLayoutExport->addWidget(ckxUseSeparateFile, line, col++, 1, 2);
+
+
   //****************************
   // Filter Group box
   QGroupBox* gbxFilter = new QGroupBox(parent);
@@ -217,7 +226,7 @@ void XAOPlugin_ExportDlg::processObject()
   else
   {
     ledShape->setText(GEOMBase::GetName(m_mainObj));
-    GEOM::GEOM_IShapesOperations_var shapeOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+    GEOM::GEOM_IShapesOperations_var shapeOp = getGeomEngine()->GetIShapesOperations();
 
     // add groups names
     GEOM::ListOfGO_var groups = shapeOp->GetExistingSubObjects(m_mainObj, true);
@@ -234,7 +243,7 @@ void XAOPlugin_ExportDlg::processObject()
     lstGroups->sortItems(Qt::AscendingOrder);
 
     // add fields
-    GEOM::GEOM_IFieldOperations_var fieldOp = getGeomEngine()->GetIFieldOperations(getStudyId());
+    GEOM::GEOM_IFieldOperations_var fieldOp = getGeomEngine()->GetIFieldOperations();
 
     GEOM::ListOfFields_var fields = fieldOp->GetFields(m_mainObj);
     for (int i = 0, n = fields->length(); i < n; i++)
@@ -380,14 +389,14 @@ void XAOPlugin_ExportDlg::enterEvent(QEvent*)
 //=================================================================================
 GEOM::GEOM_IOperations_ptr XAOPlugin_ExportDlg::createOperation()
 {
-  return getGeomEngine()->GetPluginOperations( getStudyId(), "XAOPluginEngine" );
+  return getGeomEngine()->GetPluginOperations( "XAOPluginEngine" );
 }
 
 //=================================================================================
 // function : isValid
 // purpose  :
 //=================================================================================
-bool XAOPlugin_ExportDlg::isValid(QString& msg)
+bool XAOPlugin_ExportDlg::isValid(QString& /*msg*/)
 {
   // check shape
   if (ledShape->text().isEmpty())
@@ -410,6 +419,12 @@ bool XAOPlugin_ExportDlg::execute()
 
   QString author = ledAuthor->text();
   QString fileName = ledFileName->text();
+  QString shapeFileName = QString("");//ledShapeFile->text();
+  if (ckxUseSeparateFile->isChecked())
+  {
+    shapeFileName = fileName;
+    shapeFileName.append(".brep");
+  }
 
   // get selected groups
   QList<QListWidgetItem*> selGroups;
@@ -451,6 +466,7 @@ bool XAOPlugin_ExportDlg::execute()
   GEOM::IXAOOperations_var aXAOOp = GEOM::IXAOOperations::_narrow( getOperation() );
   res = aXAOOp->ExportXAO(m_mainObj, groups, fields,
                           author.toUtf8().constData(),
-                          fileName.toUtf8().constData());
+                          fileName.toUtf8().constData(),
+                          shapeFileName.toStdString().c_str());
   return res;
 }