0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / AppDef / AppDef_MyLineTool.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// AppDef_MyLineTool.cxx
7fd59977 16
42cf5bc1 17#include <AppDef_MultiLine.hxx>
7fd59977 18#include <AppDef_MultiPointConstraint.hxx>
42cf5bc1 19#include <AppDef_MyLineTool.hxx>
7fd59977 20#include <gp_Pnt.hxx>
21#include <gp_Pnt2d.hxx>
22#include <gp_Vec.hxx>
23#include <gp_Vec2d.hxx>
24
25Standard_Integer AppDef_MyLineTool::FirstPoint(const AppDef_MultiLine&)
26{
27 return 1;
28}
29
30Standard_Integer AppDef_MyLineTool::LastPoint(const AppDef_MultiLine& ML)
31{
32 return ML.NbMultiPoints();
33}
34
35Standard_Integer AppDef_MyLineTool::NbP2d(const AppDef_MultiLine& ML)
36{
37 return ML.Value(1).NbPoints2d();
38}
39
40Standard_Integer AppDef_MyLineTool::NbP3d(const AppDef_MultiLine& ML)
41{
42 return ML.Value(1).NbPoints();
43}
44
45
46void AppDef_MyLineTool::Value(const AppDef_MultiLine& ML,
47 const Standard_Integer MPointIndex,
48 TColgp_Array1OfPnt& tabPt)
49{
50 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
51 Standard_Integer nbp3d = MPC.NbPoints(), low = tabPt.Lower();
52 for (Standard_Integer i = 1; i <= nbp3d; i++) {
53 tabPt(i+low-1) = MPC.Point(i);
54 }
55}
56
57void AppDef_MyLineTool::Value(const AppDef_MultiLine& ML,
58 const Standard_Integer MPointIndex,
59 TColgp_Array1OfPnt2d& tabPt2d)
60{
61 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
62 Standard_Integer nbp2d = MPC.NbPoints2d(), low = tabPt2d.Lower();
63 for (Standard_Integer i = 1; i <= nbp2d; i++) {
64 tabPt2d(i+low-1) = MPC.Point2d(i);
65 }
66}
67
68void AppDef_MyLineTool::Value(const AppDef_MultiLine& ML,
69 const Standard_Integer MPointIndex,
70 TColgp_Array1OfPnt& tabPt,
71 TColgp_Array1OfPnt2d& tabPt2d)
72{
73 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
74 Standard_Integer i, nbp2d = MPC.NbPoints2d(), low2d = tabPt2d.Lower();
75 Standard_Integer nbp3d = MPC.NbPoints(), low = tabPt.Lower();
76 for (i = 1; i <= nbp3d; i++) {
77 tabPt(i+low-1) = MPC.Point(i);
78 }
79 for (i = 1; i <= nbp2d; i++) {
80 tabPt2d(i+low2d-1) = MPC.Point2d(nbp3d+i);
81 }
82}
83
84
85Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
86 const Standard_Integer MPointIndex,
87 TColgp_Array1OfVec& tabV)
88{
89 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
90 if (MPC.IsTangencyPoint()) {
91 Standard_Integer nbp3d = MPC.NbPoints(), low = tabV.Lower();
92 for (Standard_Integer i = 1; i <= nbp3d; i++) {
93 tabV(i+low-1) = MPC.Tang(i);
94 }
95 return Standard_True;
96 }
97 else return Standard_False;
98}
99
100Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
101 const Standard_Integer MPointIndex,
102 TColgp_Array1OfVec2d& tabV2d)
103{
104 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
105 if (MPC.IsTangencyPoint()) {
106 Standard_Integer nbp2d = MPC.NbPoints2d(), low = tabV2d.Lower();
107 for (Standard_Integer i = 1; i <= nbp2d; i++) {
108 tabV2d(i+low-1) = MPC.Tang2d(i);
109 }
110 return Standard_True;
111 }
112 else return Standard_False;
113}
114
115Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
116 const Standard_Integer MPointIndex,
117 TColgp_Array1OfVec& tabV,
118 TColgp_Array1OfVec2d& tabV2d)
119{
120 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
121 if (MPC.IsTangencyPoint()) {
122 Standard_Integer i, nbp3d = MPC.NbPoints(), low = tabV.Lower();
123 Standard_Integer nbp2d = MPC.NbPoints2d(), low2d = tabV2d.Lower();
124 for (i = 1; i <= nbp3d; i++) {
125 tabV(i+low-1) = MPC.Tang(i);
126 }
127 for (i = 1; i <= nbp2d; i++) {
128 tabV2d(i+low2d-1) = MPC.Tang2d(nbp3d+i);
129 }
130 return Standard_True;
131 }
132 else return Standard_False;
133
134}
135
136
137AppDef_MultiLine& AppDef_MyLineTool::MakeMLBetween(const AppDef_MultiLine&,
138 const Standard_Integer ,
139 const Standard_Integer ,
140 const Standard_Integer )
141{
142 return *((AppDef_MultiLine*) 0);
143}
144
145Approx_Status AppDef_MyLineTool::WhatStatus(const AppDef_MultiLine&,
146 const Standard_Integer,
147 const Standard_Integer)
148{
149 return Approx_NoPointsAdded;
150}
151
152
153Standard_Boolean AppDef_MyLineTool::Curvature(const AppDef_MultiLine& ML,
154 const Standard_Integer MPointIndex,
155 TColgp_Array1OfVec& tabV)
156{
157 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
158 if (MPC.IsCurvaturePoint()) {
159 Standard_Integer nbp3d = MPC.NbPoints(), low = tabV.Lower();
160 for (Standard_Integer i = 1; i <= nbp3d; i++) {
161 tabV(i+low-1) = MPC.Curv(i);
162 }
163 return Standard_True;
164 }
165 else return Standard_False;
166}
167
168Standard_Boolean AppDef_MyLineTool::Curvature(const AppDef_MultiLine& ML,
169 const Standard_Integer MPointIndex,
170 TColgp_Array1OfVec2d& tabV2d)
171{
172 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
173 if (MPC.IsCurvaturePoint()) {
174 Standard_Integer nbp2d = MPC.NbPoints2d(), low = tabV2d.Lower();
175 for (Standard_Integer i = 1; i <= nbp2d; i++) {
176 tabV2d(i+low-1) = MPC.Curv2d(i);
177 }
178 return Standard_True;
179 }
180 else return Standard_False;
181}
182
183
184Standard_Boolean AppDef_MyLineTool::Curvature(const AppDef_MultiLine& ML,
185 const Standard_Integer MPointIndex,
186 TColgp_Array1OfVec& tabV,
187 TColgp_Array1OfVec2d& tabV2d)
188
189{
190 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
191 if (MPC.IsCurvaturePoint()) {
192 Standard_Integer i, nbp3d = MPC.NbPoints(), low = tabV.Lower();
193 Standard_Integer nbp2d = MPC.NbPoints2d(), low2d = tabV2d.Lower();
194 for (i = 1; i <= nbp3d; i++) {
195 tabV(i+low-1) = MPC.Curv(i);
196 }
197 for (i = 1; i <= nbp2d; i++) {
198 tabV2d(i+low2d-1) = MPC.Curv2d(nbp3d+i);
199 }
200 return Standard_True;
201 }
202 else return Standard_False;
203
204}
205
206