-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
/*!
* This class represents a hatcher for topological faces.
*/
-class GEOMUtils_Hatcher {
-
-public:
-
- /**
- * Constructor. Initializes the object with the face.
- */
- Standard_EXPORT GEOMUtils_Hatcher(const TopoDS_Face &theFace);
-
- /**
- * This method initializes the hatcher with hatchings.
- *
- * \param theNbIsos the number of U- and V-isolines.
- */
- Standard_EXPORT void Init(const Standard_Integer theNbIsos);
-
- /**
- * This method initializes the hatcher with hatchings.
- *
- * \param theNbIsoU the number of U-isolines.
- * \param theNbIsoV the number of V-isolines.
- */
- Standard_EXPORT void Init(const Standard_Integer theNbIsoU,
- const Standard_Integer theNbIsoV);
-
- /**
- * This method initializes the hatcher with a hatching.
- *
- * \param theIsoType the isoline type.
- * \param theParameter the isoline parameter.
- */
- Standard_EXPORT void Init(const GeomAbs_IsoType theIsoType,
- const Standard_Real theParameter);
-
- /**
- * Compute hatching domatins.
- */
- Standard_EXPORT void Perform();
-
- /**
- * This method returns true if at least one hatching's domains
- * are computed successfully.
- *
- * \return Standard_True is case of success.
- */
- Standard_Boolean IsDone() const
- { return myIsDone; }
-
- /**
- * This method returns the initial face.
- *
- * \return the initial face.
- */
- const TopoDS_Face &GetFace() const
- { return myFace; }
-
- /**
- * This method returns the number of domains for a particular hatching.
- * If the operation is not done or there is no real hatching for
- * a particular index a negative value is returned.
- *
- * \param theHatchingIndex the hatching index.
- * \return the number of domains computed for the hatching.
- */
- Standard_EXPORT Standard_Integer GetNbDomains
- (const Standard_Integer theHatchingIndex) const;
-
- /**
- * This method returns the domputed domain range computed for a particular
- * hatching. theDomainIndex should be in the range [1..GetNbDomains].
- *
- * \param theHatchingIndex the hatching index.
- * \param theDomainIndex the domain index for the particular hatching.
- * \param theParam1 (output) the first parameter of the domain.
- * \param theParam2 (output) the last parameter of the domain.
- * \return Standard_True in case of success; Standard_False otherwise.
- */
- Standard_EXPORT Standard_Boolean GetDomain
- (const Standard_Integer theHatchingIndex,
- const Standard_Integer theDomainIndex,
- Standard_Real &theParam1,
- Standard_Real &theParam2) const;
-
- /**
- * This method returns Standard_True if a domain has infinite first
- * or last parameter.
- *
- * \param theHatchingIndex the hatching index.
- * \param theDomainIndex the domain index for the particular hatching.
- * \return Standard_True if a domain is infinite; Standard_False otherwise.
- */
- Standard_EXPORT Standard_Boolean IsDomainInfinite
- (const Standard_Integer theHatchingIndex,
- const Standard_Integer theDomainIndex) const;
-
- /**
- * This method returns the reference to OCCT hatcher.
- *
- * \return the reference to OCCT hatcher.
- */
- Standard_EXPORT const Geom2dHatch_Hatcher &GetHatcher() const
- { return myHatcher; }
-
- /**
- * This method returns the array of indices of U-isoline hatchings.
- * Can be null if the object is initialized by 0 U-isolines.
- *
- * \return the array of U-isoline hatching indices.
- */
- Standard_EXPORT const Handle(TColStd_HArray1OfInteger) &GetUIndices() const
- { return myUInd; }
-
- /**
- * This method returns the array of indices of V-isoline hatchings.
- * Can be null if the object is initialized by 0 V-isolines.
- *
- * \return the array of V-isoline hatching indices.
- */
- Standard_EXPORT const Handle(TColStd_HArray1OfInteger) &GetVIndices() const
- { return myVInd; }
-
- /**
- * This method returns the array of parameters of U-isoline hatchings.
- * Can be null if the object is initialized by 0 U-isolines.
- *
- * \return the array of U-isoline hatching parameters.
- */
- Standard_EXPORT const Handle(TColStd_HArray1OfReal) &GetUParams() const
- { return myUPrm; }
-
- /**
- * This method returns the array of parameters of V-isoline hatchings.
- * Can be null if the object is initialized by 0 V-isolines.
- *
- * \return the array of V-isoline hatching parameters.
- */
- Standard_EXPORT const Handle(TColStd_HArray1OfReal) &GetVParams() const
- { return myVPrm; }
-
- /**
- * This method returns a hatching curve by its index.
- * If the curve is not found null handle is returned.
- *
- * \param theHatchingIndex the hatching curve index.
- */
- Standard_EXPORT const Handle(Geom2d_Curve) &GetHatching
- (const Standard_Integer theHatchingIndex) const;
-
-protected:
-
- /**
- * This method clears all hatchings data.
- */
- void Clear();
-
-private:
-
- Geom2dHatch_Hatcher myHatcher;
- TopoDS_Face myFace;
- Standard_Boolean myIsDone;
- Standard_Real myUMin;
- Standard_Real myUMax;
- Standard_Real myVMin;
- Standard_Real myVMax;
- Handle(TColStd_HArray1OfReal) myUPrm;
- Handle(TColStd_HArray1OfReal) myVPrm;
- Handle(TColStd_HArray1OfInteger) myUInd;
- Handle(TColStd_HArray1OfInteger) myVInd;
-
-};
+namespace GEOMUtils
+{
+ class Hatcher
+ {
+ public:
+
+ /**
+ * Constructor. Initializes the object with the face.
+ */
+ Standard_EXPORT Hatcher(const TopoDS_Face &theFace);
+
+ /**
+ * This method initializes the hatcher with hatchings.
+ *
+ * \param theNbIsos the number of U- and V-isolines.
+ */
+ Standard_EXPORT void Init(const Standard_Integer theNbIsos);
+
+ /**
+ * This method initializes the hatcher with hatchings.
+ *
+ * \param theNbIsoU the number of U-isolines.
+ * \param theNbIsoV the number of V-isolines.
+ */
+ Standard_EXPORT void Init(const Standard_Integer theNbIsoU,
+ const Standard_Integer theNbIsoV);
+
+ /**
+ * This method initializes the hatcher with a hatching.
+ *
+ * \param theIsoType the isoline type.
+ * \param theParameter the isoline parameter.
+ */
+ Standard_EXPORT void Init(const GeomAbs_IsoType theIsoType,
+ const Standard_Real theParameter);
+
+ /**
+ * Compute hatching domatins.
+ */
+ Standard_EXPORT void Perform();
+
+ /**
+ * This method returns true if at least one hatching's domains
+ * are computed successfully.
+ *
+ * \return Standard_True is case of success.
+ */
+ Standard_Boolean IsDone() const
+ { return myIsDone; }
+
+ /**
+ * This method returns the initial face.
+ *
+ * \return the initial face.
+ */
+ const TopoDS_Face &GetFace() const
+ { return myFace; }
+
+ /**
+ * This method returns the number of domains for a particular hatching.
+ * If the operation is not done or there is no real hatching for
+ * a particular index a negative value is returned.
+ *
+ * \param theHatchingIndex the hatching index.
+ * \return the number of domains computed for the hatching.
+ */
+ Standard_EXPORT Standard_Integer GetNbDomains
+ (const Standard_Integer theHatchingIndex) const;
+
+ /**
+ * This method returns the domputed domain range computed for a particular
+ * hatching. theDomainIndex should be in the range [1..GetNbDomains].
+ *
+ * \param theHatchingIndex the hatching index.
+ * \param theDomainIndex the domain index for the particular hatching.
+ * \param theParam1 (output) the first parameter of the domain.
+ * \param theParam2 (output) the last parameter of the domain.
+ * \return Standard_True in case of success; Standard_False otherwise.
+ */
+ Standard_EXPORT Standard_Boolean GetDomain
+ (const Standard_Integer theHatchingIndex,
+ const Standard_Integer theDomainIndex,
+ Standard_Real &theParam1,
+ Standard_Real &theParam2) const;
+
+ /**
+ * This method returns Standard_True if a domain has infinite first
+ * or last parameter.
+ *
+ * \param theHatchingIndex the hatching index.
+ * \param theDomainIndex the domain index for the particular hatching.
+ * \return Standard_True if a domain is infinite; Standard_False otherwise.
+ */
+ Standard_EXPORT Standard_Boolean IsDomainInfinite
+ (const Standard_Integer theHatchingIndex,
+ const Standard_Integer theDomainIndex) const;
+
+ /**
+ * This method returns the reference to OCCT hatcher.
+ *
+ * \return the reference to OCCT hatcher.
+ */
+ Standard_EXPORT const Geom2dHatch_Hatcher &GetHatcher() const
+ { return myHatcher; }
+
+ /**
+ * This method returns the array of indices of U-isoline hatchings.
+ * Can be null if the object is initialized by 0 U-isolines.
+ *
+ * \return the array of U-isoline hatching indices.
+ */
+ Standard_EXPORT const Handle(TColStd_HArray1OfInteger) &GetUIndices() const
+ { return myUInd; }
+
+ /**
+ * This method returns the array of indices of V-isoline hatchings.
+ * Can be null if the object is initialized by 0 V-isolines.
+ *
+ * \return the array of V-isoline hatching indices.
+ */
+ Standard_EXPORT const Handle(TColStd_HArray1OfInteger) &GetVIndices() const
+ { return myVInd; }
+
+ /**
+ * This method returns the array of parameters of U-isoline hatchings.
+ * Can be null if the object is initialized by 0 U-isolines.
+ *
+ * \return the array of U-isoline hatching parameters.
+ */
+ Standard_EXPORT const Handle(TColStd_HArray1OfReal) &GetUParams() const
+ { return myUPrm; }
+
+ /**
+ * This method returns the array of parameters of V-isoline hatchings.
+ * Can be null if the object is initialized by 0 V-isolines.
+ *
+ * \return the array of V-isoline hatching parameters.
+ */
+ Standard_EXPORT const Handle(TColStd_HArray1OfReal) &GetVParams() const
+ { return myVPrm; }
+
+ /**
+ * This method returns a hatching curve by its index.
+ * If the curve is not found null handle is returned.
+ *
+ * \param theHatchingIndex the hatching curve index.
+ */
+ Standard_EXPORT const Handle(Geom2d_Curve) &GetHatching
+ (const Standard_Integer theHatchingIndex) const;
+
+ protected:
+
+ /**
+ * This method clears all hatchings data.
+ */
+ void Clear();
+
+ private:
+
+ Geom2dHatch_Hatcher myHatcher;
+ TopoDS_Face myFace;
+ Standard_Boolean myIsDone;
+ Standard_Real myUMin;
+ Standard_Real myUMax;
+ Standard_Real myVMin;
+ Standard_Real myVMax;
+ Handle(TColStd_HArray1OfReal) myUPrm;
+ Handle(TColStd_HArray1OfReal) myVPrm;
+ Handle(TColStd_HArray1OfInteger) myUInd;
+ Handle(TColStd_HArray1OfInteger) myVInd;
+
+ };
+}
#endif