0023024: Update headers of OCCT files
[occt.git] / src / AppDef / AppDef_MultiLine.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
2// Copyright (c) 1999-2012 OPEN CASCADE SAS
3//
4// The content of this file is subject to the Open CASCADE Technology Public
5// License Version 6.5 (the "License"). You may not use the content of this file
6// except in compliance with the License. Please obtain a copy of the License
7// at http://www.opencascade.org and read it completely before using this file.
8//
9// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11//
12// The Original Code and all software distributed under the License is
13// distributed on an "AS IS" basis, without warranty of any kind, and the
14// Initial Developer hereby disclaims all such warranties, including without
15// limitation, any warranties of merchantability, fitness for a particular
16// purpose or non-infringement. Please see the License for the specific terms
17// and conditions governing the rights and limitations under the License.
18
7fd59977 19// Lpa, le 3/12/91
20
21#include <AppDef_MultiLine.ixx>
22#include <Standard_OutOfRange.hxx>
23#include <AppDef_Array1OfMultiPointConstraint.hxx>
24#include <Standard_ConstructionError.hxx>
25
26
27AppDef_MultiLine::AppDef_MultiLine(){}
28
29
30AppDef_MultiLine::AppDef_MultiLine (const Standard_Integer NbMult)
31{
32 if (NbMult < 0 ) Standard_ConstructionError::Raise();
33
34 tabMult = new AppDef_HArray1OfMultiPointConstraint (1, NbMult);
35}
36
37
38AppDef_MultiLine::AppDef_MultiLine (const AppDef_Array1OfMultiPointConstraint& tabMultiP)
39{
40 tabMult = new AppDef_HArray1OfMultiPointConstraint (1, tabMultiP.Length());
41 Standard_Integer i, Lower = tabMultiP.Lower();
42 for (i = 1; i <= tabMultiP.Length(); i++) {
43 tabMult->SetValue(i, tabMultiP.Value(Lower+i-1));
44 }
45}
46
47
48AppDef_MultiLine::AppDef_MultiLine (const TColgp_Array1OfPnt& tabP3d)
49{
50 tabMult = new AppDef_HArray1OfMultiPointConstraint (1, tabP3d.Length());
51 Standard_Integer i, Lower = tabP3d.Lower();
52 for (i = 1; i <= tabP3d.Length(); i++) {
53 AppDef_MultiPointConstraint MP(1, 0);
54 MP.SetPoint(1, tabP3d(Lower+i-1));
55 tabMult->SetValue(i, MP);
56 }
57}
58
59
60
61AppDef_MultiLine::AppDef_MultiLine (const TColgp_Array1OfPnt2d& tabP2d)
62{
63 tabMult = new AppDef_HArray1OfMultiPointConstraint (1, tabP2d.Length());
64 Standard_Integer i, Lower = tabP2d.Lower();
65 for (i = 1; i <= tabP2d.Length(); i++) {
66 AppDef_MultiPointConstraint MP(0, 1);
67 MP.SetPoint2d(1, tabP2d(Lower+i-1));
68 tabMult->SetValue(i, MP);
69 }
70
71}
72
73
74Standard_Integer AppDef_MultiLine::NbMultiPoints () const {
75 return tabMult->Length();
76}
77
78
79Standard_Integer AppDef_MultiLine::NbPoints() const {
80 return tabMult->Value(1).NbPoints() + tabMult->Value(1).NbPoints2d();
81}
82
83
84void AppDef_MultiLine::SetValue (const Standard_Integer Index,
85 const AppDef_MultiPointConstraint& MPoint) {
86 if ((Index <= 0) || (Index > tabMult->Length())) {
87 Standard_OutOfRange::Raise();
88 }
89 tabMult->SetValue(Index, MPoint);
90}
91
92AppDef_MultiPointConstraint AppDef_MultiLine::Value (const Standard_Integer Index) const
93{
94 if ((Index <= 0) || (Index > tabMult->Length())) {
95 Standard_OutOfRange::Raise();
96 }
97 return tabMult->Value(Index);
98}
99
100
101void AppDef_MultiLine::Dump(Standard_OStream& o) const
102{
103 o << "AppDef_MultiLine dump:" << endl;
104// AppDef_MultiPointConstraint MP = tabMult->Value(1);
105 o << "It contains " << tabMult->Length() << " MultiPointConstraint"<< endl;
106// o << MP->NbPoints() << " 3d and " << MP->NbPoints2d() << endl;
107}