]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
refs #30 - Sketch base GUI: create, draw lines
authornds <natalia.donis@opencascade.com>
Fri, 25 Apr 2014 14:46:19 +0000 (18:46 +0400)
committernds <natalia.donis@opencascade.com>
Fri, 25 Apr 2014 14:46:19 +0000 (18:46 +0400)
Line operation start over the sketch

src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp
src/ModuleBase/ModuleBase_PropPanelOperation.h
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketch.h
src/PartSet/PartSet_OperationSketchBase.cpp
src/PartSet/PartSet_OperationSketchBase.h
src/PartSet/PartSet_OperationSketchLine.cpp
src/PartSet/PartSet_OperationSketchLine.h
src/XGUI/XGUI_Workshop.cpp

index c8419fe376853ab416221be403e4441779c9a379..84e4234bde052e0e76ef1c92aa6eba8c79306ee2 100644 (file)
@@ -16,6 +16,8 @@ boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_EdgeBuilder::line(
   const gp_Pnt& aStart = theStart->impl<gp_Pnt>();
   const gp_Pnt& anEnd = theEnd->impl<gp_Pnt>();
 
+  if (aStart.IsEqual(anEnd, Precision::Confusion()))
+    return boost::shared_ptr<GeomAPI_Shape>();
   BRepBuilderAPI_MakeEdge anEdgeBuilder(aStart, anEnd);
   boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
   TopoDS_Edge anEdge = anEdgeBuilder.Edge();
index 29ced2bd3ae5d3ec045762ae5eccaf591e6f3eb4..c6dc06814d25a8b2d10e6c040973a10179101016 100644 (file)
@@ -29,15 +29,6 @@ public:
   ModuleBase_PropPanelOperation(const QString& theId = "", QObject* parent = 0);
   virtual ~ModuleBase_PropPanelOperation();
 
-  /*!
-   * \brief Replied whether the operation should be commited after the start, or the operation itself
-   *  do that. The default realization provides the check by the operation having the xml prepresentation 
-   *  @return the boolean value
-   */
-  virtual bool isPerformedImmediately() const
-  {
-    return xmlRepresentation().isEmpty();
-  }
   /*!
    *  \brief Returns XML representation of the operation's widget.
    *  \return XML QString
index 5893526b45f6d98919cd8379baa1eccb05873c31..c91631f06b3eb6e6ad7fae0466a893ce0b9b663e 100644 (file)
@@ -16,6 +16,8 @@
 #include <Events_Loop.h>
 #include <Events_Message.h>
 
+#include <GeomAPI_Shape.h>
+
 #include <AIS_ListOfInteractive.hxx>
 
 #include <QObject>
@@ -162,8 +164,10 @@ void PartSet_Module::visualizePreview(bool isDisplay)
     return;
 
   if (isDisplay) {
-    myWorkshop->displayer()->LocalSelection(anOperation->feature(), aPreviewOp->preview(),
-                                            aPreviewOp->getSelectionMode());
+    boost::shared_ptr<GeomAPI_Shape> aPreview = aPreviewOp->preview();
+    if (aPreview)
+      myWorkshop->displayer()->LocalSelection(anOperation->feature(),
+                                   aPreview->impl<TopoDS_Shape>(), aPreviewOp->getSelectionMode());
   }
   else {
     myWorkshop->displayer()->GlobalSelection(false);
index 7eca33e4376d08d47fde5f9426dca70928480d5e..32a2199b8d2b6fe1d8acebfaaf2c9ef0f3d8bb81 100644 (file)
@@ -30,11 +30,6 @@ PartSet_OperationSketch::~PartSet_OperationSketch()
 {
 }
 
-bool PartSet_OperationSketch::isPerformedImmediately() const
-{
-  return false;
-}
-
 int PartSet_OperationSketch::getSelectionMode() const
 {
   return TopAbs_FACE;
index 6a7670b0007caf3a9927899b9c279331328428fb..4a4fd74bc547a47978e739aa98ecf0be6c591729 100644 (file)
@@ -25,9 +25,6 @@ public:
   /// Destructor
   virtual ~PartSet_OperationSketch();
 
-  /// The sketch can not be created immediately, firstly a plane should be set
-  virtual bool isPerformedImmediately() const;
-
   /// Returns the operation local selection mode
   /// \return the selection mode
   virtual int getSelectionMode() const;
index 519c97f76d5335d3def922e4158b77de59982c2f..864f77dda90f447729947fe20f8f97eb660ca097 100644 (file)
@@ -22,9 +22,9 @@ PartSet_OperationSketchBase::~PartSet_OperationSketchBase()
 {
 }
 
-const TopoDS_Shape& PartSet_OperationSketchBase::preview() const
+boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview() const
 {
   boost::shared_ptr<SketchPlugin_Feature> aFeature = 
     boost::dynamic_pointer_cast<SketchPlugin_Feature>(feature());
-  return aFeature->preview()->impl<TopoDS_Shape>();
+  return aFeature->preview();
 }
index 7ca7fd2d3ac30aa4a1cfaf37ad690c4fe6cdcb99..916ebc46648ab9b402ee03581b6e38c2c3027f5f 100644 (file)
@@ -13,6 +13,8 @@
 #include <ModuleBase_PropPanelOperation.h>
 #include <QObject>
 
+class GeomAPI_Shape;
+
 /*!
   \class PartSet_OperationSketchBase
   * \brief The base operation for the sketch features.
@@ -30,7 +32,7 @@ public:
   virtual ~PartSet_OperationSketchBase();
 
   /// Returns the feature preview shape
-  const TopoDS_Shape& preview() const;
+  boost::shared_ptr<GeomAPI_Shape> preview() const;
 
   /// Returns the operation local selection mode
   /// \return the selection mode
index 7a5a78196a0739f42c98ae2a60c21debf49cb603..6ceda06f1366b9ac35429c956ed54b2b7985e39e 100644 (file)
@@ -23,9 +23,9 @@ PartSet_OperationSketchLine::~PartSet_OperationSketchLine()
 {
 }
 
-bool PartSet_OperationSketchLine::isPerformedImmediately() const
+bool PartSet_OperationSketchLine::isGranted() const
 {
-  return false;
+  return true;
 }
 
 int PartSet_OperationSketchLine::getSelectionMode() const
index 7c228af0683bf480d39bdf5ee99316b57c116d52..737c73c36780c098125de5f1a0c2cd5afda724e1 100644 (file)
@@ -27,8 +27,9 @@ public:
   /// Destructor
   virtual ~PartSet_OperationSketchLine();
 
-  /// The sketch can not be created immediately, firstly a plane should be set
-  virtual bool isPerformedImmediately() const;
+   /// Returns that this operator can be started above already running one.
+   /// The runned operation should be the sketch feature modified operation
+  virtual bool isGranted() const;
 
   /// Returns the operation local selection mode
   /// \return the selection mode
index 9af73c3dfdba68cc4703d5f22cbb25327a2eb93c..0729b14c7ffaf0a40b7843c95220935ecb3f9fb3 100644 (file)
@@ -179,7 +179,7 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage)
         (ModuleBase_PropPanelOperation*)(aPartSetMsg->pointer());
 
     if (myOperationMgr->startOperation(anOperation)) {
-      if (anOperation->isPerformedImmediately()) {
+      if (anOperation->xmlRepresentation().isEmpty()) {
         anOperation->commit();
         updateCommandStatus();
       }