]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'MultiLevelCompound'
authorazv <azv@opencascade.com>
Thu, 16 May 2019 04:44:48 +0000 (07:44 +0300)
committerazv <azv@opencascade.com>
Thu, 16 May 2019 04:44:48 +0000 (07:44 +0300)
CMakeLists.txt
env.sh
src/ConstructionAPI/ConstructionAPI_Point.cpp
src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp
src/SHAPERGUI/SHAPERGUI_DataModel.cpp

index 09bd369cd7f5fa8ee6b31bb01fea7bfcfc13519c..cab33dbc4ec6bd7fb949dd3a27de6fa058d29f16 100644 (file)
@@ -26,7 +26,7 @@ IF(WIN32)
   CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib
 ENDIF(WIN32)
 
-SET (SHAPER_Version 9.2.2)
+SET (SHAPER_Version 9.3.0)
 
 SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH})
 OPTION(SHAPER_BUILD_DOC "Generate SHAPER documentation" ON)
diff --git a/env.sh b/env.sh
index 08ecb872d0ac7b3595edc9814f33e5aaa8f54265..e9cd297ebc4f35d60145ab7ef5f9a8f1f790d07b 100644 (file)
--- a/env.sh
+++ b/env.sh
@@ -1,6 +1,6 @@
 #!/bin/bash -x
 
-export SALOME_DIR=/dn46/SALOME/series9x/current-2019-03-20
+export SALOME_DIR=/dn46/SALOME/series9x/current-2019-04-11
 
 # Path to sources
 export SOURCES_DIR=$(pwd)
index 0029708af6f768cb9c1baf29195b91e87ce2ab18..d4f073f1b2ceb5671d29e9c7f980bf963ec8a568 100644 (file)
@@ -166,13 +166,6 @@ void ConstructionAPI_Point::setByXYZ(const ModelHighAPI_Double& theX,
                                      const ModelHighAPI_Double& theY,
                                      const ModelHighAPI_Double& theZ)
 {
-  //fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ(), mycreationMethod);
-
-  // TODO: Fill point attribute
-  //fillAttribute(theX, myx);
-  //fillAttribute(theY, myy);
-  //fillAttribute(theZ, myz);
-
   fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ(), mycreationMethod);
   fillAttribute(theX, theY, theZ, mypoint);
 
@@ -277,6 +270,8 @@ void ConstructionAPI_Point::setByCenterOfGravity(const ModelHighAPI_Selection& t
   fillAttribute(ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY(),
                 mygeometricalPropertyType);
   fillAttribute(theObject, myobjectForCenterOfGravity);
+
+  execute();
 }
 
 //==================================================================================================
@@ -287,6 +282,8 @@ void ConstructionAPI_Point::setByCenterOfCircle(const ModelHighAPI_Selection& th
   fillAttribute(ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_CIRCLE(),
                 mygeometricalPropertyType);
   fillAttribute(theObject, myobjectForCenterOfCircle);
+
+  execute();
 }
 
 //==================================================================================================
index 24a0de7e7b1cbddbb950deafdfbdd43c4fe8ffd3..370efa3a6d76bb3ab73850afd123e344f8f327a7 100644 (file)
@@ -86,65 +86,71 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged(const std::string& theID)
   }
 
   myChangedInCode = true;
+  if (theID == BASE_SHAPE_ID() || theID == SUBSHAPES_TO_KEEP_ID() ||
+    theID == SUBSHAPES_TO_REMOVE_ID()) {
+    std::list<ResultPtr> anAllSubs;
+    ModelAPI_Tools::allSubs(aResultBody, anAllSubs);
 
-  if(theID == BASE_SHAPE_ID()) {
-    aSubShapesToKeepAttrList->clear();
-    aSubShapesToRemoveAttrList->clear();
+    if(theID == BASE_SHAPE_ID()) {
+      aSubShapesToKeepAttrList->clear();
+      aSubShapesToRemoveAttrList->clear();
 
-    if (!aBaseShape.get()) {
-      return;
-    }
+      if (!aBaseShape.get()) {
+        return;
+      }
 
-    std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
-    for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); anIt != aSubShapes.cend(); ++anIt)
-    {
-      GeomShapePtr aSubShape = *anIt;
-      if(!isHasSubs) {
-        aSubShapesToKeepAttrList->append(aContext, aSubShape);
-      } else {
-        std::list<ResultPtr> anAllSubs;
-        ModelAPI_Tools::allSubs(aResultBody, anAllSubs);
-        std::list<ResultPtr>::iterator aSubsIt = anAllSubs.begin();
-        for(; aSubsIt != anAllSubs.end(); aSubsIt++) {
-          ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aSubsIt);
-          if (aSub && aSub->shape().get() && aSub->shape()->isSubShape(aSubShape)) {
-            aSubShapesToKeepAttrList->append(aSub, aSubShape);
-            break;
+      std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
+      ListOfShape::const_iterator anIt = aSubShapes.cbegin();
+      for (; anIt != aSubShapes.cend(); ++anIt)
+      {
+        GeomShapePtr aSubShape = *anIt;
+        if(!isHasSubs) {
+          aSubShapesToKeepAttrList->append(aContext, aSubShape);
+        } else {
+          std::list<ResultPtr>::iterator aSubsIt = anAllSubs.begin();
+          for(; aSubsIt != anAllSubs.end(); aSubsIt++) {
+            ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aSubsIt);
+            if (aSub && aSub->shape().get() && aSub->shape()->isSubShape(aSubShape)) {
+              aSubShapesToKeepAttrList->append(aSub, aSubShape);
+              break;
+            }
           }
         }
       }
     }
-  }
-  else if (theID == SUBSHAPES_TO_KEEP_ID())
-  {
-    aSubShapesToRemoveAttrList->clear();
+    else if (theID == SUBSHAPES_TO_KEEP_ID())
+    {
+      aSubShapesToRemoveAttrList->clear();
 
-    if (!aBaseShape.get()) {
-      return;
-    }
+      if (!aBaseShape.get()) {
+        return;
+      }
 
-    int anIndex;
-    const int aSubsToKeepNb = aSubShapesToKeepAttrList->size();
-    std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
-    for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); anIt != aSubShapes.cend(); ++anIt)
-    {
-      GeomShapePtr aSubShape = *anIt;
+      int anIndex;
+      // optimization: collect selection attribute values into a map
+      const int aSubsToKeepNb = aSubShapesToKeepAttrList->size();
+      GeomAPI_DataMapOfShapeShape aSubShapesToKeep;
       for(anIndex = 0; anIndex < aSubsToKeepNb; ++anIndex) {
         AttributeSelectionPtr anAttrSelectionInList = aSubShapesToKeepAttrList->value(anIndex);
         GeomShapePtr aSubShapeToKeep = anAttrSelectionInList->value();
-        if (aSubShapeToKeep.get() && aSubShapeToKeep->isEqual(aSubShape)) {
-          break;
-        }
+        if (aSubShapeToKeep.get())
+          aSubShapesToKeep.bind(aSubShapeToKeep, aSubShapeToKeep);
       }
 
-      if (anIndex == aSubsToKeepNb) {
+      std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
+      ListOfShape::const_iterator anIt = aSubShapes.cbegin();
+      for (; anIt != aSubShapes.cend(); ++anIt)
+      {
+        GeomShapePtr aSubShape = *anIt;
+        if (aSubShapesToKeep.isBound(aSubShape))
+          continue;
+
         if(!isHasSubs) {
           aSubShapesToRemoveAttrList->append(aContext, aSubShape);
-        } else {
-          std::list<ResultPtr> anAllSubs;
-          ModelAPI_Tools::allSubs(aResultBody, anAllSubs);
+        }
+        else {
           std::list<ResultPtr>::iterator aSubsIt = anAllSubs.begin();
-          for(; aSubsIt != anAllSubs.end(); aSubsIt++) {
+          for (; aSubsIt != anAllSubs.end(); aSubsIt++) {
             ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aSubsIt);
             if (aSub && aSub->shape().get() && aSub->shape()->isSubShape(aSubShape)) {
               aSubShapesToRemoveAttrList->append(aSub, aSubShape);
@@ -154,37 +160,39 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged(const std::string& theID)
         }
       }
     }
-  }
-  else if (theID == SUBSHAPES_TO_REMOVE_ID())
-  {
-    aSubShapesToKeepAttrList->clear();
+    else if (theID == SUBSHAPES_TO_REMOVE_ID())
+    {
+      aSubShapesToKeepAttrList->clear();
 
-    if (!aBaseShape.get()) {
-      return;
-    }
+      if (!aBaseShape.get()) {
+        return;
+      }
 
-    int anIndex;
-    const int aSubsToRemoveNb = aSubShapesToRemoveAttrList->size();
-    std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
-    for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); anIt != aSubShapes.cend(); ++anIt)
-    {
-      GeomShapePtr aSubShape = *anIt;
+      int anIndex;
+      const int aSubsToRemoveNb = aSubShapesToRemoveAttrList->size();
+      GeomAPI_DataMapOfShapeShape aSubShapesToRemove;
       for(anIndex = 0; anIndex < aSubsToRemoveNb; ++anIndex) {
         AttributeSelectionPtr anAttrSelectionInList = aSubShapesToRemoveAttrList->value(anIndex);
         GeomShapePtr aSubShapeToRemove = anAttrSelectionInList->value();
-        if (aSubShapeToRemove.get() && aSubShapeToRemove->isEqual(aSubShape)) {
-          break;
-        }
+        if (aSubShapeToRemove.get())
+          aSubShapesToRemove.bind(aSubShapeToRemove, aSubShapeToRemove);
       }
 
-      if (anIndex == aSubsToRemoveNb) {
-        if(!isHasSubs) {
+
+      std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
+      ListOfShape::const_iterator anIt = aSubShapes.cbegin();
+      for (; anIt != aSubShapes.cend(); ++anIt)
+      {
+        GeomShapePtr aSubShape = *anIt;
+        if (aSubShapesToRemove.isBound(aSubShape))
+          continue;
+
+        if (!isHasSubs) {
           aSubShapesToKeepAttrList->append(aContext, aSubShape);
-        } else {
-          std::list<ResultPtr> anAllSubs;
-          ModelAPI_Tools::allSubs(aResultBody, anAllSubs);
+        }
+        else {
           std::list<ResultPtr>::iterator aSubsIt = anAllSubs.begin();
-          for(; aSubsIt != anAllSubs.end(); aSubsIt++) {
+          for (; aSubsIt != anAllSubs.end(); aSubsIt++) {
             ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aSubsIt);
             if (aSub && aSub->shape().get() && aSub->shape()->isSubShape(aSubShape)) {
               aSubShapesToKeepAttrList->append(aSub, aSubShape);
index b08f83b80c5742281ea38b9927e328fda5f22d81..efb30f936765a43c170cefea155ee697679e16a2 100644 (file)
@@ -197,32 +197,34 @@ bool SHAPERGUI_DataModel::dumpPython(const QString& thePath, CAM_Study* theStudy
     ModelAPI_Session::get()->finishOperation();
 
     if (QFile::exists(aFileName.c_str())) {
-      if (isMultiFile) {
         QFile aInFile(aFileName.c_str());
-        if (!aInFile.open(QIODevice::ReadOnly | QIODevice::Text))
-          return false;
-        QTextStream aText(&aInFile);
-        QString aTrace(aText.readAll());
-        aInFile.close();
+      if (!aInFile.open(QIODevice::ReadOnly | QIODevice::Text))
+        return false;
+      QTextStream aText(&aInFile);
+      QString aTrace(aText.readAll());
+      aInFile.close();
 
+      if (isMultiFile) {
         QStringList aBuffer;
-        aBuffer.push_back(QString("def RebuildData( theStudy ):"));
+        aBuffer.push_back(QString("def RebuildData():"));
         QStringList aList(aTrace.split("\n"));
         foreach(QString aStr, aList) {
           QString s = "  " + aStr;
           aBuffer.push_back(s);
         }
         aTrace = aBuffer.join("\n");
+      }
 
-        QFile aOutFile(aFileName.c_str());
-        if (!aOutFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate))
-          return false;
+      QFile aOutFile(aFileName.c_str());
+      // binary for SALOME, issue 16931
+      if (!aOutFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
+        return false;
+
+      QTextStream aOut(&aOutFile);
+      aOut << aTrace.toStdString().c_str() << "\n";
+      aOut.flush();
+      aOutFile.close();
 
-        QTextStream aOut(&aOutFile);
-        aOut << aTrace.toStdString().c_str() << "\n";
-        aOut.flush();
-        aOutFile.close();
-      }
       theListOfFiles.append(aTmpDir.c_str());
       theListOfFiles.append(DUMP_NAME);
       return true;