1 // File: Model_ResultBody.cpp
2 // Created: 08 Jul 2014
3 // Author: Mikhail PONIKAROV
5 #include <Model_ResultBody.h>
6 #include <Model_Data.h>
7 #include <TNaming_Builder.hxx>
8 #include <TNaming_NamedShape.hxx>
9 #include <TopoDS_Shape.hxx>
10 #include <GeomAPI_Shape.h>
12 Model_ResultBody::Model_ResultBody()
16 void Model_ResultBody::store(const boost::shared_ptr<GeomAPI_Shape>& theShape)
18 boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(data());
20 TDF_Label& aShapeLab = aData->shapeLab();
21 // TODO: to add the naming mechanism for shape storage in the next iteration
22 TNaming_Builder aBuilder(aShapeLab);
25 TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
27 return; // null shape inside
29 aBuilder.Generated(aShape);
33 boost::shared_ptr<GeomAPI_Shape> Model_ResultBody::shape()
35 boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(data());
37 TDF_Label& aShapeLab = aData->shapeLab();
38 Handle(TNaming_NamedShape) aName;
39 if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aName)) {
40 TopoDS_Shape aShape = aName->Get();
41 if (!aShape.IsNull()) {
42 boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
43 aRes->setImpl(new TopoDS_Shape(aShape));
48 return boost::shared_ptr<GeomAPI_Shape>();
51 boost::shared_ptr<ModelAPI_Feature> Model_ResultBody::owner()