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