diff --git a/src/DPrsStd/DPrsStd_AISPresentationCommands.cxx b/src/DPrsStd/DPrsStd_AISPresentationCommands.cxx index 51fce65e51..84c8392e12 100644 --- a/src/DPrsStd/DPrsStd_AISPresentationCommands.cxx +++ b/src/DPrsStd/DPrsStd_AISPresentationCommands.cxx @@ -598,6 +598,79 @@ static Standard_Integer DPrsStd_AISHasOwnTransparency (Draw_Interpretor& di, return 1; } +//======================================================================= +//function : DPrsStd_AISMode +//purpose : AISMode (DOC,entry,[Mode]) +//======================================================================= +static Standard_Integer DPrsStd_AISMode(Draw_Interpretor& di, + Standard_Integer nb, + const char** arg) +{ + TDF_Label L; + Handle(TDocStd_Document) D; + Handle(TPrsStd_AISPresentation) prs; + if (nb >= 3 && nb <= 4) + { + if (!DDocStd::GetDocument(arg[1],D)) + return 1; + if (!DDF::FindLabel(D->GetData(),arg[2],L)) + return 1; + if (!L.FindAttribute(TPrsStd_AISPresentation::GetID(), prs)) + return 1; + if (nb == 4) + { + Standard_Integer mode = Draw::Atoi(arg[3]); + prs->SetMode(mode); + TPrsStd_AISViewer::Update(L); + } + else if (nb == 3) + { + Standard_Integer mode = prs->Mode(); + di<= 3 && nb <= 4) + { + if (!DDocStd::GetDocument(arg[1],D)) + return 1; + if (!DDF::FindLabel(D->GetData(),arg[2],L)) + return 1; + if (!L.FindAttribute(TPrsStd_AISPresentation::GetID(), prs)) + return 1; + if (nb == 4) + { + // Set selection mode. + Standard_Integer selMode = Draw::Atoi(arg[3]); + prs->SetSelectionMode(selMode); + TPrsStd_AISViewer::Update(L); + } + else if (nb == 3) + { + // Print selection mode. + Standard_Integer selMode = prs->SelectionMode(); + di<HasOwnMode()) { aNb = aTPrs->Mode(); theTarget.Element().setAttribute(::ModeString(), aNb); } -#endif } diff --git a/tests/caf/presentation/M1 b/tests/caf/presentation/M1 new file mode 100644 index 0000000000..3237a7136e --- /dev/null +++ b/tests/caf/presentation/M1 @@ -0,0 +1,27 @@ +#INTERFACE CAF +# Presentation attributes +# +# Testing attribute: TPrsStd_AISPresentation +# +# Testing command: AISMode, storage of display mode in XML file +# + +NewDocument D1 XmlOcaf +AISInitViewer D1 +box b 100 100 100 +SetShape D1 0:1 b +AISSet D1 0:1 NS +AISDisplay D1 0:1 +AISMode D1 0:1 1 + +SaveAs D1 testmode.xml +Close D1 +Open testmode.xml D2 +AISInitViewer D2 +AISDisplay D2 0:1 +set mode [AISMode D2 0:1] +if { ${mode} != 1 } { + puts ${mode} + puts "Storage of display mode of TPrsStd_AISPresentation attribute in XML document: Error" + return +}