0024708: Convertation of the generic classes to the non-generic. Part 2
[occt.git] / src / AppDef / AppDef_MultiLine.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15// Lpa, le 3/12/91
16
17#include <AppDef_MultiLine.ixx>
18#include <Standard_OutOfRange.hxx>
19#include <AppDef_Array1OfMultiPointConstraint.hxx>
20#include <Standard_ConstructionError.hxx>
21
22
23AppDef_MultiLine::AppDef_MultiLine(){}
24
25
26AppDef_MultiLine::AppDef_MultiLine (const Standard_Integer NbMult)
27{
28 if (NbMult < 0 ) Standard_ConstructionError::Raise();
29
30 tabMult = new AppDef_HArray1OfMultiPointConstraint (1, NbMult);
31}
32
33
34AppDef_MultiLine::AppDef_MultiLine (const AppDef_Array1OfMultiPointConstraint& tabMultiP)
35{
36 tabMult = new AppDef_HArray1OfMultiPointConstraint (1, tabMultiP.Length());
37 Standard_Integer i, Lower = tabMultiP.Lower();
38 for (i = 1; i <= tabMultiP.Length(); i++) {
39 tabMult->SetValue(i, tabMultiP.Value(Lower+i-1));
40 }
41}
42
43
44AppDef_MultiLine::AppDef_MultiLine (const TColgp_Array1OfPnt& tabP3d)
45{
46 tabMult = new AppDef_HArray1OfMultiPointConstraint (1, tabP3d.Length());
47 Standard_Integer i, Lower = tabP3d.Lower();
48 for (i = 1; i <= tabP3d.Length(); i++) {
49 AppDef_MultiPointConstraint MP(1, 0);
50 MP.SetPoint(1, tabP3d(Lower+i-1));
51 tabMult->SetValue(i, MP);
52 }
53}
54
55
56
57AppDef_MultiLine::AppDef_MultiLine (const TColgp_Array1OfPnt2d& tabP2d)
58{
59 tabMult = new AppDef_HArray1OfMultiPointConstraint (1, tabP2d.Length());
60 Standard_Integer i, Lower = tabP2d.Lower();
61 for (i = 1; i <= tabP2d.Length(); i++) {
62 AppDef_MultiPointConstraint MP(0, 1);
63 MP.SetPoint2d(1, tabP2d(Lower+i-1));
64 tabMult->SetValue(i, MP);
65 }
66
67}
68
69
70Standard_Integer AppDef_MultiLine::NbMultiPoints () const {
71 return tabMult->Length();
72}
73
74
75Standard_Integer AppDef_MultiLine::NbPoints() const {
76 return tabMult->Value(1).NbPoints() + tabMult->Value(1).NbPoints2d();
77}
78
79
80void AppDef_MultiLine::SetValue (const Standard_Integer Index,
81 const AppDef_MultiPointConstraint& MPoint) {
82 if ((Index <= 0) || (Index > tabMult->Length())) {
83 Standard_OutOfRange::Raise();
84 }
85 tabMult->SetValue(Index, MPoint);
86}
87
88AppDef_MultiPointConstraint AppDef_MultiLine::Value (const Standard_Integer Index) const
89{
90 if ((Index <= 0) || (Index > tabMult->Length())) {
91 Standard_OutOfRange::Raise();
92 }
93 return tabMult->Value(Index);
94}
95
96
97void AppDef_MultiLine::Dump(Standard_OStream& o) const
98{
99 o << "AppDef_MultiLine dump:" << endl;
100// AppDef_MultiPointConstraint MP = tabMult->Value(1);
101 o << "It contains " << tabMult->Length() << " MultiPointConstraint"<< endl;
102// o << MP->NbPoints() << " 3d and " << MP->NbPoints2d() << endl;
103}