b311480e |
1 | // Created on: 1997-03-17 |
2 | // Created by: Prestataire Mary FABIEN |
3 | // Copyright (c) 1997-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
7fd59977 |
17 | |
7fd59977 |
18 | #include <Geom_BSplineCurve.hxx> |
19 | #include <gp_Pnt.hxx> |
42cf5bc1 |
20 | #include <TColgp_Array1OfPnt.hxx> |
21 | #include <TColgp_HArray1OfPnt.hxx> |
22 | #include <TCollection_AsciiString.hxx> |
23 | #include <TColStd_HArray1OfInteger.hxx> |
24 | #include <TColStd_HArray1OfReal.hxx> |
25 | #include <TestTopOpeTools_Mesure.hxx> |
7fd59977 |
26 | |
27 | //======================================================================= |
28 | //function : TestTopOpeTools_Mesure |
29 | //purpose : |
30 | //======================================================================= |
7fd59977 |
31 | TestTopOpeTools_Mesure::TestTopOpeTools_Mesure() |
32 | :myPnts(new TColgp_HArray1OfPnt(1,100)),myNPnts(0){} |
33 | |
34 | //======================================================================= |
35 | //function : TestTopOpeTools_Mesure |
36 | //purpose : |
37 | //======================================================================= |
38 | |
39 | TestTopOpeTools_Mesure::TestTopOpeTools_Mesure |
40 | (const TCollection_AsciiString& Name) |
41 | : myName(Name),myPnts(new TColgp_HArray1OfPnt(1,100)),myNPnts(0) |
42 | { |
43 | myNPnts = 1; |
44 | myPnts->SetValue(myNPnts,gp_Pnt(0.,0.,0.)); |
45 | } |
46 | |
47 | //======================================================================= |
48 | //function : TestTopOpeTools_Mesure |
49 | //purpose : |
50 | //======================================================================= |
51 | |
52 | TestTopOpeTools_Mesure::TestTopOpeTools_Mesure |
53 | (const Handle(TColgp_HArray1OfPnt)& P) |
54 | : myName(""),myPnts(new TColgp_HArray1OfPnt(1,100)),myNPnts(0) |
55 | { |
56 | myPnts = P; |
57 | myNPnts = myPnts->Length(); |
58 | } |
59 | |
60 | //======================================================================= |
61 | //function : Add |
62 | //purpose : |
63 | //======================================================================= |
64 | |
65 | void TestTopOpeTools_Mesure::Add(const Standard_Integer n, |
66 | const Standard_Real t) |
67 | { |
68 | if (myPnts.IsNull()) return; |
69 | if (myNPnts+1 > myPnts->Upper()) { |
70 | Handle(TColgp_HArray1OfPnt) Ploc = new TColgp_HArray1OfPnt(1,10*myNPnts); |
71 | for(Standard_Integer i = 1;i <= myNPnts;i++) |
72 | Ploc->SetValue(i,myPnts->Value(i)); |
73 | myPnts->ChangeArray1() = Ploc->Array1(); |
74 | } |
75 | myNPnts++; |
76 | myPnts->SetValue(myNPnts,gp_Pnt((Standard_Real)n,t,0.)); |
77 | } |
78 | |
79 | //======================================================================= |
80 | //function : Name |
81 | //purpose : |
82 | //======================================================================= |
83 | |
84 | const TCollection_AsciiString& TestTopOpeTools_Mesure::Name() const |
85 | { |
86 | return myName; |
87 | } |
88 | |
89 | //======================================================================= |
90 | //function : Name |
91 | //purpose : |
92 | //======================================================================= |
93 | |
94 | void TestTopOpeTools_Mesure::SetName(const TCollection_AsciiString& Name) |
95 | { |
96 | myName = Name; |
97 | } |
98 | |
99 | //======================================================================= |
100 | //function : Pnts |
101 | //purpose : |
102 | //======================================================================= |
103 | |
104 | const TColgp_Array1OfPnt& TestTopOpeTools_Mesure::Pnts() const |
105 | { |
106 | return myPnts->Array1(); |
107 | } |
108 | |
109 | //======================================================================= |
110 | //function : Pnt |
111 | //purpose : |
112 | //======================================================================= |
113 | |
114 | const gp_Pnt& TestTopOpeTools_Mesure::Pnt(const Standard_Integer I) const |
115 | { |
116 | return myPnts->Value(I); |
117 | } |
118 | |
119 | //======================================================================= |
120 | //function : NPnts |
121 | //purpose : |
122 | //======================================================================= |
123 | |
124 | Standard_Integer TestTopOpeTools_Mesure::NPnts() const |
125 | { |
126 | return myNPnts; |
127 | } |
128 | |
129 | //======================================================================= |
130 | //function : Clear |
131 | //purpose : |
132 | //======================================================================= |
133 | |
134 | void TestTopOpeTools_Mesure::Clear() |
135 | { |
136 | myNPnts = 0; |
137 | } |