Salome HOME
Copyright update 2021
[modules/geom.git] / src / AdvancedGUI / AdvancedGUI_SmoothingSurfaceDlg.cxx
index 15a5cd5701897a6714ed7da1f36d205ea4e16474..d696c665e14cafea3f37a9a83ca5085812aa9ef0 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2021  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
@@ -19,6 +19,9 @@
 
 #include "AdvancedGUI_SmoothingSurfaceDlg.h"
 
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(AdvancedGEOM)
+
 #include <DlgRef.h>
 #include <GeometryGUI.h>
 #include <GEOMBase.h>
@@ -33,7 +36,6 @@
 #include <TopoDS.hxx>
 #include <TopoDS_Iterator.hxx>
 #include <TopExp.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
 
 #include <GEOMImpl_Types.hxx>
@@ -107,7 +109,7 @@ AdvancedGUI_SmoothingSurfaceDlg::~AdvancedGUI_SmoothingSurfaceDlg()
 void AdvancedGUI_SmoothingSurfaceDlg::Init()
 {
   // Get setting of step value from file configuration
-  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+  //SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
 
   initSpinBox(myDMaxSpin, 0., COORD_MAX, 0.00001, "parametric_precision" );
 
@@ -115,6 +117,10 @@ void AdvancedGUI_SmoothingSurfaceDlg::Init()
   myDegMaxSpin->setValue(8);
   myDMaxSpin->setValue(0.);
 
+  showOnlyPreviewControl();
+
+  globalSelection();
+  localSelection( TopAbs_VERTEX );
   //@@ initialize dialog box widgets here @@//
 
   // Signal/slot connections
@@ -133,6 +139,7 @@ void AdvancedGUI_SmoothingSurfaceDlg::Init()
  
   initName(tr("GEOM_SMOOTHINGSURFACE"));
   //displayPreview();
+  SelectionIntoArgument();
 }
 
 //=================================================================================
@@ -155,7 +162,8 @@ bool AdvancedGUI_SmoothingSurfaceDlg::ClickOnApply()
     return false;
 
   initName();
-
+  globalSelection();
+  localSelection( TopAbs_VERTEX );
   return true;
 }
 
@@ -166,6 +174,8 @@ bool AdvancedGUI_SmoothingSurfaceDlg::ClickOnApply()
 void AdvancedGUI_SmoothingSurfaceDlg::ActivateThisDialog()
 {
   GEOMBase_Skeleton::ActivateThisDialog();
+  globalSelection();
+  localSelection( TopAbs_VERTEX );
   //displayPreview();
 }
 
@@ -185,8 +195,7 @@ void AdvancedGUI_SmoothingSurfaceDlg::enterEvent (QEvent*)
 //=================================================================================
 GEOM::GEOM_IOperations_ptr AdvancedGUI_SmoothingSurfaceDlg::createOperation()
 {
-  //return getGeomEngine()->GetIAdvancedOperations(getStudyId());
-  return getGeomEngine()->GetPluginOperations(getStudyId(), "AdvancedEngine");
+  return getGeomEngine()->GetPluginOperations("AdvancedEngine");
 }
 
 //=================================================================================
@@ -217,7 +226,7 @@ bool AdvancedGUI_SmoothingSurfaceDlg::execute (ObjectList& objects)
 
   GEOM::GEOM_Object_var anObj;
 
-  GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation());
+  GEOM::IAdvancedOperations_var anOper = GEOM::IAdvancedOperations::_narrow(getOperation());
 
   //@@ retrieve input values from the widgets here @@//
   GEOM::ListOfGO_var points = new GEOM::ListOfGO();
@@ -236,7 +245,7 @@ bool AdvancedGUI_SmoothingSurfaceDlg::execute (ObjectList& objects)
   {
     QStringList aParameters;
     //@@ put stringified input parameters to the string list here to store in the data model for notebook @@//
-    if ( aParameters.count() > 0 ) anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+    if ( aParameters.count() > 0 ) anObj->SetParameters(aParameters.join(":").toUtf8().constData());
   }
   
   if (res)
@@ -245,6 +254,26 @@ bool AdvancedGUI_SmoothingSurfaceDlg::execute (ObjectList& objects)
   return res;
 }
 
+//=================================================================================
+// function : addSubshapesToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void AdvancedGUI_SmoothingSurfaceDlg::addSubshapesToStudy()
+{
+  for ( int i = 0; i < myPoints.count(); i++ )
+    GEOMBase::PublishSubObject( myPoints[i].get() );
+}
+
+
+//=================================================================================
+// function : getSourceObjects
+// purpose  : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> AdvancedGUI_SmoothingSurfaceDlg::getSourceObjects()
+{
+  return myPoints;
+}
+
 //=================================================================================
 // function : getNbPoints()
 // purpose  : Returns the number of points in myPoints list.
@@ -333,5 +362,7 @@ void AdvancedGUI_SmoothingSurfaceDlg::SetEditCurrentArgument()
   if ( sender() == GroupPoints->PushButton1 )
     myEditCurrentArgument = GroupPoints->LineEdit1;
   myEditCurrentArgument->setFocus();
+  globalSelection();
+  localSelection( TopAbs_VERTEX );
   SelectionIntoArgument();
 }