0030416: Incorrect implementation of the method Bnd_OBB::SquareExtent
[occt.git] / src / ShapePersistent / ShapePersistent_Geom2d.hxx
CommitLineData
ff205346 1// Copyright (c) 2015 OPEN CASCADE SAS
2//
3// This file is part of Open CASCADE Technology software library.
4//
5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
10//
11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
13
14
15#ifndef _ShapePersistent_Geom2d_HeaderFile
16#define _ShapePersistent_Geom2d_HeaderFile
17
ec964372 18#include <StdObjMgt_TransientPersistentMap.hxx>
ff205346 19#include <ShapePersistent_Geom.hxx>
20
21#include <Geom2d_CartesianPoint.hxx>
22#include <Geom2d_Direction.hxx>
23#include <Geom2d_VectorWithMagnitude.hxx>
24#include <Geom2d_AxisPlacement.hxx>
25#include <Geom2d_Transformation.hxx>
26#include <Geom2d_Curve.hxx>
27
ec964372 28class ShapePersistent_Geom2d : public ShapePersistent_Geom
ff205346 29{
30 typedef geometryBase<Geom2d_Geometry> basic;
31
32public:
33 typedef ShapePersistent_Geom::Geometry Geometry;
34
35 typedef subBase_empty<basic> Point;
36 typedef instance<Point, Geom2d_CartesianPoint, gp_Pnt2d> CartesianPoint;
37
38 typedef subBase_gp<basic, gp_Vec2d> Vector;
39 typedef instance<Vector, Geom2d_Direction , gp_Dir2d> Direction;
40 typedef instance<Vector, Geom2d_VectorWithMagnitude, gp_Vec2d> VectorWithMagnitude;
41
42 typedef instance<basic, Geom2d_AxisPlacement, gp_Ax2d> AxisPlacement;
43
44 typedef instance <SharedBase<Geom2d_Transformation>,
45 Geom2d_Transformation,
46 gp_Trsf2d> Transformation;
47
48 typedef geometryBase<Geom2d_Curve> Curve;
ec964372 49
50public:
51 //! Create a persistent object for a curve
52 Standard_EXPORT static Handle(Curve) Translate (const Handle(Geom2d_Curve)& theCurve,
53 StdObjMgt_TransientPersistentMap& theMap);
ff205346 54};
55
ec964372 56//=======================================================================
57// Geometry
58//=======================================================================
59template<>
0f57ab75 60inline Standard_CString ShapePersistent_Geom::geometryBase<Geom2d_Geometry>
61 ::PName() const { return "PGeom2d_Geometry"; }
ec964372 62
63//=======================================================================
64// Point
65//=======================================================================
66template<>
0f57ab75 67inline Standard_CString ShapePersistent_Geom::subBase_empty<ShapePersistent_Geom2d::geometryBase<Geom2d_Geometry> >
68 ::PName() const { return "PGeom2d_Point"; }
ec964372 69
70//=======================================================================
71// CartesianPoint
72//=======================================================================
73template<>
0f57ab75 74inline Standard_CString ShapePersistent_Geom::instance<ShapePersistent_Geom2d::Point,
ec964372 75 Geom2d_CartesianPoint,
76 gp_Pnt2d>
0f57ab75 77 ::PName() const { return "PGeom2d_CartesianPoint"; }
ec964372 78
79template<>
0f57ab75 80inline void ShapePersistent_Geom::instance<ShapePersistent_Geom2d::Point,
ec964372 81 Geom2d_CartesianPoint,
82 gp_Pnt2d>
0f57ab75 83 ::Write(StdObjMgt_WriteData& theWriteData) const
84{
85 Handle(Geom2d_CartesianPoint) aMyGeom =
86 Handle(Geom2d_CartesianPoint)::DownCast(myTransient);
87 theWriteData << aMyGeom->Pnt2d();
88}
ec964372 89
90//=======================================================================
91// Direction
92//=======================================================================
93template<>
94Standard_CString ShapePersistent_Geom::instance<ShapePersistent_Geom2d::Direction,
95 Geom2d_Direction,
96 gp_Dir2d>
97 ::PName() const;
98
99template<>
100void ShapePersistent_Geom::instance<ShapePersistent_Geom2d::Direction,
101 Geom2d_Direction,
102 gp_Dir2d>
103 ::Write(StdObjMgt_WriteData& theWriteData) const;
104
105//=======================================================================
106// VectorWithMagnitude
107//=======================================================================
108template<>
109Standard_CString ShapePersistent_Geom::instance<ShapePersistent_Geom2d::VectorWithMagnitude,
110 Geom2d_VectorWithMagnitude,
111 gp_Vec2d>
112 ::PName() const;
113
114template<>
115void ShapePersistent_Geom::instance<ShapePersistent_Geom2d::VectorWithMagnitude,
116 Geom2d_VectorWithMagnitude,
117 gp_Vec2d>
118 ::Write(StdObjMgt_WriteData& theWriteData) const;
119
120//=======================================================================
121// AxisPlacement
122//=======================================================================
123template<>
124Standard_CString ShapePersistent_Geom::instance<ShapePersistent_Geom2d::AxisPlacement,
125 Geom2d_AxisPlacement,
126 gp_Ax2d>
127 ::PName() const;
128
129template<>
130void ShapePersistent_Geom::instance<ShapePersistent_Geom2d::AxisPlacement,
131 Geom2d_AxisPlacement,
132 gp_Ax2d>
133 ::Write(StdObjMgt_WriteData& theWriteData) const;
134
135//=======================================================================
136// Transformation
137//=======================================================================
138template<>
139Standard_CString ShapePersistent_Geom::instance<ShapePersistent_Geom2d::Transformation,
140 Geom2d_Transformation,
141 gp_Trsf2d>
142 ::PName() const;
143
144template<>
145void ShapePersistent_Geom::instance<ShapePersistent_Geom2d::Transformation,
146 Geom2d_Transformation,
147 gp_Trsf2d>
148 ::PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
149
150template<>
151void ShapePersistent_Geom::instance<ShapePersistent_Geom2d::Transformation,
152 Geom2d_Transformation,
153 gp_Trsf2d>
154 ::Write(StdObjMgt_WriteData& theWriteData) const;
155
156//=======================================================================
157// Curve
158//=======================================================================
159template<>
0f57ab75 160inline Standard_CString ShapePersistent_Geom::geometryBase<Geom2d_Curve>
161 ::PName() const { return "PGeom2d_Curve"; }
ec964372 162
ff205346 163#endif