Warning, /include/opencascade/IntPatch_WLine.lxx is written in an unsupported language. File is not indexed.
0001 // Created on: 1991-05-27
0002 // Created by: Isabelle GRIGNON
0003 // Copyright (c) 1991-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016
0017 #include <Standard_DomainError.hxx>
0018 #include <IntSurf_LineOn2S.hxx>
0019 #include <IntPatch_Point.hxx>
0020
0021
0022 inline void IntPatch_WLine::AddVertex (const IntPatch_Point& thePnt,
0023 const Standard_Boolean theIsPrepend)
0024 {
0025 if(theIsPrepend)
0026 svtx.Prepend(thePnt);
0027 else
0028 svtx.Append(thePnt);
0029 }
0030
0031 inline void IntPatch_WLine::Replace (const Standard_Integer Index,
0032 const IntPatch_Point& Pnt)
0033 {
0034 svtx(Index) = Pnt;
0035 }
0036
0037 inline void IntPatch_WLine::SetFirstPoint (const Standard_Integer IndFirst)
0038 {
0039 fipt = Standard_True;
0040 indf = IndFirst;
0041 }
0042
0043 inline void IntPatch_WLine::SetLastPoint (const Standard_Integer IndLast)
0044 {
0045 lapt = Standard_True;
0046 indl = IndLast;
0047 }
0048
0049 inline Standard_Integer IntPatch_WLine::NbPnts () const
0050 {
0051 return curv->NbPoints();
0052 }
0053
0054 inline const IntSurf_PntOn2S& IntPatch_WLine::Point (const Standard_Integer Index) const
0055 {
0056 return curv->Value(Index);
0057 }
0058
0059 inline Standard_Boolean IntPatch_WLine::HasFirstPoint () const
0060 {
0061 return fipt;
0062 }
0063
0064 inline Standard_Boolean IntPatch_WLine::HasLastPoint () const
0065 {
0066 return lapt;
0067 }
0068
0069 inline const IntPatch_Point& IntPatch_WLine::FirstPoint () const
0070 {
0071 if (!fipt) {throw Standard_DomainError();}
0072 return svtx(indf);
0073 }
0074
0075 inline const IntPatch_Point& IntPatch_WLine::LastPoint () const
0076 {
0077 if (!lapt) {throw Standard_DomainError();}
0078 return svtx(indl);
0079 }
0080
0081 inline const IntPatch_Point& IntPatch_WLine::FirstPoint (Standard_Integer& Indfirst) const
0082 {
0083 if (!fipt) {throw Standard_DomainError();}
0084 Indfirst = indf;
0085 return svtx(indf);
0086 }
0087
0088 inline const IntPatch_Point& IntPatch_WLine::LastPoint (Standard_Integer& Indlast) const
0089 {
0090 if (!lapt) {throw Standard_DomainError();}
0091 Indlast = indl;
0092 return svtx(indl);
0093 }
0094
0095 inline Standard_Integer IntPatch_WLine::NbVertex () const
0096 {
0097 return svtx.Length();
0098 }
0099
0100 inline const IntPatch_Point& IntPatch_WLine::Vertex (const Standard_Integer Index) const
0101 {
0102 return svtx(Index);
0103 }
0104
0105 inline IntPatch_Point& IntPatch_WLine::ChangeVertex (const Standard_Integer Index)
0106 {
0107 return svtx(Index);
0108 }
0109
0110 inline void IntPatch_WLine::ClearVertexes()
0111 {
0112 svtx.Clear();
0113 }
0114
0115 inline void IntPatch_WLine::RemoveVertex(const Standard_Integer theIndex)
0116 {
0117 if((theIndex < 1) || (theIndex > NbVertex()))
0118 throw Standard_OutOfRange("Cannot delete not existing vertex");
0119 svtx.Remove(theIndex);
0120 }
0121
0122 inline void IntPatch_WLine::InsertVertexBefore( const Standard_Integer theIndex,
0123 const IntPatch_Point& thePnt)
0124 {
0125 const Standard_Integer aNbVertexes = NbVertex();
0126 Standard_Integer anIndex = Max(theIndex, 1);
0127
0128 if(anIndex > aNbVertexes)
0129 svtx.Append(thePnt);
0130 else
0131 svtx.InsertBefore(theIndex, thePnt);
0132 }