]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Merge branch 'BR_HYDRO_IMPS_2016' of ssh://gitolite3@git.salome-platform.org/modules...
authorasl <asl@opencascade.com>
Wed, 18 Jan 2017 07:30:56 +0000 (10:30 +0300)
committerasl <asl@opencascade.com>
Wed, 18 Jan 2017 07:30:56 +0000 (10:30 +0300)
Conflicts:
src/HYDROData/HYDROData_DTM.cxx
src/HYDROData/HYDROData_DTM.h
src/HYDROPy/HYDROData_Stream.sip

13 files changed:
1  2 
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_Channel.h
src/HYDROData/HYDROData_DTM.cxx
src/HYDROData/HYDROData_DTM.h
src/HYDROData/HYDROData_Object.cxx
src/HYDROData/HYDROData_Stream.cxx
src/HYDROData/HYDROData_Stream.h
src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx
src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx
src/HYDROGUI/HYDROGUI_StreamOp.cxx
src/HYDROPy/HYDROData_Stream.sip
src/HYDRO_tests/TestViewer.cxx
src/HYDRO_tests/test_HYDROData_CalcCase.cxx

Simple merge
index 4b0a1392cc70a9c3982a6608607818f954833d50,6678a8b90035bef1d3d4e70e2c7bec180cd0bc87..aae21b43f937fa9d807cc983d35a64ca8e0b29e5
  #include <TopTools_IndexedMapOfShape.hxx>
  #include <BRepBuilderAPI_MakeFace.hxx>
  #include <TopExp.hxx>
++<<<<<<< HEAD
++=======
+ #include <TopTools_IndexedMapOfOrientedShape.hxx>
+ #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
++>>>>>>> origin/BR_HYDRO_IMPS_2016
  
  #include <BRepLib_MakeEdge.hxx>
  #include <BRepLib_MakeWire.hxx>
  #include <ShapeUpgrade_UnifySameDomain.hxx>
  #include <BRepBuilderAPI_MakePolygon.hxx>
  #include <BOPAlgo_Builder.hxx>
+ #include <BRepAdaptor_Curve.hxx>
+ #include <GeomProjLib.hxx>
+ #include <gp_Pln.hxx>
  #include <TopTools_IndexedDataMapOfShapeShape.hxx>
  #include <TopTools_ListIteratorOfListOfShape.hxx>
+ #include <TopTools_SequenceOfShape.hxx>
+ #include <assert.h>
  
 -IMPLEMENT_STANDARD_HANDLE( HYDROData_DTM, HYDROData_Bathymetry )
  IMPLEMENT_STANDARD_RTTIEXT( HYDROData_DTM, HYDROData_Bathymetry )
  
  HYDROData_DTM::CurveUZ::CurveUZ( double theXCurv, const gp_Vec2d& theProfileDir, double theDeltaZ )
@@@ -294,182 -311,47 +312,47 @@@ void HYDROData_DTM::CreateProfilesFromD
      Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, Create3dPres, Create2dPres, InvInd, WireIntersections );
  }
  
- void HYDROData_DTM::ProjWireOnPlane(const TopoDS_Shape& inpWire, const Handle(Geom_Plane)& RefPlane, 
-   TopTools_DataMapOfShapeListOfShape* E2PE)
+ bool HYDROData_DTM::GetPlanarFaceFromBanks( const TopoDS_Edge& LB, const TopoDS_Edge& RB, TopoDS_Face& outF,
+   TopTools_SequenceOfShape* Boundr)
  {
    BRep_Builder BB;
-   //project shape (edges) on planar face
    TopoDS_Face F;
-   BB.MakeFace(F, RefPlane, Precision::Confusion());
-   BRepAlgo_NormalProjection nproj(F);
-   nproj.Add(inpWire);
-   nproj.SetDefaultParams();
-   nproj.Build();
-   if(!nproj.IsDone())
-     return;
+   Handle_Geom_Plane refpl = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1));
  
-   TopoDS_Shape projRes = nproj.Projection();
+   TopoDS_Vertex VFI, VLI, VFO, VLO;
+   TopoDS_Edge prLB;
+   TopoDS_Edge prRB;
  
-   // unite all vertexes/edges from projected result
-   BOPAlgo_Builder anAlgo;
-   TopExp_Explorer exp(projRes, TopAbs_EDGE);
-   for (;exp.More(); exp.Next())
-   {
-     const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
-     if (E.Orientation() != TopAbs_INTERNAL)
-       anAlgo.AddArgument(E);
-   }
-   anAlgo.Perform(); 
-   int stat = anAlgo.ErrorStatus();
-   TopoDS_Shape projResConn = anAlgo.Shape();
-   // make wire => vertexes and edges should be untouched after this operation!
-   exp.Init(projResConn, TopAbs_EDGE);
-   //TopTools_ListOfShape llE;
-   //TopoDS_Wire RW;
-   //BRepLib_MakeWire WM;
-   //for (;exp.More();exp.Next()) 
-   //  llE.Append(exp.Current());
-   //
-   //WM.Add(llE);
-   //outWire = WM.Wire();
-   //outWire.Orientation(inpWire.Orientation()); //take from the original wire
-   //history mode: edge to projected edges
-   if (E2PE)
-   {
-     TopExp_Explorer ex(inpWire, TopAbs_EDGE);
-     for (;ex.More();ex.Next())
-     {
-       const TopoDS_Edge& CE = TopoDS::Edge(ex.Current());
-       TopTools_ListOfShape NEL;
-       const TopTools_ListOfShape& LS = nproj.Generated(CE);
-       TopTools_ListIteratorOfListOfShape it(LS);
-       for (;it.More();it.Next())
-       {
-         const TopoDS_Shape& PCE = it.Value();
-         TopTools_ListOfShape PLS = anAlgo.Modified(PCE);
-         if (PLS.IsEmpty())
-           PLS.Append(PCE);
-         TopTools_ListIteratorOfListOfShape itp(PLS);
-         for (;itp.More();itp.Next())
-           NEL.Append(itp.Value());
-       }
-       E2PE->Bind(CE, NEL);
-     }
-   }
- }
- #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
- bool HYDROData_DTM::Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF,
-   TopTools_SequenceOfShape* Boundr, std::set<int> ind )
- {
-   //ind : set of indices (starts with 0). index == number of boundary (inlet, outlet, etc..)
-   //in compound cmp. 
-   //if Boundr is not null => this method will return sequence of boundary wires (inlet, outlet...)
-   Handle(Geom_Plane) refpl = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1));
-   TopTools_DataMapOfShapeListOfShape E2PE;
-   ProjWireOnPlane(cmp, refpl, &E2PE);
-   TopTools_ListOfShape ELL;
-   TopoDS_Iterator it(cmp);
-   int i = 0;
-   for (;it.More(); it.Next())
-   {
-     const TopoDS_Wire& W = TopoDS::Wire(it.Value());
-     if (W.Orientation() != TopAbs_INTERNAL)
-     {
-       TopoDS_Wire PW;
-       TopExp_Explorer ex(W, TopAbs_EDGE);   
-       TopTools_ListOfShape LEpW;
-       TopTools_ListOfShape LEpWDummy;
-       for (;ex.More();ex.Next())
-       {
-         const TopoDS_Edge& CE = TopoDS::Edge(ex.Current());
-         TopTools_ListOfShape LS = E2PE.Find(CE);
-         LEpW.Append(LS);
-       }
-       
-       if (ind.count(i) != 0)
-       {
-         BRepLib_MakeWire WM;
-         WM.Add(LEpW);
-         const TopoDS_Wire& WMW = WM.Wire();
-         //assume that wire is a straight line,
-         //take first and last vertex and make simple edge (RE)
-         TopoDS_Vertex VF, VL;
-         TopExp::Vertices(WMW, VF, VL);
-         TopoDS_Edge RE = BRepLib_MakeEdge(VF, VL).Edge();
-         if (RE.IsNull())
-         {
-           LEpWDummy = LEpW; //LEpW will be nullified after appending to ELL
-           ELL.Append(LEpW);
-         }
-         else
-         {
-           LEpWDummy.Append(RE); 
-           ELL.Append(RE);
-         }
-         //TODO: in the new version of OCCT, USD can process separate wires
-         //ShapeUpgrade_UnifySameDomain USD(WMW, 1U, 0U, 1U); //concat bsplines
-         //USD.Build();
-         //const TopoDS_Shape& RSU = USD.Shape();
-         //TopExp_Explorer exp(RSU, TopAbs_EDGE);
-         //TopTools_ListOfShape DummyL;
-         //for (;it.More();it.Next())
-         //  DummyL.Append(it.Value());
-         //if (DummyL.Extent() == 1)
-         //  ELL.Append(DummyL.First()); //if one edge => accept this result 
-         //else
-         //  ELL.Append(LEpW);  //else put 'as is'
-       }
-       else
-       {
-         LEpWDummy = LEpW;
-         ELL.Append(LEpW);
-       }
-       if (Boundr)
-       {
-         //make inlet, outlet, left/tight banks [wires]
-         //shouldn't change topology of the edges
-         BRepLib_MakeWire IWM;
-         IWM.Add(LEpWDummy);
-         Boundr->Append(IWM.Wire());
-       }
-     }
-     i++;
-   }
  
-   //make primary wire
-   BRepLib_MakeWire WME;
-   WME.Add(ELL);
+   BRepAdaptor_Curve LBAD(LB);
+   Handle_Geom_Curve LBPC = GeomProjLib::ProjectOnPlane(LBAD.Curve().Curve(), refpl, gp_Dir(0, 0, -1), 1 );
+   prLB = BRepLib_MakeEdge(LBPC).Edge();
  
-   const TopoDS_Wire& resW = WME.Wire();
-   BRepBuilderAPI_MakeFace mf(refpl, resW, true); //check inside is true by def
-   outF = mf.Face();
+   BRepAdaptor_Curve RBAD(RB);
+   Handle_Geom_Curve RBPC = GeomProjLib::ProjectOnPlane(RBAD.Curve().Curve(), refpl, gp_Dir(0, 0, -1), 1 );
+   prRB = BRepLib_MakeEdge(RBPC).Edge();
  
-   ShapeAnalysis_Wire WA(resW, outF, Precision::Confusion());
-   bool res = WA.CheckSelfIntersection(); //TODO check that this return false if OK
-   return res;
+   TopExp::Vertices(prLB, VFI, VFO, 1);
+   TopExp::Vertices(prRB, VLI, VLO, 1);
+   TopoDS_Edge prIL = BRepLib_MakeEdge(VFI, VLI).Edge();
+   TopoDS_Edge prOL = BRepLib_MakeEdge(VFO, VLO).Edge();
+   TopoDS_Wire prW = BRepLib_MakeWire(prLB, prIL, prOL, prRB).Wire();
+   outF = BRepBuilderAPI_MakeFace(refpl->Pln(), prW, 1).Face();
  
-   ///!!! the internal wires cant be added with 'internal' ori.
-   // it's possible to do with brep builder yet the result will not be correct!
-   // more proper way is to use BOP operation here.
-   /*for (int i = 1; i <= IntW.Extent(); i++)
+   if (Boundr)
    {
-   TopoDS_Wire outIW;
-   const TopoDS_Wire& W = TopoDS::Wire(IntW(i));
-   ProjWireOnPlane(W, refpl, outIW);
-   BB.Add(outF, outIW);
-   }*/
+     Boundr->Append(prLB);
+     Boundr->Append(prIL);
+     Boundr->Append(prOL);
+     Boundr->Append(prRB);
+   }
+   ShapeAnalysis_Wire WA(prW, outF, Precision::Confusion());
+   bool res = WA.CheckSelfIntersection();
+   return !res;
  }
  
 -void HYDROData_DTM::CreateProfiles(const std::vector<Handle_HYDROData_Profile>& theProfiles,
 +void HYDROData_DTM::CreateProfiles(const std::vector<Handle(HYDROData_Profile)>& theProfiles,
                                     double theDDZ,
                                     double theSpatialStep,
                                     AltitudePoints& theOutLeft,
index 7b67be1a59ff06e93cf35c3953c2ef771457d911,a283f9ceb67492e909feda39a8b9a3e396cba531..7f2de733cc173ed0acaf8aa92414bd23ab78905d
@@@ -182,12 -184,12 +187,12 @@@ protected
                               bool Create3dPres,
                               bool Create2dPres,
                               std::set<int>& InvInd,
-                              bool& WireIntersections);
+                              bool& ProjStat);
  
-   static bool Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF, 
-     TopTools_SequenceOfShape* Boundr = NULL, std::set<int> ind = std::set<int>() );
+   //static bool Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF, 
+     //TopTools_SequenceOfShape* Boundr = NULL, std::set<int> ind = std::set<int>() );
    
 -  static int EstimateNbPoints( const std::vector<Handle_HYDROData_Profile>& theProfiles,
 +  static int EstimateNbPoints( const std::vector<Handle(HYDROData_Profile)>& theProfiles,
                                 double theDDZ, double theSpatialStep );
  
    void GetPresentationShapes( TopoDS_Shape& Out3dPres,
Simple merge
index 3ecb3e779857587c501eccf20aad1fc2705bd0ff,5ba187ec836db7fb890f4c759eea9a9641186f7d..91718cb223d29f341008d5dbf1e439b07c2f80ba
@@@ -1117,9 -1126,9 +1124,9 @@@ void HYDROData_Stream::CreatePresentati
    assert(noncontNb == 0);
  #endif
  
-   thePrs.myLeftBank = TopoDS::Wire(LS(1));  
-   thePrs.myInlet = TopoDS::Wire(LS(2));  
-   thePrs.myOutlet = TopoDS::Wire(LS(3));  
-   thePrs.myRightBank = TopoDS::Wire(LS(4));
+   thePrs.myLeftBank = LS(1);  
+   thePrs.myInlet = LS(2);  
+   thePrs.myOutlet = LS(3);  
+   thePrs.myRightBank = LS(4);
  
 -}
 +}
Simple merge
index 8bca430933432e5d0beb02ee22424ef72dac9f01,f72601fbd30526b3d8c418031e7e66e7379b2e1f..3ad5e1dcc1869bc7eabc66c51a6c28275a41ef40
@@@ -452,5 -462,10 +462,10 @@@ bool HYDROGUI_ImportLandCoverMapDlg::Ch
       SUIT_MessageBox::critical( module()->getApp()->desktop(), tr( "DBF_LOAD_ERROR" ), tr("DBF_LOAD_ERR_MESS"));
       return false;
    }
+   if (this->getAttrCheckBoxState() && this->getDbfRecordsNb() == 0)
+   {
+      SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "DBF_NB_RECORDS_IS_NULL" ), tr("DBF_NB_RECORDS_IS_NULL_MESS"));
+      return false;
+   }
    return true;
 -}
 +}
Simple merge
index 7963b776caa4dc2310a23d4932d4db6a620f302f,f6890ad3b1af9537405c79d2adbb2113fd62ed47..cb233c5c8f03c41143c9cc5766f7dbae654ecdca
@@@ -77,15 -77,15 +77,15 @@@ public
     * Returns reference hydraulic axis object of stream.
     */
    HYDROData_PolylineXY GetHydraulicAxis() const
 -  [Handle_HYDROData_PolylineXY ()];
 +  [opencascade::handle<HYDROData_PolylineXY> ()];
    %MethodCode
      Handle(HYDROData_PolylineXY) aRef;
-     
      Py_BEGIN_ALLOW_THREADS
-     aRef = sipSelfWasArg ? sipCpp->HYDROData_Stream::GetHydraulicAxis() : 
+     aRef = sipSelfWasArg ? sipCpp->HYDROData_Stream::GetHydraulicAxis() :
                             sipCpp->GetHydraulicAxis();
      Py_END_ALLOW_THREADS
-     
      sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
    %End
  
     * Returns reference bottom polyline object of stream.
     */
    HYDROData_Polyline3D GetBottomPolyline() const
 -  [Handle_HYDROData_Polyline3D ()];
 +  [opencascade::handle<HYDROData_Polyline3D> ()];
    %MethodCode
      Handle(HYDROData_Polyline3D) aRef;
-     
      Py_BEGIN_ALLOW_THREADS
-     aRef = sipSelfWasArg ? sipCpp->HYDROData_Stream::GetBottomPolyline() : 
+     aRef = sipSelfWasArg ? sipCpp->HYDROData_Stream::GetBottomPolyline() :
                             sipCpp->GetBottomPolyline();
      Py_END_ALLOW_THREADS
-     
      sipRes = (HYDROData_Polyline3D*)createPointer( aRef );
    %End
-   
    /**
     * Sets reference bottom polyline object for stream.
     */
Simple merge