Model_ResultConstruction.h
Model_ResultPart.h
Model_ResultGroup.h
+ Model_ResultParameter.h
Model_FeatureValidator.h
)
Model_ResultConstruction.cpp
Model_ResultPart.cpp
Model_ResultGroup.cpp
+ Model_ResultParameter.cpp
Model_FeatureValidator.cpp
)
#include <Model_ResultGroup.h>
#include <ModelAPI_Validator.h>
#include <ModelAPI_CompositeFeature.h>
+
#include <Events_Loop.h>
#include <Events_Error.h>
return aResult;
}
+std::shared_ptr<ModelAPI_ResultParameter> Model_Document::createParameter(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
+{
+ TDF_Label aLab = resultLabel(theFeatureData, theIndex);
+ TDataStd_Comment::Set(aLab, ModelAPI_ResultParameter::group().c_str());
+ ObjectPtr anOldObject = object(aLab);
+ std::shared_ptr<ModelAPI_ResultParameter> aResult;
+ if (anOldObject) {
+ aResult = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(anOldObject);
+ }
+ if (!aResult) {
+ aResult = std::shared_ptr<ModelAPI_ResultParameter>(new ModelAPI_ResultParameter);
+ storeResult(theFeatureData, aResult, theIndex);
+ }
+ return aResult;
+}
+
std::shared_ptr<ModelAPI_Feature> Model_Document::feature(
const std::shared_ptr<ModelAPI_Result>& theResult)
{
#include <ModelAPI_Document.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Result.h>
+#include <ModelAPI_ResultParameter.h>
#include <TDocStd_Document.hxx>
#include <NCollection_DataMap.hxx>
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultGroup> createGroup(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultParameter> createParameter(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
+
//! Returns a feature by result (owner of result)
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
feature(const std::shared_ptr<ModelAPI_Result>& theResult);
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: Model_ResultParameter.h
+// Created: 02 Apr 2015
+// Author: Sergey BELASH
+
+#ifndef MODEL_RESULTPARAMETER_H_
+#define MODEL_RESULTPARAMETER_H_
+
+#include "Model.h"
+#include <Model_Document.h>
+
+#include <ModelAPI_Data.h>
+#include <ModelAPI_ResultParameter.h>
+
+/**\class Model_ResultParameter
+ * \ingroup DataModel
+ * \brief
+ */
+class Model_ResultParameter : public ModelAPI_ResultParameter
+{
+ public:
+ MODEL_EXPORT virtual ~Model_ResultParameter();
+ MODEL_EXPORT virtual void initAttributes();
+
+ protected:
+ Model_ResultParameter();
+
+ friend class Model_Document;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: Model_ResultParameter.cpp
+// Created: 02 Apr 2015
+// Author: Sergey BELASH
+
+#include "Model_ResultParameter.h"
+
+Model_ResultParameter::~Model_ResultParameter()
+{
+
+}
+
+void Model_ResultParameter::initAttributes()
+{
+ data()->addAttribute(ModelAPI_ResultParameter::VALUE(),
+ ModelAPI_AttributeDouble::typeId());
+}
+
+
+Model_ResultParameter::Model_ResultParameter()
+{
+ setIsConcealed(false);
+}
ModelAPI_ResultBody.h
ModelAPI_ResultConstruction.h
ModelAPI_ResultGroup.h
- ModelAPI_ResultParameters.h
+ ModelAPI_ResultParameter.h
ModelAPI_ResultPart.h
ModelAPI_Session.h
ModelAPI_Tools.h
#include "ModelAPI_ResultConstruction.h"
#include "ModelAPI_ResultBody.h"
#include "ModelAPI_ResultPart.h"
- #include "ModelAPI_ResultParameters.h"
+ #include "ModelAPI_ResultParameter.h"
#include "ModelAPI_ResultGroup.h"
#include "ModelAPI_Tools.h"
%shared_ptr(ModelAPI_ResultBody)
%shared_ptr(ModelAPI_ResultPart)
%shared_ptr(ModelAPI_ResultGroup)
-%shared_ptr(ModelAPI_ResultParameters)
+%shared_ptr(ModelAPI_ResultParameter)
// all supported interfaces
%include "ModelAPI_Document.h"
%include "ModelAPI_ResultBody.h"
%include "ModelAPI_ResultPart.h"
%include "ModelAPI_ResultGroup.h"
-%include "ModelAPI_ResultParameters.h"
+%include "ModelAPI_ResultParameter.h"
%include "ModelAPI_Tools.h"
// std::list -> []
class ModelAPI_ResultBody;
class ModelAPI_ResultPart;
class ModelAPI_ResultGroup;
+class ModelAPI_ResultParameter;
class ModelAPI_Data;
/**\class ModelAPI_Document
virtual std::shared_ptr<ModelAPI_ResultGroup> createGroup(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
+ virtual std::shared_ptr<ModelAPI_ResultParameter> createParameter(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
+
//! Returns a feature by result (owner of result)
virtual std::shared_ptr<ModelAPI_Feature> feature(
const std::shared_ptr<ModelAPI_Result>& theResult) = 0;
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ModelAPI_ResultParameter.h
+// Created: 07 Jul 2014
+// Author: Vitaly SMETANNIKOV
+
+#ifndef MODELAPI_RESULTPARAMETER_H_
+#define MODELAPI_RESULTPARAMETER_H_
+
+#include "ModelAPI_Result.h"
+
+/**\class ModelAPI_ResultParameter
+ * \ingroup DataModel
+ * \brief The construction element result of a feature.
+ *
+ * Provides a shape that may be displayed in the viewer.
+ * Intermediate, light result that in many cases produces a result on the fly.
+ */
+class ModelAPI_ResultParameter : public ModelAPI_Result
+{
+ public:
+ /// Returns the group identifier of this result
+ virtual std::string groupName()
+ {
+ return group();
+ }
+
+ /// Returns the group identifier of this result
+ inline static std::string group()
+ {
+ static std::string MY_GROUP = "Parameters";
+ return MY_GROUP;
+ }
+
+ inline static const std::string& VALUE()
+ {
+ static const std::string MY_VALUE_ID("Value");
+ return MY_VALUE_ID;
+ }
+};
+
+//! Pointer on feature object
+typedef std::shared_ptr<ModelAPI_ResultParameter> ResultParameterPtr;
+
+#endif
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: ModelAPI_ResultParameters.h
-// Created: 07 Jul 2014
-// Author: Vitaly SMETANNIKOV
-
-#ifndef MODELAPI_RESULTPARAMETERS_H_
-#define MODELAPI_RESULTPARAMETERS_H_
-
-#include "ModelAPI_Result.h"
-
-/**\class ModelAPI_ResultParameters
- * \ingroup DataModel
- * \brief The construction element result of a feature.
- *
- * Provides a shape that may be displayed in the viewer.
- * Intermediate, light result that in many cases produces a result on the fly.
- */
-class ModelAPI_ResultParameters : public ModelAPI_Result
-{
- public:
- /// Returns the group identifier of this result
- virtual std::string groupName()
- {
- return group();
- }
-
- /// Returns the group identifier of this result
- inline static std::string group()
- {
- static std::string MY_GROUP = "Parameters";
- return MY_GROUP;
- }
-};
-
-//! Pointer on feature object
-typedef std::shared_ptr<ModelAPI_ResultParameters> ResultParametersPtr;
-
-#endif
#include <ModelAPI_Object.h>
#include <ModelAPI_ResultPart.h>
#include <ModelAPI_ResultConstruction.h>
-#include <ModelAPI_ResultParameters.h>
+#include <ModelAPI_ResultParameter.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultGroup.h>
return tr("Parameters") + QString(" (%1)").arg(rowCount(theIndex));
case ParamObject: {
DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
- ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultParameters::group(), theIndex.row());
+ ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultParameter::group(), theIndex.row());
if (aObject)
return aObject->data()->name().c_str();
}
DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
if (theParent.internalId() == ParamsFolder)
- return aRootDoc->size(ModelAPI_ResultParameters::group());
+ return aRootDoc->size(ModelAPI_ResultParameter::group());
if (theParent.internalId() == ConstructFolder)
return aRootDoc->size(ModelAPI_ResultConstruction::group());
return ObjectPtr();
case ParamObject: {
DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
- return aRootDoc->object(ModelAPI_ResultParameters::group(), theIndex.row());
+ return aRootDoc->object(ModelAPI_ResultParameter::group(), theIndex.row());
}
case ConstructObject: {
DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
QModelIndex XGUI_TopDataModel::findGroup(const std::string& theGroup) const
{
- if (theGroup == ModelAPI_ResultParameters::group())
+ if (theGroup == ModelAPI_ResultParameter::group())
return createIndex(0, 0, (qint32) ParamsFolder);
if (theGroup == ModelAPI_ResultConstruction::group())
return createIndex(1, 0, (qint32) ConstructFolder);
}
}
if (aRow != -1) {
- if (aGroup == ModelAPI_ResultParameters::group())
+ if (aGroup == ModelAPI_ResultParameter::group())
return createIndex(aRow, 0, (qint32) ParamObject);
if (aGroup == ModelAPI_ResultConstruction::group())
return createIndex(aRow, 0, (qint32) ConstructObject);
case GroupsFolder:
return tr("Groups") + QString(" (%1)").arg(rowCount(theIndex));
case ParamObject: {
- ObjectPtr aObject = partDocument()->object(ModelAPI_ResultParameters::group(),
+ ObjectPtr aObject = partDocument()->object(ModelAPI_ResultParameter::group(),
theIndex.row());
if (aObject)
return std::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
return 0;
}
case ParamsFolder:
- return partDocument()->size(ModelAPI_ResultParameters::group());
+ return partDocument()->size(ModelAPI_ResultParameter::group());
case ConstructFolder:
return partDocument()->size(ModelAPI_ResultConstruction::group());
case BodiesFolder:
return ObjectPtr();
case ParamObject:
- return partDocument()->object(ModelAPI_ResultParameters::group(), theIndex.row());
+ return partDocument()->object(ModelAPI_ResultParameter::group(), theIndex.row());
case ConstructObject:
return partDocument()->object(ModelAPI_ResultConstruction::group(), theIndex.row());
case BodiesObject:
QModelIndex XGUI_PartDataModel::findGroup(const std::string& theGroup) const
{
- if (theGroup == ModelAPI_ResultParameters::group())
+ if (theGroup == ModelAPI_ResultParameter::group())
return createIndex(0, 0, (qint32) ParamsFolder);
if (theGroup == ModelAPI_ResultConstruction::group())
return createIndex(1, 0, (qint32) ConstructFolder);
}
if (aRow == -1)
return aIndex;
- if (aGroup == ModelAPI_ResultParameters::group())
+ if (aGroup == ModelAPI_ResultParameter::group())
return createIndex(aRow, 0, (qint32) ParamObject);
else if (aGroup == ModelAPI_ResultConstruction::group())
return createIndex(aRow, 0, (qint32) ConstructObject);