X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FModuleBase%2FModuleBase_ResultPrs.cpp;h=e2d35c87b2a8111facc8ebd31d15db737b151aee;hb=4c74e5b864eef28128e27b3ece944990ca8f3fbe;hp=035d6c52a12a9fa73dbc7d49dcac375b42ad6168;hpb=a1baede8e41ab33d4d133cfa42f1fbafb50c8438;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp old mode 100755 new mode 100644 index 035d6c52a..e2d35c87b --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2019 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 @@ -12,10 +12,9 @@ // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or -// email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "ModuleBase_ResultPrs.h" @@ -65,12 +64,16 @@ IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ResultPrs, ViewerData_AISShape); //******************************************************************** ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) : ViewerData_AISShape(TopoDS_Shape()), myResult(theResult), myAdditionalSelectionPriority(0), - myTransparency(1) + myTransparency(1), myIsSubstituted(false) { std::shared_ptr aShapePtr = ModelAPI_Tools::shape(theResult); TopoDS_Shape aShape = aShapePtr->impl(); Set(aShape); + // Activate individual repaintng if this is a part of compsolid + 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 Handle(Prs3d_Drawer) aDrawer = Attributes(); @@ -83,11 +86,7 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) else aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.)); - // Activate individual repaintng if this is a part of compsolid - ResultBodyPtr aResOwner = ModelAPI_Tools::bodyOwner(myResult); - SetAutoHilight(aResOwner.get() == NULL); - - myHiddenSubShapesDrawer = new AIS_ColoredDrawer (myDrawer); + myHiddenSubShapesDrawer = new AIS_ColoredDrawer(myDrawer); Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect(); aShadingAspect->SetMaterial(Graphic3d_NOM_BRASS); //default value of context material myHiddenSubShapesDrawer->SetShadingAspect(aShadingAspect); @@ -114,31 +113,33 @@ void ModuleBase_ResultPrs::SetColor (const Quantity_Color& theColor) void ModuleBase_ResultPrs::setEdgesDefaultColor() { - AttributeIntArrayPtr aColorAttr = myResult->data()->intArray(ModelAPI_Result::COLOR_ID()); - bool aHasColor = aColorAttr.get() && aColorAttr->isInitialized(); - - if (!aHasColor) { - Handle(Prs3d_Drawer) aDrawer = Attributes(); - Handle(Prs3d_LineAspect) anAspect; // = aDrawer->LineAspect(); - //anAspect->SetColor(Quantity_NOC_YELLOW); - //aDrawer->SetLineAspect(anAspect); - - // - unfree boundaries color - anAspect = aDrawer->UnFreeBoundaryAspect(); - anAspect->SetColor(Quantity_NOC_YELLOW); - aDrawer->SetUnFreeBoundaryAspect(anAspect); - aDrawer->SetUnFreeBoundaryDraw(true); - - // - free boundaries color - anAspect = aDrawer->FreeBoundaryAspect(); - anAspect->SetColor(Quantity_NOC_GREEN); - aDrawer->SetFreeBoundaryAspect(anAspect); - aDrawer->SetFreeBoundaryDraw(true); - - // - standalone edges color - anAspect = aDrawer->WireAspect(); - anAspect->SetColor(Quantity_NOC_RED); - aDrawer->SetWireAspect(anAspect); + if (myResult.get()) { + AttributeIntArrayPtr aColorAttr = myResult->data()->intArray(ModelAPI_Result::COLOR_ID()); + bool aHasColor = aColorAttr.get() && aColorAttr->isInitialized(); + + if (!aHasColor) { + Handle(Prs3d_Drawer) aDrawer = Attributes(); + Handle(Prs3d_LineAspect) anAspect; // = aDrawer->LineAspect(); + //anAspect->SetColor(Quantity_NOC_YELLOW); + //aDrawer->SetLineAspect(anAspect); + + // - unfree boundaries color + anAspect = aDrawer->UnFreeBoundaryAspect(); + anAspect->SetColor(Quantity_NOC_YELLOW); + aDrawer->SetUnFreeBoundaryAspect(anAspect); + aDrawer->SetUnFreeBoundaryDraw(true); + + // - free boundaries color + anAspect = aDrawer->FreeBoundaryAspect(); + anAspect->SetColor(Quantity_NOC_GREEN); + aDrawer->SetFreeBoundaryAspect(anAspect); + aDrawer->SetFreeBoundaryDraw(true); + + // - standalone edges color + anAspect = aDrawer->WireAspect(); + anAspect->SetColor(Quantity_NOC_RED); + aDrawer->SetWireAspect(anAspect); + } } } @@ -151,30 +152,44 @@ bool ModuleBase_ResultPrs::setSubShapeHidden(const NCollection_List