#include <ModelAPI_Document.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_ResultCompSolid.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelection.h>
#define _LAST_TAG 3
#define EDGE 6
+//#define DEBUG_COMPSOLID
+
//=================================================================================================
FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion()
{
}
for(int aFaceIndex = 0; aFaceIndex < aFacesNum || aFacesNum == -1; aFaceIndex++) {
+ //ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
+#ifdef DEBUG_COMPSOLID
+ ResultCompSolidPtr aResultBody = document()->createCompSolid(data(), aResultIndex);
+#else
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
+#endif
std::shared_ptr<GeomAPI_Shape> aBaseShape;
if (aFacesNum == -1) {
aBaseShape = aValueFace;
break;
}
//LoadNamingDS
+#ifdef DEBUG_COMPSOLID
+#else
LoadNamingDS(aFeature, aResultBody, aBaseShape, aContext);
-
+#endif
setResult(aResultBody, aResultIndex);
aResultIndex++;
Model_Update.h
Model_Validator.h
Model_ResultBody.h
+ Model_ResultCompSolid.h
Model_ResultConstruction.h
Model_ResultPart.h
Model_ResultGroup.h
Model_Update.cpp
Model_Validator.cpp
Model_ResultBody.cpp
+ Model_ResultCompSolid.cpp
Model_ResultConstruction.cpp
Model_ResultPart.cpp
Model_ResultGroup.cpp
return myObjs->createBody(theFeatureData, theIndex);
}
+std::shared_ptr<ModelAPI_ResultCompSolid> Model_Document::createCompSolid(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
+{
+ return myObjs->createCompSolid(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 compsolid results
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultCompSolid> createCompSolid(
+ 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);
#include <Model_ResultPart.h>
#include <Model_ResultConstruction.h>
#include <Model_ResultBody.h>
+#include <Model_ResultCompSolid.h>
#include <Model_ResultGroup.h>
#include <Model_ResultParameter.h>
#include <ModelAPI_Validator.h>
return aResult;
}
+std::shared_ptr<ModelAPI_ResultCompSolid> Model_Objects::createCompSolid(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
+{
+ TDF_Label aLab = resultLabel(theFeatureData, theIndex);
+ TDataStd_Comment::Set(aLab, ModelAPI_ResultCompSolid::group().c_str());
+ ObjectPtr anOldObject = object(aLab);
+ std::shared_ptr<ModelAPI_ResultCompSolid> aResult;
+ if (anOldObject) {
+ aResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(anOldObject);
+ }
+ if (!aResult) {
+ aResult = std::shared_ptr<ModelAPI_ResultCompSolid>(new Model_ResultCompSolid);
+ storeResult(theFeatureData, aResult, theIndex);
+ }
+ return aResult;
+}
+
std::shared_ptr<ModelAPI_ResultPart> Model_Objects::createPart(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
{
/// Creates a body results
std::shared_ptr<ModelAPI_ResultBody> createBody(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
+ /// Creates a body results
+ std::shared_ptr<ModelAPI_ResultCompSolid> createCompSolid(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
/// Creates a part results
std::shared_ptr<ModelAPI_ResultPart> createPart(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: Model_ResultCompSolid.cpp
+// Created: 20 Jul 2015
+// Author: Natalia ERMOLAEVA
+
+#include <Model_ResultCompSolid.h>
+
+Model_ResultCompSolid::Model_ResultCompSolid()
+{
+}
+
+Model_ResultCompSolid::~Model_ResultCompSolid()
+{
+}
+
+std::shared_ptr<ModelAPI_ResultBody> Model_ResultCompSolid::addResult(std::string theID)
+{
+ std::shared_ptr<ModelAPI_ResultBody> aResult;
+ return aResult;
+}
+
+int Model_ResultCompSolid::numberOfSubs(bool forTree) const
+{
+ return 0;
+}
+
+std::shared_ptr<ModelAPI_ResultBody> Model_ResultCompSolid::subResult(const int theIndex,
+ bool forTree) const
+{
+ std::shared_ptr<ModelAPI_ResultBody> aBody;
+
+ return aBody;
+}
+
+int Model_ResultCompSolid::subResultId(const int theIndex) const
+{
+ return 0;
+}
+
+bool Model_ResultCompSolid::isSub(ObjectPtr theObject) const
+{
+ return true;
+}
+
+void Model_ResultCompSolid::removeResult(std::shared_ptr<ModelAPI_ResultBody> theResult)
+{
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: Model_ResultCompSolid.h
+// Created: 20 Jul 2015
+// Author: Natalia ERMOLAEVA
+
+#ifndef Model_ResultCompSolid_H_
+#define Model_ResultCompSolid_H_
+
+#include "Model.h"
+#include <ModelAPI_ResultCompSolid.h>
+
+/**\class Model_ResultCompSolid
+ * \ingroup DataModel
+ * \brief The compsolid (container of body results) result of a feature.
+ *
+ * Provides a container of shapes that may be displayed in the viewer.
+ */
+class Model_ResultCompSolid : public ModelAPI_ResultCompSolid
+{
+public:
+ /// Removes the stored builders
+ MODEL_EXPORT virtual ~Model_ResultCompSolid();
+
+ /// Adds result to the sketch and to its document
+ virtual std::shared_ptr<ModelAPI_ResultBody> addResult(std::string theID);
+
+ /// Returns the number of sub-elements
+ virtual int numberOfSubs(bool forTree = false) const;
+
+ /// Returns the sub-result by zero-base index
+ virtual std::shared_ptr<ModelAPI_ResultBody> subResult(const int theIndex,
+ bool forTree = false) const;
+
+ /// Returns the sub-feature unique identifier in this composite feature by zero-base index
+ virtual int subResultId(const int theIndex) const;
+
+ /// Returns true if feature or reuslt belong to this composite feature as subs
+ virtual bool isSub(ObjectPtr theObject) const;
+
+ /// This method to inform that sub-feature is removed and must be removed from the internal data
+ /// structures of the owner (the remove from the document will be done outside just after)
+ virtual void removeResult(std::shared_ptr<ModelAPI_ResultBody> theResult);
+
+protected:
+ /// Makes a body on the given feature
+ Model_ResultCompSolid();
+
+ friend class Model_Objects;
+};
+
+#endif
ModelAPI_Plugin.h
ModelAPI_Result.h
ModelAPI_ResultBody.h
+ ModelAPI_ResultCompSolid.h
ModelAPI_ResultConstruction.h
ModelAPI_ResultGroup.h
ModelAPI_ResultParameter.h
ModelAPI_Plugin.cpp
ModelAPI_Result.cpp
ModelAPI_ResultBody.cpp
+ ModelAPI_ResultCompSolid.cpp
ModelAPI_ResultConstruction.cpp
ModelAPI_ResultGroup.cpp
ModelAPI_ResultPart.cpp
class ModelAPI_Result;
class ModelAPI_ResultConstruction;
class ModelAPI_ResultBody;
+class ModelAPI_ResultCompSolid;
class ModelAPI_ResultPart;
class ModelAPI_ResultGroup;
class ModelAPI_ResultParameter;
//! Creates a body results
virtual std::shared_ptr<ModelAPI_ResultBody> createBody(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
+ /// Creates a compsolid results
+ virtual std::shared_ptr<ModelAPI_ResultCompSolid> createCompSolid(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
//! Creates a part results
virtual std::shared_ptr<ModelAPI_ResultPart> createPart(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ModelAPI_ResultCompSolid.cpp
+// Created: 20 Jul 2015
+// Author: Natalia ERMOLAEVA
+
+#include "ModelAPI_ResultCompSolid.h"
+
+ModelAPI_ResultCompSolid::~ModelAPI_ResultCompSolid()
+{
+}
+
+std::string ModelAPI_ResultCompSolid::groupName()
+{
+ return group();
+}
+
+void ModelAPI_ResultCompSolid::initAttributes()
+{
+}
+
+bool ModelAPI_ResultCompSolid::isDisabled() const
+{
+ return false;
+}
+
+
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ModelAPI_ResultCompSolid.hxx
+// Created: 20 Jul 2015
+// Author: Natalia ERMOLAEVA
+
+#ifndef ModelAPI_ResultCompSolid_H_
+#define ModelAPI_ResultCompSolid_H_
+
+#include "ModelAPI_Result.h"
+#include "ModelAPI_ResultBody.h"
+#include <string>
+
+/**\class ModelAPI_ResultCompSolid
+* \ingroup DataModel
+* \brief The comp solid (container of results) result of a feature.
+*
+* Provides a conainer of body result that may be displayed in the viewer.
+*/
+class ModelAPI_ResultCompSolid : public ModelAPI_Result
+{
+public:
+ MODELAPI_EXPORT virtual ~ModelAPI_ResultCompSolid();
+ /// Returns the group identifier of this result
+ MODELAPI_EXPORT virtual std::string groupName();
+
+ /// Returns the group identifier of this result
+ inline static std::string group()
+ {
+ static std::string MY_GROUP = "CompSolid";
+ return MY_GROUP;
+ }
+
+ /// Request for initialization of data model of the object: adding all attributes
+ MODELAPI_EXPORT virtual void initAttributes();
+
+ /// Returns the feature is disabled or not.
+ MODELAPI_EXPORT virtual bool isDisabled() const;
+
+ /// Adds result to the sketch and to its document
+ virtual std::shared_ptr<ModelAPI_ResultBody> addResult(std::string theID) = 0;
+
+ /// Returns the number of sub-elements
+ virtual int numberOfSubs(bool forTree = false) const = 0;
+
+ /// Returns the sub-result by zero-base index
+ virtual std::shared_ptr<ModelAPI_ResultBody> subResult(const int theIndex,
+ bool forTree = false) const = 0;
+
+ /// Returns the sub-feature unique identifier in this composite feature by zero-base index
+ virtual int subResultId(const int theIndex) const = 0;
+
+ /// Returns true if feature or reuslt belong to this composite feature as subs
+ virtual bool isSub(ObjectPtr theObject) const = 0;
+
+ /// This method to inform that sub-feature is removed and must be removed from the internal data
+ /// structures of the owner (the remove from the document will be done outside just after)
+ virtual void removeResult(std::shared_ptr<ModelAPI_ResultBody> theResult) = 0;
+
+protected:
+};
+
+//! Pointer on feature object
+typedef std::shared_ptr<ModelAPI_ResultCompSolid> ResultCompSolidPtr;
+
+#endif