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