File indexing completed on 2026-06-01 08:33:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _ShapePersistent_Geom2d_Curve_HeaderFile
0015 #define _ShapePersistent_Geom2d_Curve_HeaderFile
0016
0017 #include <ShapePersistent_Geom2d.hxx>
0018 #include <ShapePersistent_HArray1.hxx>
0019 #include <StdLPersistent_HArray1.hxx>
0020
0021 #include <Geom2d_Line.hxx>
0022 #include <Geom2d_Circle.hxx>
0023 #include <Geom2d_Ellipse.hxx>
0024 #include <Geom2d_Hyperbola.hxx>
0025 #include <Geom2d_Parabola.hxx>
0026 #include <Geom2d_BezierCurve.hxx>
0027 #include <Geom2d_BSplineCurve.hxx>
0028 #include <Geom2d_TrimmedCurve.hxx>
0029 #include <Geom2d_OffsetCurve.hxx>
0030
0031 #include <gp_Circ2d.hxx>
0032 #include <gp_Elips2d.hxx>
0033 #include <gp_Hypr2d.hxx>
0034 #include <gp_Parab2d.hxx>
0035
0036 class ShapePersistent_Geom2d_Curve : public ShapePersistent_Geom2d
0037 {
0038 typedef Curve::PersistentBase pBase;
0039
0040 typedef pBase pBounded;
0041
0042 class pBezier : public pBounded
0043 {
0044 friend class ShapePersistent_Geom2d_Curve;
0045
0046 public:
0047 pBezier()
0048 : myRational(Standard_False)
0049 {
0050 }
0051
0052 inline void Read(StdObjMgt_ReadData& theReadData)
0053 {
0054 theReadData >> myRational >> myPoles >> myWeights;
0055 }
0056
0057 inline void Write(StdObjMgt_WriteData& theWriteData) const
0058 {
0059 theWriteData << myRational << myPoles << myWeights;
0060 }
0061
0062 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
0063 {
0064 theChildren.Append(myPoles);
0065 theChildren.Append(myWeights);
0066 }
0067
0068 inline Standard_CString PName() const { return "PGeom2d_BezierCurve"; }
0069
0070 virtual Handle(Geom2d_Curve) Import() const;
0071
0072 private:
0073 Standard_Boolean myRational;
0074 Handle(ShapePersistent_HArray1::Pnt2d) myPoles;
0075 Handle(StdLPersistent_HArray1::Real) myWeights;
0076 };
0077
0078 class pBSpline : public pBounded
0079 {
0080 friend class ShapePersistent_Geom2d_Curve;
0081
0082 public:
0083 pBSpline()
0084 : myRational(Standard_False),
0085 myPeriodic(Standard_False),
0086 mySpineDegree(0)
0087 {
0088 }
0089
0090 inline void Read(StdObjMgt_ReadData& theReadData)
0091 {
0092 theReadData >> myRational >> myPeriodic >> mySpineDegree;
0093 theReadData >> myPoles >> myWeights >> myKnots >> myMultiplicities;
0094 }
0095
0096 inline void Write(StdObjMgt_WriteData& theWriteData) const
0097 {
0098 theWriteData << myRational << myPeriodic << mySpineDegree;
0099 theWriteData << myPoles << myWeights << myKnots << myMultiplicities;
0100 }
0101
0102 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
0103 {
0104 theChildren.Append(myPoles);
0105 theChildren.Append(myWeights);
0106 theChildren.Append(myKnots);
0107 theChildren.Append(myMultiplicities);
0108 }
0109
0110 inline Standard_CString PName() const { return "PGeom2d_BSplineCurve"; }
0111
0112 virtual Handle(Geom2d_Curve) Import() const;
0113
0114 private:
0115 Standard_Boolean myRational;
0116 Standard_Boolean myPeriodic;
0117 Standard_Integer mySpineDegree;
0118 Handle(ShapePersistent_HArray1::Pnt2d) myPoles;
0119 Handle(StdLPersistent_HArray1::Real) myWeights;
0120 Handle(StdLPersistent_HArray1::Real) myKnots;
0121 Handle(StdLPersistent_HArray1::Integer) myMultiplicities;
0122 };
0123
0124 class pTrimmed : public pBounded
0125 {
0126 friend class ShapePersistent_Geom2d_Curve;
0127
0128 public:
0129 pTrimmed()
0130 : myFirstU(0.0),
0131 myLastU(0.0)
0132 {
0133 }
0134
0135 inline void Read(StdObjMgt_ReadData& theReadData)
0136 {
0137 theReadData >> myBasisCurve >> myFirstU >> myLastU;
0138 }
0139
0140 inline void Write(StdObjMgt_WriteData& theWriteData) const
0141 {
0142 theWriteData << myBasisCurve << myFirstU << myLastU;
0143 }
0144
0145 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
0146 {
0147 theChildren.Append(myBasisCurve);
0148 }
0149
0150 inline Standard_CString PName() const { return "PGeom2d_TrimmedCurve"; }
0151
0152 virtual Handle(Geom2d_Curve) Import() const;
0153
0154 private:
0155 Handle(Curve) myBasisCurve;
0156 Standard_Real myFirstU;
0157 Standard_Real myLastU;
0158 };
0159
0160 class pOffset : public pBase
0161 {
0162 friend class ShapePersistent_Geom2d_Curve;
0163
0164 public:
0165 pOffset()
0166 : myOffsetValue(0.0)
0167 {
0168 }
0169
0170 inline void Read(StdObjMgt_ReadData& theReadData)
0171 {
0172 theReadData >> myBasisCurve >> myOffsetValue;
0173 }
0174
0175 inline void Write(StdObjMgt_WriteData& theWriteData) const
0176 {
0177 theWriteData << myBasisCurve << myOffsetValue;
0178 }
0179
0180 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
0181 {
0182 theChildren.Append(myBasisCurve);
0183 }
0184
0185 inline Standard_CString PName() const { return "PGeom2d_OffsetCurve"; }
0186
0187 virtual Handle(Geom2d_Curve) Import() const;
0188
0189 private:
0190 Handle(Curve) myBasisCurve;
0191 Standard_Real myOffsetValue;
0192 };
0193
0194 public:
0195 typedef instance<Curve, Geom2d_Line, gp_Ax2d> Line;
0196
0197 typedef subBase_gp<Curve, gp_Ax22d> Conic;
0198 typedef instance<Conic, Geom2d_Circle, gp_Circ2d> Circle;
0199 typedef instance<Conic, Geom2d_Ellipse, gp_Elips2d> Ellipse;
0200 typedef instance<Conic, Geom2d_Hyperbola, gp_Hypr2d> Hyperbola;
0201 typedef instance<Conic, Geom2d_Parabola, gp_Parab2d> Parabola;
0202
0203 typedef subBase_empty<Curve> Bounded;
0204 typedef Delayed<Bounded, pBezier> Bezier;
0205 typedef Delayed<Bounded, pBSpline> BSpline;
0206 typedef Delayed<Bounded, pTrimmed> Trimmed;
0207
0208 typedef Delayed<Curve, pOffset> Offset;
0209
0210 public:
0211
0212 Standard_EXPORT static Handle(Curve) Translate(const Handle(Geom2d_Line)& theCurve,
0213 StdObjMgt_TransientPersistentMap& theMap);
0214
0215 Standard_EXPORT static Handle(Curve) Translate(const Handle(Geom2d_Circle)& theCurve,
0216 StdObjMgt_TransientPersistentMap& theMap);
0217
0218 Standard_EXPORT static Handle(Curve) Translate(const Handle(Geom2d_Ellipse)& theCurve,
0219 StdObjMgt_TransientPersistentMap& theMap);
0220
0221 Standard_EXPORT static Handle(Curve) Translate(const Handle(Geom2d_Hyperbola)& theCurve,
0222 StdObjMgt_TransientPersistentMap& theMap);
0223
0224 Standard_EXPORT static Handle(Curve) Translate(const Handle(Geom2d_Parabola)& theCurve,
0225 StdObjMgt_TransientPersistentMap& theMap);
0226
0227 Standard_EXPORT static Handle(Curve) Translate(const Handle(Geom2d_BezierCurve)& theCurve,
0228 StdObjMgt_TransientPersistentMap& theMap);
0229
0230 Standard_EXPORT static Handle(Curve) Translate(const Handle(Geom2d_BSplineCurve)& theCurve,
0231 StdObjMgt_TransientPersistentMap& theMap);
0232
0233 Standard_EXPORT static Handle(Curve) Translate(const Handle(Geom2d_TrimmedCurve)& theCurve,
0234 StdObjMgt_TransientPersistentMap& theMap);
0235
0236 Standard_EXPORT static Handle(Curve) Translate(const Handle(Geom2d_OffsetCurve)& theCurve,
0237 StdObjMgt_TransientPersistentMap& theMap);
0238 };
0239
0240
0241
0242
0243 template <>
0244 Standard_CString ShapePersistent_Geom2d_Curve::
0245 instance<ShapePersistent_Geom2d::Curve, Geom2d_Line, gp_Ax2d>::PName() const;
0246
0247 template <>
0248 void ShapePersistent_Geom2d_Curve::instance<ShapePersistent_Geom2d::Curve, Geom2d_Line, gp_Ax2d>::
0249 Write(StdObjMgt_WriteData& theWriteData) const;
0250
0251
0252
0253
0254 template <>
0255 Standard_CString ShapePersistent_Geom2d_Curve::subBase_gp<ShapePersistent_Geom2d::Curve,
0256 gp_Ax22d>::PName() const;
0257
0258
0259
0260
0261 template <>
0262 Standard_CString ShapePersistent_Geom2d_Curve::
0263 instance<ShapePersistent_Geom2d_Curve::Conic, Geom2d_Circle, gp_Circ2d>::PName() const;
0264
0265 template <>
0266 void ShapePersistent_Geom2d_Curve::
0267 instance<ShapePersistent_Geom2d_Curve::Conic, Geom2d_Circle, gp_Circ2d>::Write(
0268 StdObjMgt_WriteData& theWriteData) const;
0269
0270
0271
0272
0273 template <>
0274 Standard_CString ShapePersistent_Geom2d_Curve::
0275 instance<ShapePersistent_Geom2d_Curve::Conic, Geom2d_Ellipse, gp_Elips2d>::PName() const;
0276
0277 template <>
0278 void ShapePersistent_Geom2d_Curve::
0279 instance<ShapePersistent_Geom2d_Curve::Conic, Geom2d_Ellipse, gp_Elips2d>::Write(
0280 StdObjMgt_WriteData& theWriteData) const;
0281
0282
0283
0284
0285 template <>
0286 Standard_CString ShapePersistent_Geom2d_Curve::
0287 instance<ShapePersistent_Geom2d_Curve::Conic, Geom2d_Hyperbola, gp_Hypr2d>::PName() const;
0288
0289 template <>
0290 void ShapePersistent_Geom2d_Curve::
0291 instance<ShapePersistent_Geom2d_Curve::Conic, Geom2d_Hyperbola, gp_Hypr2d>::Write(
0292 StdObjMgt_WriteData& theWriteData) const;
0293
0294
0295
0296
0297 template <>
0298 Standard_CString ShapePersistent_Geom2d_Curve::
0299 instance<ShapePersistent_Geom2d_Curve::Conic, Geom2d_Parabola, gp_Parab2d>::PName() const;
0300
0301 template <>
0302 void ShapePersistent_Geom2d_Curve::
0303 instance<ShapePersistent_Geom2d_Curve::Conic, Geom2d_Parabola, gp_Parab2d>::Write(
0304 StdObjMgt_WriteData& theWriteData) const;
0305
0306 #endif