| 1 | // Created on: 1998-01-14 |
| 2 | // Created by: Philippe MANGIN |
| 3 | // Copyright (c) 1998-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 | #ifndef _BRepFill_LocationLaw_HeaderFile |
| 18 | #define _BRepFill_LocationLaw_HeaderFile |
| 19 | |
| 20 | #include <Standard.hxx> |
| 21 | #include <Standard_Type.hxx> |
| 22 | |
| 23 | #include <TopoDS_Wire.hxx> |
| 24 | #include <Standard_Real.hxx> |
| 25 | #include <GeomFill_HArray1OfLocationLaw.hxx> |
| 26 | #include <TColStd_HArray1OfReal.hxx> |
| 27 | #include <TopTools_HArray1OfShape.hxx> |
| 28 | #include <TColStd_HArray1OfInteger.hxx> |
| 29 | #include <Standard_Integer.hxx> |
| 30 | #include <MMgt_TShared.hxx> |
| 31 | #include <GeomFill_PipeError.hxx> |
| 32 | #include <TColStd_Array1OfInteger.hxx> |
| 33 | #include <Standard_Boolean.hxx> |
| 34 | class Standard_OutOfRange; |
| 35 | class TopoDS_Wire; |
| 36 | class GeomFill_LocationLaw; |
| 37 | class TopoDS_Edge; |
| 38 | class TopoDS_Vertex; |
| 39 | class TopoDS_Shape; |
| 40 | |
| 41 | |
| 42 | class BRepFill_LocationLaw; |
| 43 | DEFINE_STANDARD_HANDLE(BRepFill_LocationLaw, MMgt_TShared) |
| 44 | |
| 45 | //! Location Law on a Wire. |
| 46 | class BRepFill_LocationLaw : public MMgt_TShared |
| 47 | { |
| 48 | |
| 49 | public: |
| 50 | |
| 51 | |
| 52 | //! Return a error status, if the status is not PipeOk then |
| 53 | //! it exist a parameter tlike the law is not valuable for t. |
| 54 | Standard_EXPORT GeomFill_PipeError GetStatus() const; |
| 55 | |
| 56 | //! Apply a linear transformation on each law, to have |
| 57 | //! continuity of the global law beetween the edges. |
| 58 | Standard_EXPORT virtual void TransformInG0Law(); |
| 59 | |
| 60 | //! Apply a linear transformation on each law, to reduce |
| 61 | //! the dicontinuities of law at one rotation. |
| 62 | Standard_EXPORT virtual void TransformInCompatibleLaw (const Standard_Real AngularTolerance); |
| 63 | |
| 64 | Standard_EXPORT void DeleteTransform(); |
| 65 | |
| 66 | Standard_EXPORT Standard_Integer NbHoles (const Standard_Real Tol = 1.0e-7); |
| 67 | |
| 68 | Standard_EXPORT void Holes (TColStd_Array1OfInteger& Interval) const; |
| 69 | |
| 70 | //! Return the number of elementary Law |
| 71 | Standard_EXPORT Standard_Integer NbLaw() const; |
| 72 | |
| 73 | //! Return the elementary Law of rank <Index> |
| 74 | //! <Index> have to be in [1, NbLaw()] |
| 75 | Standard_EXPORT const Handle(GeomFill_LocationLaw)& Law (const Standard_Integer Index) const; |
| 76 | |
| 77 | //! return the path |
| 78 | Standard_EXPORT const TopoDS_Wire& Wire() const; |
| 79 | |
| 80 | //! Return the Edge of rank <Index> in the path |
| 81 | //! <Index> have to be in [1, NbLaw()] |
| 82 | Standard_EXPORT const TopoDS_Edge& Edge (const Standard_Integer Index) const; |
| 83 | |
| 84 | //! Return the vertex of rank <Index> in the path |
| 85 | //! <Index> have to be in [0, NbLaw()] |
| 86 | Standard_EXPORT TopoDS_Vertex Vertex (const Standard_Integer Index) const; |
| 87 | |
| 88 | //! Compute <OutputVertex> like a transformation of |
| 89 | //! <InputVertex> the transformation is given by |
| 90 | //! evaluation of the location law in the vertex of |
| 91 | //! rank <Index>. |
| 92 | //! <Location> is used to manage discontinuities : |
| 93 | //! - -1 : The law before the vertex is used. |
| 94 | //! - 1 : The law after the vertex is used. |
| 95 | //! - 0 : Average of the both laws is used. |
| 96 | Standard_EXPORT void PerformVertex (const Standard_Integer Index, const TopoDS_Vertex& InputVertex, const Standard_Real TolMin, TopoDS_Vertex& OutputVertex, const Standard_Integer Location = 0) const; |
| 97 | |
| 98 | //! Return the Curvilinear Bounds of the <Index> Law |
| 99 | Standard_EXPORT void CurvilinearBounds (const Standard_Integer Index, Standard_Real& First, Standard_Real& Last) const; |
| 100 | |
| 101 | Standard_EXPORT Standard_Boolean IsClosed() const; |
| 102 | |
| 103 | //! Compute the Law's continuity beetween 2 edges of the path |
| 104 | //! The result can be : |
| 105 | //! -1 : Case Not connex |
| 106 | //! 0 : It is connex (G0) |
| 107 | //! 1 : It is tangent (G1) |
| 108 | Standard_EXPORT Standard_Integer IsG1 (const Standard_Integer Index, const Standard_Real SpatialTolerance = 1.0e-7, const Standard_Real AngularTolerance = 1.0e-4) const; |
| 109 | |
| 110 | //! Apply the Law to a shape, for a given Curnilinear abscissa |
| 111 | Standard_EXPORT void D0 (const Standard_Real Abscissa, TopoDS_Shape& Section); |
| 112 | |
| 113 | //! Find the index Law and the parmaeter, for a given |
| 114 | //! Curnilinear abscissa |
| 115 | Standard_EXPORT void Parameter (const Standard_Real Abscissa, Standard_Integer& Index, Standard_Real& Param); |
| 116 | |
| 117 | //! Return the curvilinear abscissa corresponding to a point |
| 118 | //! of the path, defined by <Index> of Edge and a |
| 119 | //! parameter on the edge. |
| 120 | Standard_EXPORT Standard_Real Abscissa (const Standard_Integer Index, const Standard_Real Param); |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | DEFINE_STANDARD_RTTIEXT(BRepFill_LocationLaw,MMgt_TShared) |
| 126 | |
| 127 | protected: |
| 128 | |
| 129 | |
| 130 | //! Initialize all the fields, this methode have to |
| 131 | //! be called by the constructors of Inherited class. |
| 132 | Standard_EXPORT void Init (const TopoDS_Wire& Path); |
| 133 | |
| 134 | //! To preseve if possible the Tangent in transformations |
| 135 | //! It is the default mode. |
| 136 | Standard_EXPORT void TangentIsMain(); |
| 137 | |
| 138 | //! To preseve if possible the Normal in transformations |
| 139 | Standard_EXPORT void NormalIsMain(); |
| 140 | |
| 141 | //! To preseve if possible the BiNormal in transformations |
| 142 | Standard_EXPORT void BiNormalIsMain(); |
| 143 | |
| 144 | TopoDS_Wire myPath; |
| 145 | Standard_Real myTol; |
| 146 | Handle(GeomFill_HArray1OfLocationLaw) myLaws; |
| 147 | Handle(TColStd_HArray1OfReal) myLength; |
| 148 | Handle(TopTools_HArray1OfShape) myEdges; |
| 149 | Handle(TColStd_HArray1OfInteger) myDisc; |
| 150 | |
| 151 | |
| 152 | private: |
| 153 | |
| 154 | |
| 155 | Standard_Integer myType; |
| 156 | |
| 157 | |
| 158 | }; |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | #endif // _BRepFill_LocationLaw_HeaderFile |