]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #353 constraint on 2 segments from not acive sketches
authornds <natalia.donis@opencascade.com>
Fri, 27 Feb 2015 09:44:27 +0000 (12:44 +0300)
committernds <natalia.donis@opencascade.com>
Fri, 27 Feb 2015 09:44:27 +0000 (12:44 +0300)
It moves the widget constraint shape selector in a separate file.

src/PartSet/CMakeLists.txt
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_WidgetConstraintShapeSelector.cpp [new file with mode: 0644]
src/PartSet/PartSet_WidgetConstraintShapeSelector.h [new file with mode: 0644]
src/PartSet/PartSet_WidgetShapeSelector.cpp
src/PartSet/PartSet_WidgetShapeSelector.h

index 280c107f6d893509c408498e56716c5cdc59ff5c..60388bb2b90d155ed946041041759df8116c481e 100644 (file)
@@ -12,6 +12,7 @@ SET(PROJECT_HEADERS
        PartSet_WidgetSketchLabel.h
        PartSet_Validators.h
        PartSet_WidgetPoint2d.h
+       PartSet_WidgetConstraintShapeSelector.h
        PartSet_WidgetPoint2dDistance.h
        PartSet_WidgetShapeSelector.h
        PartSet_Filters.h
@@ -23,6 +24,7 @@ SET(PROJECT_SOURCES
        PartSet_Tools.cpp
        PartSet_WidgetSketchLabel.cpp
        PartSet_Validators.cpp
+       PartSet_WidgetConstraintShapeSelector.cpp
        PartSet_WidgetPoint2d.cpp
        PartSet_WidgetPoint2dDistance.cpp
        PartSet_WidgetShapeSelector.cpp
index a73034a9562d3e25f8e77eb3bba70ca100e8a7cf..1b693e1258324323a5c1b552a5b1f2ddb4ecff76 100644 (file)
@@ -7,6 +7,7 @@
 #include <PartSet_WidgetPoint2d.h>
 #include <PartSet_WidgetPoint2dDistance.h>
 #include <PartSet_WidgetShapeSelector.h>
+#include <PartSet_WidgetConstraintShapeSelector.h>
 #include <PartSet_SketcherMgr.h>
 
 #include <ModuleBase_Operation.h>
diff --git a/src/PartSet/PartSet_WidgetConstraintShapeSelector.cpp b/src/PartSet/PartSet_WidgetConstraintShapeSelector.cpp
new file mode 100644 (file)
index 0000000..5e1ebe9
--- /dev/null
@@ -0,0 +1,34 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        PartSet_WidgetShapeSelector.cpp
+// Created:     27 Nov 2014
+// Author:      Vitaly Smetannikov
+
+#include "PartSet_WidgetConstraintShapeSelector.h"
+
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Validator.h>
+
+#include <PartSet_Tools.h>
+#include <SketchPlugin_Feature.h>
+
+
+//*********************************************
+bool PartSet_WidgetConstraintShapeSelector::storeValueCustom() const
+{
+  FeaturePtr aFeature = ModelAPI_Feature::feature(mySelectedObject);
+  if (aFeature) {
+    std::shared_ptr<SketchPlugin_Feature> aSPFeature = 
+            std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+    if ((!aSPFeature) && (!myShape->isNull())) {
+      ObjectPtr aObj = PartSet_Tools::createFixedObjectByExternal(myShape->impl<TopoDS_Shape>(),
+                                                                  mySelectedObject, mySketch);
+      if (aObj) {
+        PartSet_WidgetConstraintShapeSelector* that = (PartSet_WidgetConstraintShapeSelector*) this;
+        that->mySelectedObject = aObj;
+      } else 
+        return false;
+    }
+  }
+  return ModuleBase_WidgetShapeSelector::storeValueCustom();
+}
diff --git a/src/PartSet/PartSet_WidgetConstraintShapeSelector.h b/src/PartSet/PartSet_WidgetConstraintShapeSelector.h
new file mode 100644 (file)
index 0000000..900e4ce
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        PartSet_WidgetShapeSelector.h
+// Created:     27 Nov 2014
+// Author:      Vitaly Smetannikov
+
+
+#ifndef PartSet_WidgetConstraintShapeSelector_H
+#define PartSet_WidgetConstraintShapeSelector_H
+
+#include "PartSet.h"
+
+#include <ModuleBase_WidgetShapeSelector.h>
+
+#include <ModelAPI_CompositeFeature.h>
+
+
+/**
+* \ingroup Modules
+* Customosation of ModuleBase_WidgetShapeSelector in order to provide 
+* working with constraints.
+*/
+class PARTSET_EXPORT PartSet_WidgetConstraintShapeSelector: public ModuleBase_WidgetShapeSelector
+{
+Q_OBJECT
+ public:
+  /// Constructor
+  /// \param theParent the parent object
+  /// \param theWorkshop instance of workshop interface
+  /// \param theData the widget configuation. The attribute of the model widget is obtained from
+  /// \param theParentId is Id of a parent of the current attribute
+  PartSet_WidgetConstraintShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
+    const Config_WidgetAPI* theData, const std::string& theParentId)
+    : ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData, theParentId) {}
+
+  virtual ~PartSet_WidgetConstraintShapeSelector() {}
+
+  /// Set sketcher
+  /// \param theSketch a sketcher object
+  void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
+
+  /// Retrurns installed sketcher
+  CompositeFeaturePtr sketch() const { return mySketch; }
+
+protected:
+  /// Saves the internal parameters to the given feature
+  /// \return True in success
+  virtual bool storeValueCustom() const;
+
+private:
+  /// Pointer to a sketch 
+  CompositeFeaturePtr mySketch;
+};
+
+#endif
\ No newline at end of file
index 76561e4e6e79b1dc42cda0ec95525736c9ba9e83..bd9e1ce81cbbcc4d253a54955adeab7c7b09b2a3 100644 (file)
@@ -125,22 +125,3 @@ bool PartSet_WidgetShapeSelector::isValid(ObjectPtr theObj, std::shared_ptr<Geom
   return true;
 }
 
-//*********************************************
-bool PartSet_WidgetConstraintShapeSelector::storeValueCustom() const
-{
-  FeaturePtr aFeature = ModelAPI_Feature::feature(mySelectedObject);
-  if (aFeature) {
-    std::shared_ptr<SketchPlugin_Feature> aSPFeature = 
-            std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
-    if ((!aSPFeature) && (!myShape->isNull())) {
-      ObjectPtr aObj = PartSet_Tools::createFixedObjectByExternal(myShape->impl<TopoDS_Shape>(),
-                                                                  mySelectedObject, mySketch);
-      if (aObj) {
-        PartSet_WidgetConstraintShapeSelector* that = (PartSet_WidgetConstraintShapeSelector*) this;
-        that->mySelectedObject = aObj;
-      } else 
-        return false;
-    }
-  }
-  return ModuleBase_WidgetShapeSelector::storeValueCustom();
-}
index e38cdf7984b21e924f8dd7a0a4fea33aace27a69..b69c66648c351c04fdc8a109da761d8feefabefa 100644 (file)
@@ -55,41 +55,4 @@ private:
   CompositeFeaturePtr mySketch;
 };
 
-/**
-* \ingroup Modules
-* Customosation of ModuleBase_WidgetShapeSelector in order to provide 
-* working with constraints.
-*/
-class PARTSET_EXPORT PartSet_WidgetConstraintShapeSelector: public ModuleBase_WidgetShapeSelector
-{
-Q_OBJECT
- public:
-  /// Constructor
-  /// \param theParent the parent object
-  /// \param theWorkshop instance of workshop interface
-  /// \param theData the widget configuation. The attribute of the model widget is obtained from
-  /// \param theParentId is Id of a parent of the current attribute
-  PartSet_WidgetConstraintShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
-    const Config_WidgetAPI* theData, const std::string& theParentId)
-    : ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData, theParentId) {}
-
-  virtual ~PartSet_WidgetConstraintShapeSelector() {}
-
-  /// Set sketcher
-  /// \param theSketch a sketcher object
-  void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
-
-  /// Retrurns installed sketcher
-  CompositeFeaturePtr sketch() const { return mySketch; }
-
-protected:
-  /// Saves the internal parameters to the given feature
-  /// \return True in success
-  virtual bool storeValueCustom() const;
-
-private:
-  /// Pointer to a sketch 
-  CompositeFeaturePtr mySketch;
-};
-
 #endif
\ No newline at end of file