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