folder_features="ParametersMgr"/>
<folder name="Constructions" group_type="Construction" icon=":pictures/constr_folder.png"/>
<folder name="Results" group_type="Bodies" icon=":pictures/constr_folder.png"/>
+ <folder name="Volumes" group_type="Volumes" icon=":pictures/constr_folder.png"/>
<folder name="Fields" group_type="Fields" icon=":pictures/constr_folder.png" show_empty="false"/>
<folder name="Groups" group_type="Groups" icon=":pictures/constr_folder.png" show_empty="false"/>
</sub_document>
-</data_model>
\ No newline at end of file
+</data_model>
Model_FeatureValidator.h
Model_FiltersFactory.h
Model_ResultBody.h
+
+ Model_ResultVolume.h
+
Model_ResultConstruction.h
Model_ResultPart.h
Model_ResultField.h
Model_FeatureValidator.cpp
Model_FiltersFactory.cpp
Model_ResultBody.cpp
+
+ Model_ResultVolume.cpp
+
Model_ResultConstruction.cpp
Model_ResultPart.cpp
Model_ResultField.cpp
private:
friend class Model_ResultBody;
+
+ friend class Model_ResultVolume;
+
friend class Model_ResultCompSolid;
};
friend class Model_SelectionNaming;
friend class Model_ResultConstruction;
friend class Model_ResultBody;
+
+ friend class Model_ResultVolume;
+
friend class Model_Tools;
public:
return myObjs->createBody(theFeatureData, theIndex);
}
+std::shared_ptr<ModelAPI_ResultVolume> Model_Document::createVolume(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
+{
+ return myObjs->createVolume(theFeatureData, theIndex);
+}
+
std::shared_ptr<ModelAPI_ResultPart> Model_Document::createPart(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
{
/// Creates a body results
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultBody> createBody(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
+ /// Creates a volume results
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultVolume> createVolume(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
/// Creates a part results
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultPart> createPart(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
friend class Model_AttributeSelectionList;
friend class Model_ResultPart;
friend class Model_ResultBody;
+
+ friend class Model_ResultVolume;
+
friend class Model_ResultConstruction;
friend class Model_SelectionNaming;
friend class Model_BodyBuilder;
#include <Model_ResultPart.h>
#include <Model_ResultConstruction.h>
#include <Model_ResultBody.h>
+
+#include <Model_ResultVolume.h>
+
#include <Model_ResultGroup.h>
#include <Model_ResultField.h>
#include <Model_ResultParameter.h>
#include <ModelAPI_Tools.h>
#include <ModelAPI_Filter.h>
-
#include <Events_Loop.h>
#include <Events_InfoMessage.h>
return aResult;
}
+std::shared_ptr<ModelAPI_ResultVolume> Model_Objects::createVolume(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData,
+ const int theIndex,
+ const std::wstring& theNameShape)
+{
+ TDF_Label aLab = resultLabel(theFeatureData, theIndex);
+ TDataStd_Comment::Set(aLab, ModelAPI_ResultVolume::group().c_str());
+ ObjectPtr anOldObject = object(aLab);
+ std::shared_ptr<ModelAPI_ResultVolume> aResult;
+ if (anOldObject.get()) {
+ aResult = std::dynamic_pointer_cast<ModelAPI_ResultVolume>(anOldObject);
+ }
+ if (!aResult.get()) {
+ aResult = std::shared_ptr<ModelAPI_ResultVolume>(new Model_ResultVolume);
+ storeResult(theFeatureData, aResult, theIndex, theNameShape);
+ }
+ return aResult;
+}
+
std::shared_ptr<ModelAPI_ResultPart> Model_Objects::createPart(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
{
std::shared_ptr<ModelAPI_ResultBody> createBody(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0,
const std::wstring& theNameShape = L"");
+ /// Creates a body result
+ std::shared_ptr<ModelAPI_ResultVolume> createVolume(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0,
+ const std::wstring& theNameShape = L"");
/// Creates a part result
std::shared_ptr<ModelAPI_ResultPart> createPart(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
--- /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
+//
+
+#include <Model_ResultVolume.h>
+
+#include <Model_Document.h>
+#include <Model_Objects.h>
+#include <Model_BodyBuilder.h>
+#include <Model_Document.h>
+#include <ModelAPI_Object.h>
+#include <ModelAPI_Events.h>
+#include <ModelAPI_Tools.h>
+#include <Model_Data.h>
+#include <Events_Loop.h>
+#include <GeomAPI_ShapeIterator.h>
+#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_Face.h>
+#include <GeomAPI_Pnt.h>
+
+#include <TopoDS_Shape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TDataStd_UAttribute.hxx>
+
+// if this attribute exists, the shape is connected topology
+Standard_GUID kIsConnectedTopology("e51392e0-3a4d-405d-8e36-bbfe19858ef5");
+// if this attribute exists, the connected topology flag must be recomputed
+Standard_GUID kUpdateConnectedTopology("01ef7a45-0bec-4266-b0b4-4aa570921818");
+
+Model_ResultVolume::Model_ResultVolume() : Model_ResultVolume()
+{
+ myBuilder = new Model_BodyBuilder(this);
+ // myLastConcealed = false;
+ // updateSubs(shape()); // in case of open, etc.
+}
+
+Model_ResultVolume::~Model_ResultVolume()
+{
+ // updateSubs(std::shared_ptr<GeomAPI_Shape>()); // erase sub-results
+ delete myBuilder;
+}
--- /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
+//
+
+#ifndef Model_ResultVolume_H_
+#define Model_ResultVolume_H_
+
+#include "Model.h"
+#include <ModelAPI_ResultVolume.h>
+#include <vector>
+#include <map>
+
+#include <TopTools_DataMapOfShapeListOfShape.hxx>
+
+/**\class Model_ResultVolume
+* \ingroup DataModel
+* \brief The body (shape) result of a feature.
+*
+* Provides a shape that may be displayed in the viewer.
+* May provide really huge results, so, working with this kind
+* of result must be optimized.
+* Also provides a container of sub-body result in case it is compound or compsolid.
+*/
+class Model_ResultVolume : public ModelAPI_ResultVolume
+{
+
+ public:
+ /// Removes the stored builders
+ MODEL_EXPORT virtual ~Model_ResultVolume();
+
+ protected:
+ /// Makes a body on the given feature
+ Model_ResultVolume();
+};
+
+#endif
ModelAPI_Plugin.h
ModelAPI_Result.h
ModelAPI_ResultBody.h
+
+ ModelAPI_ResultVolume.h
+
ModelAPI_ResultConstruction.h
ModelAPI_ResultField.h
ModelAPI_ResultGroup.h
if(${HAVE_SALOME})
enable_testing()
set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/ModelAPI")
-
+
install(FILES CTestTestfileInstall.cmake
DESTINATION ${TEST_INSTALL_DIRECTORY}
RENAME CTestTestfile.cmake)
install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
-
+
set(TMP_TESTS_NAMES)
foreach(tfile ${TEST_NAMES})
list(APPEND TMP_TESTS_NAMES "Test/${tfile}")
endforeach(tfile ${TEST_NAMES})
-
+
install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY})
endif(${HAVE_SALOME})
class ModelAPI_Result;
class ModelAPI_ResultConstruction;
class ModelAPI_ResultBody;
+class ModelAPI_ResultVolume;
class ModelAPI_ResultPart;
class ModelAPI_ResultGroup;
class ModelAPI_ResultField;
//! Creates a body result
virtual std::shared_ptr<ModelAPI_ResultBody> createBody(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
+ //! Creates a volume result
+ virtual std::shared_ptr<ModelAPI_ResultVolume> createVolume(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
//! Creates a part result
virtual std::shared_ptr<ModelAPI_ResultPart> createPart(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
void ModelAPI_ParameterEvalMessage::setVolumes(
const std::list<std::shared_ptr<ModelAPI_ResultParameter> >& theParamsList,
- const double theResult, const std::string& theError)
+ const double theVolume, const std::string& theError)
{
myParamsList = theParamsList;
- myResult = theResult;
+ myResult = theVolume;
myError = theError;
myIsProcessed = true;
}
const double theResult, const std::string& theError);
MODELAPI_EXPORT void setVolumes(
const std::list<std::shared_ptr<ModelAPI_ResultParameter> >& theParamsList,
- const double theResult, const std::string& theError);
+ const double theVolume, const std::string& theError);
/// Returns true if the expression is processed
MODELAPI_EXPORT bool isProcessed();
/// Returns the results of processing: list of parameters found in the expression
MODELAPI_EXPORT void setResults(
const std::list<std::shared_ptr<ModelAPI_ResultParameter> >& theParamsList,
const std::string& theError);
- /// Sets the results of processing
+ /// Sets the volumes of processing
MODELAPI_EXPORT void setVolumes(
const std::list<std::shared_ptr<ModelAPI_ResultParameter> >& theParamsList,
const std::string& theError);
--- /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
+//
+
+#ifndef ModelAPI_ResultVolume_H_
+#define ModelAPI_ResultVolume_H_
+
+#include "ModelAPI_ResultBody.h"
+
+class ModelAPI_BodyBuilder;
+class GeomAlgoAPI_MakeShape;
+
+/**\class ModelAPI_ResultVolume
+* \ingroup DataModel
+* \brief The body (shape) result of a feature.
+*
+* Provides a shape that may be displayed in the viewer.
+* May provide really huge results, so, working with this kind
+* of result must be optimized.
+* Also provides a container of sub-body result in case it is compound or compsolid.
+*/
+class ModelAPI_ResultVolume : public ModelAPI_ResultBody
+{
+ public:
+
+ inline static std::string group()
+ {
+ static std::string MY_GROUP = "Volumes";
+ return MY_GROUP;
+ }
+
+ protected:
+ ModelAPI_BodyBuilder* myBuilder; ///< provides the body processing in naming shape
+
+};
+
+//! Pointer on feature object
+typedef std::shared_ptr<ModelAPI_ResultVolume> ResultVolumePtr;
+
+#endif
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_ResultPart.h>
#include <ModelAPI_ResultBody.h>
+
+#include <ModelAPI_ResultVolume.h>
+
#include <ModelAPI_Tools.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_CompositeFeature.h>
case GroupsFolder:
return ModelAPI_ResultGroup::group();
case VolumesFolder:
- return ModelAPI_ResultBody::group();
+ return ModelAPI_ResultVolume::group();
}
return "";
}
#include <ModelAPI_Data.h>
#include <ModelAPI_ResultBody.h>
+
+#include <ModelAPI_ResultVolume.h>
+
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelection.h>
#include <ModelAPI_AttributeString.h>
setResult(aResultBox, aResultIndex);
}
+//=================================================================================================
+static void toto(std::shared_ptr<GeomAlgoAPI_Box> theBoxAlgo,
+ std::shared_ptr<ModelAPI_ResultVolume> theResultBox)
+{
+ // Load the result
+ theResultBox->store(theBoxAlgo->shape());
+
+ // Prepare the naming
+ theBoxAlgo->prepareNamingFaces();
+
+ // Insert to faces
+ std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
+ theBoxAlgo->getCreatedFaces();
+ for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+ it != listOfFaces.end();
+ ++it)
+ {
+ theResultBox->generated((*it).second, (*it).first);
+ }
+}
+
//=================================================================================================
void PrimitivesPlugin_Box::createBoxByOnePointAndDims()
{
}
int aResultIndex = 0;
- ResultBodyPtr aResultBox = document()->createBody(data(), aResultIndex);
- loadNamingDS(aBoxAlgo, aResultBox);
- setResult(aResultBox, aResultIndex);
+ ResultVolumePtr aResultBox = document()->createVolume(data(), aResultIndex);
+ toto(aBoxAlgo, aResultBox);
+ setVolume(aResultBox, aResultIndex);
}
//=================================================================================================