1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0030451: Selection mode of TPrsStd_AISPresentation attribute is restricted to one value

Two classes TDataXtd_Presentation and TPrsStd_AISPresentation were improved so that they accept a list of selection modes.
A new non-regression test is added: caf presentation N1
This commit is contained in:
vro
2019-01-22 13:47:09 +03:00
committed by bugmaster
parent 9c0787df75
commit a0d0f96afe
6 changed files with 239 additions and 42 deletions

View File

@@ -636,7 +636,7 @@ static Standard_Integer DPrsStd_AISMode(Draw_Interpretor& di,
//=======================================================================
//function : DPrsStd_AISSelMode
//purpose : AISSelMode (DOC,entry,[SelMode])
//purpose : AISSelMode (DOC,entry,[SelMode1 SelMode2 ...])
//=======================================================================
static Standard_Integer DPrsStd_AISSelMode(Draw_Interpretor& di,
Standard_Integer nb,
@@ -645,7 +645,7 @@ static Standard_Integer DPrsStd_AISSelMode(Draw_Interpretor& di,
TDF_Label L;
Handle(TDocStd_Document) D;
Handle(TPrsStd_AISPresentation) prs;
if (nb >= 3 && nb <= 4)
if (nb >= 3)
{
if (!DDocStd::GetDocument(arg[1],D))
return 1;
@@ -653,18 +653,38 @@ static Standard_Integer DPrsStd_AISSelMode(Draw_Interpretor& di,
return 1;
if (!L.FindAttribute(TPrsStd_AISPresentation::GetID(), prs))
return 1;
if (nb == 4)
if (nb >= 4)
{
// Set selection mode.
Standard_Integer selMode = Draw::Atoi(arg[3]);
prs->SetSelectionMode(selMode);
// Add other selection modes.
for (Standard_Integer i = 4; i < nb; i++)
{
selMode = Draw::Atoi(arg[i]);
prs->AddSelectionMode(selMode);
}
TPrsStd_AISViewer::Update(L);
}
else if (nb == 3)
{
// Print selection mode.
Standard_Integer selMode = prs->SelectionMode();
di<<selMode;
Standard_Integer nbSelModes = prs->GetNbSelectionModes();
if (nbSelModes == 1)
{
Standard_Integer selMode = prs->SelectionMode();
di << selMode;
}
else
{
for (Standard_Integer i = 1; i <= nbSelModes; i++)
{
Standard_Integer selMode = prs->SelectionMode(i);
di << selMode;
if (i < nbSelModes)
di << " ";
}
}
}
return 0;
}
@@ -756,6 +776,6 @@ void DPrsStd::AISPresentationCommands (Draw_Interpretor& theCommands)
__FILE__, DPrsStd_AISMode, g);
theCommands.Add ("AISSelMode",
"AISSelMode (DOC, entry, [SelMode])",
"AISSelMode (DOC, entry, [SelMode1 SelMode2 ...])",
__FILE__, DPrsStd_AISSelMode, g);
}