1 // Copyright (C) 2007-2013 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.
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.
37 class GEOMUtils_Hatcher {
42 * Constructor. Initializes the object with the face.
44 Standard_EXPORT GEOMUtils_Hatcher(const TopoDS_Face &theFace);
47 * This method initializes the hatcher with hatchings.
49 * \param theNbIsos the number of U- and V-isolines.
51 Standard_EXPORT void Init(const Standard_Integer theNbIsos);
54 * This method initializes the hatcher with hatchings.
56 * \param theNbIsoU the number of U-isolines.
57 * \param theNbIsoV the number of V-isolines.
59 Standard_EXPORT void Init(const Standard_Integer theNbIsoU,
60 const Standard_Integer theNbIsoV);
63 * This method initializes the hatcher with a hatching.
65 * \param theIsoType the isoline type.
66 * \param theParameter the isoline parameter.
68 Standard_EXPORT void Init(const GeomAbs_IsoType theIsoType,
69 const Standard_Real theParameter);
72 * Compute hatching domatins.
74 Standard_EXPORT void Perform();
77 * This method returns true if at least one hatching's domains
78 * are computed successfully.
80 * \return Standard_True is case of success.
82 Standard_Boolean IsDone() const
86 * This method returns the initial face.
88 * \return the initial face.
90 const TopoDS_Face &GetFace() const
94 * This method returns the number of domains for a particular hatching.
95 * If the operation is not done or there is no real hatching for
96 * a particular index a negative value is returned.
98 * \param theHatchingIndex the hatching index.
99 * \return the number of domains computed for the hatching.
101 Standard_EXPORT Standard_Integer GetNbDomains
102 (const Standard_Integer theHatchingIndex) const;
105 * This method returns the domputed domain range computed for a particular
106 * hatching. theDomainIndex should be in the range [1..GetNbDomains].
108 * \param theHatchingIndex the hatching index.
109 * \param theDomainIndex the domain index for the particular hatching.
110 * \param theParam1 (output) the first parameter of the domain.
111 * \param theParam2 (output) the last parameter of the domain.
112 * \return Standard_True in case of success; Standard_False otherwise.
114 Standard_EXPORT Standard_Boolean GetDomain
115 (const Standard_Integer theHatchingIndex,
116 const Standard_Integer theDomainIndex,
117 Standard_Real &theParam1,
118 Standard_Real &theParam2) const;
121 * This method returns Standard_True if a domain has infinite first
124 * \param theHatchingIndex the hatching index.
125 * \param theDomainIndex the domain index for the particular hatching.
126 * \return Standard_True if a domain is infinite; Standard_False otherwise.
128 Standard_EXPORT Standard_Boolean IsDomainInfinite
129 (const Standard_Integer theHatchingIndex,
130 const Standard_Integer theDomainIndex) const;
133 * This method returns the reference to OCCT hatcher.
135 * \return the reference to OCCT hatcher.
137 Standard_EXPORT const Geom2dHatch_Hatcher &GetHatcher() const
138 { return myHatcher; }
141 * This method returns the array of indices of U-isoline hatchings.
142 * Can be null if the object is initialized by 0 U-isolines.
144 * \return the array of U-isoline hatching indices.
146 Standard_EXPORT const Handle(TColStd_HArray1OfInteger) &GetUIndices() const
150 * This method returns the array of indices of V-isoline hatchings.
151 * Can be null if the object is initialized by 0 V-isolines.
153 * \return the array of V-isoline hatching indices.
155 Standard_EXPORT const Handle(TColStd_HArray1OfInteger) &GetVIndices() const
159 * This method returns the array of parameters of U-isoline hatchings.
160 * Can be null if the object is initialized by 0 U-isolines.
162 * \return the array of U-isoline hatching parameters.
164 Standard_EXPORT const Handle(TColStd_HArray1OfReal) &GetUParams() const
168 * This method returns the array of parameters of V-isoline hatchings.
169 * Can be null if the object is initialized by 0 V-isolines.
171 * \return the array of V-isoline hatching parameters.
173 Standard_EXPORT const Handle(TColStd_HArray1OfReal) &GetVParams() const
177 * This method returns a hatching curve by its index.
178 * If the curve is not found null handle is returned.
180 * \param theHatchingIndex the hatching curve index.
182 Standard_EXPORT const Handle(Geom2d_Curve) &GetHatching
183 (const Standard_Integer theHatchingIndex) const;
188 * This method clears all hatchings data.
194 Geom2dHatch_Hatcher myHatcher;
196 Standard_Boolean myIsDone;
197 Standard_Real myUMin;
198 Standard_Real myUMax;
199 Standard_Real myVMin;
200 Standard_Real myVMax;
201 Handle(TColStd_HArray1OfReal) myUPrm;
202 Handle(TColStd_HArray1OfReal) myVPrm;
203 Handle(TColStd_HArray1OfInteger) myUInd;
204 Handle(TColStd_HArray1OfInteger) myVInd;