Salome HOME
First publish of HEXABLOCKcomponant
[modules/hexablock.git] / src / HEXABLOCK_I / HexVertex_impl.cxx
1 using namespace std;
2 #include "HEXABLOCK.hxx"
3 #include "utilities.h"
4
5 #include <string>
6
7 #include "hexa_base.hxx"
8 #include "HexVertex_impl.hxx"
9 #include "HexShape.hxx"
10
11 Vertex_impl::Vertex_impl( HEXA_NS::Vertex *ptrCpp ):
12 _vertex_cpp( ptrCpp )
13 // _association( GEOM::GEOM_Object::_nil() )
14 {
15 }
16
17 HEXA_NS::Vertex* Vertex_impl::GetImpl()
18 {
19   return _vertex_cpp;
20 }
21
22 CORBA::Double Vertex_impl::getX() throw(SALOME::SALOME_Exception)
23 {
24   return _vertex_cpp->getX();
25 }
26
27 CORBA::Double Vertex_impl::getY() throw(SALOME::SALOME_Exception)
28 {
29   return _vertex_cpp->getY();
30 }
31
32 CORBA::Double Vertex_impl::getZ() throw(SALOME::SALOME_Exception)
33 {
34   return _vertex_cpp->getZ();
35 }
36
37
38 void Vertex_impl::setX( CORBA::Double x ) throw(SALOME::SALOME_Exception)
39 {
40   _vertex_cpp->setX(x);
41 }
42 void Vertex_impl::setY(  CORBA::Double y ) throw(SALOME::SALOME_Exception)
43 {
44   _vertex_cpp->setY(y);
45 }
46
47 void Vertex_impl::setZ(  CORBA::Double z ) throw(SALOME::SALOME_Exception)
48 {
49   _vertex_cpp->setY(z);
50 }
51
52
53 void Vertex_impl::setAssociation(GEOM::GEOM_Object_ptr geom_object_vertex)
54   throw (SALOME::SALOME_Exception)
55 {
56 //   TopoDS_Shape shape = HEXABLOCK::GetHEXABLOCKGen()->geomObjectToShape(geom_object_vertex);
57   HEXABLOCK::HEXABLOCK* gen = HEXABLOCK::GetHEXABLOCKGen();
58   TopoDS_Shape shape = gen->geomObjectToShape(geom_object_vertex);
59   string strBrep = shape2string( shape );
60   HEXA_NS::Shape* s = new HEXA_NS::Shape( strBrep );
61   _vertex_cpp->setAssociation(s);
62
63 //   _association = GEOM::GEOM_Object::_duplicate( geom_object_vertex );
64 }
65
66
67 GEOM::GEOM_Object_ptr Vertex_impl::getAssociation()
68   throw (SALOME::SALOME_Exception)
69 {
70 //   GEOM::GEOM_Object_var result = GEOM::GEOM_Object::_nil();
71 //   GEOM::GEOM_Object_ptr result = GEOM::GEOM_Object::_nil();
72
73   GEOM::GEOM_Object_var result; // = new GEOM::GEOM_Object;
74
75   HEXA_NS::Shape* s = _vertex_cpp->getAssociation();
76
77   std::cout << "getAssociation ->" << s << std::endl;
78
79   if (s != NULL){
80     string strBrep = s->getBrep();
81     TopoDS_Shape shape = string2shape( strBrep );
82     result = HEXABLOCK::GetHEXABLOCKGen()->shapeToGeomObject(shape);
83   }
84
85 // //   _vertex_cpp->getAssociation()->_topo;
86 // //   result = HEXABLOCK::GetHEXABLOCKGen()->shapeToGeomObject(_shape);
87
88 //   return result;
89   return result._retn();
90 //   return GEOM::GEOM_Object::_duplicate( _association );
91 }
92
93
94
95 // void Vertex_impl::removeAssociation()
96 //   throw (SALOME::SALOME_Exception)
97 // {
98 // }
99
100
101 void Vertex_impl::setScalar( ::CORBA::Double val )throw (SALOME::SALOME_Exception)
102 {
103   _vertex_cpp->setScalar(val);
104 }
105
106 void Vertex_impl::dump() throw (SALOME::SALOME_Exception)
107 {
108   _vertex_cpp->dump();
109 }
110
111
112 void Vertex_impl::printName()throw (SALOME::SALOME_Exception)
113 {
114   _vertex_cpp->printName();
115 }