Salome HOME
#1330 Multiply selection when Create fillet using Shift button
[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                                 const bool theIsStoreSameShapes)
30 {
31   myBuilder->store(theShape, theIsStoreSameShapes);
32
33   static Events_Loop* aLoop = Events_Loop::loop();
34   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
35   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
36   aECreator->sendUpdated(data()->owner(), aRedispEvent);
37 }
38
39 void ModelAPI_ResultBody::storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
40                                   const std::shared_ptr<GeomAPI_Shape>& theToShape)
41 {
42   myBuilder->storeGenerated(theFromShape, theToShape);
43
44   static Events_Loop* aLoop = Events_Loop::loop();
45   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
46   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
47   aECreator->sendUpdated(data()->owner(), aRedispEvent);
48 }
49
50 void ModelAPI_ResultBody::storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
51                                   const std::shared_ptr<GeomAPI_Shape>& theNewShape,
52                             const int theDecomposeSolidsTag)
53 {
54   myBuilder->storeModified(theOldShape, theNewShape, theDecomposeSolidsTag);
55
56   static Events_Loop* aLoop = Events_Loop::loop();
57   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
58   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
59   aECreator->sendUpdated(data()->owner(), aRedispEvent);
60 }
61
62 void ModelAPI_ResultBody::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
63 {
64   myBuilder->storeWithoutNaming(theShape);
65
66   static Events_Loop* aLoop = Events_Loop::loop();
67   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
68   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
69   aECreator->sendUpdated(data()->owner(), aRedispEvent);
70 }
71
72 std::shared_ptr<GeomAPI_Shape> ModelAPI_ResultBody::shape()
73 {
74   return myBuilder->shape();
75 }
76
77 void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
78     const std::string& theName, const int theTag)
79 {
80   myBuilder->generated(theNewShape, theName, theTag);
81 }
82
83 void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
84     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, 
85     const int theTag)
86 {
87   myBuilder->generated(theOldShape, theNewShape, theName, theTag);
88 }
89
90 void ModelAPI_ResultBody::modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
91     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
92     const int theTag)
93 {
94   myBuilder->modified(theOldShape, theNewShape, theName, theTag);
95 }
96
97
98 void ModelAPI_ResultBody::deleted(
99     const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag)
100 {
101   myBuilder->deleted(theOldShape, theTag);
102 }
103   
104 void ModelAPI_ResultBody::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
105                                   std::shared_ptr<GeomAPI_Shape>  theShapeIn,
106                                   const int  theKindOfShape,
107                                   const int  theTag)
108 {
109   myBuilder->loadDeletedShapes(theMS, theShapeIn, theKindOfShape, theTag);
110 }
111
112 void ModelAPI_ResultBody::loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
113     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape, const int  theTag,
114     const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, const bool theIsStoreSeparate)
115 {
116   myBuilder->loadAndOrientModifiedShapes(
117     theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate);
118 }
119
120 void ModelAPI_ResultBody::loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
121     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape,
122     const int  theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes)
123 {
124   myBuilder->loadAndOrientGeneratedShapes(
125     theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes);
126 }
127
128 void ModelAPI_ResultBody::loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, 
129     const std::string& theName, int&  theTag)
130 {
131   myBuilder->loadFirstLevel(theShape, theName, theTag);
132 }
133
134 void ModelAPI_ResultBody::loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
135     const std::string& theName, int&  theTag)
136 {
137   myBuilder->loadDisconnectedEdges(theShape, theName, theTag);
138 }
139
140 void ModelAPI_ResultBody::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
141     const std::string& theName,int&  theTag)
142 {
143   myBuilder->loadDisconnectedVertexes(theShape, theName, theTag);
144 }