]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fixed the crash on moving Group down and edit it in the issue #1862
authormpv <mpv@opencascade.com>
Fri, 11 Nov 2016 11:48:29 +0000 (14:48 +0300)
committermpv <mpv@opencascade.com>
Fri, 11 Nov 2016 11:49:56 +0000 (14:49 +0300)
src/ConstructionAPI/ConstructionAPI_Point.cpp
src/ExchangeAPI/ExchangeAPI_Export.cpp
src/ExchangeAPI/ExchangeAPI_Import.cpp
src/Model/Model_SelectionNaming.cpp
src/ModelHighAPI/ModelHighAPI_Interface.cpp
src/ModelHighAPI/ModelHighAPI_Interface.h
src/ParametersAPI/ParametersAPI_Parameter.cpp
src/PartSetAPI/PartSetAPI_Part.cpp
src/SketchAPI/SketchAPI_Sketch.cpp

index 95e89ca4b87d946b411e90f6258bcca59251dd56..c5c722ef7cfb6b66690a85c5f4788f089dd63f86 100644 (file)
@@ -157,7 +157,6 @@ PointPtr addPoint(const std::shared_ptr<ModelAPI_Document>& thePart,
                   const ModelHighAPI_Double& theY,
                   const ModelHighAPI_Double& theZ)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
   return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ));
 }
index f0daad8f1b16df396c718931927aaa6980238697..3f6b9fec692501976533e46002a511134a1007e3 100644 (file)
@@ -16,7 +16,6 @@ void exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const std::list<ModelHighAPI_Selection> & theSelectionList,
                   const std::string & theFileFormat)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature =
     thePart->addFeature(ExchangePlugin_ExportFeature::ID());
   fillAttribute("Regular", aFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID()));
@@ -32,7 +31,6 @@ void exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
                  const std::string & theAuthor,
                  const std::string & theGeometryName)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature =
     thePart->addFeature(ExchangePlugin_ExportFeature::ID());
   fillAttribute("XAO", aFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID()));
index ff64ff5d972be538d76246c67aa1dc4f88e57a22..dfa58a2d5a639109b8092a1880742bbd28e4ae53 100644 (file)
@@ -81,7 +81,6 @@ ImportPtr addImport(
     const std::shared_ptr<ModelAPI_Document> & thePart,
     const std::string & theFilePath)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ExchangeAPI_Import::ID());
   return ImportPtr(new ExchangeAPI_Import(aFeature, theFilePath));
 }
index 39b32c5e4b268a742be2d1611eec4c31a9206704..bc88078c686a08dcc2ef7fce8ed6d588859b2755 100644 (file)
@@ -252,15 +252,20 @@ std::string Model_SelectionNaming::namingName(ResultPtr& theContext,
       {
         TopTools_IndexedDataMapOfShapeListOfShape aMap;
         TopExp::MapShapesAndAncestors(aContext, TopAbs_VERTEX, TopAbs_FACE, aMap);
-        const TopTools_ListOfShape& aList2  = aMap.FindFromKey(aSubShape);
         TopTools_ListOfShape aList;
         TopTools_MapOfShape aFMap;
-        // fix is below
-        TopTools_ListIteratorOfListOfShape itl2(aList2);
-        for (int i = 1;itl2.More();itl2.Next(),i++) {
-          if(aFMap.Add(itl2.Value()))
-            aList.Append(itl2.Value());
-        }
+        // simetimes when group is moved in history, naming may be badly updated, so
+        // avoid crash in FindFromKey (issue 1842)
+        if (aMap.Contains(aSubShape)) {
+          const TopTools_ListOfShape& aList2  = aMap.FindFromKey(aSubShape);
+          // fix is below
+          TopTools_ListIteratorOfListOfShape itl2(aList2);
+          for (int i = 1;itl2.More();itl2.Next(),i++) {
+            if(aFMap.Add(itl2.Value()))
+              aList.Append(itl2.Value());
+          }
+        } else
+          break;
         int n = aList.Extent();
         bool isByFaces = n >= 3;
         if(!isByFaces) { // open topology case or Compound case => via edges
index 07fd0249a3df782b9b9226a52924584a1dffb086..51d6f036aabf86035dfb71d9140153283efd7f22 100644 (file)
@@ -81,7 +81,6 @@ void ModelHighAPI_Interface::setName(const std::string& theName)
 
 std::list<ModelHighAPI_Selection> ModelHighAPI_Interface::result() const
 {
-  // TODO(spo): should I use more common function for the whole model to prepare results?
   const_cast<ModelHighAPI_Interface*>(this)->execute();
 
   std::list<ModelHighAPI_Selection> aSelectionList;
index 3c95aa90394fe06f7f20613dcfd05e37a47f1998..669559d9ad9c411464ae498524de779b68791bea 100644 (file)
@@ -58,7 +58,6 @@ public:
   MODELHIGHAPI_EXPORT
   void setName(const std::string& theName);
 
-  // TODO(spo): rename to selectAll()
   /// Return all objects of the feature
   MODELHIGHAPI_EXPORT
   virtual std::list<ModelHighAPI_Selection> result() const;
index d562cf325fcbe48a6f311f999864be01a45bec39..b6b9374feaae0314e6353198737177a820e609a7 100644 (file)
@@ -60,7 +60,6 @@ ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
                           const std::string & theExpression,
                           const std::string & theComment)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ParametersAPI_Parameter::ID());
   return ParameterPtr(new ParametersAPI_Parameter(aFeature, theName, theExpression, theComment));
 }
index 6adbac25954ab4204bcd74ff0a3b33a50103f0fa..63b3def93b085a5e39e54cdd75969212cb934e46 100644 (file)
@@ -42,7 +42,6 @@ void PartSetAPI_Part::dump(ModelHighAPI_Dumper& theDumper) const
 //--------------------------------------------------------------------------------------
 PartPtr addPart(const std::shared_ptr<ModelAPI_Document> & thePart)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetAPI_Part::ID());
   aFeature->execute();
   return PartPtr(new PartSetAPI_Part(aFeature));
@@ -50,7 +49,6 @@ PartPtr addPart(const std::shared_ptr<ModelAPI_Document> & thePart)
 
 PartPtr duplicatePart(const std::shared_ptr<ModelAPI_Document> & thePart)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetPlugin_Duplicate::ID());
   aFeature->execute();
   return PartPtr(new PartSetAPI_Part(aFeature));
@@ -58,7 +56,6 @@ PartPtr duplicatePart(const std::shared_ptr<ModelAPI_Document> & thePart)
 
 void removePart(const std::shared_ptr<ModelAPI_Document> & thePart)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetPlugin_Remove::ID());
   aFeature->execute();
 }
index 60c8165ef0e7b6f605d903bb8055712c3cd7680a..cd9f9875cdee26607a648162bd47a0310f57c366 100644 (file)
@@ -124,8 +124,6 @@ void SketchAPI_Sketch::setValue(
     const std::shared_ptr<ModelHighAPI_Interface> & theConstraint,
     const ModelHighAPI_Double & theValue)
 {
-  // TODO(spo): check somehow that the feature is a constraint or eliminate
-  // crash if the feature have no real attribute VALUE
   fillAttribute(theValue, theConstraint->feature()->real(SketchPlugin_Constraint::VALUE()));
 
 //  theConstraint->execute();
@@ -156,7 +154,6 @@ std::list<ModelHighAPI_Selection> SketchAPI_Sketch::selectFace() const
 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
                     const std::shared_ptr<GeomAPI_Ax3> & thePlane)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
   return SketchPtr(new SketchAPI_Sketch(aFeature, thePlane));
 }
@@ -164,7 +161,6 @@ SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
                     const ModelHighAPI_Selection & theExternal)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
   return SketchPtr(new SketchAPI_Sketch(aFeature, theExternal));
 }
@@ -172,7 +168,6 @@ SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
                     const std::string & theExternalName)
 {
-  // TODO(spo): check that thePart is not empty
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
   return SketchPtr(
     new SketchAPI_Sketch(aFeature, ModelHighAPI_Selection("FACE", theExternalName)));