mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0028365: Visualization, AIS_InteractiveContext - apply selection filter in AddOrRemoveSelected at Neutral point
This commit is contained in:
parent
650efe05be
commit
4d901cde7c
@ -1183,6 +1183,9 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
|||||||
if (theOwner.IsNull() || !theOwner->HasSelectable())
|
if (theOwner.IsNull() || !theOwner->HasSelectable())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!myFilters->IsOk(theOwner) && !theOwner->IsSelected())
|
||||||
|
return;
|
||||||
|
|
||||||
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
|
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
|
||||||
theOwner->SetSelected (aSelStat == AIS_SS_Added);
|
theOwner->SetSelected (aSelStat == AIS_SS_Added);
|
||||||
const Handle(AIS_InteractiveObject) anObj =
|
const Handle(AIS_InteractiveObject) anObj =
|
||||||
|
@ -4947,6 +4947,62 @@ static int VPickShape( Draw_Interpretor& di, Standard_Integer argc, const char**
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : VSetFilter
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
static int VSetFilter(Draw_Interpretor& theDi, Standard_Integer theArgc,
|
||||||
|
const char** theArgv)
|
||||||
|
{
|
||||||
|
if (theArgc != 2)
|
||||||
|
{
|
||||||
|
theDi << theArgv[0] << " error : wrong number of parameters.\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
|
||||||
|
if (aContext.IsNull())
|
||||||
|
{
|
||||||
|
std::cout << "Error: AIS context is not available.\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TCollection_AsciiString anArg(theArgv[1]);
|
||||||
|
if (anArg.IsEqual("-clear")) {
|
||||||
|
aContext->RemoveFilters();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TCollection_AsciiString aPName, aPValue;
|
||||||
|
if (!ViewerTest::SplitParameter (anArg, aPName, aPValue)) {
|
||||||
|
std::cout << "Error: wrong command attribute name" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TopAbs_ShapeEnum aType = TopAbs_COMPOUND;
|
||||||
|
if(aPValue.IsEqual("VERTEX")) aType = TopAbs_VERTEX;
|
||||||
|
else if (aPValue.IsEqual("EDGE")) aType = TopAbs_EDGE;
|
||||||
|
else if (aPValue.IsEqual("WIRE")) aType = TopAbs_WIRE;
|
||||||
|
else if (aPValue.IsEqual("FACE")) aType = TopAbs_FACE;
|
||||||
|
else if(aPValue.IsEqual("SHAPE")) aType = TopAbs_SHAPE;
|
||||||
|
else if (aPValue.IsEqual("SHELL")) aType = TopAbs_SHELL;
|
||||||
|
else if (aPValue.IsEqual("SOLID")) aType = TopAbs_SOLID;
|
||||||
|
else {
|
||||||
|
std::cout << "Error: wrong command attribute value" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(aType==TopAbs_SHAPE){
|
||||||
|
Handle(AIS_TypeFilter) aFilter = new AIS_TypeFilter(AIS_KOI_Shape);
|
||||||
|
aContext->AddFilter(aFilter);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Handle(StdSelect_ShapeTypeFilter) aFilter = new StdSelect_ShapeTypeFilter(aType);
|
||||||
|
aContext->AddFilter(aFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : VPickSelected
|
//function : VPickSelected
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -5839,6 +5895,13 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
|
|||||||
"\n\t\t: Reads shape from BREP-format file and displays it in the viewer. ",
|
"\n\t\t: Reads shape from BREP-format file and displays it in the viewer. ",
|
||||||
__FILE__,vr, group);
|
__FILE__,vr, group);
|
||||||
|
|
||||||
|
theCommands.Add("vsetfilter",
|
||||||
|
"vsetfilter [-type={VERTEX|EDGE|WIRE|FACE|SHAPE|SHELL|SOLID}] [-clear]"
|
||||||
|
"\nSets selection shape type filter in context or remove all filters."
|
||||||
|
"\n : Option -type set type of selection filter. Filters are applyed with Or combination."
|
||||||
|
"\n : Option -clear remove all filters in context",
|
||||||
|
__FILE__,VSetFilter,group);
|
||||||
|
|
||||||
theCommands.Add("vpickselected", "vpickselected [name]: extract selected shape.",
|
theCommands.Add("vpickselected", "vpickselected [name]: extract selected shape.",
|
||||||
__FILE__, VPickSelected, group);
|
__FILE__, VPickSelected, group);
|
||||||
|
|
||||||
|
21
tests/bugs/vis/bug28365
Normal file
21
tests/bugs/vis/bug28365
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
puts "==========="
|
||||||
|
puts "OCC28365"
|
||||||
|
puts "==========="
|
||||||
|
puts ""
|
||||||
|
##########################################################################
|
||||||
|
# Visualization, AIS_InteractiveContext - apply selection filter in
|
||||||
|
# AddOrRemoveSelected at Neutral point
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
pload ALL
|
||||||
|
vinit
|
||||||
|
box b 10 10 10
|
||||||
|
vdisplay b
|
||||||
|
vfit
|
||||||
|
vsetfilter -type=VERTEX
|
||||||
|
vchangeselected b
|
||||||
|
|
||||||
|
set NbSelected1 [vnbselected]
|
||||||
|
if { ${NbSelected1} != 0 } {
|
||||||
|
puts "Error : Vertex filter was not applyed"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user