Handle(Geom_RectangularTrimmedSurface) aTrimSurface = Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
aType = aTrimSurface->BasisSurface()->DynamicType();
}
- return (aType == STANDARD_TYPE(Geom_Plane));
+ return (aType == STANDARD_TYPE(Geom_Plane)) == Standard_True;
} else {
return false;
}
int Model_Application::generateDocumentId()
{
- int aResult = myDocs.size();
+ int aResult = int(myDocs.size());
for(; myDocs.find(aResult) != myDocs.end(); aResult++); // count until the result id is unique
return aResult;
}
#include <ModelAPI_CompositeFeature.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
+#include <ModelAPI_ResultBody.h>
#include <Events_Loop.h>
#include <Events_Error.h>
#include <TDF_AttributeDeltaList.hxx>
#include <TDF_ListIteratorOfAttributeDeltaList.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TNaming_SameShapeIterator.hxx>
+
#include <climits>
#ifndef WIN32
return myObjs->lastFeature();
return FeaturePtr();
}
+
+std::shared_ptr<ModelAPI_Feature> Model_Document::producedByFeature(
+ std::shared_ptr<ModelAPI_Result> theResult,
+ const std::shared_ptr<GeomAPI_Shape>& theShape)
+{
+ ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
+ if (!aBody.get()) {
+ return feature(theResult); // for not-body just returns the feature that produced this result
+ }
+ // otherwise get the shape and search the very initial label for it
+ TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
+ if (aShape.IsNull())
+ return FeaturePtr();
+
+
+ FeaturePtr aResult;
+ for(TNaming_SameShapeIterator anIter(aShape, myDoc->Main()); anIter.More(); anIter.Next()) {
+ TDF_Label aNSLab = anIter.Label();
+ while(aNSLab.Depth() > 4)
+ aNSLab = aNSLab.Father();
+ FeaturePtr aFeature = myObjs->feature(aNSLab);
+ if (aFeature.get()) {
+ if (!aResult.get() || myObjs->isLater(aResult, aFeature)) {
+ aResult = aFeature;
+ }
+ }
+ }
+ return aResult;
+}
/// \returns null if there is no features
FeaturePtr lastFeature();
+ /// Returns the feature that produced the given face of the given result.
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> producedByFeature(
+ std::shared_ptr<ModelAPI_Result> theResult,
+ const std::shared_ptr<GeomAPI_Shape>& theShape);
+
protected:
//! Returns (creates if needed) the general label
TDF_Label generalLabel() const;
class ModelAPI_ResultGroup;
class ModelAPI_ResultParameter;
class ModelAPI_Data;
+class GeomAPI_Shape;
/**\class ModelAPI_Document
* \ingroup DataModel
/// Returns true if document is opened and valid
virtual bool isOpened() = 0;
+ /// Returns the feature that produced the given face of the given result.
+ virtual std::shared_ptr<ModelAPI_Feature> producedByFeature(
+ std::shared_ptr<ModelAPI_Result> theResult,
+ const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
+
protected:
//! Only for SWIG wrapping it is here
return aPosMap[thePrs];
} else {
// Add a new [Presentation - Index] pair
- int aInd = aPosMap.size();
+ int aInd = int(aPosMap.size());
aPosMap[thePrs] = aInd;
return aInd;
}