Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/Contap_TheIWLineOfTheIWalking.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created on: 1993-02-05
0002 // Created by: Jacques GOUSSARD
0003 // Copyright (c) 1993-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 #ifndef _Contap_TheIWLineOfTheIWalking_HeaderFile
0018 #define _Contap_TheIWLineOfTheIWalking_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <IntSurf_Couple.hxx>
0024 #include <NCollection_Sequence.hxx>
0025 #include <Standard_Boolean.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <IntSurf_PathPoint.hxx>
0028 #include <gp_Vec.hxx>
0029 #include <Standard_Transient.hxx>
0030 #include <IntSurf_Allocator.hxx>
0031 #include <IntSurf_LineOn2S.hxx>
0032 class Standard_OutOfRange;
0033 class Standard_DomainError;
0034 class IntSurf_PathPoint;
0035 class IntSurf_PntOn2S;
0036 class gp_Vec;
0037 
0038 class Contap_TheIWLineOfTheIWalking : public Standard_Transient
0039 {
0040 
0041 public:
0042   Standard_EXPORT Contap_TheIWLineOfTheIWalking(const IntSurf_Allocator& theAllocator = nullptr);
0043 
0044   //! reverse the points in the line. Hasfirst, HasLast are kept.
0045   Standard_EXPORT void Reverse();
0046 
0047   //! Cut the line at the point of rank Index.
0048   void Cut(const int Index);
0049 
0050   //! Add a point in the line.
0051   void AddPoint(const IntSurf_PntOn2S& P);
0052 
0053   void AddStatusFirst(const bool Closed, const bool HasFirst);
0054 
0055   void AddStatusFirst(const bool               Closed,
0056                       const bool               HasLast,
0057                       const int                Index,
0058                       const IntSurf_PathPoint& P);
0059 
0060   void AddStatusFirstLast(const bool Closed, const bool HasFirst, const bool HasLast);
0061 
0062   void AddStatusLast(const bool HasLast);
0063 
0064   void AddStatusLast(const bool HasLast, const int Index, const IntSurf_PathPoint& P);
0065 
0066   //! associate the index of the point on the line with the index of the point
0067   //! passing through the starting iterator
0068   void AddIndexPassing(const int Index);
0069 
0070   void SetTangentVector(const gp_Vec& V, const int Index);
0071 
0072   void SetTangencyAtBegining(const bool IsTangent);
0073 
0074   void SetTangencyAtEnd(const bool IsTangent);
0075 
0076   //! Returns the number of points of the line (including first
0077   //! point and end point : see HasLastPoint and HasFirstPoint).
0078   int NbPoints() const;
0079 
0080   //! Returns the point of range Index.
0081   //! If index <= 0 or Index > NbPoints, an exception is raised.
0082   const IntSurf_PntOn2S& Value(const int Index) const;
0083 
0084   //! Returns the LineOn2S contained in the walking line.
0085   const occ::handle<IntSurf_LineOn2S>& Line() const;
0086 
0087   //! Returns True if the line is closed.
0088   bool IsClosed() const;
0089 
0090   //! Returns True if the first point of the line is a
0091   //! marching point. when is HasFirstPoint==False ,the line
0092   //! begins on the natural bound of the surface. The line can
0093   //! be too long
0094   bool HasFirstPoint() const;
0095 
0096   //! Returns True if the end point of the line is a
0097   //! marching point (Point from IntWS).
0098   //! when is HasFirstPoint==False the line ends
0099   //! on the natural bound of the surface. The line can be
0100   //! too long.
0101   bool HasLastPoint() const;
0102 
0103   //! Returns the first point of the line when it is a
0104   //! marching point.
0105   //! An exception is raised if HasFirstPoint returns False.
0106   const IntSurf_PathPoint& FirstPoint() const;
0107 
0108   //! Returns the Index of first point of the line when it is a
0109   //! marching point. This index is the index in the
0110   //! PointStartIterator.
0111   //! An exception is raised if HasFirstPoint returns False.
0112   int FirstPointIndex() const;
0113 
0114   //! Returns the last point of the line when it is a
0115   //! marching point.
0116   //! An exception is raised if HasLastPoint returns False.
0117   const IntSurf_PathPoint& LastPoint() const;
0118 
0119   //! Returns the index of last point of the line when it is a
0120   //! marching point. This index is the index in the
0121   //! PointStartIterator.
0122   //! An exception is raised if HasLastPoint returns False.
0123   int LastPointIndex() const;
0124 
0125   //! returns the number of points belonging to Pnts1 which are
0126   //! passing point.
0127   int NbPassingPoint() const;
0128 
0129   //! returns the index of the point belonging to the line which
0130   //! is associated to the passing point belonging to Pnts1
0131   //! an exception is raised if Index > NbPassingPoint()
0132   void PassingPoint(const int Index, int& IndexLine, int& IndexPnts) const;
0133 
0134   const gp_Vec& TangentVector(int& Index) const;
0135 
0136   bool IsTangentAtBegining() const;
0137 
0138   bool IsTangentAtEnd() const;
0139 
0140   DEFINE_STANDARD_RTTI_INLINE(Contap_TheIWLineOfTheIWalking, Standard_Transient)
0141 
0142 private:
0143   occ::handle<IntSurf_LineOn2S>        line;
0144   NCollection_Sequence<IntSurf_Couple> couple;
0145   bool                                 closed;
0146   bool                                 hasFirst;
0147   bool                                 hasLast;
0148   int                                  firstIndex;
0149   int                                  lastIndex;
0150   IntSurf_PathPoint                    theFirstPoint;
0151   IntSurf_PathPoint                    theLastPoint;
0152   int                                  indextg;
0153   gp_Vec                               vcttg;
0154   bool                                 istgtbeg;
0155   bool                                 istgtend;
0156 };
0157 
0158 //=================================================================================================
0159 // Inline implementations
0160 //=================================================================================================
0161 
0162 inline void Contap_TheIWLineOfTheIWalking::Cut(const int Index)
0163 {
0164   occ::handle<IntSurf_LineOn2S> lost = line->Split(Index);
0165 }
0166 
0167 inline void Contap_TheIWLineOfTheIWalking::AddPoint(const IntSurf_PntOn2S& P)
0168 {
0169   line->Add(P);
0170 }
0171 
0172 inline void Contap_TheIWLineOfTheIWalking::AddStatusFirst(const bool Closed, const bool HasFirst)
0173 {
0174   closed   = Closed;
0175   hasFirst = HasFirst;
0176 }
0177 
0178 inline void Contap_TheIWLineOfTheIWalking::AddStatusLast(const bool HasLast)
0179 {
0180   hasLast = HasLast;
0181 }
0182 
0183 inline void Contap_TheIWLineOfTheIWalking::AddStatusFirst(const bool               Closed,
0184                                                           const bool               HasFirst,
0185                                                           const int                Index,
0186                                                           const IntSurf_PathPoint& P)
0187 {
0188   closed        = Closed;
0189   hasFirst      = HasFirst;
0190   firstIndex    = Index;
0191   theFirstPoint = P;
0192 }
0193 
0194 inline void Contap_TheIWLineOfTheIWalking::AddStatusLast(const bool               HasLast,
0195                                                          const int                Index,
0196                                                          const IntSurf_PathPoint& P)
0197 {
0198   hasLast      = HasLast;
0199   lastIndex    = Index;
0200   theLastPoint = P;
0201 }
0202 
0203 inline void Contap_TheIWLineOfTheIWalking::AddStatusFirstLast(const bool Closed,
0204                                                               const bool HasFirst,
0205                                                               const bool HasLast)
0206 {
0207   closed   = Closed;
0208   hasFirst = HasFirst;
0209   hasLast  = HasLast;
0210 }
0211 
0212 inline void Contap_TheIWLineOfTheIWalking::AddIndexPassing(const int Index)
0213 {
0214   couple.Append(IntSurf_Couple(line->NbPoints() + 1, Index));
0215 }
0216 
0217 inline int Contap_TheIWLineOfTheIWalking::NbPoints() const
0218 {
0219   return line->NbPoints();
0220 }
0221 
0222 inline const IntSurf_PntOn2S& Contap_TheIWLineOfTheIWalking::Value(const int Index) const
0223 {
0224   return line->Value(Index);
0225 }
0226 
0227 inline const occ::handle<IntSurf_LineOn2S>& Contap_TheIWLineOfTheIWalking::Line() const
0228 {
0229   return line;
0230 }
0231 
0232 inline bool Contap_TheIWLineOfTheIWalking::IsClosed() const
0233 {
0234   return closed;
0235 }
0236 
0237 inline bool Contap_TheIWLineOfTheIWalking::HasFirstPoint() const
0238 {
0239   return hasFirst;
0240 }
0241 
0242 inline int Contap_TheIWLineOfTheIWalking::FirstPointIndex() const
0243 {
0244   if (!hasFirst)
0245     throw Standard_DomainError();
0246   return firstIndex;
0247 }
0248 
0249 inline const IntSurf_PathPoint& Contap_TheIWLineOfTheIWalking::FirstPoint() const
0250 {
0251   if (!hasFirst)
0252     throw Standard_DomainError();
0253   return theFirstPoint;
0254 }
0255 
0256 inline bool Contap_TheIWLineOfTheIWalking::HasLastPoint() const
0257 {
0258   return hasLast;
0259 }
0260 
0261 inline const IntSurf_PathPoint& Contap_TheIWLineOfTheIWalking::LastPoint() const
0262 {
0263   if (!hasLast)
0264     throw Standard_DomainError();
0265   return theLastPoint;
0266 }
0267 
0268 inline int Contap_TheIWLineOfTheIWalking::LastPointIndex() const
0269 {
0270   if (!hasLast)
0271     throw Standard_DomainError();
0272   return lastIndex;
0273 }
0274 
0275 inline int Contap_TheIWLineOfTheIWalking::NbPassingPoint() const
0276 {
0277   return couple.Length();
0278 }
0279 
0280 inline void Contap_TheIWLineOfTheIWalking::PassingPoint(const int Index,
0281                                                         int&      IndexLine,
0282                                                         int&      IndexPnts) const
0283 {
0284   IndexLine = couple(Index).First();
0285   IndexPnts = couple(Index).Second();
0286 }
0287 
0288 inline void Contap_TheIWLineOfTheIWalking::SetTangentVector(const gp_Vec& V, const int Index)
0289 {
0290   indextg = Index;
0291   vcttg   = V;
0292 }
0293 
0294 inline void Contap_TheIWLineOfTheIWalking::SetTangencyAtBegining(const bool IsTangent)
0295 {
0296   istgtend = IsTangent;
0297 }
0298 
0299 inline void Contap_TheIWLineOfTheIWalking::SetTangencyAtEnd(const bool IsTangent)
0300 {
0301   istgtend = IsTangent;
0302 }
0303 
0304 inline const gp_Vec& Contap_TheIWLineOfTheIWalking::TangentVector(int& Index) const
0305 {
0306   Index = indextg;
0307   return vcttg;
0308 }
0309 
0310 inline bool Contap_TheIWLineOfTheIWalking::IsTangentAtBegining() const
0311 {
0312   return istgtbeg;
0313 }
0314 
0315 inline bool Contap_TheIWLineOfTheIWalking::IsTangentAtEnd() const
0316 {
0317   return istgtend;
0318 }
0319 
0320 #endif // _Contap_TheIWLineOfTheIWalking_HeaderFile