Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:34

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