X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ResultPrs.cpp;h=ccba3a2071f008092dd64616e85add91ddb700c8;hb=724c0db85290472474a71c1165ae2c06670e7372;hp=76ea42c68a9b7c0c296306c677f504fd901b81e8;hpb=f14192492e36f4febc93b2ad7ab7f866cbbdf71b;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index 76ea42c68..ccba3a207 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2022 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -60,6 +60,15 @@ #include #include #include +#include +#include +#include +#include +#include + +#if OCC_VERSION_HEX > 0x070400 +#include +#endif //******************************************************************************************* @@ -69,8 +78,11 @@ IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ResultPrs, ViewerData_AISShape); //******************************************************************** ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) - : ViewerData_AISShape(TopoDS_Shape()), myResult(theResult), myAdditionalSelectionPriority(0), - myTransparency(1), myIsSubstituted(false) + : ViewerData_AISShape(TopoDS_Shape()), + myResult(theResult), + myIsSubstituted(false), + myTransparency(1), + myAdditionalSelectionPriority(0) { GeomShapePtr aShapePtr = ModelAPI_Tools::shape(theResult); @@ -93,9 +105,11 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) } Set(aShape); - // Activate individual repaintng if this is a part of compsolid - ResultBodyPtr aResOwner = ModelAPI_Tools::bodyOwner(myResult); - SetAutoHilight(aResOwner.get() == NULL); + // VSV: bos22744: The AutoHilight mode is swithced off because it produces different + // behaviour of selection for simple shape and compound. For example when selection mode + // is Vertex the shape is selected by vertex, but compound is selected by whole shape + //ResultBodyPtr aResOwner = ModelAPI_Tools::bodyOwner(myResult); + //SetAutoHilight(aResOwner.get() == NULL); // Set own free boundaries aspect in order to have free // and unfree boundaries with different colors @@ -199,8 +213,6 @@ void ModuleBase_ResultPrs::setEdgesDefaultColor() //******************************************************************** void ModuleBase_ResultPrs::setSubShapeHidden(const TopoDS_ListOfShape& theShapes) { - bool isModified = false; - TopoDS_Compound aCompound; BRep_Builder aBBuilder; aBBuilder.MakeCompound (aCompound); @@ -292,6 +304,49 @@ void ModuleBase_ResultPrs::Compute( catch (...) { return; } + if (myResult.get() && ModelAPI_Tools::isShowEdgesDirection(myResult)) + { + TopExp_Explorer Exp(myshape, TopAbs_EDGE); + for (; Exp.More(); Exp.Next()) { + TopoDS_Edge anEdgeE = TopoDS::Edge(Exp.Current()); + if (anEdgeE.IsNull()) + continue; + + // draw curve direction (issue 0021087) + anEdgeE.Orientation(TopAbs_FORWARD); + + TopoDS_Vertex aV1, aV2; + TopExp::Vertices(anEdgeE, aV1, aV2); + gp_Pnt aP1 = BRep_Tool::Pnt(aV1); + gp_Pnt aP2 = BRep_Tool::Pnt(aV2); + + double fp, lp; + gp_Vec aDirVec; + Handle(Geom_Curve) C = BRep_Tool::Curve(anEdgeE, fp, lp); + + if (C.IsNull()) continue; + + if (anEdgeE.Orientation() == TopAbs_FORWARD) + C->D1(lp, aP2, aDirVec); + else { + C->D1(fp, aP1, aDirVec); + aP2 = aP1; + } + GeomAdaptor_Curve aAdC; + aAdC.Load(C, fp, lp); + Standard_Real aDist = GCPnts_AbscissaPoint::Length(aAdC, fp, lp); + + if (aDist > gp::Resolution()) { + gp_Dir aDir; + if (anEdgeE.Orientation() == TopAbs_FORWARD) + aDir = aDirVec; + else + aDir = -aDirVec; + + Prs3d_Arrow::Draw(thePresentation->CurrentGroup(), aP2, aDir, M_PI / 180.*5., aDist / 10.); + } + } + } // visualize hidden sub-shapes transparent if (myResult.get()) { @@ -420,20 +475,23 @@ void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& a //******************************************************************** bool ModuleBase_ResultPrs::appendVertexSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer theMode) + const Standard_Integer /*theMode*/) { if (Shape().ShapeType() == TopAbs_VERTEX) { const TopoDS_Shape& aShape = Shape(); int aPriority = StdSelect_BRepSelectionTool::GetStandardPriority(aShape, TopAbs_VERTEX); +#if OCC_VERSION_HEX > 0x070400 + double aDeflection = StdPrs_ToolTriangulatedShape::GetDeflection(aShape, myDrawer); +#else double aDeflection = Prs3d::GetDeflection(aShape, myDrawer); - +#endif /// The cause of this method is the last parameter of BRep owner setting into True. /// That means that owner should behave like it comes from decomposition. (In this case, OCCT /// visualizes it in Ring style) OCCT version is 7.0.0 with path for SHAPER module. Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(aShape, aPriority, Standard_True); StdSelect_BRepSelectionTool::ComputeSensitive(aShape, aOwner, aSelection, - aDeflection, myDrawer->HLRAngle(), 9, 500); + aDeflection, myDrawer->DeviationAngle(), 9, 500); NCollection_Vector anEntities = aSelection->Entities();