0026937: Eliminate NO_CXX_EXCEPTION macro support
[occt.git] / src / IntPatch / IntPatch_WLine.lxx
CommitLineData
b311480e 1// Created on: 1991-05-27
2// Created by: Isabelle GRIGNON
3// Copyright (c) 1991-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
17#include <Standard_DomainError.hxx>
18#include <IntSurf_LineOn2S.hxx>
19#include <IntPatch_Point.hxx>
20
21
b8f67cc2 22inline void IntPatch_WLine::AddVertex (const IntPatch_Point& thePnt,
23 const Standard_Boolean theIsPrepend)
7fd59977 24{
b8f67cc2 25 if(theIsPrepend)
26 svtx.Prepend(thePnt);
27 else
28 svtx.Append(thePnt);
7fd59977 29}
30
31inline void IntPatch_WLine::Replace (const Standard_Integer Index,
32 const IntPatch_Point& Pnt)
33{
34 svtx(Index) = Pnt;
35}
36
37inline void IntPatch_WLine::SetFirstPoint (const Standard_Integer IndFirst)
38{
39 fipt = Standard_True;
40 indf = IndFirst;
41}
42
43inline void IntPatch_WLine::SetLastPoint (const Standard_Integer IndLast)
44{
45 lapt = Standard_True;
46 indl = IndLast;
47}
48
49inline Standard_Integer IntPatch_WLine::NbPnts () const
50{
51 return curv->NbPoints();
52}
53
54inline const IntSurf_PntOn2S& IntPatch_WLine::Point (const Standard_Integer Index) const
55{
56 return curv->Value(Index);
57}
58
59inline Standard_Boolean IntPatch_WLine::HasFirstPoint () const
60{
61 return fipt;
62}
63
64inline Standard_Boolean IntPatch_WLine::HasLastPoint () const
65{
66 return lapt;
67}
68
69inline const IntPatch_Point& IntPatch_WLine::FirstPoint () const
70{
9775fa61 71 if (!fipt) {throw Standard_DomainError();}
7fd59977 72 return svtx(indf);
73}
74
75inline const IntPatch_Point& IntPatch_WLine::LastPoint () const
76{
9775fa61 77 if (!lapt) {throw Standard_DomainError();}
7fd59977 78 return svtx(indl);
79}
80
81inline const IntPatch_Point& IntPatch_WLine::FirstPoint (Standard_Integer& Indfirst) const
82{
9775fa61 83 if (!fipt) {throw Standard_DomainError();}
7fd59977 84 Indfirst = indf;
85 return svtx(indf);
86}
87
88inline const IntPatch_Point& IntPatch_WLine::LastPoint (Standard_Integer& Indlast) const
89{
9775fa61 90 if (!lapt) {throw Standard_DomainError();}
7fd59977 91 Indlast = indl;
92 return svtx(indl);
93}
94
95inline Standard_Integer IntPatch_WLine::NbVertex () const
96{
97 return svtx.Length();
98}
99
100inline const IntPatch_Point& IntPatch_WLine::Vertex (const Standard_Integer Index) const
101{
102 return svtx(Index);
103}
e8feb725 104
eee615ad 105inline IntPatch_Point& IntPatch_WLine::ChangeVertex (const Standard_Integer Index)
106{
107 return svtx(Index);
108}
109
e8feb725 110inline void IntPatch_WLine::ClearVertexes()
111{
112 svtx.Clear();
113}
114
115inline void IntPatch_WLine::RemoveVertex(const Standard_Integer theIndex)
116{
117 if((theIndex < 1) || (theIndex > NbVertex()))
9775fa61 118 throw Standard_OutOfRange("Cannot delete not existing vertex");
e8feb725 119 svtx.Remove(theIndex);
120}
121
122inline void IntPatch_WLine::InsertVertexBefore( const Standard_Integer theIndex,
123 const IntPatch_Point& thePnt)
124{
125 const Standard_Integer aNbVertexes = NbVertex();
126 Standard_Integer anIndex = Max(theIndex, 1);
127
128 if(anIndex > aNbVertexes)
129 svtx.Append(thePnt);
130 else
131 svtx.InsertBefore(theIndex, thePnt);
132}