X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ResultPrs.cpp;h=eb022a2bf0d853202e1a3180a9dee43da9aade9b;hb=af851100774c4ff33b515c884abe0cd03c3f0528;hp=c8eea52c22e4155eaab79d4322e32f145c23351d;hpb=e0dddd8c3be7d84a4a195eb02a22f9733da7ed5e;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index c8eea52c2..eb022a2bf 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: ModuleBase_ResultPrs.cpp // Created: 21 October 2014 // Author: Vitaly SMETANNIKOV @@ -5,8 +7,8 @@ #include "ModuleBase_ResultPrs.h" #include -#include -#include +#include +#include #include #include @@ -19,25 +21,17 @@ 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 - GeomAlgoAPI_SketchBuilder::createFaces(aWirePtr->origin(), aWirePtr->dirX(), - aWirePtr->dirY(), aWirePtr->norm(), aWirePtr, myFacesList); - - myOriginalShape = aWirePtr->impl(); - Set(myOriginalShape); myIsSketchMode = true; - } else { - Set(aWirePtr->impl()); } - } else { - Set(aShapePtr->impl()); } + Set(aShapePtr->impl()); } @@ -45,10 +39,25 @@ void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode) { - boost::shared_ptr aShapePtr = ModelAPI_Tools::shape(myResult); + std::shared_ptr aShapePtr = ModelAPI_Tools::shape(myResult); + if (!aShapePtr) + return; + if (myIsSketchMode) { + myFacesList.clear(); + ResultConstructionPtr aConstruction = + std::dynamic_pointer_cast(myResult); + if (aConstruction.get()) { + int aFacesNum = aConstruction->facesNum(); + for(int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) { + myFacesList.push_back(aConstruction->face(aFaceIndex)); + } + } + } myOriginalShape = aShapePtr->impl(); - Set(aShapePtr->impl()); - AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); + if (!myOriginalShape.IsNull()) { + Set(myOriginalShape); + AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); + } } @@ -61,7 +70,7 @@ void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& a TopoDS_Compound aComp; aBuilder.MakeCompound(aComp); aBuilder.Add(aComp, myOriginalShape); - std::list>::const_iterator aIt; + std::list>::const_iterator aIt; for (aIt = myFacesList.cbegin(); aIt != myFacesList.cend(); ++aIt) { TopoDS_Shape aFace = (*aIt)->impl(); aBuilder.Add(aComp, aFace);