1 // Created on: 1992-04-06
2 // Created by: Christophe MARION
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _HLRAlgo_EdgesBlock_HeaderFile
18 #define _HLRAlgo_EdgesBlock_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <TColStd_Array1OfInteger.hxx>
24 #include <TColStd_Array1OfBoolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Transient.hxx>
27 #include <TopAbs_Orientation.hxx>
28 #include <Standard_Boolean.hxx>
31 class HLRAlgo_EdgesBlock;
32 DEFINE_STANDARD_HANDLE(HLRAlgo_EdgesBlock, Standard_Transient)
34 //! An EdgesBlock is a set of Edges. It is used by the
35 //! DataStructure to structure the Edges.
37 //! An EdgesBlock contains :
39 //! * An Array of index of Edges.
41 //! * An Array of flagsf ( Orientation
46 class HLRAlgo_EdgesBlock : public Standard_Transient
52 Standard_Integer Min[8], Max[8];
54 MinMaxIndices& Minimize(const MinMaxIndices& theMinMaxIndices)
56 for (Standard_Integer aI = 0; aI < 8; ++aI)
58 if (Min[aI] > theMinMaxIndices.Min[aI])
60 Min[aI] = theMinMaxIndices.Min[aI];
62 if (Max[aI] > theMinMaxIndices.Max[aI])
64 Max[aI] = theMinMaxIndices.Max[aI];
70 MinMaxIndices& Maximize(const MinMaxIndices& theMinMaxIndices)
72 for (Standard_Integer aI = 0; aI < 8; ++aI)
74 if (Min[aI] < theMinMaxIndices.Min[aI])
76 Min[aI] = theMinMaxIndices.Min[aI];
78 if (Max[aI] < theMinMaxIndices.Max[aI])
80 Max[aI] = theMinMaxIndices.Max[aI];
87 //! Create a Block of Edges for a wire.
88 Standard_EXPORT HLRAlgo_EdgesBlock(const Standard_Integer NbEdges);
90 Standard_Integer NbEdges() const { return myEdges.Upper(); }
92 void Edge (const Standard_Integer I, const Standard_Integer EI) { myEdges(I) = EI; }
94 Standard_Integer Edge (const Standard_Integer I) const { return myEdges(I); }
96 void Orientation (const Standard_Integer I, const TopAbs_Orientation Or)
98 myFlags(I) &= ~EMaskOrient;
99 myFlags(I) |= (Or & EMaskOrient);
102 TopAbs_Orientation Orientation (const Standard_Integer I) const
104 return ((TopAbs_Orientation)(myFlags(I) & EMaskOrient));
107 Standard_Boolean OutLine (const Standard_Integer I) const { return (myFlags(I) & EMaskOutLine) != 0; }
109 void OutLine (const Standard_Integer I, const Standard_Boolean B)
111 if (B) myFlags(I) |= EMaskOutLine;
112 else myFlags(I) &= ~EMaskOutLine;
115 Standard_Boolean Internal (const Standard_Integer I) const { return (myFlags(I) & EMaskInternal) != 0; }
117 void Internal (const Standard_Integer I, const Standard_Boolean B)
119 if (B) myFlags(I) |= EMaskInternal;
120 else myFlags(I) &= ~EMaskInternal;
123 Standard_Boolean Double (const Standard_Integer I) const { return (myFlags(I) & EMaskDouble) != 0; }
125 void Double (const Standard_Integer I, const Standard_Boolean B)
127 if (B) myFlags(I) |= EMaskDouble;
128 else myFlags(I) &= ~EMaskDouble;
131 Standard_Boolean IsoLine (const Standard_Integer I) const { return (myFlags(I) & EMaskIsoLine) != 0; }
133 void IsoLine (const Standard_Integer I, const Standard_Boolean B)
135 if (B) myFlags(I) |= EMaskIsoLine;
136 else myFlags(I) &= ~EMaskIsoLine;
139 void UpdateMinMax(const MinMaxIndices& TotMinMax)
141 myMinMax = TotMinMax;
144 MinMaxIndices& MinMax()
149 DEFINE_STANDARD_RTTIEXT(HLRAlgo_EdgesBlock,Standard_Transient)
164 TColStd_Array1OfInteger myEdges;
165 TColStd_Array1OfInteger myFlags;
166 MinMaxIndices myMinMax;
169 #endif // _HLRAlgo_EdgesBlock_HeaderFile