1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelAPI_ResultBody.cpp
4 // Created: 07 Jul 2014
5 // Author: Mikhail PONIKAROV
7 #include "ModelAPI_ResultBody.h"
8 #include <ModelAPI_BodyBuilder.h>
9 #include <Events_Loop.h>
10 #include <ModelAPI_Events.h>
12 ModelAPI_ResultBody::ModelAPI_ResultBody()
15 myConnect = ConnectionNotComputed;
18 ModelAPI_ResultBody::~ModelAPI_ResultBody()
24 std::string ModelAPI_ResultBody::groupName()
29 void ModelAPI_ResultBody::store(const std::shared_ptr<GeomAPI_Shape>& theShape,
30 const bool theIsStoreSameShapes)
32 myBuilder->store(theShape, theIsStoreSameShapes);
33 myConnect = ConnectionNotComputed;
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);
41 void ModelAPI_ResultBody::storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
42 const std::shared_ptr<GeomAPI_Shape>& theToShape)
44 myBuilder->storeGenerated(theFromShape, theToShape);
45 myConnect = ConnectionNotComputed;
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);
53 void ModelAPI_ResultBody::storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
54 const std::shared_ptr<GeomAPI_Shape>& theNewShape,
55 const int theDecomposeSolidsTag)
57 myBuilder->storeModified(theOldShape, theNewShape, theDecomposeSolidsTag);
58 myConnect = ConnectionNotComputed;
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);
66 void ModelAPI_ResultBody::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
68 myBuilder->storeWithoutNaming(theShape);
69 myConnect = ConnectionNotComputed;
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);
77 std::shared_ptr<GeomAPI_Shape> ModelAPI_ResultBody::shape()
79 return myBuilder->shape();
82 void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
83 const std::string& theName, const int theTag)
85 myBuilder->generated(theNewShape, theName, theTag);
88 void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
89 const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
92 myBuilder->generated(theOldShape, theNewShape, theName, theTag);
95 void ModelAPI_ResultBody::modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
96 const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
99 myBuilder->modified(theOldShape, theNewShape, theName, theTag);
103 void ModelAPI_ResultBody::deleted(
104 const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag)
106 myBuilder->deleted(theOldShape, theTag);
109 void ModelAPI_ResultBody::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
110 std::shared_ptr<GeomAPI_Shape> theShapeIn,
111 const int theKindOfShape,
114 myBuilder->loadDeletedShapes(theMS, theShapeIn, theKindOfShape, theTag);
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 const bool theIsStoreAsGenerated)
123 myBuilder->loadAndOrientModifiedShapes(
124 theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
125 theIsStoreAsGenerated);
128 void ModelAPI_ResultBody::loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
129 std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape,
130 const int theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes)
132 myBuilder->loadAndOrientGeneratedShapes(
133 theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes);
136 void ModelAPI_ResultBody::loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
137 const std::string& theName, int& theTag)
139 myBuilder->loadFirstLevel(theShape, theName, theTag);
142 void ModelAPI_ResultBody::loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
143 const std::string& theName, int& theTag)
145 myBuilder->loadDisconnectedEdges(theShape, theName, theTag);
148 void ModelAPI_ResultBody::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
149 const std::string& theName,int& theTag)
151 myBuilder->loadDisconnectedVertexes(theShape, theName, theTag);
154 bool ModelAPI_ResultBody::isConnectedTopology()
156 if (myConnect == ConnectionNotComputed) {
157 myConnect = shape()->isConnectedTopology() ? IsConnected : IsNotConnected;
159 return myConnect == IsConnected;