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