]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
debug of the channel presentation
authorasl <asl@opencascade.com>
Mon, 30 Dec 2013 04:17:00 +0000 (04:17 +0000)
committerasl <asl@opencascade.com>
Mon, 30 Dec 2013 04:17:00 +0000 (04:17 +0000)
src/HYDROData/HYDROData_Channel.cxx
src/HYDROData/HYDROData_Pipes.cxx
src/HYDROData/HYDROData_Pipes.h
src/HYDROGUI/HYDROGUI_Shape.cxx

index e011807bd2c1ba9adfb5481e88c61f3a8c2d70a1..2c76702a014bce72c82f20a710dc047d5ed97b96 100644 (file)
@@ -109,8 +109,6 @@ void HYDROData_Channel::Update()
   if(aProfileWire.IsNull())
     return;
 
-  //BRepTools::Write( aPathWire, "guideline.brep" );
-  //BRepTools::Write( aProfileWire, "profile.brep" );
 
   HYDROData_Canal3dAnd2d aChannelConstructor( aProfileWire, aPathWire );
   aChannelConstructor.Create3dPresentation();
@@ -118,10 +116,12 @@ void HYDROData_Channel::Update()
   SetShape3D( aChannelConstructor.Get3dPresentation() );
   SetTopShape( aChannelConstructor.Get2dPresentation() );
 
-  //BRepTools::Write( aPathWire, "guideline.brep" );
-  //BRepTools::Write( aProfileWire, "profile.brep" );
-  //BRepTools::Write( aChannelConstructor.Get2dPresentation(), "channel2d.brep" );
-  //BRepTools::Write( aChannelConstructor.Get3dPresentation(), "channel3d.brep" );
+  BRepTools::Write( aPathWire, "guideline.brep" );
+  BRepTools::Write( aProfileWire, "profile.brep" );
+  BRepTools::Write( aChannelConstructor.Get2dPresentation(), "channel2d.brep" );
+  BRepTools::Write( aChannelConstructor.Get3dPresentation(), "channel3d.brep" );
+
+  TopAbs_ShapeEnum aType = GetTopShape().ShapeType();
 
   // Create groups for channel
   TopoDS_Wire aLeftBank = aChannelConstructor.GetLeftBank();
index 90d7b088409a6e12072a97a8cc37311bae50969f..5147d01e0edd936c7ed6bcfe4dae975747177463 100644 (file)
@@ -44,6 +44,7 @@
 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <TopExp_Explorer.hxx>
+#include <ShapeUpgrade_UnifySameDomain.hxx>
 
 /**
 * GEOMImpl_Fillet1dPoint is an internal class for 1D fillet algorithm
@@ -964,7 +965,7 @@ HYDROData_Canal3dAnd2d::HYDROData_Canal3dAnd2d(const TopoDS_Wire& Profile,
   TopExp::Vertices(myProfile, myLeftVertex, myRightVertex);
   gp_Pnt LeftPoint  = BRep_Tool::Pnt(myLeftVertex);
   gp_Pnt RightPoint = BRep_Tool::Pnt(myRightVertex);
-  myFilletRadius = (LeftPoint.Distance(RightPoint))/2.;
+  myFilletRadius = (LeftPoint.Distance(RightPoint))/2. * 1.5;
 
   myTolAngular = 0.01;
   MakeSharpVertexList();
@@ -1239,11 +1240,17 @@ Standard_Boolean HYDROData_Canal3dAnd2d::Create2dPresentation()
     return Standard_False;
 
   myPipe2d = mySweep2d->Shape();
-  myInlet  = TopoDS::Wire(mySweep2d->FirstShape());
-  myOutlet = TopoDS::Wire(mySweep2d->LastShape());
+  myUnifier.Initialize(myPipe2d);
+  myUnifier.Build();
+  myUnifiedPipe2d = myUnifier.Shape();
+  
+  TopoDS_Wire OriginalInlet  = TopoDS::Wire(mySweep2d->FirstShape());
+  TopoDS_Wire OriginalOutlet = TopoDS::Wire(mySweep2d->LastShape());
+  myInlet  = CreateWireOnUnifiedPipe2d(OriginalInlet);
+  myOutlet = CreateWireOnUnifiedPipe2d(OriginalOutlet);
   TopoDS_Vertex V1, V2, V3, V4;
   TopExp::Vertices(myTransformedProfile2d, V1, V2);
-  TopExp::Vertices(myInlet, V3, V4);
+  TopExp::Vertices(OriginalInlet, V3, V4);
   gp_Pnt P1 = BRep_Tool::Pnt(V1);
   gp_Pnt P3 = BRep_Tool::Pnt(V3);
   if (P1.IsEqual(P3, Precision::Confusion()))
@@ -1264,7 +1271,23 @@ TopoDS_Wire HYDROData_Canal3dAnd2d::GetBank(const TopoDS_Vertex& aFreeVertex)
   MW.Add(GeneratedShapes);
   aBank = MW.Wire();
 
-  return aBank;
+  TopoDS_Wire aBankOnUnifiedPipe2d = CreateWireOnUnifiedPipe2d(aBank);
+
+  return aBankOnUnifiedPipe2d;
+}
+
+TopoDS_Wire Canal3dAnd2d::CreateWireOnUnifiedPipe2d(const TopoDS_Wire& aWireOnPipe2d)
+{
+  BRepLib_MakeWire MW;
+  BRepTools_WireExplorer wexp(aWireOnPipe2d);
+  for (; wexp.More(); wexp.Next())
+  {
+    TopoDS_Shape anEdge = wexp.Current();
+    TopoDS_Shape NewEdge = myUnifier.Generated(anEdge);
+    if (!NewEdge.IsNull())
+      MW.Add(TopoDS::Edge(NewEdge));
+  }
+  return MW.Wire();
 }
 
 TopoDS_Shape HYDROData_Canal3dAnd2d::Get3dPresentation()
@@ -1272,9 +1295,10 @@ TopoDS_Shape HYDROData_Canal3dAnd2d::Get3dPresentation()
   return myPipe3d;
 }
 
-TopoDS_Shape HYDROData_Canal3dAnd2d::Get2dPresentation()
+TopoDS_Face HYDROData_Canal3dAnd2d::Get2dPresentation()
 {
-  return myPipe2d;
+  TopoDS_Iterator iter(myUnifiedPipe2d);
+  return TopoDS::Face(iter.Value());
 }
 
 TopoDS_Wire HYDROData_Canal3dAnd2d::GetInlet()
@@ -1306,4 +1330,4 @@ TopoDS_Wire HYDROData_Canal3dAnd2d::GetProjectedRoundedGuideline()
 {
   return myProjectedGuideline;
 }
-*/
\ No newline at end of file
+*/
index 4d681beeb212e8182bd0546782c67d539a9cfe79..3541d2978018494fd4728b240c86606e35885dfb 100644 (file)
@@ -34,11 +34,13 @@ public:
                                     const TopoDS_Wire& aGuideline,
                                     const gp_Pnt& aMiddlePoint);
 
+  TopoDS_Wire CreateWireOnUnifiedPipe2d(const TopoDS_Wire& aWireOnPipe2d);
+
   TopoDS_Wire GetBank(const TopoDS_Vertex& aFreeVertex);
 
   //Queries
   TopoDS_Shape Get3dPresentation();
-  TopoDS_Shape Get2dPresentation();
+  TopoDS_Face  Get2dPresentation();
   TopoDS_Wire GetLeftBank();
   TopoDS_Wire GetRightBank();
   TopoDS_Wire GetInlet();
@@ -68,6 +70,8 @@ private:
 
   TopoDS_Shape myPipe3d;
   TopoDS_Shape myPipe2d;
+  TopoDS_Shape myUnifiedPipe2d;
+  ShapeUpgrade_UnifySameDomain myUnifier;
   TopoDS_Wire myInlet;
   TopoDS_Wire myOutlet;
   //TopoDS_Shape myLeftBank;
index 4afa67d312feac2bd6f91f01e198b89a4d7eca8b..7739a90ed91925faf577af9c7c5c45b407847c7e 100644 (file)
@@ -579,7 +579,7 @@ void HYDROGUI_Shape::buildShape()
     myShape = new AIS_Shape( myTopoShape );
   }
 
-  myShape->SetHLRAngleAndDeviation( 0.0001 );
+  myShape->SetHLRAngleAndDeviation( 0.001 );
 
   if ( !myObject.IsNull() )
     myShape->SetOwner( myObject );