Salome HOME
updated copyright message
[modules/shaper.git] / src / PartSet / PartSet_SketcherMgr.cpp
index b1095873f46ead0e9b88b0e585019c5a97b8cdd7..d47d1ec75589c66af6aed3931e8c8cb605776c98 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include <SelectMgr_IndexedMapOfOwner.hxx>
 #include <StdSelect_BRepOwner.hxx>
 
-//#include <AIS_DimensionSelectionMode.hxx>
 #include <AIS_Shape.hxx>
-#include <AIS_Dimension.hxx>
+#include <PrsDim_Dimension.hxx>
 
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Session.h>
@@ -368,7 +367,7 @@ bool PartSet_SketcherMgr::isDragModeCreation() const
   // Acceptable features;
   QStringList aList;
   aList << "SketchLine" << "SketchMacroCircle" << "SketchMacroArc" <<
-    "SketchMacroEllipse" << "SketchMacroEllipticArc" << "SketchRectangle";
+    "SketchMacroEllipse" << "SketchMacroEllipticArc" << "SketchMacroRectangle";
   return aList.contains(aId);
 }
 
@@ -504,6 +503,10 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE
       myPreviousDrawModeEnabled = aViewer->enableDrawMode(false);
       if (isRelaunchEditing)
         launchEditing();
+      else {
+        if (myCurrentSelection.size() > 1)
+          aFOperation->propertyPanel()->cleanContent();
+      }
       myIsEditLaunching = aPrevLaunchingState;
       if (aFeature.get() != NULL) {
         std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
@@ -1092,6 +1095,8 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation)
   myCurrentSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFOperation->feature());
   double aSizeOfView = 0;
   std::shared_ptr<GeomAPI_Pnt> aCentralPoint;
+  // Reset size of view from previous launches
+  mySketchPlane->setSizeOfView(aSizeOfView, false, aCentralPoint);
   if (aFOperation->isEditOperation() &&
       mySketchPlane->getDefaultSizeOfView(myCurrentSketch, aSizeOfView, aCentralPoint)) {
     mySketchPlane->setSizeOfView(aSizeOfView, true, aCentralPoint);
@@ -1130,7 +1135,7 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation)
     for (; anIt != aLast; anIt++) {
       FeaturePtr aFeature = *anIt;
       if (aFeature.get())
-        anInvalidFeatureNames.append(aFeature->name().c_str());
+        anInvalidFeatureNames.append(QString::fromStdWString(aFeature->name()));
     }
     std::string aPrefixInfo = QString("Invalid features of the sketch will be deleted: %1.\n\n").
                                   arg(anInvalidFeatureNames.join(", ")).toStdString().c_str();
@@ -1701,7 +1706,7 @@ bool PartSet_SketcherMgr::setDistanceValueByPreselection(ModuleBase_Operation* t
             anAISIO = anAIS->impl<Handle(AIS_InteractiveObject)>();
 
             if (!anAISIO.IsNull()) {
-              Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAISIO);
+              Handle(PrsDim_Dimension) aDim = Handle(PrsDim_Dimension)::DownCast(anAISIO);
               if (!aDim.IsNull()) {
                 gp_Pnt aPosition = aDim->GetTextPosition();
 
@@ -2249,7 +2254,7 @@ bool isIncludeToResult(const ObjectPtr& theObject)
   for (aIt = aRefsToMe.cbegin(); aIt != aRefsToMe.cend(); ++aIt) {
     if ((*aIt)->id() == SketchPlugin_Projection::PROJECTED_FEATURE_ID()) {
       FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>((*aIt)->owner());
-      if (aFeature.get()) {
+      if (aFeature.get() && !aFeature->isMacro()) {
         anAttr = aFeature->data()->boolean(SketchPlugin_Projection::INCLUDE_INTO_RESULT());
         if (anAttr.get())
           return anAttr->value();
@@ -2345,7 +2350,7 @@ void PartSet_SketcherMgr::customizeSketchPresentation(const ObjectPtr& theObject
     thePrs->setWidth(17);
     //  thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol
   }
-  if (isCopy(aFeature) && !isIncludeToResult(aFeature)) {
+  if (isCopy(aFeature) || !isIncludeToResult(aFeature)) {
     double aPrsWidth = thePrs->width();
     thePrs->setWidth(aPrsWidth / 2.5);
   }