0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / Contap / Contap_Line.lxx
1 // Created on: 1993-02-05
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <Standard_DomainError.hxx>
18 #include <TColgp_HSequenceOfPnt.hxx>
19 #include <gp_Lin.hxx>
20 #include <gp_Circ.hxx>
21 #include <IntSurf_PntOn2S.hxx>
22 #include <IntSurf_LineOn2S.hxx>
23
24 #include <Contap_Point.hxx>
25 #include <Contap_TheHSequenceOfPoint.hxx>
26
27 inline const Handle(IntSurf_LineOn2S)& Contap_Line::LineOn2S () const
28 {
29   return curv;
30 }
31
32 inline void Contap_Line::Add(const IntSurf_PntOn2S& POn2S)
33 {
34   curv->Add(POn2S);
35 }
36
37 inline Standard_Integer Contap_Line::NbVertex () const
38 {
39   return svtx->Length();
40 }
41
42 inline Contap_Point& Contap_Line::Vertex (const Standard_Integer Index) const
43 {
44   return svtx->ChangeSequence()(Index);
45 }
46
47 inline Contap_IType Contap_Line::TypeContour () const
48 {
49   return typL;
50 }
51
52 inline Standard_Integer Contap_Line::NbPnts () const {
53   if (typL != Contap_Walking) {throw Standard_DomainError();}
54   return(curv->NbPoints());
55 }
56
57 inline const IntSurf_PntOn2S& Contap_Line::Point (const Standard_Integer Index) const {
58   if (typL != Contap_Walking) {throw Standard_DomainError();}
59   return(curv->Value(Index));
60 }
61
62 inline gp_Lin Contap_Line::Line () const
63 {
64   if (typL != Contap_Lin) {throw Standard_DomainError();}
65   return gp_Lin(pt,dir1);
66 }
67
68 inline gp_Circ Contap_Line::Circle () const
69 {
70   if (typL != Contap_Circle) {throw Standard_DomainError();}
71   return gp_Circ(gp_Ax2(pt,dir1,dir2),rad);
72 }