X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ResultPrs.cpp;h=73f066fc32ea4f4b08d90708cc347f8224ce3a02;hb=d29ed3f3f7c0e119d2917b2d4120aa7b473220f4;hp=a1ca0bdd94c2fc5f821d553c1807203a6d8f2d6c;hpb=a5de5c3d56114f3a75862ce9e8099ced4283e07d;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index a1ca0bdd9..73f066fc3 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -5,12 +5,13 @@ #include "ModuleBase_ResultPrs.h" #include -#include +#include #include #include #include #include +#include IMPLEMENT_STANDARD_HANDLE(ModuleBase_ResultPrs, AIS_Shape); IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ResultPrs, AIS_Shape); @@ -18,30 +19,19 @@ IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ResultPrs, AIS_Shape); ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) : AIS_Shape(TopoDS_Shape()), myResult(theResult), myIsSketchMode(false) { - boost::shared_ptr aShapePtr = ModelAPI_Tools::shape(theResult); - boost::shared_ptr aWirePtr = - boost::dynamic_pointer_cast(aShapePtr); + std::shared_ptr aShapePtr = ModelAPI_Tools::shape(theResult); + std::shared_ptr aWirePtr = + std::dynamic_pointer_cast(aShapePtr); if (aWirePtr) { if (aWirePtr->hasPlane() ) { // If this is a wire with plane defined thin it is a sketch-like object // It must have invisible faces - std::list > aFaces; GeomAlgoAPI_SketchBuilder::createFaces(aWirePtr->origin(), aWirePtr->dirX(), - aWirePtr->dirY(), aWirePtr->norm(), aWirePtr, aFaces); + aWirePtr->dirY(), aWirePtr->norm(), aWirePtr, myFacesList); - BRep_Builder aBuilder; - TopoDS_Shape aShape = aWirePtr->impl(); - std::list>::const_iterator aIt; - for (aIt = aFaces.cbegin(); aIt != aFaces.cend(); ++aIt) { - TopoDS_Shape aFace = (*aIt)->impl(); - aBuilder.Add(aShape, aFace); - } - Set(aShape); + myOriginalShape = aWirePtr->impl(); + Set(myOriginalShape); myIsSketchMode = true; - // Define number of ISO lines - //Handle(AIS_Drawer) aDrawer = Attributes(); - //Attributes()->SetIsoOnPlane(Standard_False); - //SetAttributes(aDrawer); } else { Set(aWirePtr->impl()); } @@ -51,24 +41,37 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) } -Standard_Boolean ModuleBase_ResultPrs::AcceptDisplayMode(const Standard_Integer theMode) const -{ - if (myIsSketchMode) { - return theMode == 0; - } - return AIS_Shape::AcceptDisplayMode(theMode); -} - void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode) { - if (myIsSketchMode) { - Handle(AIS_Drawer) aDrawer = Attributes(); - aDrawer->SetIsoOnPlane(Standard_False); - aDrawer->UIsoAspect()->SetNumber(0); - aDrawer->VIsoAspect()->SetNumber(0); - SetAttributes(aDrawer); - } + std::shared_ptr aShapePtr = ModelAPI_Tools::shape(myResult); + if (!aShapePtr) + return; + myOriginalShape = aShapePtr->impl(); + Set(aShapePtr->impl()); AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); } + + +void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, + const Standard_Integer aMode) +{ + if (myIsSketchMode) { + if (aMode == TopAbs_FACE) { + BRep_Builder aBuilder; + TopoDS_Compound aComp; + aBuilder.MakeCompound(aComp); + aBuilder.Add(aComp, myOriginalShape); + std::list>::const_iterator aIt; + for (aIt = myFacesList.cbegin(); aIt != myFacesList.cend(); ++aIt) { + TopoDS_Shape aFace = (*aIt)->impl(); + aBuilder.Add(aComp, aFace); + } + Set(aComp); + } else { + Set(myOriginalShape); + } + } + AIS_Shape::ComputeSelection(aSelection, aMode); +} \ No newline at end of file