]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Small fix to register selected name.
authorszy <szy@opencascade.com>
Thu, 25 Dec 2014 15:41:12 +0000 (18:41 +0300)
committerszy <szy@opencascade.com>
Thu, 25 Dec 2014 15:41:12 +0000 (18:41 +0300)
src/Model/Model_AttributeSelection.cpp
src/ModelAPI/ModelAPI_AttributeSelection.h

index ea00eaaec15223b20109c06ec8a18f97f3177303..f418c7b776d61e0ab9c38747e1977d9a634c4d9e 100644 (file)
@@ -442,7 +442,7 @@ TDF_Label Model_AttributeSelection::selectionLabel()
   return myRef.myRef->Label().FindChild(1);
 }
 
-#define DEB_NAME 1
+#define FIX_BUG1 1
 std::string GetShapeName(std::shared_ptr<Model_Document> theDoc, const TopoDS_Shape& theShape, 
                                             const TDF_Label& theLabel)
 {
@@ -573,21 +573,30 @@ std::string Model_AttributeSelection::buildSubShapeName(std::shared_ptr<GeomAPI_
                  break;
 
          case TopAbs_VERTEX:
-                 // name structure (Monifold Topology): F1 | F2 | F3; intersection of 3 faces defines a vertex.
+                 // name structure (Monifold Topology): 
+                 // 1) F1 | F2 | F3 - intersection of 3 faces defines a vertex - trivial case.
+                 // 2) F1 | F2      - intersection of 2 faces definses a vertex - applicable for case
+                 //                   when 1 faces is cylindrical, conical, spherical or revolution and etc.
+                 // 3) E1 | E2 | E3 - intersection of 3 edges defines a vertex - when we have case of a shell
+                 //                   or compound of 2 open faces.
+                 // 4) E1 | E2      - intesection of 2 edges defines a vertex - when we have a case of 
+                 //                   two independent edges (wire or compound)
+                 // implemented 2 first cases
                  {
                        TopTools_IndexedDataMapOfShapeListOfShape aMap;
                    TopExp::MapShapesAndAncestors(aContext, TopAbs_VERTEX, TopAbs_FACE, aMap);
                        const TopTools_ListOfShape& aList2  = aMap.FindFromKey(aSubShape);
                        TopTools_ListOfShape aList;
                        TopTools_MapOfShape aFMap;
-#ifdef DEB_NAME
-                       int n = aList2.Extent(); //bug!
+#ifdef FIX_BUG1
+                       //int n = aList2.Extent(); //bug!
+                       // 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());
                        }
-                       n = aList.Extent();
+                       //n = aList.Extent();
 #endif
                        TopTools_ListIteratorOfListOfShape itl(aList);
                    for (int i = 1;itl.More();itl.Next(),i++) {
@@ -601,6 +610,8 @@ std::string Model_AttributeSelection::buildSubShapeName(std::shared_ptr<GeomAPI_
                  }
                  break;
        }
+    // register name                   
+    aDoc->addNamingName(selectionLabel(), aName);
   }
   return aName;
 }
index 4e8f2a51e5adb8be71200a7c8d97f57a7b184e5c..b34a24d1ca70a47a7a86bfa3feb06c831c34b23b 100644 (file)
@@ -44,9 +44,12 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
     return type();
   }
 
-  /// builds name of the SubShape 
+  /// Builds name of the SubShape 
   virtual std::string buildSubShapeName(std::shared_ptr<GeomAPI_Shape> theSubShape, 
                                            const ResultPtr& theContext) = 0;
+
+  /// Selects sub-shape by Name
+  //virtual selectSubShape(const std::string& theSubShapeName, const std::string& theContextShapeName)
   /// To virtually destroy the fields of successors
   virtual ~ModelAPI_AttributeSelection()
   {