1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_OperationPrs.cpp
4 // Created: 01 Jul 2015
5 // Author: Natalia ERMOLAEVA
7 #include "PartSet_OperationPrs.h"
9 //#include <ModelAPI_Tools.h>
10 //#include <ModelAPI_ResultConstruction.h>
11 //#include <GeomAPI_PlanarEdges.h>
13 //#include <BRep_Builder.hxx>
14 //#include <Prs3d_IsoAspect.hxx>
15 //#include <TopoDS_Builder.hxx>
17 IMPLEMENT_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape);
18 IMPLEMENT_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape);
20 PartSet_OperationPrs::PartSet_OperationPrs()
21 : ViewerData_AISShape(TopoDS_Shape()), myFeature(FeaturePtr())
25 void PartSet_OperationPrs::setFeature(FeaturePtr theFeature)
27 /* std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(theResult);
28 std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr =
29 std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(aShapePtr);
31 if (aWirePtr->hasPlane() ) {
32 // If this is a wire with plane defined thin it is a sketch-like object
33 // It must have invisible faces
34 myIsSketchMode = true;
37 Set(aShapePtr->impl<TopoDS_Shape>());
42 /*#include <TopExp_Explorer.hxx>
43 #include <TopoDS_Vertex.hxx>
44 #include <StdPrs_ShadedShape.hxx>
45 #include <StdPrs_WFDeflectionShape.hxx>
47 void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
48 const Handle(Prs3d_Presentation)& thePresentation,
49 const Standard_Integer theMode)
51 /* std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(myResult);
56 ResultConstructionPtr aConstruction =
57 std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(myResult);
58 if (aConstruction.get()) {
59 int aFacesNum = aConstruction->facesNum();
60 for(int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) {
61 myFacesList.push_back(aConstruction->face(aFaceIndex));
65 myOriginalShape = aShapePtr->impl<TopoDS_Shape>();
66 if (!myOriginalShape.IsNull()) {
69 AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
71 TopExp_Explorer anExp(myOriginalShape, TopAbs_VERTEX);
72 Handle(Prs3d_Drawer) aDrawer = Attributes();
73 for (; anExp.More(); anExp.Next()) {
74 const TopoDS_Vertex& aVertex = (const TopoDS_Vertex&)anExp.Current();
75 StdPrs_WFDeflectionShape::Add(thePresentation, aVertex, aDrawer);
81 void PartSet_OperationPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
82 const Standard_Integer aMode)
84 /* if (aMode > TopAbs_SHAPE)
85 // In order to avoid using custom selection modes
89 if (aMode == TopAbs_FACE) {
90 BRep_Builder aBuilder;
91 TopoDS_Compound aComp;
92 aBuilder.MakeCompound(aComp);
93 aBuilder.Add(aComp, myOriginalShape);
94 std::list<std::shared_ptr<GeomAPI_Shape>>::const_iterator aIt;
95 for (aIt = myFacesList.cbegin(); aIt != myFacesList.cend(); ++aIt) {
96 TopoDS_Shape aFace = (*aIt)->impl<TopoDS_Shape>();
97 aBuilder.Add(aComp, aFace);
101 Set(myOriginalShape);
104 AIS_Shape::ComputeSelection(aSelection, aMode);