Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:21

0001 // Created on: 1993-11-09
0002 // Created by: Laurent BOURESCHE
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 _ChFiDS_Spine_HeaderFile
0018 #define _ChFiDS_Spine_HeaderFile
0019 
0020 #include <BRepAdaptor_Curve.hxx>
0021 #include <gp_Pnt.hxx>
0022 #include <gp_Vec.hxx>
0023 #include <GeomAbs_CurveType.hxx>
0024 #include <ChFiDS_ChamfMode.hxx>
0025 #include <ChFiDS_ErrorStatus.hxx>
0026 #include <ChFiDS_ListOfHElSpine.hxx>
0027 #include <ChFiDS_State.hxx>
0028 #include <ChFiDS_TypeOfConcavity.hxx>
0029 #include <ChFiDS_ElSpine.hxx>
0030 #include <TColStd_HArray1OfReal.hxx>
0031 #include <TopTools_SequenceOfShape.hxx>
0032 
0033 class TopoDS_Edge;
0034 class gp_Lin;
0035 class gp_Circ;
0036 class TopoDS_Vertex;
0037 
0038 // resolve name collisions with X11 headers
0039 #ifdef Status
0040   #undef Status
0041 #endif
0042 
0043 class ChFiDS_Spine;
0044 DEFINE_STANDARD_HANDLE(ChFiDS_Spine, Standard_Transient)
0045 
0046 //! Contains information necessary for construction of
0047 //! a 3D fillet or chamfer:
0048 //!
0049 //! - guideline composed of edges of the solid, tangents
0050 //! between them, and borders by faces tangents
0051 //! between them.
0052 //!
0053 //! Tools for construction of the Sp
0054 //! by propagation from an edge of solid
0055 //! are provided in the Builder of Fil3d.
0056 //!
0057 //! The Spine contains among others the
0058 //! information about the nature of extremities
0059 //! of the fillet ( on free border , on section or closed ).
0060 //!
0061 //! IMPORTANT NOTE  :    the guideline
0062 //! represented in this way is not C2, although the path
0063 //! claims it. Several palliative workarounds
0064 //! (see the methods at the end) are planned,
0065 //! but they are not enough. It is necessary to change
0066 //! the approach and double the Spine of line C2 with
0067 //! the known consequences for management of
0068 //! interactions between KPart Blend in Fil3d.
0069 class ChFiDS_Spine : public Standard_Transient
0070 {
0071 
0072 public:
0073 
0074   
0075   Standard_EXPORT ChFiDS_Spine();
0076   
0077   Standard_EXPORT ChFiDS_Spine(const Standard_Real Tol);
0078   
0079   //! store edges composing the guideline
0080     void SetEdges (const TopoDS_Edge& E);
0081   
0082   //! store offset edges composing the offset guideline
0083     void SetOffsetEdges (const TopoDS_Edge& E);
0084   
0085   //! store the edge at the first position before all others
0086     void PutInFirst (const TopoDS_Edge& E);
0087   
0088   //! store the offset edge at the first position before all others
0089     void PutInFirstOffset (const TopoDS_Edge& E);
0090   
0091     Standard_Integer NbEdges() const;
0092   
0093     const TopoDS_Edge& Edges (const Standard_Integer I) const;
0094   
0095     const TopoDS_Edge& OffsetEdges (const Standard_Integer I) const;
0096   
0097   //! stores if the start of a set of edges starts on a
0098   //! section of free border or forms  a closed contour
0099     void SetFirstStatus (const ChFiDS_State S);
0100   
0101   //! stores if the end of a set of edges starts on a
0102   //! section of free border or forms  a closed contour
0103     void SetLastStatus (const ChFiDS_State S);
0104   
0105   Standard_EXPORT virtual void AppendElSpine (const Handle(ChFiDS_ElSpine)& Els);
0106   
0107   Standard_EXPORT virtual void AppendOffsetElSpine (const Handle(ChFiDS_ElSpine)& Els);
0108   
0109   Standard_EXPORT Handle(ChFiDS_ElSpine) ElSpine (const Standard_Integer IE) const;
0110   
0111   Standard_EXPORT Handle(ChFiDS_ElSpine) ElSpine (const TopoDS_Edge& E) const;
0112   
0113   Standard_EXPORT Handle(ChFiDS_ElSpine) ElSpine (const Standard_Real W) const;
0114   
0115   Standard_EXPORT ChFiDS_ListOfHElSpine& ChangeElSpines();
0116   
0117   Standard_EXPORT ChFiDS_ListOfHElSpine& ChangeOffsetElSpines();
0118   
0119   Standard_EXPORT virtual void Reset (const Standard_Boolean AllData = Standard_False);
0120   
0121   Standard_EXPORT Standard_Boolean SplitDone() const;
0122   
0123   Standard_EXPORT void SplitDone (const Standard_Boolean B);
0124   
0125   //! prepare the guideline depending on the edges that
0126   //! are elementary arks (take parameters from
0127   //! a single curvilinear abscissa); to be able to call
0128   //! methods on the geometry (first,last,value,d1,d2)
0129   //! it is necessary to start with preparation otherwise an
0130   //! exception will be raised
0131   Standard_EXPORT void Load();
0132   
0133   Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const;
0134   
0135   Standard_EXPORT Standard_Boolean IsClosed() const;
0136   
0137   Standard_EXPORT Standard_Real FirstParameter() const;
0138   
0139   Standard_EXPORT Standard_Real LastParameter() const;
0140   
0141   Standard_EXPORT void SetFirstParameter (const Standard_Real Par);
0142   
0143   Standard_EXPORT void SetLastParameter (const Standard_Real Par);
0144   
0145   //! gives the total length of all arcs before the
0146   //! number IndexSp
0147   Standard_EXPORT Standard_Real FirstParameter (const Standard_Integer IndexSpine) const;
0148   
0149   //! gives the total length till the ark with number
0150   //! IndexSpine (inclus)
0151   Standard_EXPORT Standard_Real LastParameter (const Standard_Integer IndexSpine) const;
0152   
0153   //! gives the length of ark with number IndexSp
0154   Standard_EXPORT Standard_Real Length (const Standard_Integer IndexSpine) const;
0155   
0156   Standard_EXPORT Standard_Boolean IsPeriodic() const;
0157   
0158   Standard_EXPORT Standard_Real Period() const;
0159   
0160   Standard_EXPORT Standard_Real Absc (const Standard_Real U);
0161   
0162   Standard_EXPORT Standard_Real Absc (const Standard_Real U, const Standard_Integer I);
0163   
0164   Standard_EXPORT void Parameter (const Standard_Real AbsC, Standard_Real& U, const Standard_Boolean Oriented = Standard_True);
0165   
0166   Standard_EXPORT void Parameter (const Standard_Integer Index, const Standard_Real AbsC, Standard_Real& U, const Standard_Boolean Oriented = Standard_True);
0167   
0168   Standard_EXPORT gp_Pnt Value (const Standard_Real AbsC);
0169   
0170   Standard_EXPORT void D0 (const Standard_Real AbsC, gp_Pnt& P);
0171   
0172   Standard_EXPORT void D1 (const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1);
0173   
0174   Standard_EXPORT void D2 (const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
0175   
0176   Standard_EXPORT void SetCurrent (const Standard_Integer Index);
0177   
0178   //! sets the current curve and returns it
0179   Standard_EXPORT const BRepAdaptor_Curve& CurrentElementarySpine (const Standard_Integer Index);
0180   
0181     Standard_Integer CurrentIndexOfElementarySpine() const;
0182   
0183   Standard_EXPORT GeomAbs_CurveType GetType() const;
0184   
0185   Standard_EXPORT gp_Lin Line() const;
0186   
0187   Standard_EXPORT gp_Circ Circle() const;
0188   
0189   //! returns if the set of edges starts on a free boundary
0190   //! or if the first vertex is a breakpoint or if the set is
0191   //! closed
0192     ChFiDS_State FirstStatus() const;
0193   
0194   //! returns the state at the end of the set
0195     ChFiDS_State LastStatus() const;
0196   
0197     ChFiDS_State Status (const Standard_Boolean IsFirst) const;
0198   
0199   //! returns the type of concavity in the connection
0200     ChFiDS_TypeOfConcavity GetTypeOfConcavity() const;
0201   
0202     void SetStatus (const ChFiDS_State S, const Standard_Boolean IsFirst);
0203   
0204   //! sets the type of concavity in the connection
0205     void SetTypeOfConcavity (const ChFiDS_TypeOfConcavity theType);
0206   
0207   //! returns   if the  set  of  edges starts (or   end) on
0208   //! Tangency point.
0209     Standard_Boolean IsTangencyExtremity (const Standard_Boolean IsFirst) const;
0210   
0211     void SetTangencyExtremity (const Standard_Boolean IsTangency, const Standard_Boolean IsFirst);
0212   
0213   Standard_EXPORT Standard_Real Absc (const TopoDS_Vertex& V) const;
0214   
0215   Standard_EXPORT TopoDS_Vertex FirstVertex() const;
0216   
0217   Standard_EXPORT TopoDS_Vertex LastVertex() const;
0218   
0219   Standard_EXPORT void SetFirstTgt (const Standard_Real W);
0220   
0221   Standard_EXPORT void SetLastTgt (const Standard_Real W);
0222   
0223   Standard_EXPORT Standard_Boolean HasFirstTgt() const;
0224   
0225   Standard_EXPORT Standard_Boolean HasLastTgt() const;
0226   
0227   //! set a parameter reference for the approx.
0228   Standard_EXPORT void SetReference (const Standard_Real W);
0229   
0230   //! set  a  parameter  reference  for  the approx,  at the
0231   //! middle  of edge I.
0232   Standard_EXPORT void SetReference (const Standard_Integer I);
0233   
0234   Standard_EXPORT Standard_Integer Index (const Standard_Real W, const Standard_Boolean Forward = Standard_True) const;
0235   
0236   Standard_EXPORT Standard_Integer Index (const TopoDS_Edge& E) const;
0237   
0238   Standard_EXPORT void UnsetReference();
0239   
0240   Standard_EXPORT void SetErrorStatus (const ChFiDS_ErrorStatus state);
0241   
0242   Standard_EXPORT ChFiDS_ErrorStatus ErrorStatus() const;
0243 
0244   //! Return the mode of chamfers used
0245   Standard_EXPORT ChFiDS_ChamfMode Mode() const;
0246 
0247   //! Return tolesp parameter
0248   Standard_EXPORT Standard_Real GetTolesp() const;
0249 
0250 
0251 
0252   DEFINE_STANDARD_RTTIEXT(ChFiDS_Spine,Standard_Transient)
0253 
0254 protected:
0255 
0256 
0257   Standard_Boolean splitdone;
0258   ChFiDS_ListOfHElSpine elspines;
0259   ChFiDS_ListOfHElSpine offset_elspines;
0260   ChFiDS_ChamfMode   myMode;
0261 
0262 
0263 private:
0264 
0265   
0266   Standard_EXPORT void Prepare (Standard_Real& L, Standard_Integer& Index) const;
0267 
0268   BRepAdaptor_Curve myCurve;
0269   BRepAdaptor_Curve myOffsetCurve;
0270   Standard_Integer indexofcurve;
0271   ChFiDS_TypeOfConcavity myTypeOfConcavity;
0272   ChFiDS_State firstState;
0273   ChFiDS_State lastState;
0274   TopTools_SequenceOfShape spine;
0275   TopTools_SequenceOfShape offsetspine;
0276   Handle(TColStd_HArray1OfReal) abscissa;
0277   Handle(TColStd_HArray1OfReal) offset_abscissa;
0278   Standard_Real tolesp;
0279   Standard_Real firstparam;
0280   Standard_Real lastparam;
0281   Standard_Boolean firstprolon;
0282   Standard_Boolean lastprolon;
0283   Standard_Boolean firstistgt;
0284   Standard_Boolean lastistgt;
0285   Standard_Real firsttgtpar;
0286   Standard_Real lasttgtpar;
0287   Standard_Boolean hasfirsttgt;
0288   Standard_Boolean haslasttgt;
0289   gp_Pnt firstori;
0290   gp_Pnt lastori;
0291   gp_Vec firsttgt;
0292   gp_Vec lasttgt;
0293   Standard_Real valref;
0294   Standard_Boolean hasref;
0295   ChFiDS_ErrorStatus errorstate;
0296 
0297 
0298 };
0299 
0300 
0301 #include <ChFiDS_Spine.lxx>
0302 
0303 
0304 
0305 
0306 
0307 #endif // _ChFiDS_Spine_HeaderFile