From: mpa Date: Thu, 17 Jul 2014 10:56:46 +0000 (+0400) Subject: Implemented a new method of displaying shading with edges mode of object using OCC... X-Git-Tag: V7_5_0a1~38 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=806956971e5eeda2c52d91b2152593da2b79dbc5;p=modules%2Fgeom.git Implemented a new method of displaying shading with edges mode of object using OCC technologies --- diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 8a8969492..09c3ccf2d 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -853,9 +853,6 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap // - color for edges in shading+edges mode AISShape->SetEdgesInShadingColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value() ) ); - - // ??? - AISShape->storeBoundaryColors(); // set display mode AISShape->SetDisplayMode( HasDisplayMode() ? @@ -864,6 +861,13 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap // display mode from properties propMap.value( GEOM::propertyName( GEOM::DisplayMode ) ).toInt() ); + // - face boundaries color + if( AISShape->DisplayMode() == GEOM_AISShape::ShadingWithEdges ) + AISShape->Attributes()->SetFaceBoundaryDraw( Standard_True ); + anAspect = AISShape->Attributes()->FaceBoundaryAspect(); + anAspect->SetColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value() ) ); + AISShape->Attributes()->SetFaceBoundaryAspect( anAspect ); + // set display vectors flag AISShape->SetDisplayVectors( propMap.value( GEOM::propertyName( GEOM::EdgesDirection ) ).toBool() ); diff --git a/src/OBJECT/GEOM_AISShape.cxx b/src/OBJECT/GEOM_AISShape.cxx index e790b8072..462eed0c2 100644 --- a/src/OBJECT/GEOM_AISShape.cxx +++ b/src/OBJECT/GEOM_AISShape.cxx @@ -158,14 +158,9 @@ GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape, myShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD ); myPrevDisplayMode = 0; - storeBoundaryColors(); - myEdgesInShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD ); - myUIsoNumber = -1; - myVIsoNumber = -1; - myTopLevel = Standard_False; Graphic3d_MaterialAspect aMatAspect; if ( !HasMaterial() ) { @@ -226,9 +221,6 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent case 0://StdSelect_DM_Wireframe: case CustomHighlight: { - restoreIsoNumbers(); - // Restore wireframe edges colors - restoreBoundaryColors(); if(isTopLev) { SetColor(topLevelColor()); Handle(Prs3d_LineAspect) anAspect = Attributes()->WireAspect(); @@ -243,10 +235,16 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent } case 1://StdSelect_DM_Shading: { - restoreIsoNumbers(); shadingMode(aPresentationManager, aPrs, aMode); - // Store wireframe edges colors - storeBoundaryColors(); + break; + } + case 2: { //ShadingWithEdges + //Shaded faces + shadingMode(aPresentationManager, aPrs, AIS_Shaded); + myDrawer->SetFaceBoundaryDraw( Standard_True ); + Handle(Prs3d_LineAspect) aBoundaryAspect = + new Prs3d_LineAspect ( myEdgesInShadingColor, Aspect_TOL_SOLID, myOwnWidth ); + myDrawer->SetFaceBoundaryAspect (aBoundaryAspect); break; } case 3: //StdSelect_DM_HLR: @@ -258,38 +256,6 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent break; } } - - if ( aMode == ShadingWithEdges ) { - // Temporary store number of iso lines in order to recover its later - // when display mode is achnged to 'Wirefame' or 'Shading'. - // Iso lines are not displayed in 'Shading with edges' mode. - storeIsoNumbers(); - - // Reset number of iso lines to 0 - resetIsoNumbers(); - - //Shaded faces - shadingMode(aPresentationManager, aPrs, AIS_Shaded); - - // Store wireframe edges colors - storeBoundaryColors(); - - // Coloring edges - Handle(Prs3d_LineAspect) anAspect = myDrawer->UnFreeBoundaryAspect(); - anAspect->SetColor( myEdgesInShadingColor ); - myDrawer->SetUnFreeBoundaryAspect( anAspect ); - - anAspect = myDrawer->FreeBoundaryAspect(); - anAspect->SetColor( myEdgesInShadingColor ); - myDrawer->SetFreeBoundaryAspect( anAspect ); - - // Add edges to presentation - if( anIsColorField && myFieldDimension == 1 ) - drawField( aPrs ); - else - StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer); - } - if (isShowVectors()) { const bool isVector = IsKind(STANDARD_TYPE(GEOM_AISVector)); @@ -428,61 +394,6 @@ void GEOM_AISShape::shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPre } } -void GEOM_AISShape::storeIsoNumbers() -{ - myUIsoNumber = myDrawer->UIsoAspect()->Number(); - myVIsoNumber = myDrawer->VIsoAspect()->Number(); -} - -void GEOM_AISShape::restoreIsoNumbers() -{ - if ( myUIsoNumber > 0 ) { - // Restore number of U iso lines - Handle(Prs3d_IsoAspect) anAspect = myDrawer->UIsoAspect(); - anAspect->SetNumber( myUIsoNumber ); - myDrawer->SetUIsoAspect( anAspect ); - } - - if ( myVIsoNumber > 0 ) { - // Restore number of V iso lines - Handle(Prs3d_IsoAspect) anAspect = myDrawer->VIsoAspect(); - anAspect->SetNumber( myVIsoNumber ); - myDrawer->SetVIsoAspect( anAspect ); - } -} - -void GEOM_AISShape::resetIsoNumbers() -{ - Handle(Prs3d_IsoAspect) anAspect = myDrawer->UIsoAspect(); - anAspect->SetNumber( 0 ); - myDrawer->SetUIsoAspect( anAspect ); - - anAspect = myDrawer->VIsoAspect(); - anAspect->SetNumber( 0 ); - myDrawer->SetVIsoAspect( anAspect ); -} - -void GEOM_AISShape::storeBoundaryColors() -{ - Aspect_TypeOfLine aLT; - Standard_Real aW; - - myDrawer->FreeBoundaryAspect()->Aspect()->Values( myFreeBoundaryColor, aLT, aW); - myDrawer->UnFreeBoundaryAspect()->Aspect()->Values( myUnFreeBoundaryColor, aLT, aW); -} - -void GEOM_AISShape::restoreBoundaryColors() -{ - Handle(Prs3d_LineAspect) anAspect = myDrawer->FreeBoundaryAspect(); - anAspect->SetColor( myFreeBoundaryColor ); - myDrawer->SetFreeBoundaryAspect( anAspect ); - - anAspect = myDrawer->UnFreeBoundaryAspect(); - anAspect->SetColor( myUnFreeBoundaryColor ); - myDrawer->SetUnFreeBoundaryAspect( anAspect ); -} - - Standard_Boolean GEOM_AISShape::isTopLevel() { return myTopLevel; } diff --git a/src/OBJECT/GEOM_AISShape.hxx b/src/OBJECT/GEOM_AISShape.hxx index b2881d2c6..d744a791a 100644 --- a/src/OBJECT/GEOM_AISShape.hxx +++ b/src/OBJECT/GEOM_AISShape.hxx @@ -139,12 +139,6 @@ public: const Handle(Standard_Type)& DynamicType() const; Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - void storeIsoNumbers(); - void restoreIsoNumbers(); - void resetIsoNumbers(); - - void storeBoundaryColors(); - static Quantity_Color topLevelColor(); static void setTopLevelColor(const Quantity_Color c); @@ -173,8 +167,6 @@ protected: const Handle(Prs3d_Presentation)& aPrs, const Standard_Integer aMode); - void restoreBoundaryColors(); - // Displaying the field data void drawField( const Handle(Prs3d_Presentation)& thePrs, const bool theIsText = false, @@ -185,15 +177,8 @@ protected: gp_Pnt& theCenter ); Quantity_Color myShadingColor; - - Quantity_Color myFreeBoundaryColor; - Quantity_Color myUnFreeBoundaryColor; - Quantity_Color myEdgesInShadingColor; - int myUIsoNumber; - int myVIsoNumber; - private: TCollection_AsciiString myName; bool myDisplayVectors; diff --git a/src/OBJECT/GEOM_Actor.cxx b/src/OBJECT/GEOM_Actor.cxx index 92860af3e..47bc66b17 100644 --- a/src/OBJECT/GEOM_Actor.cxx +++ b/src/OBJECT/GEOM_Actor.cxx @@ -186,9 +186,6 @@ GEOM_Actor::GEOM_Actor(): myShadingFaceActor->SetProperty(myShadingFaceProp.GetPointer()); - myNbIsos[0] = -1; - myNbIsos[1] = -1; - // Toggle display mode setDisplayMode(0); // WIRE FRAME SetVectorMode(0); // @@ -296,16 +293,6 @@ setDisplayMode(int theMode) #ifdef MYDEBUG MESSAGE ( "GEOM_Actor::setDisplayMode = "<GetProperty()->SetColor(myIsolatedEdgeColor[0], myIsolatedEdgeColor[1], @@ -896,14 +880,6 @@ GEOM_Actor MESSAGE ( this << " GEOM_Actor::Highlight myIsSelected="<SetVisibility( false ); bool anIsPreselected = myIsPreselected; @@ -1081,11 +1049,6 @@ void GEOM_Actor::SetEdgesInShadingColor(double r,double g,double b) myEdgesInShadingColor[2] = b; } -void GEOM_Actor::StoreIsoNumbers() -{ - myWireframeFaceSource->GetNbIso(myNbIsos[0], myNbIsos[1]); -} - void GEOM_Actor::SetIsosWidth(const int width) { myWireframeFaceActor->GetProperty()->SetLineWidth(width); } @@ -1106,16 +1069,3 @@ void GEOM_Actor::SetWidth(const int width) { int GEOM_Actor::GetWidth() const { return (int)myIsolatedEdgeActor->GetProperty()->GetLineWidth(); } - -void GEOM_Actor::RestoreIsoNumbers() -{ - if ( myNbIsos[0] > 0 || myNbIsos[1] > 0 ) - // Restore number of U and (or) V iso lines - myWireframeFaceSource->SetNbIso(myNbIsos); -} - -void GEOM_Actor::ResetIsoNumbers() -{ - int aNb[2] = {0, 0}; - myWireframeFaceSource->SetNbIso(aNb); -} diff --git a/src/OBJECT/GEOM_Actor.h b/src/OBJECT/GEOM_Actor.h index 687663932..fa7193a0f 100644 --- a/src/OBJECT/GEOM_Actor.h +++ b/src/OBJECT/GEOM_Actor.h @@ -201,15 +201,6 @@ public: virtual bool GetVectorMode(); - - void - StoreIsoNumbers(); - - void - RestoreIsoNumbers(); - - void - ResetIsoNumbers(); protected: void SetModified(); @@ -221,7 +212,6 @@ protected: private: TopoDS_Shape myShape; - int myNbIsos[2]; bool isOnlyVertex; float myDeflection;