It moves the widget constraint shape selector in a separate file.
PartSet_WidgetSketchLabel.h
PartSet_Validators.h
PartSet_WidgetPoint2d.h
+ PartSet_WidgetConstraintShapeSelector.h
PartSet_WidgetPoint2dDistance.h
PartSet_WidgetShapeSelector.h
PartSet_Filters.h
PartSet_Tools.cpp
PartSet_WidgetSketchLabel.cpp
PartSet_Validators.cpp
+ PartSet_WidgetConstraintShapeSelector.cpp
PartSet_WidgetPoint2d.cpp
PartSet_WidgetPoint2dDistance.cpp
PartSet_WidgetShapeSelector.cpp
#include <PartSet_WidgetPoint2d.h>
#include <PartSet_WidgetPoint2dDistance.h>
#include <PartSet_WidgetShapeSelector.h>
+#include <PartSet_WidgetConstraintShapeSelector.h>
#include <PartSet_SketcherMgr.h>
#include <ModuleBase_Operation.h>
--- /dev/null
+// 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();
+}
--- /dev/null
+// 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
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();
-}
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