Salome HOME
Partition naming
[modules/shaper.git] / src / ModelAPI / ModelAPI_ResultBody.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_ResultBody.cpp
4 // Created:     07 Jul 2014
5 // Author:      Mikhail PONIKAROV
6
7 #include "ModelAPI_ResultBody.h"
8 #include <ModelAPI_BodyBuilder.h>
9 #include <Events_Loop.h>
10 #include <ModelAPI_Events.h>
11
12 ModelAPI_ResultBody::ModelAPI_ResultBody()
13 : myBuilder(0)
14 {
15 }
16
17 ModelAPI_ResultBody::~ModelAPI_ResultBody()
18 {
19   if (myBuilder)
20   delete myBuilder;
21 }
22
23 std::string ModelAPI_ResultBody::groupName()
24 {
25   return group();
26 }
27
28 void ModelAPI_ResultBody::store(const std::shared_ptr<GeomAPI_Shape>& theShape)
29 {
30   myBuilder->store(theShape);
31
32   static Events_Loop* aLoop = Events_Loop::loop();
33   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
34   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
35   aECreator->sendUpdated(data()->owner(), aRedispEvent);
36 }
37
38 void ModelAPI_ResultBody::storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
39                                   const std::shared_ptr<GeomAPI_Shape>& theToShape)
40 {
41   myBuilder->storeGenerated(theFromShape, theToShape);
42
43   static Events_Loop* aLoop = Events_Loop::loop();
44   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
45   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
46   aECreator->sendUpdated(data()->owner(), aRedispEvent);
47 }
48
49 void ModelAPI_ResultBody::storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
50                                   const std::shared_ptr<GeomAPI_Shape>& theNewShape,
51                             const int theDecomposeSolidsTag)
52 {
53   myBuilder->storeModified(theOldShape, theNewShape, theDecomposeSolidsTag);
54
55   static Events_Loop* aLoop = Events_Loop::loop();
56   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
57   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
58   aECreator->sendUpdated(data()->owner(), aRedispEvent);
59 }
60
61 void ModelAPI_ResultBody::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
62 {
63   myBuilder->storeWithoutNaming(theShape);
64
65   static Events_Loop* aLoop = Events_Loop::loop();
66   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
67   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
68   aECreator->sendUpdated(data()->owner(), aRedispEvent);
69 }
70
71 std::shared_ptr<GeomAPI_Shape> ModelAPI_ResultBody::shape()
72 {
73   return myBuilder->shape();
74 }
75
76 void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
77     const std::string& theName, const int theTag)
78 {
79   myBuilder->generated(theNewShape, theName, theTag);
80 }
81
82 void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
83     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, 
84     const int theTag)
85 {
86   myBuilder->generated(theOldShape, theNewShape, theName, theTag);
87 }
88
89 void ModelAPI_ResultBody::modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
90     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
91     const int theTag)
92 {
93   myBuilder->modified(theOldShape, theNewShape, theName, theTag);
94 }
95
96
97 void ModelAPI_ResultBody::deleted(
98     const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag)
99 {
100   myBuilder->deleted(theOldShape, theTag);
101 }
102   
103 void ModelAPI_ResultBody::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
104                                   std::shared_ptr<GeomAPI_Shape>  theShapeIn,
105                                   const int  theKindOfShape,
106                                   const int  theTag)
107 {
108   myBuilder->loadDeletedShapes(theMS, theShapeIn, theKindOfShape, theTag);
109 }
110
111 void ModelAPI_ResultBody::loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
112     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape, const int  theTag,
113     const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, const bool theIsStoreSeparate)
114 {
115   myBuilder->loadAndOrientModifiedShapes(
116     theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate);
117 }
118
119 void ModelAPI_ResultBody::loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
120     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape,
121     const int  theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes)
122 {
123   myBuilder->loadAndOrientGeneratedShapes(
124     theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes);
125 }
126
127 void ModelAPI_ResultBody::loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, 
128     const std::string& theName, int&  theTag)
129 {
130   myBuilder->loadFirstLevel(theShape, theName, theTag);
131 }
132
133 void ModelAPI_ResultBody::loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
134     const std::string& theName, int&  theTag)
135 {
136   myBuilder->loadDisconnectedEdges(theShape, theName, theTag);
137 }
138
139 void ModelAPI_ResultBody::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
140     const std::string& theName,int&  theTag)
141 {
142   myBuilder->loadDisconnectedVertexes(theShape, theName, theTag);
143 }