]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom.git into Dev_1.1.0
authorsbh <sergey.belash@opencascade.com>
Fri, 6 Mar 2015 08:24:05 +0000 (11:24 +0300)
committersbh <sergey.belash@opencascade.com>
Fri, 6 Mar 2015 08:24:05 +0000 (11:24 +0300)
16 files changed:
src/ModuleBase/ModuleBase_IModule.h
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_Operation.h
src/ModuleBase/ModuleBase_WidgetEditor.cpp
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherMgr.h
src/PartSet/PartSet_WidgetPoint2d.cpp
src/SketchPlugin/SketchPlugin_Feature.h
src/SketchPlugin/SketchPlugin_Sketch.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_OperationMgr.h
src/XGUI/XGUI_Workshop.cpp

index 9d59e0ffe2797383d3212ab5fab534d5e98ab8e9..1e467d859cdf7fb1bc34dd87e96229bff441b3c4 100644 (file)
@@ -110,6 +110,10 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// \param theObject a model object\r
   virtual bool canDisplayObject(const ObjectPtr& theObject) const;\r
 \r
+  /// Reacts to the delete action in module\r
+  /// \returns true if the action is processed\r
+  virtual bool deleteObjects() { return false; };\r
+\r
 public slots:\r
   /// Called on call of command corresponded to a feature\r
   void onFeatureTriggered();\r
index 459af0553e89d741c535125a0c1013a4a416b1aa..6119c42c80fd91df36bb17afca727d12cfeb861f 100644 (file)
@@ -80,16 +80,6 @@ bool ModuleBase_Operation::canBeCommitted() const
   return isValid();
 }
 
-void ModuleBase_Operation::flushUpdated()
-{
-  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
-}
-
-void ModuleBase_Operation::flushCreated()
-{
-  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
-}
-
 FeaturePtr ModuleBase_Operation::createFeature(const bool theFlushMessage)
 {
   if (myParentFeature.get()) {
@@ -111,7 +101,7 @@ FeaturePtr ModuleBase_Operation::createFeature(const bool theFlushMessage)
   }
 
   if (theFlushMessage)
-    flushCreated();
+    Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
   return myFeature;
 }
 
index f43ed76e18752ad394676cb25c6d03e983e74639..45082511a531d80517adc94f349eb95f16d53784 100644 (file)
@@ -210,12 +210,6 @@ signals:
   /// Virtual method called after operation resume (see resume() method for more description)
   virtual void resumeOperation() {}
 
-  /// Send update message by loop
-  void flushUpdated();
-
-  /// Send created message by loop
-  void flushCreated();
-
   /// Creates an operation new feature
   /// \param theFlushMessage the flag whether the create message should be flushed
   /// \returns the created feature
index 07c59651de695bdd6de1d735644fe43719c550b2..8c3b74bdfd4f372db20791bea0838dd6aefc0502 100644 (file)
@@ -47,6 +47,7 @@ double editedValue(double theValue, bool& isDone)
   ModuleBase_Tools::zeroMargins(aLay);
 
   QLineEdit* aEditor = new QLineEdit(QString::number(theValue), &aDlg);
+  aEditor->selectAll();
   aEditor->setValidator(new QDoubleValidator(aEditor));
   QObject::connect(aEditor, SIGNAL(returnPressed()), &aDlg, SLOT(accept()));
   aLay->addWidget(aEditor);
index 34fc4ec41627912086b5ceb8b940ad8c1e9cfdc6..5514a06e34dbfbff28dbd0468317c85b4fad57f3 100644 (file)
@@ -447,7 +447,8 @@ void ModuleBase_WidgetShapeSelector::selectionFilters(SelectMgr_ListOfFilter& th
   if (!myObjectTypes.isEmpty() && myObjTypeFilter.IsNull()) {
     myObjTypeFilter = new ModuleBase_ObjectTypesFilter(myWorkshop, myObjectTypes);
   }
-  theFilters.Append(myObjTypeFilter);
+  if (!myObjTypeFilter.IsNull())
+    theFilters.Append(myObjTypeFilter);
 
   // apply filters loaded from the XML definition of the widget
   ModuleBase_FilterFactory* aFactory = myWorkshop->selectionFilters();
index 44accc6cca089e6a07c24f17815c0679f2f09ed1..da9bc82816c4cced2b822e6cfed6ed605d26e854 100644 (file)
@@ -38,6 +38,7 @@
 #include <XGUI_OperationMgr.h>
 #include <XGUI_PropertyPanel.h>
 #include <XGUI_ModuleConnector.h>
+#include <XGUI_ContextMenuMgr.h>
 #include <XGUI_Tools.h>
 
 #include <SketchPlugin_Feature.h>
@@ -94,7 +95,6 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
 
   XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
   connect(anOpMgr, SIGNAL(keyEnterReleased()), this, SLOT(onEnterReleased()));
-  connect(anOpMgr, SIGNAL(keyDeleteReleased()), this, SLOT(onDeleteObjects()));
   connect(anOpMgr, SIGNAL(operationActivatedByPreselection()),
           this, SLOT(onOperationActivatedByPreselection()));
 
@@ -293,8 +293,18 @@ void PartSet_Module::addViewerItems(QMenu* theMenu) const
         hasFeature = true;
       }
     }
-    if (hasFeature)
-      theMenu->addAction(action("DELETE_PARTSET_CMD"));
+    if (hasFeature) {
+      XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
+      XGUI_Workshop* aWorkshop = aConnector->workshop();
+      QAction* anAction = aWorkshop->contextMenuMgr()->action("DELETE_CMD");
+      theMenu->addAction(anAction);
+    }
+  }
+  bool isConstruction;
+  if (mySketchMgr->canChangeConstruction(isConstruction)) {
+    QAction* anAction = action("CONSTRUCTION_CMD");
+    theMenu->addAction(anAction);
+    anAction->setChecked(isConstruction);
   }
 }
 
@@ -391,14 +401,6 @@ void PartSet_Module::onEnterReleased()
   myRestartingMode = RM_EmptyFeatureUsed;
 }
 
-void PartSet_Module::onDeleteObjects()
-{
-  ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
-  if (PartSet_SketcherMgr::isSketchOperation(anOperation) ||
-      PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
-    deleteObjects();
-}
-
 void PartSet_Module::onOperationActivatedByPreselection()
 {
   ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
@@ -475,8 +477,11 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th
 
 void PartSet_Module::createActions()
 {
-  QAction* aAction = new QAction(QIcon(":pictures/delete.png"), tr("Delete"), this);
-  addAction("DELETE_PARTSET_CMD", aAction);
+  QAction* anAction;
+
+  anAction = new QAction(tr("Construction"), this);
+  anAction->setCheckable(true);
+  addAction("CONSTRUCTION_CMD", anAction);
 }
 
 QAction* PartSet_Module::action(const QString& theId) const
@@ -500,17 +505,18 @@ void PartSet_Module::onAction(bool isChecked)
   QAction* aAction = static_cast<QAction*>(sender());
   QString anId = aAction->data().toString();
 
-  if (anId == "DELETE_PARTSET_CMD") {
-    deleteObjects();
+  if (anId == "CONSTRUCTION_CMD") {
+    mySketchMgr->setConstruction(isChecked);
   }
 }
 
-void PartSet_Module::deleteObjects()
+bool PartSet_Module::deleteObjects()
 {
   ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
-  bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation);
-  if (!isSketchOp && !PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
-    return;
+  bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
+       isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
+  if (!isSketchOp && !isNestedOp)
+    return false;
 
   // sketch feature should be skipped, only sub-features can be removed
   // when sketch operation is active
@@ -519,17 +525,23 @@ void PartSet_Module::deleteObjects()
   // selected objects should be collected before the current operation abort because
   // the abort leads to selection lost on constraint objects. It can be corrected after #386 issue
   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
+  XGUI_Workshop* aWorkshop = aConnector->workshop();
   ModuleBase_ISelection* aSel = aConnector->selection();
   QObjectPtrList aSelectedObj = aSel->selectedPresentations();
 
-  XGUI_Workshop* aWorkshop = aConnector->workshop();
-  XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
-  if (!isSketchOp && anOpMgr->canStopOperation()) {
-    ModuleBase_Operation* aCurrentOp = anOpMgr->currentOperation();
-    if (aCurrentOp) {
-      aCurrentOp->abort();
-    }
-  }
+  // if there are no selected objects in the viewer, that means that the selection in another
+  // place cased this method. It is necessary to return the false value to understande in above
+  // method that delete is not processed
+  if (aSelectedObj.count() == 0)
+    return false;
+
+  if (isNestedOp)
+    anOperation->abort();
+
+  // the active nested sketch operation should be aborted unconditionally
+  if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
+    anOperation->abort();
+
   std::set<FeaturePtr> aRefFeatures;
   foreach (ObjectPtr aObj, aSelectedObj)
   {
@@ -544,7 +556,8 @@ void PartSet_Module::deleteObjects()
     }
     //}
   }
-  QString aDescription = tr("Delete");
+
+  QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
   /**
   // according to #355 feature, it is not necessary to inform about dependencies during
   // sketch delete operation
@@ -604,4 +617,6 @@ void PartSet_Module::deleteObjects()
   aWorkshop->displayer()->updateViewer();
   //myDisplayer->updateViewer();
   aMgr->finishOperation();
+
+  return true;
 }
index aa5215e75abc71e4b2cfcc80f1239d277d2b1906..138ffb3de55b36efdd68503bc2084213ced3b74e 100644 (file)
@@ -79,6 +79,10 @@ public:
   /// \param theOperation a stopped operation
   virtual void operationStopped(ModuleBase_Operation* theOperation);
 
+  /// Returns action according to the given ID
+  /// \param theId an action identifier, it should be uniqued in the bounds of the module
+  QAction* action(const QString& theId) const;
+
   /// Returns True if there are available Undos and the sketch manager allows undo
   /// \return the boolean result
   virtual bool canUndo() const;
@@ -122,9 +126,6 @@ protected slots:
   /// It commits the operation of it is can be committed
   void onOperationActivatedByPreselection();
 
-  //! Delete features
-  void onDeleteObjects();
-
  protected:
   /// Register validators for this module
   virtual void registerValidators();
@@ -147,17 +148,13 @@ protected slots:
   /// Put the created actions into an internal map
   void createActions();
 
-  /// Returns action according to the given ID
-  /// \param theId an action identifier, it should be uniqued in the bounds of the module
-  QAction* action(const QString& theId) const;
-
   /// Add action to the internal map
   /// \param theId - string ID of the item
   /// \param theAction - action to add
   void addAction(const QString& theId, QAction* theAction);
 
   //! Delete features
-  void deleteObjects();
+  virtual bool deleteObjects();
 
  private:
    QString myLastOperationId;
index 30f1523b975c0a7b427234c22bf4dedde442742f..3b9e813c2ba6efa80b0280ed04dc5973c70c4943 100644 (file)
@@ -15,6 +15,7 @@
 #include <XGUI_ModuleConnector.h>
 #include <XGUI_Displayer.h>
 #include <XGUI_Workshop.h>
+#include <XGUI_ContextMenuMgr.h>
 #include <XGUI_Selection.h>
 #include <XGUI_SelectionMgr.h>
 #include <ModuleBase_ModelWidget.h>
@@ -55,6 +56,7 @@
 //#include <AIS_Shape.hxx>
 
 #include <ModelAPI_Events.h>
+#include <ModelAPI_Session.h>
 
 #include <QMouseEvent>
 #include <QApplication>
@@ -572,6 +574,21 @@ bool PartSet_SketcherMgr::isNestedSketchOperation(ModuleBase_Operation* theOpera
          PartSet_SketcherMgr::sketchOperationIdList().contains(theOperation->id());
 }
 
+bool PartSet_SketcherMgr::isNestedCreateOperation(ModuleBase_Operation* theOperation)
+{
+  return theOperation && !theOperation->isEditOperation() && isNestedSketchOperation(theOperation);
+}
+
+bool PartSet_SketcherMgr::isEntityOperation(ModuleBase_Operation* theOperation)
+{
+  std::string aId = theOperation ? theOperation->id().toStdString() : "";
+
+  return (aId == SketchPlugin_Line::ID()) ||
+         (aId == SketchPlugin_Point::ID()) ||
+         (aId == SketchPlugin_Arc::ID()) ||
+         (aId == SketchPlugin_Circle::ID());
+}
+
 bool PartSet_SketcherMgr::isDistanceOperation(ModuleBase_Operation* theOperation)
 {
   std::string aId = theOperation ? theOperation->id().toStdString() : "";
@@ -717,6 +734,109 @@ bool PartSet_SketcherMgr::canDisplayObject() const
   return aCanDisplay;
 }
 
+bool PartSet_SketcherMgr::canChangeConstruction(bool& isConstruction) const
+{
+  bool anEnabled = false;
+  ModuleBase_Operation* anOperation = getCurrentOperation();
+
+  bool isActiveSketch = PartSet_SketcherMgr::isSketchOperation(anOperation) ||
+                        PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
+  if (!isActiveSketch)
+    return anEnabled;
+
+  QObjectPtrList anObjects;
+  // 1. change construction type of a created feature
+  if (PartSet_SketcherMgr::isNestedCreateOperation(anOperation) &&
+      PartSet_SketcherMgr::isEntityOperation(anOperation) ) {
+    anObjects.append(anOperation->feature());
+  }
+  else {
+    if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
+      anOperation->abort();
+    // 2. change construction type of selected sketch entities
+    ModuleBase_ISelection* aSelection = myModule->workshop()->selection();
+    anObjects = aSelection->selectedPresentations();
+  }
+  anEnabled = anObjects.size() > 0;
+
+  bool isNotConstructedFound = false;
+  if (anObjects.size() > 0) {
+    QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end();
+    for (; anIt != aLast && !isNotConstructedFound; anIt++) {
+      FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
+      if (aFeature.get() != NULL) {
+        std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+                            std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+        if (aSketchFeature.get() != NULL) {
+          std::string anAttribute = SketchPlugin_Feature::CONSTRUCTION_ID();
+
+          std::shared_ptr<ModelAPI_AttributeBoolean> aConstructionAttr = 
+            std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(aSketchFeature->data()->attribute(anAttribute));
+          isNotConstructedFound = !aConstructionAttr->value();
+        }
+      }
+    }
+  }
+  isConstruction = anObjects.size() && !isNotConstructedFound;
+  return anEnabled;
+}
+  
+void PartSet_SketcherMgr::setConstruction(const bool isChecked)
+{
+  ModuleBase_Operation* anOperation = getCurrentOperation();
+
+  bool isActiveSketch = PartSet_SketcherMgr::isSketchOperation(anOperation) ||
+                        PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
+  if (!isActiveSketch)
+    return;
+
+  QObjectPtrList anObjects;
+  bool isUseTransaction = false;
+  // 1. change construction type of a created feature
+  if (PartSet_SketcherMgr::isNestedCreateOperation(anOperation) &&
+      PartSet_SketcherMgr::isEntityOperation(anOperation) ) {
+    anObjects.append(anOperation->feature());
+  }
+  else {
+    isUseTransaction = true;
+    // 2. change construction type of selected sketch entities
+    ModuleBase_ISelection* aSelection = myModule->workshop()->selection();
+    anObjects = aSelection->selectedPresentations();
+  }
+
+  QAction* anAction = myModule->action("CONSTRUCTION_CMD");
+  SessionPtr aMgr = ModelAPI_Session::get();
+  if (isUseTransaction) {
+    if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
+      anOperation->abort();
+    aMgr->startOperation(anAction->text().toStdString());
+  }
+  storeSelection();
+
+  if (anObjects.size() > 0) {
+    QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end();
+    for (; anIt != aLast; anIt++) {
+      FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
+      if (aFeature.get() != NULL) {
+        std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+                            std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+        if (aSketchFeature.get() != NULL) {
+          std::string anAttribute = SketchPlugin_Feature::CONSTRUCTION_ID();
+
+          std::shared_ptr<ModelAPI_AttributeBoolean> aConstructionAttr = 
+            std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(aSketchFeature->data()->attribute(anAttribute));
+          aConstructionAttr->setValue(isChecked);
+        }
+      }
+    }
+  }
+  if (isUseTransaction) {
+    aMgr->finishOperation();
+  }
+  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
+  restoreSelection();
+}
+
 void PartSet_SketcherMgr::onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& thePln)
 {
   myPlaneFilter->setPlane(thePln->impl<gp_Pln>());
@@ -877,11 +997,6 @@ ModuleBase_Operation* PartSet_SketcherMgr::getCurrentOperation() const
   return myModule->workshop()->currentOperation();
 }
 
-bool PartSet_SketcherMgr::isNestedCreateOperation(ModuleBase_Operation* theOperation) const
-{
-  return theOperation && !theOperation->isEditOperation() && isNestedSketchOperation(theOperation);
-}
-
 void PartSet_SketcherMgr::visualizeFeature(ModuleBase_Operation* theOperation,
                                            const bool isToDisplay)
 {
@@ -917,7 +1032,6 @@ void PartSet_SketcherMgr::visualizeFeature(ModuleBase_Operation* theOperation,
 void PartSet_SketcherMgr::storeSelection(const bool theHighlightedOnly)
 {
   ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
-
   ModuleBase_ISelection* aSelect = aWorkshop->selection();
   QList<ModuleBase_ViewerPrs> aHighlighted = aSelect->getHighlighted();
     
@@ -940,12 +1054,12 @@ void PartSet_SketcherMgr::storeSelection(const bool theHighlightedOnly)
     FeaturePtr aFeature = anIt.key();
     getCurrentSelection(aFeature, myCurrentSketch, aWorkshop, myCurrentSelection);
   }
-  qDebug(QString("  storeSelection: %1").arg(myCurrentSelection.size()).toStdString().c_str());
+  //qDebug(QString("  storeSelection: %1").arg(myCurrentSelection.size()).toStdString().c_str());
 }
 
 void PartSet_SketcherMgr::restoreSelection()
 {
-  qDebug(QString("restoreSelection: %1").arg(myCurrentSelection.size()).toStdString().c_str());
+  //qDebug(QString("restoreSelection: %1").arg(myCurrentSelection.size()).toStdString().c_str());
   ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
   FeatureToSelectionMap::const_iterator aSIt = myCurrentSelection.begin(),
index 9f2f81051437d25e75161509d0288f81993b007e..57f17840fda7e640a7901c350c246531a5483b48 100644 (file)
@@ -87,7 +87,17 @@ public:
   /// \return the boolean result
   static bool isNestedSketchOperation(ModuleBase_Operation* theOperation);
 
-  /// Returns whethe the current operation is a sketch distance - lenght, distance or radius
+  /// Returns true if the operation is a create nested feature one
+  /// \param theOperation a checked operation
+  //// \return boolean value
+  static bool isNestedCreateOperation(ModuleBase_Operation* theOperation);
+
+  /// Returns whether the current operation is a sketch entity - line, point, arc or circle
+  /// \param the operation
+  /// \return a boolean value
+  static bool isEntityOperation(ModuleBase_Operation* theOperation);
+
+  /// Returns whether the current operation is a sketch distance - lenght, distance or radius
   /// \param the operation
   /// \return a boolean value
   static bool isDistanceOperation(ModuleBase_Operation* theOperation);
@@ -127,6 +137,15 @@ public:
   /// \param theObject a model object
   bool canDisplayObject() const;
 
+  /// Returns true if the current operation is sketch entity create operation
+  /// \param isConstruction the current construction state
+  /// \return the boolean result
+  bool canChangeConstruction(bool& isConstruction) const;
+  
+  /// Changes the sketcher entity construction argument value
+  /// \param isChecked if true, the feature is a construction
+  void setConstruction(const bool isChecked);
+
 public slots:
   /// Process sketch plane selected event
   void onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& thePln);
@@ -211,11 +230,6 @@ private:
   /// \return an operation
   ModuleBase_Operation* getCurrentOperation() const;
 
-  /// Returns true if the operation is a create nested feature one
-  /// \param theOperation a checked operation
-  //// \return boolean value
-  bool isNestedCreateOperation(ModuleBase_Operation* theOperation) const;
-
   /// Erase or display the feature of the current operation. If the mouse over the active view or
   /// a current value is changed by property panel, the feature is displayed otherwise it is hidden
   /// \param theOperation an operation which feature is to be displayed, it is nested create operation
index a81a7f2c5a3c870da653d926d1fb402d05abe3b7..d011bb5d2801ff7ade90cf0d4f58caf2b7e57017 100644 (file)
@@ -54,6 +54,8 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent,
                                               const std::string& theParentId)
     : ModuleBase_ModelWidget(theParent, theData, theParentId)
 {
+  // the control should accept the focus, so the boolen flag is corrected to be true
+  myIsObligatory = true;
   //myOptionParam = theData->getProperty(PREVIOUS_FEATURE_PARAM);
   QString aPageName = QString::fromStdString(theData->getProperty(CONTAINER_PAGE_NAME));
   myGroupBox = new QGroupBox(aPageName, theParent);
@@ -241,6 +243,10 @@ bool PartSet_WidgetPoint2D::getPoint2d(const Handle(V3d_View)& theView,
 
 void PartSet_WidgetPoint2D::onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
 {
+  // the contex menu release by the right button should not be processed by this widget
+  if (theEvent->button() != Qt::LeftButton)
+    return;
+
   XGUI_Selection* aSelection = myWorkshop->selector()->selection();
   Handle(V3d_View) aView = theWnd->v3dView();
   // TODO: This fragment doesn't work because bug in OCC Viewer. It can be used after fixing.
index 9e22b9ce812c3472fd1fe948c55b4ec6106cb57e..4be01f0a671d9f67e746adb41159ae4526716c93 100644 (file)
@@ -88,15 +88,19 @@ class SketchPlugin_Feature : public ModelAPI_Feature, public GeomAPI_ICustomPrs
     if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/)
       return;
 
-    bool isConstruction = data()->boolean(SketchPlugin_Feature::CONSTRUCTION_ID())->value();
+    std::shared_ptr<ModelAPI_AttributeBoolean> aConstructionAttr =
+                                   data()->boolean(SketchPlugin_Feature::CONSTRUCTION_ID());
+    bool isConstruction = aConstructionAttr.get() != NULL && aConstructionAttr->value();
     if (aShapeType == 6) { // if this is an edge
       if (isConstruction) {
         thePrs->setWidth(1);
+        thePrs->setLineStyle(3);
         aRGB = Config_PropManager::color("Visualization", "sketch_construction_color",
                                          SKETCH_CONSTRUCTION_COLOR);
       }
       else {
         thePrs->setWidth(3);
+        thePrs->setLineStyle(0);
         if (isExternal()) {
           // Set color from preferences
           aRGB = Config_PropManager::color("Visualization", "sketch_external_color",
index 624ac16ab6d48455065bc0c226959764e7b0483a..f243c86c77aa0da8ca83cdd4beb837b5b2afb54f 100644 (file)
@@ -87,6 +87,11 @@ void SketchPlugin_Sketch::execute()
         if (aFeature->data()->selection(SketchPlugin_Feature::EXTERNAL_ID())->value())
           continue;
       }
+      // do not include the construction entities in the result
+      if (aFeature->data()->attribute(SketchPlugin_Feature::CONSTRUCTION_ID())) {
+        if (aFeature->data()->boolean(SketchPlugin_Feature::CONSTRUCTION_ID())->value())
+          continue;
+      }
 
       const std::list<std::shared_ptr<ModelAPI_Result> >& aRes = aFeature->results();
       std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter = aRes.cbegin();
index 401d1d3cafeb4997285ac69078ff9fbc24e625bc..6fc47e170982976ac55392ddddb624d2b90f9ced 100644 (file)
@@ -222,8 +222,12 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
     // Check that the visualized shape is the same and the redisplay is not necessary
     // Redisplay of AIS object leads to this object selection compute and the selection 
     // in the browser is lost
-    // become
-    ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+
+    // this check is not necessary anymore because the selection store/restore is realized
+    // before and after the values modification.
+    // Moreother, this check avoids customize and redisplay presentation if the presentable
+    // parameter is changed.
+    /*ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
     if (aResult.get() != NULL) {
       Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aAISIO);
       if (!aShapePrs.IsNull()) {
@@ -237,7 +241,15 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
             return;
         }
       }
+    }*/
+    // Customization of presentation
+    FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+    if (aFeature.get() != NULL) {
+      GeomCustomPrsPtr aCustPrs = std::dynamic_pointer_cast<GeomAPI_ICustomPrs>(aFeature);
+      if (aCustPrs.get() != NULL)
+        aCustPrs->customisePresentation(aAISObj);
     }
+
     aContext->Redisplay(aAISIO, false);
     if (isUpdateViewer)
       updateViewer();
index e767d7f964c053723c057983372d8a552c0685b7..1fe9717fb9bf9f6623b39514ea2c530153f43fa5 100644 (file)
@@ -301,10 +301,6 @@ bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent)
       commitOperation();
     }
     break;
-    case Qt::Key_Delete: { // the delete button is occupied by the workshop Delete action,
-      // so this button process is realized here
-      emit keyDeleteReleased();
-    }
     default:
       isAccepted = false;
       break;
index 609d8fde4a6c0bf99a3ab7557ed1da3938544222..eb0e7541a753675a929521bc09d0342576d81937 100644 (file)
@@ -135,9 +135,6 @@ signals:
   /// Signal is emitted after the key released click.
   void keyEnterReleased();
 
-  /// Signal is emitted after the key delete released click.
-  void keyDeleteReleased();
-
  protected:
   /// Commits the current operatin if it is valid
   bool commitOperation();
index ff3347b02c3cfa371121b43c86049441565a11e2..805b3b1bd78decb4b0f13e63efcc8332bceeefc4 100644 (file)
@@ -1287,9 +1287,8 @@ void XGUI_Workshop::activatePart(ResultPartPtr theFeature)
 //**************************************************************
 void XGUI_Workshop::deleteObjects(const QObjectPtrList& theList)
 {
-  // the active operation should not be aborted if there is an empty list of objects
-  // it is possible that delete shortcut should be processed in the active operation.
-  if (theList.empty())
+  ModuleBase_IModule* aModule = module();
+  if (aModule->deleteObjects())
     return;
 
   if (!isActiveOperationAborted())