Integration of OCCT 6.5.0 from SVN
[occt.git] / src / AppDef / AppDef_MultiLine.cxx
CommitLineData
7fd59977 1// File AppDef_MultiLine.cxx
2// Lpa, le 3/12/91
3
4#include <AppDef_MultiLine.ixx>
5#include <Standard_OutOfRange.hxx>
6#include <AppDef_Array1OfMultiPointConstraint.hxx>
7#include <Standard_ConstructionError.hxx>
8
9
10AppDef_MultiLine::AppDef_MultiLine(){}
11
12
13AppDef_MultiLine::AppDef_MultiLine (const Standard_Integer NbMult)
14{
15 if (NbMult < 0 ) Standard_ConstructionError::Raise();
16
17 tabMult = new AppDef_HArray1OfMultiPointConstraint (1, NbMult);
18}
19
20
21AppDef_MultiLine::AppDef_MultiLine (const AppDef_Array1OfMultiPointConstraint& tabMultiP)
22{
23 tabMult = new AppDef_HArray1OfMultiPointConstraint (1, tabMultiP.Length());
24 Standard_Integer i, Lower = tabMultiP.Lower();
25 for (i = 1; i <= tabMultiP.Length(); i++) {
26 tabMult->SetValue(i, tabMultiP.Value(Lower+i-1));
27 }
28}
29
30
31AppDef_MultiLine::AppDef_MultiLine (const TColgp_Array1OfPnt& tabP3d)
32{
33 tabMult = new AppDef_HArray1OfMultiPointConstraint (1, tabP3d.Length());
34 Standard_Integer i, Lower = tabP3d.Lower();
35 for (i = 1; i <= tabP3d.Length(); i++) {
36 AppDef_MultiPointConstraint MP(1, 0);
37 MP.SetPoint(1, tabP3d(Lower+i-1));
38 tabMult->SetValue(i, MP);
39 }
40}
41
42
43
44AppDef_MultiLine::AppDef_MultiLine (const TColgp_Array1OfPnt2d& tabP2d)
45{
46 tabMult = new AppDef_HArray1OfMultiPointConstraint (1, tabP2d.Length());
47 Standard_Integer i, Lower = tabP2d.Lower();
48 for (i = 1; i <= tabP2d.Length(); i++) {
49 AppDef_MultiPointConstraint MP(0, 1);
50 MP.SetPoint2d(1, tabP2d(Lower+i-1));
51 tabMult->SetValue(i, MP);
52 }
53
54}
55
56
57Standard_Integer AppDef_MultiLine::NbMultiPoints () const {
58 return tabMult->Length();
59}
60
61
62Standard_Integer AppDef_MultiLine::NbPoints() const {
63 return tabMult->Value(1).NbPoints() + tabMult->Value(1).NbPoints2d();
64}
65
66
67void AppDef_MultiLine::SetValue (const Standard_Integer Index,
68 const AppDef_MultiPointConstraint& MPoint) {
69 if ((Index <= 0) || (Index > tabMult->Length())) {
70 Standard_OutOfRange::Raise();
71 }
72 tabMult->SetValue(Index, MPoint);
73}
74
75AppDef_MultiPointConstraint AppDef_MultiLine::Value (const Standard_Integer Index) const
76{
77 if ((Index <= 0) || (Index > tabMult->Length())) {
78 Standard_OutOfRange::Raise();
79 }
80 return tabMult->Value(Index);
81}
82
83
84void AppDef_MultiLine::Dump(Standard_OStream& o) const
85{
86 o << "AppDef_MultiLine dump:" << endl;
87// AppDef_MultiPointConstraint MP = tabMult->Value(1);
88 o << "It contains " << tabMult->Length() << " MultiPointConstraint"<< endl;
89// o << MP->NbPoints() << " 3d and " << MP->NbPoints2d() << endl;
90}