File indexing completed on 2025-01-18 10:04:38
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _Poly_ArrayOfUVNodes_HeaderFile
0015 #define _Poly_ArrayOfUVNodes_HeaderFile
0016
0017 #include <NCollection_AliasedArray.hxx>
0018 #include <gp_Pnt2d.hxx>
0019 #include <gp_Vec2f.hxx>
0020 #include <Standard_Macro.hxx>
0021
0022
0023 class Poly_ArrayOfUVNodes : public NCollection_AliasedArray<>
0024 {
0025 public:
0026
0027
0028 Poly_ArrayOfUVNodes() : NCollection_AliasedArray ((Standard_Integer )sizeof(gp_Pnt2d))
0029 {
0030
0031 }
0032
0033
0034 Poly_ArrayOfUVNodes (Standard_Integer theLength)
0035 : NCollection_AliasedArray ((Standard_Integer )sizeof(gp_Pnt2d), theLength)
0036 {
0037
0038 }
0039
0040
0041 Standard_EXPORT Poly_ArrayOfUVNodes (const Poly_ArrayOfUVNodes& theOther);
0042
0043
0044 Poly_ArrayOfUVNodes (const gp_Pnt2d& theBegin,
0045 Standard_Integer theLength)
0046 : NCollection_AliasedArray (theBegin, theLength)
0047 {
0048
0049 }
0050
0051
0052 Poly_ArrayOfUVNodes (const gp_Vec2f& theBegin,
0053 Standard_Integer theLength)
0054 : NCollection_AliasedArray (theBegin, theLength)
0055 {
0056
0057 }
0058
0059
0060 Standard_EXPORT ~Poly_ArrayOfUVNodes();
0061
0062
0063 bool IsDoublePrecision() const { return myStride == (Standard_Integer )sizeof(gp_Pnt2d); }
0064
0065
0066
0067 void SetDoublePrecision (bool theIsDouble)
0068 {
0069 if (myData != NULL) { throw Standard_ProgramError ("Poly_ArrayOfUVNodes::SetDoublePrecision() should be called before allocation"); }
0070 myStride = Standard_Integer(theIsDouble ? sizeof(gp_Pnt2d) : sizeof(gp_Vec2f));
0071 }
0072
0073
0074
0075
0076 Standard_EXPORT Poly_ArrayOfUVNodes& Assign (const Poly_ArrayOfUVNodes& theOther);
0077
0078
0079 Poly_ArrayOfUVNodes& Move (Poly_ArrayOfUVNodes& theOther)
0080 {
0081 NCollection_AliasedArray::Move (theOther);
0082 return *this;
0083 }
0084
0085
0086 Poly_ArrayOfUVNodes& operator= (const Poly_ArrayOfUVNodes& theOther) { return Assign (theOther); }
0087
0088
0089 Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther) Standard_Noexcept
0090 : NCollection_AliasedArray (std::move (theOther))
0091 {
0092
0093 }
0094
0095
0096 Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther) Standard_Noexcept
0097 {
0098 return Move (theOther);
0099 }
0100
0101 public:
0102
0103
0104 inline gp_Pnt2d Value (Standard_Integer theIndex) const;
0105
0106
0107 inline void SetValue (Standard_Integer theIndex, const gp_Pnt2d& theValue);
0108
0109
0110 gp_Pnt2d operator[] (Standard_Integer theIndex) const { return Value (theIndex); }
0111
0112 };
0113
0114
0115
0116
0117
0118 inline gp_Pnt2d Poly_ArrayOfUVNodes::Value (Standard_Integer theIndex) const
0119 {
0120 if (myStride == (Standard_Integer )sizeof(gp_Pnt2d))
0121 {
0122 return NCollection_AliasedArray::Value<gp_Pnt2d> (theIndex);
0123 }
0124 else
0125 {
0126 const gp_Vec2f& aVec2 = NCollection_AliasedArray::Value<gp_Vec2f> (theIndex);
0127 return gp_Pnt2d (aVec2.x(), aVec2.y());
0128 }
0129 }
0130
0131
0132
0133
0134
0135 inline void Poly_ArrayOfUVNodes::SetValue (Standard_Integer theIndex, const gp_Pnt2d& theValue)
0136 {
0137 if (myStride == (Standard_Integer )sizeof(gp_Pnt2d))
0138 {
0139 NCollection_AliasedArray::ChangeValue<gp_Pnt2d> (theIndex) = theValue;
0140 }
0141 else
0142 {
0143 gp_Vec2f& aVec2 = NCollection_AliasedArray::ChangeValue<gp_Vec2f> (theIndex);
0144 aVec2.SetValues ((float )theValue.X(), (float )theValue.Y());
0145 }
0146 }
0147
0148 #endif