Salome HOME
Creation of edges groups improved.
authoradv <adv@opencascade.com>
Thu, 9 Jan 2014 10:22:56 +0000 (10:22 +0000)
committeradv <adv@opencascade.com>
Thu, 9 Jan 2014 10:22:56 +0000 (10:22 +0000)
src/HYDROData/HYDROData_Stream.cxx
src/HYDROData/HYDROData_Stream.h

index 9aa3d2354deeac809724251d2732cfea92240dea..45b38d4de0821f2c494423c44b21f104e978db38 100644 (file)
@@ -292,7 +292,29 @@ void HYDROData_Stream::UpdatePrs()
 #endif 
 
   // Create the stream groups
 #endif 
 
   // Create the stream groups
-  createGroupObjects();
+  QString aLeftGroupName = GetName() + "_Left_Bank";
+
+  Handle(HYDROData_ShapesGroup) aLeftGroup = createGroupObject();
+  aLeftGroup->SetName( aLeftGroupName );
+  aLeftGroup->AddShape( anEdgLeft );
+
+  QString aRightGroupName = GetName() + "_Right_Bank";
+
+  Handle(HYDROData_ShapesGroup) aRightGroup = createGroupObject();
+  aRightGroup->SetName( aRightGroupName );
+  aRightGroup->AddShape( anEdgRight );
+
+  QString anInGroupName = GetName() + "_Inlet";
+
+  Handle(HYDROData_ShapesGroup) anInGroup = createGroupObject();
+  anInGroup->SetName( anInGroupName );
+  anInGroup->AddShape( aBotEdge );
+
+  QString anOutGroupName = GetName() + "_Outlet";
+
+  Handle(HYDROData_ShapesGroup) anOutGroup = createGroupObject();
+  anOutGroup->SetName( anOutGroupName );
+  anOutGroup->AddShape( aTopEdge );
 
   // This peace of code is for testing of functionality of altitude,
   // will be removed by adv when testing will be finished
 
   // This peace of code is for testing of functionality of altitude,
   // will be removed by adv when testing will be finished
@@ -732,114 +754,6 @@ void HYDROData_Stream::updateProfilesOrder()
 #endif
 }
 
 #endif
 }
 
-void HYDROData_Stream::createGroupObjects()
-{
-  TopoDS_Shape aStreamShape = GetTopShape();
-  if ( aStreamShape.IsNull() )
-    return;
-
-  HYDROData_SequenceOfObjects aRefProfiles = GetProfiles();
-  if ( aRefProfiles.Length() < 2 )
-    return;
-
-  Handle(HYDROData_Profile) aFirstProfile =
-    Handle(HYDROData_Profile)::DownCast( aRefProfiles.First() );
-  Handle(HYDROData_Profile) aLastProfile =
-    Handle(HYDROData_Profile)::DownCast( aRefProfiles.Last() );
-  if ( aFirstProfile.IsNull() || aLastProfile.IsNull() )
-    return;
-
-  TopoDS_Shape aBotEdgeShape = aFirstProfile->GetTopShape();
-  TopoDS_Shape aTopEdgeShape = aLastProfile->GetTopShape();
-  if ( aBotEdgeShape.IsNull() || aBotEdgeShape.ShapeType() != TopAbs_WIRE ||
-       aTopEdgeShape.IsNull() || aTopEdgeShape.ShapeType() != TopAbs_WIRE )
-    return;
-
-  TopExp_Explorer aBotEdgeShapeExp( aBotEdgeShape, TopAbs_EDGE );
-  TopExp_Explorer aTopEdgeShapeExp( aTopEdgeShape, TopAbs_EDGE );
-  if ( !aBotEdgeShapeExp.More() || !aTopEdgeShapeExp.More() )
-    return;
-
-  TopoDS_Edge aBotEdge = TopoDS::Edge( aBotEdgeShapeExp.Current() );
-  TopoDS_Edge aTopEdge = TopoDS::Edge( aTopEdgeShapeExp.Current() );
-
-  TopoDS_Vertex aBotFirstVert, aBotLastVert, aTopFirstVert, aTopLastVert;
-  TopExp::Vertices( aBotEdge, aBotFirstVert, aBotLastVert, true );
-  TopExp::Vertices( aTopEdge, aTopFirstVert, aTopLastVert, true );
-
-  TopExp_Explorer aStreamFaceExp( aStreamShape, TopAbs_FACE );
-  if ( !aStreamFaceExp.More() )
-    return;
-
-  // Get only face because of 2d profile wires is in compound
-  TopoDS_Face aStreamFace = TopoDS::Face( aStreamFaceExp.Current() );
-  
-  TopTools_SequenceOfShape aStreamWires;
-  HYDROData_ShapesTool::ExploreShapeToShapes( aStreamFace, TopAbs_EDGE, aStreamWires );
-
-  bool anIsLeft = false;
-  bool anIsRight = false;
-
-  TopTools_SequenceOfShape aLeftEdges, aRightEdges;
-  for ( int i = 1, n = aStreamWires.Length(); i <= n; ++i )
-  {
-    TopoDS_Edge anEdge = TopoDS::Edge( aStreamWires.Value( i ) );
-    if ( HYDROData_ShapesTool::IsEdgesEquals( anEdge, aBotEdge ) || 
-         HYDROData_ShapesTool::IsEdgesEquals( anEdge, aTopEdge ) )
-    {
-      anIsLeft = false;
-      anIsRight = false;
-      continue;
-    }
-
-    if ( !anIsLeft && !anIsRight )
-    {
-      TopoDS_Vertex anEdgeFirstVert, anEdgeLastVert;
-      TopExp::Vertices( anEdge, anEdgeFirstVert, anEdgeLastVert, true );
-
-      anIsLeft = HYDROData_ShapesTool::IsVerticesEquals( anEdgeFirstVert, aBotFirstVert ) ||
-                 HYDROData_ShapesTool::IsVerticesEquals( anEdgeLastVert, aTopFirstVert );
-      
-      anIsRight = HYDROData_ShapesTool::IsVerticesEquals( anEdgeFirstVert, aTopLastVert ) ||
-                  HYDROData_ShapesTool::IsVerticesEquals( anEdgeLastVert, aBotLastVert );
-    }
-
-    if ( anIsLeft )
-    {
-      aLeftEdges.Append( anEdge );
-    }
-    else if ( anIsRight )
-    {
-      aRightEdges.Append( anEdge );
-    }
-  }
-
-  // Create edges groups
-  QString aLeftGroupName = GetName() + "_Left_Bank";
-
-  Handle(HYDROData_ShapesGroup) aLeftGroup = createGroupObject();
-  aLeftGroup->SetName( aLeftGroupName );
-  aLeftGroup->SetShapes( aLeftEdges );
-
-  QString aRightGroupName = GetName() + "_Right_Bank";
-
-  Handle(HYDROData_ShapesGroup) aRightGroup = createGroupObject();
-  aRightGroup->SetName( aRightGroupName );
-  aRightGroup->SetShapes( aRightEdges );
-
-  QString anInGroupName = GetName() + "_Inlet";
-
-  Handle(HYDROData_ShapesGroup) anInGroup = createGroupObject();
-  anInGroup->SetName( anInGroupName );
-  anInGroup->AddShape( aBotEdge );
-
-  QString anOutGroupName = GetName() + "_Outlet";
-
-  Handle(HYDROData_ShapesGroup) anOutGroup = createGroupObject();
-  anOutGroup->SetName( anOutGroupName );
-  anOutGroup->AddShape( aTopEdge );
-}
-
 ObjectKind HYDROData_Stream::getAltitudeObjectType() const
 {
   return KIND_STREAM_ALTITUDE;
 ObjectKind HYDROData_Stream::getAltitudeObjectType() const
 {
   return KIND_STREAM_ALTITUDE;
index fd340d335c0296bb1ef8d44fd4b1a38f9c8c9929..bba1d0a660548289dbe750b584fd034c7210ad77 100644 (file)
@@ -181,11 +181,6 @@ protected:
    */
   void updateProfilesOrder();
   
    */
   void updateProfilesOrder();
   
-  /**
-   * Create all necessary child group objects.
-   */
-  virtual void createGroupObjects();
-
   /**
    * Returns the type of child altitude object.
    * Reimplemented to create stream altitude object.
   /**
    * Returns the type of child altitude object.
    * Reimplemented to create stream altitude object.