Remove duplicated methods.
std::shared_ptr<GeomAPI_Shape> theShape,
const bool theAllowFolder = false);
- //! Returns the shape index in the result.
- //! \param theResult result
- //! \param theShape result subshape
- //! \returns index started from zero, or -1 if shape is not stored or is not a subshape of the result
- MODEL_EXPORT virtual const int index(std::shared_ptr<ModelAPI_Result> theResult,
- std::shared_ptr<GeomAPI_Shape> theShape,
- const bool theAllowFolder = false);
-
//! Internal sub-document by ID
MODEL_EXPORT virtual std::shared_ptr<Model_Document> subDoc(int theDocID);
aResultLabel = resultLabel(theResult->data(), index(theResult));
TDF_Label anAttributeLabel = subShapeLabel(aResultLabel, index(theResult, theShape)).FindChild(TAG_FEATURE_ARGUMENTS);
- if (Standard_GUID::IsEqual(theAttribute->ID(), TDataStd_IntegerArray::GetID()))
+ if (theAttribute->ID() == TDataStd_IntegerArray::GetID())
{
Handle(TDataStd_IntegerArray) anColor;
Handle(TDataStd_IntegerArray) anAttr =
TDF_Label anAttributeLabel = subShapeLabel(aResultLabel, anIndex).FindChild(TAG_FEATURE_ARGUMENTS);
Handle(TDF_Attribute) anAttr;
- anAttributeLabel.FindAttribute(theID, anAttr); // ? TDataStd_IntegerArray::GetID() or TDataStd_Integer::GetID()
+ anAttributeLabel.FindAttribute(theID, anAttr);
return anAttr;
}
}
}
-TDF_Label Model_Objects::shapesFromResult(TDF_Label theResult) const
-{
- return theResult.Father().FindChild(TAG_RESULT_SHAPES);
-}
-
void Model_Objects::getSubShapesWithEdgeThickness(
const std::shared_ptr<ModelAPI_Result> theResult,
std::map<std::shared_ptr<GeomAPI_Shape>, int>& oShapes
#include <TopExp_Explorer.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TDataStd_UAttribute.hxx>
+#include <TDataStd_Integer.hxx>
#include <TDataStd_IntegerArray.hxx>
#include <TNaming_Tool.hxx>
#include <TDF_Reference.hxx>
anObjects->getSubShapesWithEdgeThickness(theResult, oShapes);
}
-void Model_ResultBody::setSubShapeEdgeThickness(
- const std::shared_ptr<ModelAPI_Result> theResult,
- const std::shared_ptr<GeomAPI_Shape> theSubShape,
- int theEdgeThickness
-)
-{
- TopoDS_Shape aShape = shape()->impl<TopoDS_Shape>();
- TopoDS_Shape aSubShape = theSubShape->impl<TopoDS_Shape>();
- if (!shape()->isSubShape(theSubShape))
- return;
-
- Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
- document()->storeShape(data(), theResult, theSubShape);
-
- Handle(TDataStd_Integer) aThickness = new TDataStd_Integer();
- aThickness->Set(theEdgeThickness);
- anObjects->setAttribute(aThickness, theResult, theSubShape);
-}
-
-int Model_ResultBody::getSubShapeEdgeThickness(const std::shared_ptr<ModelAPI_Result> theResult, const std::shared_ptr<GeomAPI_Shape> theSubShape) const
-{
- TopoDS_Shape aShape = shape()->impl<TopoDS_Shape>();
- TopoDS_Shape aSubShape = theSubShape->impl<TopoDS_Shape>();
- if (!shape()->isSubShape(theSubShape))
- return -1;
-
- Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
- auto anAttr = Handle(TDataStd_Integer)::DownCast(anObjects->getAttribute(TDataStd_Integer::GetID(), theResult, theSubShape));
- if (anAttr.IsNull())
- return;
-
- return anAttr->Get();
-}
-
-void Model_ResultBody::getSubShapesWithEdgeThickness(
- const std::shared_ptr<ModelAPI_Result> theResult,
- std::map<std::shared_ptr<GeomAPI_Shape>, int>& oShapes
-) const
-{
- Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
- anObjects->getSubShapesWithEdgeThickness(theResult, oShapes);
-}
-
void Model_ResultBody::addShapeColor( const std::wstring& theName,std::vector<int>& color)
{
if (myColorsShape.find(theName) == myColorsShape.end())
std::shared_ptr<GeomAPI_Shape> theShape,
const bool theAllowFolder = false) = 0;
- //! Returns the shape index in the result.
- //! \param theResult result
- //! \param theShape result subshape
- //! \returns index started from zero, or -1 if shape is not stored or is not a subshape of the result
- virtual const int index(std::shared_ptr<ModelAPI_Result> theResult,
- std::shared_ptr<GeomAPI_Shape> theShape,
- const bool theAllowFolder = false) = 0;
-
//! Returns the number of objects in the group of objects
//! \param theGroupID group of objects
//! \param theAllowFolder take into account grouping feature by folders