From: vpa Date: Thu, 17 Sep 2015 15:57:48 +0000 (+0300) Subject: 0026680: Visualization - Changed behavior of mesh visualization and selection in... X-Git-Tag: V7_0_0_beta~244 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=673cf4e37625056a5a3dfee783b78713ed40b66d 0026680: Visualization - Changed behavior of mesh visualization and selection in OMF sample - handling of global selection mode was added to MeshVS_Mesh; - corrected unhighlight of interactives with auto-highlight disabled; - test case for issue 0026680. --- diff --git a/src/AIS/AIS_InteractiveContext_1.cxx b/src/AIS/AIS_InteractiveContext_1.cxx index 81cdbf3c79..2cb6e921c0 100644 --- a/src/AIS/AIS_InteractiveContext_1.cxx +++ b/src/AIS/AIS_InteractiveContext_1.cxx @@ -426,7 +426,10 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdate } while (!anObjToClear.IsEmpty()) { - anObjToClear.FindKey (anObjToClear.Size())->ClearSelected(); + const Handle(AIS_InteractiveObject)& anObj = anObjToClear.FindKey (anObjToClear.Size()); + const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0; + myMainPM->Unhighlight (anObj, aHiMode); + anObj->ClearSelected(); anObjToClear.RemoveLast(); } diff --git a/src/MeshVS/MeshVS_Mesh.cxx b/src/MeshVS/MeshVS_Mesh.cxx index 9dd92641db..894bd96ef0 100644 --- a/src/MeshVS/MeshVS_Mesh.cxx +++ b/src/MeshVS/MeshVS_Mesh.cxx @@ -908,6 +908,13 @@ void MeshVS_Mesh::HilightSelected ( const Handle(PrsMgr_PresentationManager3d)& for( i=1; i<=len; i++ ) { + if (theOwners.Value (i) == GlobalSelOwner()) + { + const Standard_Integer aHiMode = HasHilightMode() ? HilightMode() : 0; + const Quantity_NameOfColor aSelColor = GetContext().IsNull() ? Quantity_NOC_GRAY80 : GetContext()->SelectionColor(); + thePM->Color (this, aSelColor, aHiMode); + continue; + } anOwner = Handle (MeshVS_MeshEntityOwner)::DownCast ( theOwners.Value ( i ) ); if ( !anOwner.IsNull() ) { @@ -1016,6 +1023,16 @@ void MeshVS_Mesh::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManage const Quantity_NameOfColor Color, const Handle(SelectMgr_EntityOwner)& Owner) { + if (Owner.IsNull()) + return; + + if (Owner == GlobalSelOwner()) + { + Standard_Integer aHiMode = HasHilightMode() ? HilightMode() : 0; + PM->Color (this, Color, aHiMode, NULL, Graphic3d_ZLayerId_Top); + return; + } + if ( myHilighter.IsNull() ) return; @@ -1029,8 +1046,6 @@ void MeshVS_Mesh::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManage aHilightPrs->SetTransformPersistence( Presentation()->TransformPersistenceMode(), Presentation()->TransformPersistencePoint() ); //---------------- - if( Owner.IsNull() ) return; - const Standard_Boolean isMeshEntityOwner = Owner->IsKind ( STANDARD_TYPE ( MeshVS_MeshEntityOwner ) ); const Standard_Boolean isWholeMeshOwner = //agv !Owner.IsNull() && Owner==myWholeMeshOwner; diff --git a/tests/bugs/vis/bug26680 b/tests/bugs/vis/bug26680 new file mode 100644 index 0000000000..c4e8da692d --- /dev/null +++ b/tests/bugs/vis/bug26680 @@ -0,0 +1,36 @@ +puts "============" +puts "CR26680" +puts "============" +puts "" + +########################################################################################## +puts "Visualization - Changed behavior of mesh visualization and selection in OMF sample" +########################################################################################## + +pload VISUALIZATION XDE + +vinit +meshfromstl m [locate_data_file bug26680.stl] +meshcolors m elem2 1 + +vselmode 0 1 + +vmoveto 200 200 +if {[vreadpixel 197 257 name] != "CYAN1 1"} { + puts "ERROR: presentation for dynamic highlight of the object is wrong!" +} +vmoveto 0 0 +if {[vreadpixel 197 257 name] != "BLUE2 1"} { + puts "ERROR: the object is not unhighlighted after dynamic highlight!" +} + +vselect 200 200 +if {[vreadpixel 197 257 name] != "GRAY80 1"} { + puts "ERROR: presentation for selection highlight is wrong!" +} +vselect 0 0 +if {[vreadpixel 197 257 name] != "BLUE2 1"} { + puts "ERROR: the object is not unhighlighted after selection highlight!" +} + +set only_screen 1