0024750: Replace instantiations of TCollection generic classes by NCollection templat...
[occt.git] / src / Contap / Contap_Line.cxx
CommitLineData
b311480e 1// Created on: 1993-02-05
2// Created by: Jacques GOUSSARD
3// Copyright (c) 1993-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
e2065c2f 17#include <Contap_Line.ixx>
18
7fd59977 19Contap_Line::Contap_Line () {
e2065c2f 20 svtx = new Contap_TheHSequenceOfPoint ();
7fd59977 21 Trans = IntSurf_Undecided;
22}
23
24void Contap_Line::ResetSeqOfVertex() {
e2065c2f 25 svtx = new Contap_TheHSequenceOfPoint ();
7fd59977 26}
27
e2065c2f 28void Contap_Line::Add(const Contap_Point& P) {
7fd59977 29 Standard_Integer n = svtx->Length();
30 if(n==0) {
31 svtx->Append(P);
32 }
33 else {
34 Standard_Real prm = P.ParameterOnLine();
35 if(prm > svtx->Value(n).ParameterOnLine()) {
36 svtx->Append(P);
37 }
38 else {
39 for(Standard_Integer i=n-1;i>0;i--) {
e2065c2f 40 if(prm> svtx->Value(i).ParameterOnLine()) {
41 svtx->InsertBefore(i+1,P);
42 return;
43 }
7fd59977 44 }
45 svtx->Prepend(P);
46 }
47 }
48}
49
7fd59977 50void Contap_Line::Clear () {
51 if(!curv.IsNull())
52 curv->Clear();
e2065c2f 53 svtx = new Contap_TheHSequenceOfPoint ();
7fd59977 54 typL = Contap_Walking;
55}
56
57void Contap_Line::SetValue(const gp_Lin& L)
58{
59 pt = L.Location();
60 dir1 = L.Direction();
61 typL = Contap_Lin;
62}
63
64void Contap_Line::SetValue(const gp_Circ& C)
65{
66 pt = C.Location();
67 dir1 = C.Position().Direction();
68 dir2 = C.Position().XDirection();
69 rad = C.Radius();
70 typL = Contap_Circle;
71}
72
e2065c2f 73void Contap_Line::SetValue(const Handle(Adaptor2d_HCurve2d)& A)
7fd59977 74{
75 thearc = A;
76 typL = Contap_Restriction;
77}
78
79void Contap_Line::SetLineOn2S(const Handle(IntSurf_LineOn2S)& L) {
80 curv = L;
81 typL = Contap_Walking;
82}
83
84void Contap_Line::SetTransitionOnS(const IntSurf_TypeTrans T) {
85 Trans = T;
86}
87
88IntSurf_TypeTrans Contap_Line::TransitionOnS() const {
89 return(Trans);
90}
91
e2065c2f 92const Handle(Adaptor2d_HCurve2d)& Contap_Line::Arc () const
7fd59977 93{
94 if (typL != Contap_Restriction) {Standard_DomainError::Raise();}
95 return thearc;
96}