0025748: Parallel version of progress indicator
[occt.git] / src / XSControl / XSControl_Vars.cxx
1 // Copyright (c) 1999-2014 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 #include <Geom2d_CartesianPoint.hxx>
16 #include <Geom2d_Curve.hxx>
17 #include <Geom_CartesianPoint.hxx>
18 #include <Geom_Curve.hxx>
19 #include <Geom_Geometry.hxx>
20 #include <Geom_Surface.hxx>
21 #include <gp_Pnt.hxx>
22 #include <gp_Pnt2d.hxx>
23 #include <Interface_Macros.hxx>
24 #include <Standard_Transient.hxx>
25 #include <Standard_Type.hxx>
26 #include <TopoDS_HShape.hxx>
27 #include <TopoDS_Shape.hxx>
28 #include <XSControl_Vars.hxx>
29
30 IMPLEMENT_STANDARD_RTTIEXT(XSControl_Vars,Standard_Transient)
31
32 XSControl_Vars::XSControl_Vars() { }
33
34 void  XSControl_Vars::Set
35   (const Standard_CString name,
36    const Handle(Standard_Transient)& val)
37 {
38   thevars.Bind(name,val);
39 }
40
41 Handle(Standard_Transient)  XSControl_Vars::Get ( Standard_CString& name) const
42 {
43   Handle(Standard_Transient) val;
44   if (!thevars.Find(name, val))
45     val.Nullify();
46   return val;
47 }
48
49 Handle(Geom_Geometry)  XSControl_Vars::GetGeom ( Standard_CString& name) const
50 {  return GetCasted(Geom_Geometry,Get(name));  }
51
52 Handle(Geom2d_Curve)  XSControl_Vars::GetCurve2d ( Standard_CString& name) const
53 {  return GetCasted(Geom2d_Curve,Get(name));  }
54
55 Handle(Geom_Curve)  XSControl_Vars::GetCurve ( Standard_CString& name) const
56 {  return GetCasted(Geom_Curve,Get(name));  }
57
58 Handle(Geom_Surface)  XSControl_Vars::GetSurface ( Standard_CString& name) const
59 {  return GetCasted(Geom_Surface,Get(name));  }
60
61
62 void  XSControl_Vars::SetPoint (const Standard_CString name, const gp_Pnt& val)
63 {  Set (name, new Geom_CartesianPoint(val));  }
64
65 Standard_Boolean  XSControl_Vars::GetPoint (Standard_CString& name, gp_Pnt& pnt) const
66 {
67   DeclareAndCast(Geom_CartesianPoint,val,Get(name));
68   if (val.IsNull()) return Standard_False;
69   pnt = val->Pnt();
70   return Standard_True;
71 }
72
73
74 void  XSControl_Vars::SetPoint2d (const Standard_CString name, const gp_Pnt2d& val)
75 {  Set (name, new Geom2d_CartesianPoint(val));  }
76
77 Standard_Boolean  XSControl_Vars::GetPoint2d (Standard_CString& name, gp_Pnt2d& pnt) const
78 {
79   DeclareAndCast(Geom2d_CartesianPoint,val,Get(name));
80   if (val.IsNull()) return Standard_False;
81   pnt = val->Pnt2d();
82   return Standard_True;
83 }
84
85
86 void  XSControl_Vars::SetShape (const Standard_CString name, const TopoDS_Shape& val)
87 {  Set (name, new TopoDS_HShape(val));  }
88
89 TopoDS_Shape  XSControl_Vars::GetShape (Standard_CString& name) const
90 {
91   TopoDS_Shape sh;
92   DeclareAndCast(TopoDS_HShape,val,Get(name));
93   if (!val.IsNull()) sh = val->Shape();
94   return sh;
95 }