File indexing completed on 2026-10-04 09:14:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _HLRAlgo_EdgesBlock_HeaderFile
0018 #define _HLRAlgo_EdgesBlock_HeaderFile
0019
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022
0023 #include <Standard_Integer.hxx>
0024 #include <NCollection_Array1.hxx>
0025 #include <Standard_Transient.hxx>
0026 #include <TopAbs_Orientation.hxx>
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 class HLRAlgo_EdgesBlock : public Standard_Transient
0042 {
0043
0044 public:
0045 struct MinMaxIndices
0046 {
0047 int Min[8], Max[8];
0048
0049 MinMaxIndices& Minimize(const MinMaxIndices& theMinMaxIndices)
0050 {
0051 for (int aI = 0; aI < 8; ++aI)
0052 {
0053 if (Min[aI] > theMinMaxIndices.Min[aI])
0054 {
0055 Min[aI] = theMinMaxIndices.Min[aI];
0056 }
0057 if (Max[aI] > theMinMaxIndices.Max[aI])
0058 {
0059 Max[aI] = theMinMaxIndices.Max[aI];
0060 }
0061 }
0062 return *this;
0063 }
0064
0065 MinMaxIndices& Maximize(const MinMaxIndices& theMinMaxIndices)
0066 {
0067 for (int aI = 0; aI < 8; ++aI)
0068 {
0069 if (Min[aI] < theMinMaxIndices.Min[aI])
0070 {
0071 Min[aI] = theMinMaxIndices.Min[aI];
0072 }
0073 if (Max[aI] < theMinMaxIndices.Max[aI])
0074 {
0075 Max[aI] = theMinMaxIndices.Max[aI];
0076 }
0077 }
0078 return *this;
0079 }
0080 };
0081
0082
0083 Standard_EXPORT HLRAlgo_EdgesBlock(const int NbEdges);
0084
0085 int NbEdges() const { return myEdges.Upper(); }
0086
0087 void Edge(const int I, const int EI) { myEdges(I) = EI; }
0088
0089 int Edge(const int I) const { return myEdges(I); }
0090
0091 void Orientation(const int I, const TopAbs_Orientation Or)
0092 {
0093 myFlags(I) &= ~EMaskOrient;
0094 myFlags(I) |= ((int)Or & (int)EMaskOrient);
0095 }
0096
0097 TopAbs_Orientation Orientation(const int I) const
0098 {
0099 return ((TopAbs_Orientation)(myFlags(I) & EMaskOrient));
0100 }
0101
0102 bool OutLine(const int I) const { return (myFlags(I) & EMaskOutLine) != 0; }
0103
0104 void OutLine(const int I, const bool B)
0105 {
0106 if (B)
0107 myFlags(I) |= EMaskOutLine;
0108 else
0109 myFlags(I) &= ~EMaskOutLine;
0110 }
0111
0112 bool Internal(const int I) const { return (myFlags(I) & EMaskInternal) != 0; }
0113
0114 void Internal(const int I, const bool B)
0115 {
0116 if (B)
0117 myFlags(I) |= EMaskInternal;
0118 else
0119 myFlags(I) &= ~EMaskInternal;
0120 }
0121
0122 bool Double(const int I) const { return (myFlags(I) & EMaskDouble) != 0; }
0123
0124 void Double(const int I, const bool B)
0125 {
0126 if (B)
0127 myFlags(I) |= EMaskDouble;
0128 else
0129 myFlags(I) &= ~EMaskDouble;
0130 }
0131
0132 bool IsoLine(const int I) const { return (myFlags(I) & EMaskIsoLine) != 0; }
0133
0134 void IsoLine(const int I, const bool B)
0135 {
0136 if (B)
0137 myFlags(I) |= EMaskIsoLine;
0138 else
0139 myFlags(I) &= ~EMaskIsoLine;
0140 }
0141
0142 void UpdateMinMax(const MinMaxIndices& TotMinMax) { myMinMax = TotMinMax; }
0143
0144 MinMaxIndices& MinMax() { return myMinMax; }
0145
0146 DEFINE_STANDARD_RTTIEXT(HLRAlgo_EdgesBlock, Standard_Transient)
0147
0148 protected:
0149 enum EMskFlags
0150 {
0151 EMaskOrient = 15,
0152 EMaskOutLine = 16,
0153 EMaskInternal = 32,
0154 EMaskDouble = 64,
0155 EMaskIsoLine = 128
0156 };
0157
0158 private:
0159 NCollection_Array1<int> myEdges;
0160 NCollection_Array1<int> myFlags;
0161 MinMaxIndices myMinMax;
0162 };
0163
0164 #endif