Warning, /include/opencascade/Geom2dHatch_Hatcher.lxx is written in an unsupported language. File is not indexed.
0001 // Created on: 1995-01-03
0002 // Created by: Laurent BUCHARD
0003 // Copyright (c) 1995-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 #define RAISE_IF_NOSUCHOBJECT 0
0018 #define TRACE 0
0019
0020 #include <StdFail_NotDone.hxx>
0021
0022 #include <Geom2dAdaptor_Curve.hxx>
0023 #include <Geom2dHatch_Intersector.hxx>
0024 #include <Geom2dHatch_Hatching.hxx>
0025 #include <Geom2dHatch_Element.hxx>
0026
0027 //=======================================================================
0028 // Function : Intersector
0029 // Purpose : Returns the associated intersector.
0030 //=======================================================================
0031
0032 inline const Geom2dHatch_Intersector& Geom2dHatch_Hatcher::Intersector()
0033 {
0034 return myIntersector;
0035 }
0036
0037 //=======================================================================
0038 // Function : ChangeIntersector
0039 // Purpose : Returns the associated intersector.
0040 //=======================================================================
0041
0042 inline Geom2dHatch_Intersector& Geom2dHatch_Hatcher::ChangeIntersector()
0043 {
0044 return myIntersector;
0045 }
0046
0047 //=======================================================================
0048 // Function : Confusion2d
0049 // Purpose : Returns the 2d confusion tolerance.
0050 //=======================================================================
0051
0052 inline double Geom2dHatch_Hatcher::Confusion2d() const
0053 {
0054 return myConfusion2d;
0055 }
0056
0057 //=======================================================================
0058 // Function : Confusion3d
0059 // Purpose : Returns the 3d confusion tolerance.
0060 //=======================================================================
0061
0062 inline double Geom2dHatch_Hatcher::Confusion3d() const
0063 {
0064 return myConfusion3d;
0065 }
0066
0067 //=======================================================================
0068 // Function : KeepPoints
0069 // Purpose : Returns the flag about the points consideration.
0070 //=======================================================================
0071
0072 inline bool Geom2dHatch_Hatcher::KeepPoints() const
0073 {
0074 return myKeepPoints;
0075 }
0076
0077 //=======================================================================
0078 // Function : KeepSegments
0079 // Purpose : Returns the flag about the segments consideration.
0080 //=======================================================================
0081
0082 inline bool Geom2dHatch_Hatcher::KeepSegments() const
0083 {
0084 return myKeepSegments;
0085 }
0086
0087 //=======================================================================
0088 // Function : Clear
0089 // Purpose : Removes all the hatchings and all the elements.
0090 //=======================================================================
0091
0092 inline void Geom2dHatch_Hatcher::Clear()
0093 {
0094 if (myNbHatchings != 0)
0095 ClrHatchings();
0096 if (myNbElements != 0)
0097 ClrElements();
0098 }
0099
0100 //=================================================================================================
0101
0102 inline Geom2dHatch_Element& Geom2dHatch_Hatcher::Element(const int IndE)
0103 {
0104 #if RAISE_IF_NOSUCHOBJECT
0105 Standard_NoSuchObject_Raise_if(!myElements.IsBound(IndE), "");
0106 #endif
0107 Geom2dHatch_Element& Element = myElements.ChangeFind(IndE);
0108 return Element;
0109 }
0110
0111 //=======================================================================
0112 // Function : ElementCurve
0113 // Purpose : Returns the curve associated to the IndE-th element.
0114 //=======================================================================
0115
0116 inline const Geom2dAdaptor_Curve& Geom2dHatch_Hatcher::ElementCurve(const int IndE) const
0117 {
0118 #if RAISE_IF_NOSUCHOBJECT
0119 Standard_NoSuchObject_Raise_if(!myElements.IsBound(IndE), "");
0120 #endif
0121 const Geom2dHatch_Element& Element = myElements.Find(IndE);
0122 return Element.Curve();
0123 }
0124
0125 //=================================================================================================
0126
0127 inline Geom2dHatch_Hatching& Geom2dHatch_Hatcher::Hatching(const int IndH)
0128 {
0129 #if RAISE_IF_NOSUCHOBJECT
0130 Standard_NoSuchObject_Raise_if(!myHatchings.IsBound(IndH), "");
0131 #endif
0132 Geom2dHatch_Hatching& Hatching = myHatchings.ChangeFind(IndH);
0133 return Hatching;
0134 }
0135
0136 //=======================================================================
0137 // Function : HatchingCurve
0138 // Purpose : Returns the curve associated to the IndH-th hatching.
0139 //=======================================================================
0140
0141 inline const Geom2dAdaptor_Curve& Geom2dHatch_Hatcher::HatchingCurve(const int IndH) const
0142 {
0143 #if RAISE_IF_NOSUCHOBJECT
0144 Standard_NoSuchObject_Raise_if(!myHatchings.IsBound(IndH), "");
0145 #endif
0146 const Geom2dHatch_Hatching& Hatching = myHatchings.Find(IndH);
0147 return Hatching.Curve();
0148 }
0149
0150 //=======================================================================
0151 // Function : NbPoints
0152 // Purpose : Returns the number of intersection points of the IndH-th
0153 // hatching.
0154 //=======================================================================
0155
0156 inline int Geom2dHatch_Hatcher::NbPoints(const int IndH) const
0157 {
0158 #if RAISE_IF_NOSUCHOBJECT
0159 Standard_NoSuchObject_Raise_if(!myHatchings.IsBound(IndH), "");
0160 #endif
0161 const Geom2dHatch_Hatching& Hatching = myHatchings.Find(IndH);
0162 return Hatching.NbPoints();
0163 }
0164
0165 //=======================================================================
0166 // Function : Point
0167 // Purpose : Returns the IndP-th intersection point of the IndH-th
0168 // hatching.
0169 //=======================================================================
0170
0171 inline const HatchGen_PointOnHatching& Geom2dHatch_Hatcher::Point(const int IndH,
0172 const int IndP) const
0173 {
0174 #if RAISE_IF_NOSUCHOBJECT
0175 Standard_NoSuchObject_Raise_if(!myHatchings.IsBound(IndH), "");
0176 #endif
0177 const Geom2dHatch_Hatching& Hatching = myHatchings.Find(IndH);
0178 #if RAISE_IF_NOSUCHOBJECT
0179 Standard_OutOfRange_Raise_if(IndP < 0 || IndP > Hatching.NbPoints(), "");
0180 #endif
0181 const HatchGen_PointOnHatching& PntH = Hatching.Point(IndP);
0182 return PntH;
0183 }
0184
0185 //=======================================================================
0186 // Function : TrimDone
0187 // Purpose : Returns the fact that all the intersections were computed
0188 // for the IndH-th hatching.
0189 //=======================================================================
0190
0191 inline bool Geom2dHatch_Hatcher::TrimDone(const int IndH) const
0192 {
0193 #if RAISE_IF_NOSUCHOBJECT
0194 Standard_NoSuchObject_Raise_if(!myHatchings.IsBound(IndH), "");
0195 #endif
0196 const Geom2dHatch_Hatching& Hatching = myHatchings.Find(IndH);
0197 return Hatching.TrimDone();
0198 }
0199
0200 //=======================================================================
0201 // Function : TrimFailed
0202 // Purpose : Returns the fact that all the intersections failed
0203 // for the IndH-th hatching.
0204 //=======================================================================
0205
0206 inline bool Geom2dHatch_Hatcher::TrimFailed(const int IndH) const
0207 {
0208 #if RAISE_IF_NOSUCHOBJECT
0209 Standard_NoSuchObject_Raise_if(!myHatchings.IsBound(IndH), "");
0210 #endif
0211 const Geom2dHatch_Hatching& Hatching = myHatchings.Find(IndH);
0212 return Hatching.TrimFailed();
0213 }
0214
0215 //=======================================================================
0216 // Function : IsDone
0217 // Purpose : Returns the fact that all the domains were computed
0218 // for the IndH-th hatching.
0219 //=======================================================================
0220
0221 inline bool Geom2dHatch_Hatcher::IsDone(const int IndH) const
0222 {
0223 #if RAISE_IF_NOSUCHOBJECT
0224 Standard_NoSuchObject_Raise_if(!myHatchings.IsBound(IndH), "");
0225 #endif
0226 const Geom2dHatch_Hatching& Hatching = myHatchings.Find(IndH);
0227 return Hatching.IsDone();
0228 }
0229
0230 //=======================================================================
0231 // Function : Status
0232 // Purpose : Returns the status about the IndH-th hatching.
0233 //=======================================================================
0234
0235 inline HatchGen_ErrorStatus Geom2dHatch_Hatcher::Status(const int IndH) const
0236 {
0237 #if RAISE_IF_NOSUCHOBJECT
0238 Standard_NoSuchObject_Raise_if(!myHatchings.IsBound(IndH), "");
0239 #endif
0240 const Geom2dHatch_Hatching& Hatching = myHatchings.Find(IndH);
0241 return Hatching.Status();
0242 }
0243
0244 //=======================================================================
0245 // Function : NbDomains
0246 // Purpose : Returns the number of domains of the IndH-th hatching.
0247 //=======================================================================
0248
0249 inline int Geom2dHatch_Hatcher::NbDomains(const int IndH) const
0250 {
0251 #if RAISE_IF_NOSUCHOBJECT
0252 Standard_NoSuchObject_Raise_if(!myHatchings.IsBound(IndH), "");
0253 #endif
0254 const Geom2dHatch_Hatching& Hatching = myHatchings.Find(IndH);
0255 StdFail_NotDone_Raise_if(!Hatching.IsDone(), "Geom2dHatch_Hatcher::NbDomains");
0256 return Hatching.NbDomains();
0257 }