]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/ModelAPI_ResultBody.cpp
Salome HOME
Porting to SALOME_8.2.0 : Debug visualization selection for AIS_Trihedron axes.
[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   myConnect = ConnectionNotComputed;
16 }
17
18 ModelAPI_ResultBody::~ModelAPI_ResultBody()
19 {
20   if (myBuilder)
21   delete myBuilder;
22 }
23
24 std::string ModelAPI_ResultBody::groupName()
25 {
26   return group();
27 }
28
29 void ModelAPI_ResultBody::store(const std::shared_ptr<GeomAPI_Shape>& theShape,
30                                 const bool theIsStoreSameShapes)
31 {
32   myBuilder->store(theShape, theIsStoreSameShapes);
33   myConnect = ConnectionNotComputed;
34
35   static Events_Loop* aLoop = Events_Loop::loop();
36   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
37   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
38   aECreator->sendUpdated(data()->owner(), aRedispEvent);
39 }
40
41 void ModelAPI_ResultBody::storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
42                                   const std::shared_ptr<GeomAPI_Shape>& theToShape)
43 {
44   myBuilder->storeGenerated(theFromShape, theToShape);
45   myConnect = ConnectionNotComputed;
46
47   static Events_Loop* aLoop = Events_Loop::loop();
48   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
49   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
50   aECreator->sendUpdated(data()->owner(), aRedispEvent);
51 }
52
53 void ModelAPI_ResultBody::storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
54                                   const std::shared_ptr<GeomAPI_Shape>& theNewShape,
55                             const int theDecomposeSolidsTag)
56 {
57   myBuilder->storeModified(theOldShape, theNewShape, theDecomposeSolidsTag);
58   myConnect = ConnectionNotComputed;
59
60   static Events_Loop* aLoop = Events_Loop::loop();
61   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
62   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
63   aECreator->sendUpdated(data()->owner(), aRedispEvent);
64 }
65
66 void ModelAPI_ResultBody::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
67 {
68   myBuilder->storeWithoutNaming(theShape);
69   myConnect = ConnectionNotComputed;
70
71   static Events_Loop* aLoop = Events_Loop::loop();
72   static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
73   static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
74   aECreator->sendUpdated(data()->owner(), aRedispEvent);
75 }
76
77 std::shared_ptr<GeomAPI_Shape> ModelAPI_ResultBody::shape()
78 {
79   return myBuilder->shape();
80 }
81
82 void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
83     const std::string& theName, const int theTag)
84 {
85   myBuilder->generated(theNewShape, theName, theTag);
86 }
87
88 void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
89     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
90     const int theTag)
91 {
92   myBuilder->generated(theOldShape, theNewShape, theName, theTag);
93 }
94
95 void ModelAPI_ResultBody::modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
96     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
97     const int theTag)
98 {
99   myBuilder->modified(theOldShape, theNewShape, theName, theTag);
100 }
101
102
103 void ModelAPI_ResultBody::deleted(
104     const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag)
105 {
106   myBuilder->deleted(theOldShape, theTag);
107 }
108
109 void ModelAPI_ResultBody::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
110                                   std::shared_ptr<GeomAPI_Shape>  theShapeIn,
111                                   const int  theKindOfShape,
112                                   const int  theTag)
113 {
114   myBuilder->loadDeletedShapes(theMS, theShapeIn, theKindOfShape, theTag);
115 }
116
117 void ModelAPI_ResultBody::loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
118     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape, const int  theTag,
119     const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
120     const bool theIsStoreSeparate)
121 {
122   myBuilder->loadAndOrientModifiedShapes(
123     theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate);
124 }
125
126 void ModelAPI_ResultBody::loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
127     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape,
128     const int  theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes)
129 {
130   myBuilder->loadAndOrientGeneratedShapes(
131     theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes);
132 }
133
134 void ModelAPI_ResultBody::loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
135     const std::string& theName, int&  theTag)
136 {
137   myBuilder->loadFirstLevel(theShape, theName, theTag);
138 }
139
140 void ModelAPI_ResultBody::loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
141     const std::string& theName, int&  theTag)
142 {
143   myBuilder->loadDisconnectedEdges(theShape, theName, theTag);
144 }
145
146 void ModelAPI_ResultBody::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
147     const std::string& theName,int&  theTag)
148 {
149   myBuilder->loadDisconnectedVertexes(theShape, theName, theTag);
150 }
151
152 bool ModelAPI_ResultBody::isConnectedTopology()
153 {
154   if (myConnect == ConnectionNotComputed) {
155     myConnect = shape()->isConnectedTopology() ? IsConnected : IsNotConnected;
156   }
157   return myConnect == IsConnected;
158 }