Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-06 08:36:01

0001 // Created on: 1993-10-25
0002 // Created by: Jean Marc LACHAUME
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 _Geom2dHatch_Hatcher_HeaderFile
0018 #define _Geom2dHatch_Hatcher_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Geom2dAdaptor_Curve.hxx>
0023 #include <Geom2dHatch_Intersector.hxx>
0024 #include <Geom2dHatch_Elements.hxx>
0025 #include <Geom2dHatch_Hatchings.hxx>
0026 #include <TopAbs_Orientation.hxx>
0027 #include <HatchGen_ErrorStatus.hxx>
0028 
0029 class HatchGen_PointOnHatching;
0030 class HatchGen_Domain;
0031 
0032 // resolve name collisions with X11 headers
0033 #ifdef Status
0034   #undef Status
0035 #endif
0036 
0037 class Geom2dHatch_Hatcher
0038 {
0039 public:
0040   DEFINE_STANDARD_ALLOC
0041 
0042   //! Returns an empty hatcher.
0043   Standard_EXPORT Geom2dHatch_Hatcher(const Geom2dHatch_Intersector& Intersector,
0044                                       const Standard_Real            Confusion2d,
0045                                       const Standard_Real            Confusion3d,
0046                                       const Standard_Boolean         KeepPnt = Standard_False,
0047                                       const Standard_Boolean         KeepSeg = Standard_False);
0048 
0049   //! Sets the associated intersector.
0050   Standard_EXPORT void Intersector(const Geom2dHatch_Intersector& Intersector);
0051 
0052   //! Returns the associated intersector.
0053   const Geom2dHatch_Intersector& Intersector();
0054 
0055   //! Returns the associated intersector.
0056   Geom2dHatch_Intersector& ChangeIntersector();
0057 
0058   //! Sets the confusion tolerance.
0059   Standard_EXPORT void Confusion2d(const Standard_Real Confusion);
0060 
0061   //! Returns the 2d confusion tolerance, i.e. the value under
0062   //! which two points are considered identical in the
0063   //! parametric space of the hatching.
0064   Standard_Real Confusion2d() const;
0065 
0066   //! Sets the confusion tolerance.
0067   Standard_EXPORT void Confusion3d(const Standard_Real Confusion);
0068 
0069   //! Returns the 3d confusion tolerance, i.e. the value under
0070   //! which two points are considered identical in the
0071   //! 3d space of the hatching.
0072   Standard_Real Confusion3d() const;
0073 
0074   //! Sets the above flag.
0075   Standard_EXPORT void KeepPoints(const Standard_Boolean Keep);
0076 
0077   //! Returns the flag about the points consideration.
0078   Standard_Boolean KeepPoints() const;
0079 
0080   //! Sets the above flag.
0081   Standard_EXPORT void KeepSegments(const Standard_Boolean Keep);
0082 
0083   //! Returns the flag about the segments consideration.
0084   Standard_Boolean KeepSegments() const;
0085 
0086   //! Removes all the hatchings and all the elements.
0087   void Clear();
0088 
0089   //! Returns the curve associated to the IndE-th element.
0090   const Geom2dAdaptor_Curve& ElementCurve(const Standard_Integer IndE) const;
0091 
0092   //! Adds an element to the hatcher and returns its index.
0093   Standard_EXPORT Standard_Integer
0094     AddElement(const Geom2dAdaptor_Curve& Curve,
0095                const TopAbs_Orientation   Orientation = TopAbs_FORWARD);
0096 
0097   //! Adds an element to the hatcher and returns its index.
0098   Standard_Integer AddElement(const Handle(Geom2d_Curve)& Curve,
0099                               const TopAbs_Orientation    Orientation = TopAbs_FORWARD)
0100   {
0101     Geom2dAdaptor_Curve aGAC(Curve);
0102     return AddElement(aGAC, Orientation);
0103   }
0104 
0105   //! Removes the IndE-th element from the hatcher.
0106   Standard_EXPORT void RemElement(const Standard_Integer IndE);
0107 
0108   //! Removes all the elements from the hatcher.
0109   Standard_EXPORT void ClrElements();
0110 
0111   //! Returns the curve associated to the IndH-th hatching.
0112   const Geom2dAdaptor_Curve& HatchingCurve(const Standard_Integer IndH) const;
0113 
0114   //! Adds a hatching to the hatcher and returns its index.
0115   Standard_EXPORT Standard_Integer AddHatching(const Geom2dAdaptor_Curve& Curve);
0116 
0117   //! Removes the IndH-th hatching from the hatcher.
0118   Standard_EXPORT void RemHatching(const Standard_Integer IndH);
0119 
0120   //! Removes all the hatchings from the hatcher.
0121   Standard_EXPORT void ClrHatchings();
0122 
0123   //! Returns the number of intersection points of
0124   //! the IndH-th hatching.
0125   Standard_Integer NbPoints(const Standard_Integer IndH) const;
0126 
0127   //! Returns the IndP-th intersection point of the
0128   //! IndH-th hatching.
0129   const HatchGen_PointOnHatching& Point(const Standard_Integer IndH,
0130                                         const Standard_Integer IndP) const;
0131 
0132   //! Trims all the hatchings of the hatcher by all the
0133   //! elements of the hatcher.
0134   Standard_EXPORT void Trim();
0135 
0136   //! Adds a hatching to the hatcher and trims it by
0137   //! the elements already given and returns its index.
0138   Standard_EXPORT Standard_Integer Trim(const Geom2dAdaptor_Curve& Curve);
0139 
0140   //! Trims the IndH-th hatching by the elements
0141   //! already given.
0142   Standard_EXPORT void Trim(const Standard_Integer IndH);
0143 
0144   //! Computes the domains of all the hatchings.
0145   Standard_EXPORT void ComputeDomains();
0146 
0147   //! Computes the domains of the IndH-th hatching.
0148   Standard_EXPORT void ComputeDomains(const Standard_Integer IndH);
0149 
0150   //! Returns the fact that the intersections were computed
0151   //! for the IndH-th hatching.
0152   Standard_Boolean TrimDone(const Standard_Integer IndH) const;
0153 
0154   //! Returns the fact that the intersections failed
0155   //! for the IndH-th hatching.
0156   Standard_Boolean TrimFailed(const Standard_Integer IndH) const;
0157 
0158   //! Returns the fact that the domains were computed
0159   //! for all the hatchings.
0160   Standard_Boolean IsDone() const;
0161 
0162   //! Returns the fact that the domains were computed
0163   //! for the IndH-th hatching.
0164   Standard_Boolean IsDone(const Standard_Integer IndH) const;
0165 
0166   //! Returns the status about the IndH-th hatching.
0167   HatchGen_ErrorStatus Status(const Standard_Integer IndH) const;
0168 
0169   //! Returns the number of domains of the IndH-th hatching.
0170   //! Only ONE "INFINITE" domain means that the hatching is
0171   //! fully included in the contour defined by the elements.
0172   Standard_Integer NbDomains(const Standard_Integer IndH) const;
0173 
0174   //! Returns the IDom-th domain of the IndH-th hatching.
0175   Standard_EXPORT const HatchGen_Domain& Domain(const Standard_Integer IndH,
0176                                                 const Standard_Integer IDom) const;
0177 
0178   //! Dump the hatcher.
0179   Standard_EXPORT void Dump() const;
0180 
0181 protected:
0182   //! Returns the IndE-th element.
0183   Geom2dHatch_Element& Element(const Standard_Integer IndE);
0184 
0185   //! Returns the IndH-th hatching.
0186   Geom2dHatch_Hatching& Hatching(const Standard_Integer IndH);
0187 
0188 private:
0189   //! Trims the IndH-th hatching of the hatcher by the
0190   //! IndE-th element.
0191   Standard_EXPORT Standard_Boolean Trim(const Standard_Integer IndH, const Standard_Integer IndE);
0192 
0193   //! Sets the global transition (the before and after
0194   //! states and segment extremities flags) of the point.
0195   Standard_EXPORT Standard_Boolean GlobalTransition(HatchGen_PointOnHatching& Point);
0196 
0197   Geom2dHatch_Intersector myIntersector;
0198   Standard_Real           myConfusion2d;
0199   Standard_Real           myConfusion3d;
0200   Standard_Boolean        myKeepPoints;
0201   Standard_Boolean        myKeepSegments;
0202   Standard_Integer        myNbElements;
0203   Geom2dHatch_Elements    myElements;
0204   Standard_Integer        myNbHatchings;
0205   Geom2dHatch_Hatchings   myHatchings;
0206 };
0207 
0208 #include <Geom2dHatch_Hatcher.lxx>
0209 
0210 #endif // _Geom2dHatch_Hatcher_HeaderFile