mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0026779: Draw Harness, ViewerTest - vstate output is incorrect for sub-shapes selection without opening local context
- vstate output was corrected to handle parts selection without opened local context; - test case for issue #26779
This commit is contained in:
parent
fe30607a18
commit
23963a92d2
@ -4317,20 +4317,23 @@ static void objInfo (const NCollection_Map<Handle(AIS_InteractiveObject)>& theDe
|
||||
}
|
||||
|
||||
//! Print information about locally selected sub-shapes
|
||||
static void localCtxInfo (Draw_Interpretor& theDI)
|
||||
template <typename T>
|
||||
static void printLocalSelectionInfo (const T& theContext, Draw_Interpretor& theDI)
|
||||
{
|
||||
Handle(AIS_InteractiveContext) aCtx = TheAISContext();
|
||||
if (!aCtx->HasOpenedContext())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Boolean isGlobalCtx = !(Handle(AIS_InteractiveContext)::DownCast (theContext).IsNull());
|
||||
TCollection_AsciiString aPrevName;
|
||||
Handle(AIS_LocalContext) aCtxLoc = aCtx->LocalContext();
|
||||
for (aCtxLoc->InitSelected(); aCtxLoc->MoreSelected(); aCtxLoc->NextSelected())
|
||||
for (theContext->InitSelected(); theContext->MoreSelected(); theContext->NextSelected())
|
||||
{
|
||||
const TopoDS_Shape aSubShape = aCtxLoc->SelectedShape();
|
||||
const Handle(AIS_Shape) aShapeIO = Handle(AIS_Shape)::DownCast (aCtxLoc->SelectedInteractive());
|
||||
const Handle(AIS_Shape) aShapeIO = Handle(AIS_Shape)::DownCast (theContext->SelectedInteractive());
|
||||
const Handle(SelectMgr_EntityOwner) anOwner = theContext->SelectedOwner();
|
||||
if (aShapeIO.IsNull() || anOwner.IsNull())
|
||||
continue;
|
||||
if (isGlobalCtx)
|
||||
{
|
||||
if (anOwner == aShapeIO->GlobalSelOwner())
|
||||
continue;
|
||||
}
|
||||
const TopoDS_Shape aSubShape = theContext->SelectedShape();
|
||||
if (aSubShape.IsNull()
|
||||
|| aShapeIO.IsNull()
|
||||
|| !GetMapOfAIS().IsBound1 (aShapeIO))
|
||||
@ -4527,18 +4530,27 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (aCtx->NbSelected() > 0
|
||||
&& !toShowAll)
|
||||
if (!aCtx->HasOpenedContext() && aCtx->NbSelected() > 0 && !toShowAll)
|
||||
{
|
||||
NCollection_DataMap<Handle(SelectMgr_EntityOwner), TopoDS_Shape> anOwnerShapeMap;
|
||||
for (aCtx->InitSelected(); aCtx->MoreSelected(); aCtx->NextSelected())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObj = aCtx->SelectedInteractive();
|
||||
TCollection_AsciiString aName = GetMapOfAIS().Find1 (anObj);
|
||||
aName.LeftJustify (20, ' ');
|
||||
theDI << aName << " ";
|
||||
objInfo (aDetected, anObj, theDI);
|
||||
theDI << "\n";
|
||||
const Handle(SelectMgr_EntityOwner) anOwner = aCtx->SelectedOwner();
|
||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
// handle whole object selection
|
||||
if (anOwner == anObj->GlobalSelOwner())
|
||||
{
|
||||
TCollection_AsciiString aName = GetMapOfAIS().Find1 (anObj);
|
||||
aName.LeftJustify (20, ' ');
|
||||
theDI << aName << " ";
|
||||
objInfo (aDetected, anObj, theDI);
|
||||
theDI << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// process selected sub-shapes
|
||||
printLocalSelectionInfo (aCtx, theDI);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4558,7 +4570,9 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
|
||||
objInfo (aDetected, anObj, theDI);
|
||||
theDI << "\n";
|
||||
}
|
||||
localCtxInfo (theDI);
|
||||
printLocalSelectionInfo (aCtx, theDI);
|
||||
if (aCtx->HasOpenedContext())
|
||||
printLocalSelectionInfo (aCtx->LocalContext(), theDI);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
60
tests/bugs/vis/bug26779
Normal file
60
tests/bugs/vis/bug26779
Normal file
@ -0,0 +1,60 @@
|
||||
puts "============"
|
||||
puts "CR26779"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
##########################################################################################
|
||||
puts "Draw Harness, ViewerTest - vstate output is incorrect for sub-shapes selection without opening local context"
|
||||
##########################################################################################
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
box b1 1 2 3
|
||||
box b2 5 5 5 1 1 1
|
||||
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1
|
||||
vaxo
|
||||
vsetdispmode 1
|
||||
vdisplay b1
|
||||
vfit
|
||||
|
||||
vselmode b1 4 1
|
||||
vselect 300 300
|
||||
set anInfo [split [vstate] "\n"]
|
||||
set aItem1 [lindex $anInfo 0]
|
||||
set aItem2 [string trim [lindex $anInfo 1] ]
|
||||
set aSize [llength $anInfo]
|
||||
if {$aSize != 3 || [string compare $aItem1 "Locally selected sub-shapes within b1:"] != 0 || [string compare $aItem2 "Face #2"] != 0} {
|
||||
puts "ERROR: vstate output for selected face is incorrect"
|
||||
}
|
||||
|
||||
vdisplay b2
|
||||
vfit
|
||||
|
||||
vselect 350 120 1
|
||||
set anInfo [split [vstate *] "\n"]
|
||||
set aItem1 [string trim [lindex $anInfo 1] ]
|
||||
set aItem2 [string trim [lindex $anInfo 2] ]
|
||||
set aItem3 [string trim [lindex $anInfo 4] ]
|
||||
set aSize [llength $anInfo]
|
||||
puts $aItem1
|
||||
puts $aItem2
|
||||
puts $aSize
|
||||
if {$aSize != 6} {
|
||||
puts "ERROR: vstate output for shift selection is incorrect"
|
||||
}
|
||||
if {[string compare $aItem1 "b1 Displayed Type: AIS_Shape (AIS_Shape)"] != 0 &&
|
||||
[string compare $aItem2 "b1 Displayed Type: AIS_Shape (AIS_Shape)"] != 0} {
|
||||
puts "ERROR: no info about object b1 in vstate output"
|
||||
}
|
||||
if {[string compare $aItem1 "b2 Displayed Selected Detected Type: AIS_Shape (AIS_Shape)"] != 0 &&
|
||||
[string compare $aItem2 "b2 Displayed Selected Detected Type: AIS_Shape (AIS_Shape)"] != 0} {
|
||||
puts "ERROR: no info about object b2 in vstate output"
|
||||
}
|
||||
if {[string compare $aItem3 "Face #2"] != 0} {
|
||||
puts "ERROR: vstate output for selected face in test part 2 is incorrect"
|
||||
}
|
||||
|
||||
set only_screen 1
|
Loading…
x
Reference in New Issue
Block a user