0022922: Clean up warnings on uninitialized / unused variables
[occt.git] / src / ShapeUpgrade / ShapeUpgrade_SplitCurve.cxx
1 // File:        ShapeUpgrade_SplitCurve.cxx
2 // Created:     Thu Mar 12 12:26:05 1998
3 // Author:      Pierre BARRAS
4 //              <pbs@sgi84>
5 //    gka 30.04.99 S4137: re-worked
6
7 #include <ShapeUpgrade_SplitCurve.ixx>
8 #include <Geom_BSplineCurve.hxx>
9 #include <Precision.hxx>
10 #include <ShapeUpgrade.hxx>
11 #include <TColStd_ListIteratorOfListOfReal.hxx>
12 #include <TColGeom_HArray1OfCurve.hxx>
13 #include <TColStd_HSequenceOfReal.hxx>
14 #include <ShapeExtend.hxx>
15
16 //=======================================================================
17 //function : ShapeUpgrade_SplitCurve
18 //purpose  : 
19 //=======================================================================
20
21 ShapeUpgrade_SplitCurve::ShapeUpgrade_SplitCurve() : myStatus(0)
22 {
23 }
24
25 //=======================================================================
26 //function : Init
27 //purpose  : 
28 //=======================================================================
29
30  void ShapeUpgrade_SplitCurve::Init(const Standard_Real First,
31                                     const Standard_Real Last) 
32 {
33   myStatus = ShapeExtend::EncodeStatus (ShapeExtend_OK);
34 //  if (ShapeUpgrade::Debug()) cout << "SplitCurve::Init"<<endl;
35
36   myNbCurves = 1;
37  // mySplitValues.Clear();
38   mySplitValues = new TColStd_HSequenceOfReal;
39   mySplitValues->Append(First);
40   mySplitValues->Append(Last);
41 }
42
43 //=======================================================================
44 //function : SetSplitValues
45 //purpose  : 
46 //=======================================================================
47
48  void ShapeUpgrade_SplitCurve::SetSplitValues (const Handle(TColStd_HSequenceOfReal& SplitValues))
49 {
50   Standard_Real precision = Precision::PConfusion();
51   if(SplitValues.IsNull()) return;
52   if(SplitValues->Length()==0) return;
53     
54   Standard_Real First = mySplitValues->Value(1), 
55   Last = mySplitValues->Value(mySplitValues->Length()); 
56   Standard_Integer i =1;
57   Standard_Integer len = SplitValues->Length();
58    for( Standard_Integer k = 2;k <= mySplitValues->Length();k++) {
59      Last = mySplitValues->Value(k);
60      for(; i <=  len; i++) {
61        if( (First + precision) >= SplitValues->Value(i)) continue;
62        if((Last - precision) <= SplitValues->Value(i)) break;
63        mySplitValues->InsertBefore(k++,SplitValues->Value(i));
64      }
65      First = Last;
66    }
67 }
68
69
70 //=======================================================================
71 //function : Build
72 //purpose  : 
73 //=======================================================================
74
75  void ShapeUpgrade_SplitCurve::Build(const Standard_Boolean /*Segment*/) 
76 {
77   myStatus = ShapeExtend::EncodeStatus (ShapeExtend_OK);
78 }
79
80
81 //=======================================================================
82 //function : GlobalKnots
83 //purpose  : 
84 //=======================================================================
85
86 const Handle(TColStd_HSequenceOfReal)& ShapeUpgrade_SplitCurve::SplitValues() const
87 {
88   return mySplitValues;
89 }
90
91 //=======================================================================
92 //function : Perform
93 //purpose  : 
94 //=======================================================================
95
96 void ShapeUpgrade_SplitCurve::Perform(const Standard_Boolean Segment)
97 {
98   Compute();
99   //if ( ! mySplitValues.IsNull() ) 
100   //  SetSplitValues(mySplitValues);
101   Build(Segment);
102
103 }
104 //=======================================================================
105 //function : Compute
106 //purpose  : 
107 //===================================================================
108 void ShapeUpgrade_SplitCurve::Compute()  
109 {  
110   myStatus = ShapeExtend::EncodeStatus (ShapeExtend_OK);
111 }
112 //=======================================================================
113 //function : Status
114 //purpose  : 
115 //=======================================================================
116
117 Standard_Boolean ShapeUpgrade_SplitCurve::Status(const ShapeExtend_Status status) const
118 {
119   return ShapeExtend::DecodeStatus (myStatus, status);
120 }