X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ResultPrs.cpp;h=69ef0e7517952f6f6d9e84f8b8fdef16fe1a52fc;hb=f9fd953bf814fad40ae045f6164c7f80229b0872;hp=a298dd29723c13b92e42b45c7d781673d795f09c;hpb=4bf5c624e120ef5b7fca9625f8fdc23fbdfefc25;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index a298dd297..69ef0e751 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -5,21 +5,23 @@ // Author: Vitaly SMETANNIKOV #include "ModuleBase_ResultPrs.h" +#include "ModuleBase_Tools.h" #include +#include #include -#include #include -#include +#include +#include #include #include -IMPLEMENT_STANDARD_HANDLE(ModuleBase_ResultPrs, AIS_Shape); -IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ResultPrs, AIS_Shape); +IMPLEMENT_STANDARD_HANDLE(ModuleBase_ResultPrs, ViewerData_AISShape); +IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ResultPrs, ViewerData_AISShape); ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) - : AIS_Shape(TopoDS_Shape()), myResult(theResult), myIsSketchMode(false) + : ViewerData_AISShape(TopoDS_Shape()), myResult(theResult), myIsSketchMode(false) { std::shared_ptr aShapePtr = ModelAPI_Tools::shape(theResult); std::shared_ptr aWirePtr = @@ -31,7 +33,13 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) myIsSketchMode = true; } } - Set(aShapePtr->impl()); + TopoDS_Shape aShape = aShapePtr->impl(); + Set(aShape); + Handle(Prs3d_Drawer) aDrawer = Attributes(); + if (aDrawer->HasOwnPointAspect()) + aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS); + else + aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.)); } @@ -43,16 +51,28 @@ void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t if (!aShapePtr) return; if (myIsSketchMode) { - std::shared_ptr aWirePtr = - std::dynamic_pointer_cast(aShapePtr); myFacesList.clear(); - GeomAlgoAPI_SketchBuilder::createFaces(aWirePtr->origin(), aWirePtr->dirX(), - aWirePtr->dirY(), aWirePtr->norm(), aWirePtr, myFacesList); + 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(); if (!myOriginalShape.IsNull()) { - Set(aShapePtr->impl()); + Set(myOriginalShape); + + // change deviation coefficient to provide more precise circle + Handle(Prs3d_Drawer) aDrawer = Attributes(); + Standard_Real aPrevDeviation = aDrawer->DeviationCoefficient(); + //aDrawer->SetDeviationCoefficient(ModuleBase_Tools::defaultDeviationCoefficient()); + AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); + + //aDrawer->SetDeviationCoefficient(aPrevDeviation); } } @@ -60,6 +80,10 @@ void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) { + if (aMode > TopAbs_SHAPE) + // In order to avoid using custom selection modes + return; + if (myIsSketchMode) { if (aMode == TopAbs_FACE) { BRep_Builder aBuilder;