#include "ModelAPI_ResultBody.h"
+#include <ModelAPI_BodyBuilder.h>
+#include <Events_Loop.h>
+#include <ModelAPI_Events.h>
+
ModelAPI_ResultBody::ModelAPI_ResultBody() {}
ModelAPI_ResultBody::~ModelAPI_ResultBody() {}
for (int i = 0; i < numberOfSubs(); i++)
subResult(i)->setDisplayed(theDisplay);
}
+
+void ModelAPI_ResultBody::store(const GeomShapePtr& theShape,
+ const bool theIsStoreSameShapes)
+{
+ myBuilder->store(theShape, theIsStoreSameShapes);
+ myConnect = ConnectionNotComputed;
+
+ static Events_Loop* aLoop = Events_Loop::loop();
+ static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
+ aECreator->sendUpdated(data()->owner(), aRedispEvent);
+
+ updateSubs(theShape);
+}
public:
MODELAPI_EXPORT virtual ~ModelAPI_ResultBody();
+ /// \brief Stores the shape (called by the execution method).
+ /// param[in] theShape shape to store.
+ /// param[in] theIsStoreSameShapes if false stores reference to the same shape
+ /// if it is already in document.
+ MODELAPI_EXPORT virtual void store(const GeomShapePtr& theShape,
+ const bool theIsStoreSameShapes = true);
+
// /// Returns the group identifier of this result
MODELAPI_EXPORT virtual std::string groupName();
{
}
-void ModelAPI_ResultMeta::store(const GeomShapePtr& theShape,
- const bool theIsStoreSameShapes)
-{
- myBuilder->store(theShape, theIsStoreSameShapes);
- myConnect = ConnectionNotComputed;
-
- static Events_Loop* aLoop = Events_Loop::loop();
- static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
- static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
- aECreator->sendUpdated(data()->owner(), aRedispEvent);
-
- updateSubs(theShape);
-}
-
void ModelAPI_ResultMeta::storeGenerated(const GeomShapePtr& theFromShape,
const GeomShapePtr& theToShape)
{
/// param[in] theIsStoreSameShapes if false stores reference to the same shape
/// if it is already in document.
MODELAPI_EXPORT virtual void store(const GeomShapePtr& theShape,
- const bool theIsStoreSameShapes = true);
+ const bool theIsStoreSameShapes = true) = 0;
/// Stores the generated shape (called by the execution method).
MODELAPI_EXPORT virtual void storeGenerated(const GeomShapePtr& theFromShape,
#include "ModelAPI_ResultVolume.h"
+#include <ModelAPI_BodyBuilder.h>
+#include <Events_Loop.h>
+#include <ModelAPI_Events.h>
+
ModelAPI_ResultVolume::ModelAPI_ResultVolume() {}
ModelAPI_ResultVolume::~ModelAPI_ResultVolume() {}
for (int i = 0; i < numberOfSubs(); i++)
subResult(i)->setDisplayed(theDisplay);
}
+
+void ModelAPI_ResultVolume::store(const GeomShapePtr& theShape,
+ const bool theIsStoreSameShapes)
+{
+ myBuilder->store(theShape, theIsStoreSameShapes);
+ myConnect = ConnectionNotComputed;
+
+ static Events_Loop* aLoop = Events_Loop::loop();
+ static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
+ aECreator->sendUpdated(data()->owner(), aRedispEvent);
+
+ updateSubs(theShape);
+}
public:
MODELAPI_EXPORT virtual ~ModelAPI_ResultVolume();
+ /// \brief Stores the shape (called by the execution method).
+ /// param[in] theShape shape to store.
+ /// param[in] theIsStoreSameShapes if false stores reference to the same shape
+ /// if it is already in document.
+ MODELAPI_EXPORT virtual void store(const GeomShapePtr& theShape,
+ const bool theIsStoreSameShapes = true);
+
/// Returns the group identifier of this result
MODELAPI_EXPORT std::string groupName();
//==================================================================================================
OperaAPI_addVolume::OperaAPI_addVolume(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Double& theMedium,
- const std::list<ModelHighAPI_Selection>& theVolumeList)
+ const std::list<ModelHighAPI_Selection>& theObjectList)
: ModelHighAPI_Interface(theFeature)
{
if(initialize()) {
- setMedium(theMedium);
- setVolumeList(theVolumeList);
+ fillAttribute(OperaPlugin_Volume::MEDIUM(), medium());
+ setObjectList(theObjectList);
}
}
}
//==================================================================================================
-void OperaAPI_addVolume::setVolumeList(const std::list<ModelHighAPI_Selection>& theVolumeList)
+void OperaAPI_addVolume::setObjectList(const std::list<ModelHighAPI_Selection>& theObjectList)
{
- fillAttribute(theVolumeList, myvolumeList);
+ fillAttribute(theObjectList, myvolumeList);
execute();
}
theDumper << ")" << std::endl;
}
-//==================================================================================================
-VolumePtr addVolume(const std::shared_ptr<ModelAPI_Document>& thePart,
- const ModelHighAPI_Double& theMedium)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(OperaAPI_addVolume::ID());
- return VolumePtr(new OperaAPI_addVolume(aFeature));
-}
-
//==================================================================================================
VolumePtr addVolume(const std::shared_ptr<ModelAPI_Document>& thePart,
const ModelHighAPI_Double& theMedium,
- const std::list<ModelHighAPI_Selection>& theVolumeList)
+ const std::list<ModelHighAPI_Selection>& theObjectList)
{
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(OperaAPI_addVolume::ID());
aFeature->selectionList(OperaPlugin_Volume::LIST_ID())->setGeometricalSelection(true);
- return VolumePtr(new OperaAPI_addVolume(aFeature, theMedium, theVolumeList));
+ return VolumePtr(new OperaAPI_addVolume(aFeature, theMedium, theObjectList));
}
OPERAAPI_EXPORT
OperaAPI_addVolume(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Double& theMedium,
- const std::list<ModelHighAPI_Selection>& theVolumeList);
+ const std::list<ModelHighAPI_Selection>& theObjectList);
/// Destructor.
OPERAAPI_EXPORT
/// Set main objects list.
OPERAAPI_EXPORT
- void setVolumeList(const std::list<ModelHighAPI_Selection>& theVolumeList);
+ void setObjectList(const std::list<ModelHighAPI_Selection>& theObjectList);
/// Dump wrapped feature
OPERAAPI_EXPORT
OPERAAPI_EXPORT
VolumePtr addVolume(const std::shared_ptr<ModelAPI_Document>& thePart,
const ModelHighAPI_Double& theMedium,
- const std::list<ModelHighAPI_Selection>& theVolumeList);
+ const std::list<ModelHighAPI_Selection>& theObjectList);
#endif // OperaAPI_addVolume_H_
--- /dev/null
+# Copyright (C) 2014-2021 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+"""
+ TestBoolean.py
+ Unit test of FeaturesPlugin_Group class
+
+ class FeaturesPlugin_Group
+ static const std::string MY_GROUP_ID("Group");
+ static const std::string MY_GROUP_LIST_ID("group_list");
+
+ data()->addAttribute(FeaturesPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
+"""
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+
+#=========================================================================
+# Create a Box
+#=========================================================================
+
+#=========================================================================
+# Create a Torus
+#=========================================================================
+
+#=========================================================================
+# Create a Cylinder
+#=========================================================================
+
+#=========================================================================
+# Create one Volume
+#=========================================================================
+
+#=========================================================================
+# Check results
+#=========================================================================
+
+#=========================================================================
+# Create two volumes at once
+#=========================================================================
+
+#=========================================================================
+# Check results
+#=========================================================================
+
+#=========================================================================
+# End of test
+#=========================================================================
+
+from salome.shaper import model
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2021 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(TEST_NAMES
+ TestAddVolume.py
+)