}
}
+ DTM()->Update();
UpdatePrs();
}
return true;
}
-bool HYDROData_Stream::CreatePresentations( const Handle(HYDROData_PolylineXY)& theHydAxis,
- const HYDROData_SequenceOfObjects& theProfiles,
- PrsDefinition& thePrs )
+bool HYDROData_Stream::CreatePresentations( const Handle_HYDROData_DTM& theDTM,
+ PrsDefinition& thePrs )
{
- if ( theHydAxis.IsNull() || theProfiles.Length() < 2 )
+ if ( theDTM.IsNull() )
return false;
- Handle(TColgp_HArray1OfPnt) anArrayOfFPnt = new TColgp_HArray1OfPnt(1, theProfiles.Length());
- Handle(TColgp_HArray1OfPnt) anArrayOfLPnt = new TColgp_HArray1OfPnt(1, theProfiles.Length());
- Handle(TopTools_HArray1OfShape) anArrOfProfiles = new TopTools_HArray1OfShape(1, theProfiles.Length());
- Handle(TopTools_HArray1OfShape) anArrOf2DProfiles = new TopTools_HArray1OfShape(1, theProfiles.Length());
+ HYDROData_SequenceOfObjects profiles = theDTM->GetProfiles();
+ if( profiles.Length() < 2 )
+ return false;
+
+ TopTools_ListOfShape profiles3d;
// Pre-processing
- HYDROData_SequenceOfObjects::Iterator anIter( theProfiles );
+ HYDROData_SequenceOfObjects::Iterator anIter( profiles );
for (int i=1 ; anIter.More(); anIter.Next(),i++ )
{
Handle(HYDROData_Profile) aProfile =
Handle(HYDROData_Profile)::DownCast( anIter.Value() );
- if ( aProfile.IsNull() )
- continue;
- const TopoDS_Shape& aProf3d = aProfile->GetShape3D();
- gp_XY aPnt1, aPnt2;
- if ( !aProfile->GetLeftPoint( aPnt1, false ) || !aProfile->GetRightPoint( aPnt2, false ) )
+ if ( aProfile.IsNull() )
continue;
- anArrOfProfiles->SetValue(i,aProfile->GetShape3D());//aProfile->GetTopShape();
- anArrOf2DProfiles->SetValue(i,aProfile->GetTopShape());
-
- gp_Pnt aCurFP, aCurLP;
- TopoDS_Vertex aV1, aV2;
- TopExp::Vertices(TopoDS::Wire(aProf3d), aV1, aV2);
- gp_Pnt aP1 = BRep_Tool::Pnt(aV1);
- if(aP1.X() == aPnt1.X() && aP1.Y() == aPnt1.Y())
- aCurFP = aP1;
- else
- aCurLP = aP1;
- aP1 = BRep_Tool::Pnt(aV2);
- if(aP1.X() == aPnt2.X() && aP1.Y() == aPnt2.Y())
- aCurLP = aP1;
- else
- aCurFP = aP1;
- anArrayOfFPnt->SetValue(i,aCurFP);
- anArrayOfLPnt->SetValue(i,aCurLP);
+ const TopoDS_Shape& aProfileShape = aProfile->GetShape3D();
+ profiles3d.Append( aProfileShape );
}
- return CreatePresentations( anArrayOfFPnt, anArrayOfLPnt, anArrOfProfiles, anArrOf2DProfiles, thePrs );
+ TopoDS_Edge aLeftBank, aRightBank;
+ theDTM->CreateBankShapes( aLeftBank, aRightBank );
+ return CreatePresentations( aLeftBank, aRightBank, profiles3d, thePrs );
}
void HYDROData_Stream::UpdatePrs()
{
HYDROData_NaturalObject::Update();
- Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
- HYDROData_SequenceOfObjects aRefProfiles = GetProfiles();
-
PrsDefinition aResultPrs;
- if ( !CreatePresentations( aHydAxis, aRefProfiles, aResultPrs ) )
+ if ( !CreatePresentations( DTM(), aResultPrs ) )
return;
SetShape3D( aResultPrs.myPrs3D );
}
}
-bool HYDROData_Stream::CreatePresentations( const Handle(TColgp_HArray1OfPnt) theArrayOfFPnt,
- const Handle(TColgp_HArray1OfPnt) theArrayOfLPnt,
- const Handle(TopTools_HArray1OfShape) theArrOfProfiles,
- const Handle(TopTools_HArray1OfShape) theArrOf2DProfiles,
- PrsDefinition& thePrs )
+bool HYDROData_Stream::CreatePresentations( const TopoDS_Edge& theLeftBank,
+ const TopoDS_Edge& theRightBank,
+ const TopTools_ListOfShape& theProfiles3d,
+ PrsDefinition& thePrs )
{
- if ( theArrayOfFPnt.IsNull() || theArrayOfLPnt.IsNull() || theArrOfProfiles.IsNull() ) {
+ return true;
+ /*if ( theArrayOfFPnt.IsNull() || theArrayOfLPnt.IsNull() || theArrOfProfiles.IsNull() ) {
return false;
}
}
#endif
- return true;
+ return true;*/
}
\ No newline at end of file
class TColStd_Array1OfReal;
class Handle(TopTools_HArray1OfShape);
class Handle_HYDROData_DTM;
+class TopTools_ListOfShape;
/**\class HYDROData_Stream
{
TopoDS_Shape myPrs3D;
TopoDS_Shape myPrs2D;
- TopoDS_Edge myLeftBank;
- TopoDS_Edge myRightBank;
- TopoDS_Edge myInlet;
- TopoDS_Edge myOutlet;
+ TopoDS_Edge myLeftBank; // 3d curve of the left bank
+ TopoDS_Edge myRightBank; // 3d curve of the right bank
+ TopoDS_Edge myInlet; // first (inlet) 2d profile
+ TopoDS_Edge myOutlet; // last (inlet) 2d profile
};
protected:
/**
* Creates the presentations(2D and 3D) by given hydraulic axis and profiles.
*/
- HYDRODATA_EXPORT static bool CreatePresentations( const Handle(HYDROData_PolylineXY)& theHydAxis,
- const HYDROData_SequenceOfObjects& theProfiles,
- PrsDefinition& thePrs );
+ HYDRODATA_EXPORT static bool CreatePresentations( const Handle_HYDROData_DTM& theDTM,
+ PrsDefinition& thePrs );
/**
* Creates the presentations(2D and 3D) by given first points, last points and profiles.
* If 2D profiles is null - they will not used in the presentation.
*/
- HYDRODATA_EXPORT static bool CreatePresentations( const Handle(TColgp_HArray1OfPnt) theArrayOfFPnt,
- const Handle(TColgp_HArray1OfPnt) theArrayOfLPnt,
- const Handle(TopTools_HArray1OfShape) theArrOfProfiles,
- const Handle(TopTools_HArray1OfShape) theArrOf2DProfiles,
- PrsDefinition& thePrs );
+ HYDRODATA_EXPORT static bool CreatePresentations( const TopoDS_Edge& theLeftBank,
+ const TopoDS_Edge& theRightBank,
+ const TopTools_ListOfShape& theProfiles3d,
+ PrsDefinition& thePrs );
public: