1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef _GEOMUtils_Hatcher_HXX_
24 #define _GEOMUtils_Hatcher_HXX_
27 #include <Geom2dHatch_Hatcher.hxx>
28 #include <GeomAbs_IsoType.hxx>
29 #include <TColStd_HArray1OfInteger.hxx>
30 #include <TColStd_HArray1OfReal.hxx>
31 #include <TopoDS_Face.hxx>
35 * This class represents a hatcher for topological faces.
44 * Constructor. Initializes the object with the face.
46 Standard_EXPORT Hatcher(const TopoDS_Face &theFace);
49 * This method initializes the hatcher with hatchings.
51 * \param theNbIsos the number of U- and V-isolines.
53 Standard_EXPORT void Init(const Standard_Integer theNbIsos);
56 * This method initializes the hatcher with hatchings.
58 * \param theNbIsoU the number of U-isolines.
59 * \param theNbIsoV the number of V-isolines.
61 Standard_EXPORT void Init(const Standard_Integer theNbIsoU,
62 const Standard_Integer theNbIsoV);
65 * This method initializes the hatcher with a hatching.
67 * \param theIsoType the isoline type.
68 * \param theParameter the isoline parameter.
70 Standard_EXPORT void Init(const GeomAbs_IsoType theIsoType,
71 const Standard_Real theParameter);
74 * Compute hatching domatins.
76 Standard_EXPORT void Perform();
79 * This method returns true if at least one hatching's domains
80 * are computed successfully.
82 * \return Standard_True is case of success.
84 Standard_Boolean IsDone() const
88 * This method returns the initial face.
90 * \return the initial face.
92 const TopoDS_Face &GetFace() const
96 * This method returns the number of domains for a particular hatching.
97 * If the operation is not done or there is no real hatching for
98 * a particular index a negative value is returned.
100 * \param theHatchingIndex the hatching index.
101 * \return the number of domains computed for the hatching.
103 Standard_EXPORT Standard_Integer GetNbDomains
104 (const Standard_Integer theHatchingIndex) const;
107 * This method returns the domputed domain range computed for a particular
108 * hatching. theDomainIndex should be in the range [1..GetNbDomains].
110 * \param theHatchingIndex the hatching index.
111 * \param theDomainIndex the domain index for the particular hatching.
112 * \param theParam1 (output) the first parameter of the domain.
113 * \param theParam2 (output) the last parameter of the domain.
114 * \return Standard_True in case of success; Standard_False otherwise.
116 Standard_EXPORT Standard_Boolean GetDomain
117 (const Standard_Integer theHatchingIndex,
118 const Standard_Integer theDomainIndex,
119 Standard_Real &theParam1,
120 Standard_Real &theParam2) const;
123 * This method returns Standard_True if a domain has infinite first
126 * \param theHatchingIndex the hatching index.
127 * \param theDomainIndex the domain index for the particular hatching.
128 * \return Standard_True if a domain is infinite; Standard_False otherwise.
130 Standard_EXPORT Standard_Boolean IsDomainInfinite
131 (const Standard_Integer theHatchingIndex,
132 const Standard_Integer theDomainIndex) const;
135 * This method returns the reference to OCCT hatcher.
137 * \return the reference to OCCT hatcher.
139 Standard_EXPORT const Geom2dHatch_Hatcher &GetHatcher() const
140 { return myHatcher; }
143 * This method returns the array of indices of U-isoline hatchings.
144 * Can be null if the object is initialized by 0 U-isolines.
146 * \return the array of U-isoline hatching indices.
148 Standard_EXPORT const Handle(TColStd_HArray1OfInteger) &GetUIndices() const
152 * This method returns the array of indices of V-isoline hatchings.
153 * Can be null if the object is initialized by 0 V-isolines.
155 * \return the array of V-isoline hatching indices.
157 Standard_EXPORT const Handle(TColStd_HArray1OfInteger) &GetVIndices() const
161 * This method returns the array of parameters of U-isoline hatchings.
162 * Can be null if the object is initialized by 0 U-isolines.
164 * \return the array of U-isoline hatching parameters.
166 Standard_EXPORT const Handle(TColStd_HArray1OfReal) &GetUParams() const
170 * This method returns the array of parameters of V-isoline hatchings.
171 * Can be null if the object is initialized by 0 V-isolines.
173 * \return the array of V-isoline hatching parameters.
175 Standard_EXPORT const Handle(TColStd_HArray1OfReal) &GetVParams() const
179 * This method returns a hatching curve by its index.
180 * If the curve is not found null handle is returned.
182 * \param theHatchingIndex the hatching curve index.
184 Standard_EXPORT const Handle(Geom2d_Curve) &GetHatching
185 (const Standard_Integer theHatchingIndex) const;
190 * This method clears all hatchings data.
196 Geom2dHatch_Hatcher myHatcher;
198 Standard_Boolean myIsDone;
199 Standard_Real myUMin;
200 Standard_Real myUMax;
201 Standard_Real myVMin;
202 Standard_Real myVMax;
203 Handle(TColStd_HArray1OfReal) myUPrm;
204 Handle(TColStd_HArray1OfReal) myVPrm;
205 Handle(TColStd_HArray1OfInteger) myUInd;
206 Handle(TColStd_HArray1OfInteger) myVInd;