2 #include "HYDROData_Stream.h"
4 #include "HYDROData_Document.h"
5 #include "HYDROData_PolylineXY.h"
6 #include "HYDROData_Profile.h"
8 #include <TDataStd_RealArray.hxx>
10 #include <Precision.hxx>
12 #include <NCollection_DataMap.hxx>
14 #include <TColStd_Array1OfReal.hxx>
15 #include <TColStd_ListOfReal.hxx>
16 #include <TColStd_ListIteratorOfListOfReal.hxx>
17 #include <TCollection_CompareOfReal.hxx>
18 #include <TColgp_Array1OfPnt.hxx>
19 #include <TColgp_HArray1OfPnt.hxx>
22 #include <TopoDS_Wire.hxx>
23 #include <TopoDS_Shell.hxx>
24 #include <TopoDS_Face.hxx>
25 #include <TopoDS_Edge.hxx>
26 #include <TopoDS_Vertex.hxx>
28 #include <TopExp_Explorer.hxx>
30 #include <Bnd_Box.hxx>
32 #include <BRep_Builder.hxx>
33 #include <BRepBuilderAPI_MakeEdge.hxx>
34 #include <BRepBuilderAPI_MakeWire.hxx>
35 #include <BRepBuilderAPI_MakeFace.hxx>
37 #include <BRepBndLib.hxx>
38 #include <BRepProj_Projection.hxx>
39 #include <BRepExtrema_ExtCC.hxx>
40 #include <BRepCheck_Analyzer.hxx>
50 #include <GeomAPI_Interpolate.hxx>
51 #include <Geom_BSplineCurve.hxx>
53 #include <TopTools_Array1OfShape.hxx>
55 #include <SortTools_QuickSortOfReal.hxx>
58 #include <QStringList>
60 //#define DEB_STREAM 1
62 //#define DEB_HASINT 1
63 //#define DEB_UPDATE 1
64 #include <BRepTools.hxx>
65 #include <TCollection_AsciiString.hxx>
68 #define PYTHON_STREAM_ID "KIND_STREAM"
70 typedef NCollection_DataMap<Standard_Real, Handle(HYDROData_Profile)> HYDROData_DataMapOfRealOfHDProfile;
72 IMPLEMENT_STANDARD_HANDLE(HYDROData_Stream,HYDROData_NaturalObject)
73 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Stream,HYDROData_NaturalObject)
76 HYDROData_Stream::HYDROData_Stream()
77 : HYDROData_NaturalObject()
81 HYDROData_Stream::~HYDROData_Stream()
85 QStringList HYDROData_Stream::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
89 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
90 if ( aDocument.IsNull() )
93 QString aDocName = aDocument->GetDocPyName();
94 QString aStreamName = GetName();
96 aResList << QString( "%1 = %2.CreateObject( %3 );" )
97 .arg( aStreamName ).arg( aDocName ).arg( PYTHON_STREAM_ID );
98 aResList << QString( "%1.SetName( \"%2\" );" )
99 .arg( aStreamName ).arg( aStreamName );
100 aResList << QString( "" );
107 HYDROData_SequenceOfObjects HYDROData_Stream::GetAllReferenceObjects() const
109 HYDROData_SequenceOfObjects aResSeq = HYDROData_Object::GetAllReferenceObjects();
111 Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
112 if ( !aHydAxis.IsNull() )
113 aResSeq.Append( aHydAxis );
115 HYDROData_SequenceOfObjects aSeqOfProfiles = GetProfiles();
116 aResSeq.Append( aSeqOfProfiles );
121 TopoDS_Shape HYDROData_Stream::GetTopShape() const
123 return getTopShape();
126 TopoDS_Shape HYDROData_Stream::GetShape3D() const
131 Handle(Geom_BSplineCurve) HYDROData_Stream::buildInterpolationCurve(
132 const Handle(TColgp_HArray1OfPnt)& theArrayOfPnt )
134 Handle(Geom_BSplineCurve) aBSpline;
135 GeomAPI_Interpolate anInterpolator (theArrayOfPnt, Standard_False, 1.0e-5);
136 anInterpolator.Perform() ;
137 if (anInterpolator.IsDone())
138 aBSpline = anInterpolator.Curve();
142 void HYDROData_Stream::Update()
144 HYDROData_NaturalObject::Update();
146 Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
147 HYDROData_SequenceOfObjects aRefProfiles = GetProfiles();
148 if ( aHydAxis.IsNull() || aRefProfiles.IsEmpty() )
151 bool anIsFirst = true;
152 gp_Pnt aPrevFirstPoint, aPrevLastPoint;
153 Handle(TColgp_HArray1OfPnt) anArrayOfFPnt = new TColgp_HArray1OfPnt(1, aRefProfiles.Length());
154 Handle(TColgp_HArray1OfPnt) anArrayOfLPnt = new TColgp_HArray1OfPnt(1, aRefProfiles.Length());
155 TopTools_Array1OfShape anArrOfProfiles(1, aRefProfiles.Length());
156 TopTools_Array1OfShape anArrOf2DProfiles(1, aRefProfiles.Length());
159 HYDROData_SequenceOfObjects::Iterator anIter( aRefProfiles );
160 for (int i=1 ; anIter.More(); anIter.Next(),i++ )
162 Handle(HYDROData_Profile) aProfile =
163 Handle(HYDROData_Profile)::DownCast( anIter.Value() );
164 if ( aProfile.IsNull() )
166 const TopoDS_Shape& aProf3d = aProfile->GetShape3D();
168 if ( !aProfile->GetFirstPoint( aPnt1 ) || !aProfile->GetLastPoint( aPnt2 ) )
170 anArrOfProfiles.SetValue(i,aProfile->GetShape3D());//aProfile->GetTopShape();
171 anArrOf2DProfiles.SetValue(i,aProfile->GetTopShape());
173 gp_Pnt aCurFirstPoint( aPnt1.X(), aPnt1.Y(), 0 ), aCurFP;
174 gp_Pnt aCurLastPoint( aPnt2.X(), aPnt2.Y(), 0 ), aCurLP;
175 TopoDS_Vertex aV1, aV2;
176 TopExp::Vertices(TopoDS::Wire(aProf3d), aV1, aV2);
177 gp_Pnt aP1 = BRep_Tool::Pnt(aV1);
178 if(aP1.X() == aPnt1.X() && aP1.Y() == aPnt1.Y())
182 aP1 = BRep_Tool::Pnt(aV2);
183 if(aP1.X() == aPnt2.X() && aP1.Y() == aPnt2.Y())
187 anArrayOfFPnt->SetValue(i,aCurFP);
188 anArrayOfLPnt->SetValue(i,aCurLP);
192 // Construct of the 3D presentation
193 Handle(Geom_BSplineCurve) aBSpline = buildInterpolationCurve (anArrayOfFPnt);
194 if(aBSpline.IsNull())
196 TopoDS_Edge anEdgLeft, anEdgRight;
197 BRepBuilderAPI_MakeEdge aMakeEdge(aBSpline);
198 if(aMakeEdge.IsDone())
199 anEdgLeft = aMakeEdge.Edge();
200 if(anEdgLeft.IsNull())
203 aBSpline = buildInterpolationCurve (anArrayOfLPnt);
204 if(aBSpline.IsNull())
206 aMakeEdge.Init(aBSpline);
207 if(aMakeEdge.IsDone())
208 anEdgRight = aMakeEdge.Edge();
209 if(anEdgRight.IsNull())
212 TopoDS_Compound aCmp;
213 aBB.MakeCompound(aCmp);
214 anIter.Init( aRefProfiles );
215 for (int i=1 ; i < anArrOfProfiles.Length() +1; i++ )
216 aBB.Add(aCmp, anArrOfProfiles.Value(i));
217 aBB.Add(aCmp,anEdgLeft);
218 aBB.Add(aCmp,anEdgRight);
219 BRepCheck_Analyzer aCh(aCmp);
224 BRepTools::Write(aCmp, "str3d.brep");
229 // Construct the top presentation
230 for(int i=1;i<= anArrayOfLPnt->Length();i++) {
231 gp_Pnt aPnt = anArrayOfFPnt->Value(i);
232 aPnt.SetZ(.0); // make 2d
233 anArrayOfFPnt->SetValue(i, aPnt);
234 aPnt = anArrayOfLPnt->Value(i);
236 anArrayOfLPnt->SetValue(i, aPnt);
239 aBSpline = buildInterpolationCurve (anArrayOfFPnt);
240 if(aBSpline.IsNull())
242 aMakeEdge.Init(aBSpline);
243 if(aMakeEdge.IsDone())
244 anEdgLeft = aMakeEdge.Edge();
246 aBSpline = buildInterpolationCurve (anArrayOfLPnt);
247 if(aBSpline.IsNull())
249 aMakeEdge.Init(aBSpline);
250 if(aMakeEdge.IsDone())
251 anEdgRight = aMakeEdge.Edge();
252 if(anEdgRight.IsNull())
254 BRepBuilderAPI_MakeEdge aMakeEdge2(anArrayOfFPnt->Value(1),anArrayOfLPnt->Value(1));
255 TopoDS_Edge aBotEdge, aTopEdge;
256 if(aMakeEdge2.IsDone())
257 aBotEdge = aMakeEdge2.Edge();
258 BRepBuilderAPI_MakeEdge aMakeEdge3(anArrayOfFPnt->Value(anArrayOfFPnt->Length()),anArrayOfLPnt->Value(anArrayOfLPnt->Length()));
259 if(aMakeEdge3.IsDone())
260 aTopEdge = aMakeEdge3.Edge();
262 BRepBuilderAPI_MakeWire aMakeWire( aBotEdge, anEdgLeft, aTopEdge,anEdgRight);
263 TopoDS_Wire aSectProfileWire;
264 if(aMakeWire.IsDone())
265 aSectProfileWire = aMakeWire.Wire();
266 BRepBuilderAPI_MakeFace aMakeFace( aSectProfileWire, Standard_True );
269 if( aMakeFace.IsDone() )
270 aFace = aMakeFace.Face();
272 aBB.MakeCompound(aCmp);
274 for(int i=1;i <= anArrOf2DProfiles.Length(); i++)
275 aBB.Add(aCmp,anArrOf2DProfiles.Value(i));
281 BRepTools::Write(aCmp, "str2d.brep");
288 QColor HYDROData_Stream::DefaultFillingColor()
290 return QColor( Qt::green );
293 QColor HYDROData_Stream::DefaultBorderColor()
295 return QColor( Qt::transparent );
298 QColor HYDROData_Stream::getDefaultFillingColor() const
300 return DefaultFillingColor();
303 QColor HYDROData_Stream::getDefaultBorderColor() const
305 return DefaultBorderColor();
308 bool HYDROData_Stream::SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis )
310 Handle(HYDROData_PolylineXY) aPrevAxis = GetHydraulicAxis();
312 if ( theAxis.IsNull() )
314 RemoveHydraulicAxis();
315 return !aPrevAxis.IsNull();
318 if ( IsEqual( aPrevAxis, theAxis ) )
321 TopoDS_Wire aHydraulicWire = TopoDS::Wire( theAxis->GetShape() );
322 if ( aHydraulicWire.IsNull() )
323 return false; // The polyline must be a single wire
325 SetReferenceObject( theAxis, DataTag_HydraulicAxis );
327 // Update the order of profiles
328 updateProfilesOrder();
330 // Indicate model of the need to update the stream presentation
336 Handle(HYDROData_PolylineXY) HYDROData_Stream::GetHydraulicAxis() const
338 return Handle(HYDROData_PolylineXY)::DownCast(
339 GetReferenceObject( DataTag_HydraulicAxis ) );
342 void HYDROData_Stream::RemoveHydraulicAxis()
344 Handle(HYDROData_PolylineXY) aPrevAxis = GetHydraulicAxis();
345 if ( aPrevAxis.IsNull() )
348 ClearReferenceObjects( DataTag_HydraulicAxis );
350 // We remove the reference profiles
353 // Indicate model of the need to update the stream presentation
357 bool HYDROData_Stream::HasIntersection( const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane,
358 Standard_Real& outPar ) const
360 Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
361 if ( theProfile.IsNull() || aHydAxis.IsNull() )
364 TopoDS_Wire aHydraulicWire = TopoDS::Wire( aHydAxis->GetShape() ); //guide line
365 TopoDS_Wire aProfileWire = TopoDS::Wire( theProfile->GetTopShape() );
366 if ( aHydraulicWire.IsNull() || aProfileWire.IsNull() )
369 BRepProj_Projection aProjector (aProfileWire, thePlane, gp::OZ().Direction());
370 if(!aProjector.IsDone())
372 TopoDS_Shape aPrjProfile = aProjector.Shape();
373 if(aPrjProfile.IsNull())
375 TopoDS_Vertex aV1, aV2;
376 if(aPrjProfile.ShapeType() == TopAbs_EDGE)
377 TopExp::Vertices(TopoDS::Edge(aPrjProfile), aV1, aV2);
378 else if(aPrjProfile.ShapeType() == TopAbs_WIRE)
379 TopExp::Vertices(TopoDS::Wire(aPrjProfile), aV1, aV2);
380 else if(aPrjProfile.ShapeType() == TopAbs_COMPOUND){
381 TopExp_Explorer anExp(aPrjProfile, TopAbs_WIRE);
383 TopExp::Vertices(TopoDS::Wire(anExp.Current()), aV1, aV2);
385 anExp.Init(aPrjProfile, TopAbs_EDGE);
387 TopExp::Vertices(TopoDS::Edge(anExp.Current()), aV1, aV2);
391 if(aV1.IsNull() || aV2.IsNull())
393 gp_Pnt aPnt1 = BRep_Tool::Pnt(aV1);
394 gp_Pnt aPnt2 = BRep_Tool::Pnt(aV2);
397 BRepBuilderAPI_MakeEdge aMk(aPnt1, aPnt2);
400 const TopoDS_Edge& anEdg2 = aMk.Edge();//Section edge
401 Standard_Integer aNum(0);
403 TopExp_Explorer anExplo(aHydraulicWire, TopAbs_EDGE);
404 for(;anExplo.More();anExplo.Next()) aNum++;
405 // check for self-intersection
406 const Standard_Real SquareTolerance = Precision::Confusion()*Precision::Confusion();
407 Standard_Boolean hasInt(false);
408 Standard_Real aSqDist(DBL_MAX);
409 Standard_Integer anIndx(0);
410 BRepExtrema_ExtCC aCC;
411 aCC.Initialize(anEdg2);
413 anExplo.Init(aHydraulicWire, TopAbs_EDGE);
414 for(Standard_Integer j=1;anExplo.More();anExplo.Next(),j++) {
415 const TopoDS_Edge& anEdg1 = TopoDS::Edge(anExplo.Current());
418 Standard_Boolean hasSol(false);
422 for(Standard_Integer i=1; i<= aCC.NbExt();i++)
423 if(aCC.SquareDistance(i) < aSqDist) {
424 aSqDist = aCC.SquareDistance(i);
430 if(aSqDist <= SquareTolerance) { // hasInt
431 const gp_Pnt& aPnt = aCC.PointOnE1(anIndx);
433 TopExp::Vertices(anEdg1, aV1, aV2, Standard_True);
434 outPar += BRep_Tool::Pnt(aV1).Distance(aPnt);
436 Standard_Real aPar = aCC.ParameterOnE1(anIndx);
444 TopExp::Vertices(anEdg1, aV1, aV2);
445 outPar += BRep_Tool::Pnt(aV1).Distance(BRep_Tool::Pnt(aV2));
448 } else if(aNum > 1) {
449 TopExp::Vertices(anEdg1, aV1, aV2);
450 outPar += BRep_Tool::Pnt(aV1).Distance(BRep_Tool::Pnt(aV2));
459 bool HYDROData_Stream::AddProfile( const Handle(HYDROData_Profile)& theProfile )
461 if ( theProfile.IsNull() )
464 Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
465 if ( aHydAxis.IsNull() )
469 if(!BuildFace(aHydAxis, aPlane))
472 Standard_Real aPar(.0);
473 if ( HasReference( theProfile, DataTag_Profile ) || !HasIntersection( theProfile, aPlane, aPar ) )
474 return false; // Object is already in reference list or it has no intersection
476 int aProfileIndex = insertParameter( aPar );
477 insertProfileInToOrder( theProfile, aProfileIndex );
479 // Indicate model of the need to update the stream presentation
485 HYDROData_SequenceOfObjects HYDROData_Stream::GetProfiles() const
487 return GetReferenceObjects( DataTag_Profile );
490 bool HYDROData_Stream::RemoveProfile( const Handle(HYDROData_Profile)& theProfile )
492 if ( theProfile.IsNull() )
495 int aProfileIndex = -1;
497 HYDROData_SequenceOfObjects aRefProfiles = GetProfiles();
498 HYDROData_SequenceOfObjects::Iterator anIter( aRefProfiles );
499 for ( int i = 0 ; anIter.More(); anIter.Next(), ++i )
501 Handle(HYDROData_Profile) aProfile =
502 Handle(HYDROData_Profile)::DownCast( anIter.Value() );
503 if ( aProfile.IsNull() )
506 if ( IsEqual( theProfile, aProfile ) )
513 if ( aProfileIndex == -1 )
516 RemoveReferenceObject( theProfile->Label(), DataTag_Profile );
518 // Remove parameter for removed profile
519 removeParameter( aProfileIndex );
521 // Indicate model of the need to update the stream presentation
527 void HYDROData_Stream::RemoveProfiles()
529 bool anIsToUpdate = IsMustBeUpdated() || NbReferenceObjects( DataTag_Profile ) > 0;
531 ClearReferenceObjects( DataTag_Profile );
533 // Remove the parameters array
534 removeParametersArray();
536 // Indicate model of the need to update the stream presentation
537 SetToUpdate( anIsToUpdate );
540 void HYDROData_Stream::insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile,
541 const int theBeforeIndex )
543 Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
544 if ( theProfile.IsNull() || aHydAxis.IsNull() )
547 TopoDS_Wire aHydraulicWire = TopoDS::Wire( aHydAxis->GetShape() );
548 TopoDS_Wire aProfileWire = TopoDS::Wire( theProfile->GetTopShape() );
549 if ( aHydraulicWire.IsNull() || aProfileWire.IsNull() )
552 if ( theBeforeIndex == -1 )
553 AddReferenceObject( theProfile, DataTag_Profile );
555 InsertReferenceObject( theProfile, DataTag_Profile, theBeforeIndex );
558 bool HYDROData_Stream::BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis, TopoDS_Face& thePlane) const
560 if ( theHydAxis.IsNull() ) return false;
561 TopoDS_Wire aHydraulicWire = TopoDS::Wire( theHydAxis->GetShape() );
562 if(aHydraulicWire.IsNull()) return false;
563 gp_Ax2 aX2(gp::XOY());
567 BRepBndLib::Add(aHydraulicWire,B);
568 Standard_Real axmin,aymin,azmin,axmax,aymax,azmax;
569 B.Get(axmin,aymin,azmin,axmax,aymax,azmax);
570 BRepBuilderAPI_MakeFace aMkr(aPln, axmin-500., axmax+500., aymin-500., aymax+500.); // to be tuned later according max/ Profile deviation
571 if(!aMkr.IsDone() || aMkr.Shape().IsNull()) return false;
572 thePlane = TopoDS::Face(aMkr.Shape());
576 void HYDROData_Stream::updateProfilesOrder()
578 HYDROData_SequenceOfObjects aRefProfiles = GetProfiles();
579 if ( aRefProfiles.IsEmpty() )
582 // At first we remove all profiles from order
585 Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
586 if ( aHydAxis.IsNull() )
590 if ( !BuildFace( aHydAxis, aPlane ) )
593 Standard_Real aPar( .0 );
597 TopoDS_Compound aCmp;
598 aBB.MakeCompound(aCmp);
601 HYDROData_DataMapOfRealOfHDProfile aDM;
602 TColStd_ListOfReal aList;
603 HYDROData_SequenceOfObjects::Iterator anIter( aRefProfiles );
604 for (int i = 1 ; anIter.More(); anIter.Next(), i++ )
606 Handle(HYDROData_Profile) aProfile =
607 Handle(HYDROData_Profile)::DownCast( anIter.Value() );
609 TopoDS_Wire aProfileWire = TopoDS::Wire( aProfile->GetTopShape() );
610 aBB.Add( aCmp, aProfileWire );
612 if ( aProfile.IsNull() || !HasIntersection( aProfile, aPlane, aPar ) )
615 aDM.Bind( aPar, aProfile );
616 aList.Append( aPar );
619 if ( aList.IsEmpty() )
622 TColStd_Array1OfReal anArr( 1, aList.Extent() );
624 TColStd_ListIteratorOfListOfReal it( aList );
625 for ( int j = 1; it.More(); it.Next(), j++ )
626 anArr( j ) = it.Value();
629 if ( aList.Extent() > 1 )
631 TCollection_CompareOfReal Compar;
632 SortTools_QuickSortOfReal::Sort( anArr, Compar );
634 for (int j = 1; j <= anArr.Length(); j++) {
635 const Standard_Real aKey = anArr(j);
636 const Handle(HYDROData_Profile)& aProfile = aDM.Find(aKey);
637 insertProfileInToOrder( aProfile );
639 } else if ( aList.Extent() == 1 ) {
640 const Standard_Real aKey = aList.Last();
641 const Handle(HYDROData_Profile)& aProfile = aDM.Find(aKey);
642 insertProfileInToOrder( aProfile );
645 setParametersArray( anArr );
648 TopoDS_Wire aHydraulicWire = TopoDS::Wire( aHydAxis->GetShape() );
649 BRepTools::Write(aHydraulicWire, "Path.brep");
650 BRepTools::Write(aCmp, "Prof.brep");
654 void HYDROData_Stream::setParametersArray( const TColStd_Array1OfReal& theArray )
656 if ( theArray.Length() == 0 )
658 removeParametersArray();
662 TDF_Label aLabel = myLab.FindChild( DataTag_ParamsArray );
664 Handle(TDataStd_RealArray) aParamsArray =
665 TDataStd_RealArray::Set( aLabel, theArray.Lower(), theArray.Upper() );
667 for ( int i = theArray.Lower(), n = theArray.Upper(); i <= n; ++i )
669 const Standard_Real& aParam = theArray( i );
670 aParamsArray->SetValue( i, aParam );
674 TColStd_Array1OfReal* HYDROData_Stream::getParametersArray() const
676 TColStd_Array1OfReal* anArray = NULL;
678 TDF_Label aLabel = myLab.FindChild( DataTag_ParamsArray, false );
679 if ( !aLabel.IsNull() )
681 Handle(TDataStd_RealArray) aParamsArray;
682 if ( aLabel.FindAttribute( TDataStd_RealArray::GetID(), aParamsArray ) )
684 anArray = new TColStd_Array1OfReal( aParamsArray->Lower(), aParamsArray->Upper() );
685 for ( int i = aParamsArray->Lower(), n = aParamsArray->Upper(); i <= n; ++i )
687 const Standard_Real& aParam = aParamsArray->Value( i );
688 anArray->SetValue( i, aParam );
696 void HYDROData_Stream::removeParametersArray()
698 TDF_Label aLabel = myLab.FindChild( DataTag_ParamsArray, false );
699 if ( !aLabel.IsNull() )
700 aLabel.ForgetAllAttributes();
703 int HYDROData_Stream::insertParameter( const Standard_Real& theParam )
707 TColStd_Array1OfReal* anArr = getParametersArray();
712 TColStd_Array1OfReal aNewArr( anArr->Lower(), anArr->Upper() + 1 );
714 bool isInserted = false;
715 for ( int i = anArr->Lower(), j = i, n = anArr->Upper(); i <= n; ++i, ++j )
717 const Standard_Real& aStoredParam = anArr->Value( i );
720 if ( theParam > aStoredParam )
726 aNewArr( j ) = theParam;
732 aNewArr( j ) = aStoredParam;
738 aNewArr( aNewArr.Upper() ) = theParam;
741 setParametersArray( aNewArr );
746 TColStd_Array1OfReal aNewArr( 1, 1 );
747 aNewArr.SetValue( 1, theParam );
748 setParametersArray( aNewArr );
754 void HYDROData_Stream::removeParameter( const int& theIndex )
756 TDF_Label aLabel = myLab.FindChild( DataTag_ParamsArray, false );
757 if ( aLabel.IsNull() )
760 Handle(TDataStd_RealArray) aParamsArray;
761 if ( !aLabel.FindAttribute( TDataStd_RealArray::GetID(), aParamsArray ) )
764 TColStd_Array1OfReal aNewArr( aParamsArray->Lower(), aParamsArray->Upper() - 1 );
766 for ( int i = aParamsArray->Lower(), j = i, k = 0, n = aParamsArray->Upper(); i <= n; ++i, ++k )
768 const Standard_Real& aStoredParam = aParamsArray->Value( i );
772 aNewArr.SetValue( j, aStoredParam );
776 setParametersArray( aNewArr );