mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0026272: Visualization - provide a possibility to activate selection modes without opening local context
- picked or selected objects are now highlighted via owners instead of interactive objects; - support methods for owners were added to AIS_InteractiveContext; - dynamically highlighted owners are now displayed in immediate mode; - selection without opening of local context is enabled by default; - added "-local" key to vselmode command to enable selection in local context; - selection filters are now completely supported in AIS_InteractiveContext; - the idea of differencing of selected items onto current (in interactive context) and selected (local selection) was eliminated; - all calls to "current" were replaced by calls to "selected" in terms of future local context removal; - AIS_InteractiveObject::mySelectionMode was removed; - now each selectable object can define own selection mode for "global" selection of the whole object; - whole object selection mode is 0 by default for all standard interactive objects; - immediate structures are now added to topmost and top layer lists; - added support of drawing immediate structures in different layers; - unused code for immediate mode was removed; - vfeedback and vexport commands now produce correct output for raytrace mode.
This commit is contained in:
@@ -496,14 +496,14 @@ void ViewerTest::StandardModeActivation(const Standard_Integer mode )
|
||||
|
||||
if(!aContext->HasOpenedContext()) {
|
||||
// To unhilight the preselected object
|
||||
aContext->UnhilightCurrents(Standard_False);
|
||||
aContext->UnhilightSelected(Standard_False);
|
||||
// Open a local Context in order to be able to select subshape from
|
||||
// the selected shape if any or for all if there is no selection
|
||||
if (!aContext->FirstCurrentObject().IsNull()){
|
||||
if (!aContext->FirstSelectedObject().IsNull()){
|
||||
aContext->OpenLocalContext(Standard_False);
|
||||
|
||||
for(aContext->InitCurrent();aContext->MoreCurrent();aContext->NextCurrent()){
|
||||
aContext->Load( aContext->Current(),-1,Standard_True);
|
||||
for(aContext->InitSelected();aContext->MoreSelected();aContext->NextSelected()){
|
||||
aContext->Load( aContext->SelectedInteractive(),-1,Standard_True);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1078,18 +1078,13 @@ static int VDispMode (Draw_Interpretor& , Standard_Integer argc, const char** ar
|
||||
//unset displaymode.. comportement particulier...
|
||||
if(TypeOfOperation==4){
|
||||
if(argc==1){
|
||||
if(Ctx->NbCurrents()==0 ||
|
||||
Ctx->NbSelected()==0){
|
||||
if(Ctx->NbSelected()==0){
|
||||
Handle(AIS_InteractiveObject) IO;
|
||||
VwrTst_DispErase(IO,-1,4,Standard_False);
|
||||
}
|
||||
else if(!Ctx->HasOpenedContext()){
|
||||
for(Ctx->InitCurrent();Ctx->MoreCurrent();Ctx->NextCurrent())
|
||||
VwrTst_DispErase(Ctx->Current(),-1,4,Standard_False);
|
||||
}
|
||||
else{
|
||||
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
|
||||
VwrTst_DispErase(Ctx->Interactive(),-1,4,Standard_False);}
|
||||
VwrTst_DispErase(Ctx->SelectedInteractive(),-1,4,Standard_False);}
|
||||
Ctx->UpdateCurrentViewer();
|
||||
}
|
||||
else{
|
||||
@@ -1104,20 +1099,20 @@ static int VDispMode (Draw_Interpretor& , Standard_Integer argc, const char** ar
|
||||
}
|
||||
else if(argc==2){
|
||||
Standard_Integer Dmode = Draw::Atoi(argv[1]);
|
||||
if(Ctx->NbCurrents()==0 && TypeOfOperation==3){
|
||||
if(Ctx->NbSelected()==0 && TypeOfOperation==3){
|
||||
Handle(AIS_InteractiveObject) IO;
|
||||
VwrTst_DispErase(IO,Dmode,TypeOfOperation,Standard_True);
|
||||
}
|
||||
if(!Ctx->HasOpenedContext()){
|
||||
// set/unset display mode sur le Contexte...
|
||||
for(Ctx->InitCurrent();Ctx->MoreCurrent();Ctx->NextCurrent()){
|
||||
VwrTst_DispErase(Ctx->Current(),Dmode,TypeOfOperation,Standard_False);
|
||||
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected()){
|
||||
VwrTst_DispErase(Ctx->SelectedInteractive(),Dmode,TypeOfOperation,Standard_False);
|
||||
}
|
||||
Ctx->UpdateCurrentViewer();
|
||||
}
|
||||
else{
|
||||
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
|
||||
Ctx->Display(Ctx->Interactive(),Dmode);
|
||||
Ctx->Display(Ctx->SelectedInteractive(),Dmode);
|
||||
}
|
||||
}
|
||||
else{
|
||||
@@ -1142,30 +1137,22 @@ static int VSubInt(Draw_Interpretor& di, Standard_Integer argc, const char** arg
|
||||
Standard_Integer On = Draw::Atoi(argv[1]);
|
||||
const Handle(AIS_InteractiveContext)& Ctx = ViewerTest::GetAISContext();
|
||||
|
||||
if(argc==2){
|
||||
if(argc==2)
|
||||
{
|
||||
TCollection_AsciiString isOnOff = On == 1 ? "on" : "off";
|
||||
di << "Sub intensite is turned " << isOnOff << " for " << Ctx->NbSelected() << "objects\n";
|
||||
for (Ctx->InitSelected(); Ctx->MoreSelected(); Ctx->NextSelected())
|
||||
{
|
||||
if(On==1)
|
||||
{
|
||||
Ctx->SubIntensityOn (Ctx->SelectedInteractive(), Standard_False);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ctx->SubIntensityOff (Ctx->SelectedInteractive(), Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
if(!Ctx->HasOpenedContext()){
|
||||
di<<"sub intensite ";
|
||||
if(On==1) di<<"On";
|
||||
else di<<"Off";
|
||||
di<<" pour "<<Ctx->NbCurrents()<<" objets"<<"\n";
|
||||
for(Ctx->InitCurrent();Ctx->MoreCurrent();Ctx->NextCurrent()){
|
||||
if(On==1){
|
||||
Ctx->SubIntensityOn(Ctx->Current(),Standard_False);}
|
||||
else{
|
||||
di <<"passage dans off"<<"\n";
|
||||
Ctx->SubIntensityOff(Ctx->Current(),Standard_False);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected()){
|
||||
if(On==1){
|
||||
Ctx->SubIntensityOn(Ctx->Interactive(),Standard_False);}
|
||||
else{
|
||||
Ctx->SubIntensityOff(Ctx->Interactive(),Standard_False);}
|
||||
}
|
||||
}
|
||||
Ctx->UpdateCurrentViewer();
|
||||
}
|
||||
else {
|
||||
@@ -1220,11 +1207,11 @@ public:
|
||||
mySource = IterSource_List;
|
||||
mySeqIter = NCollection_Sequence<TCollection_AsciiString>::Iterator (mySeq);
|
||||
}
|
||||
else if (aCtx->NbCurrents() > 0)
|
||||
else if (aCtx->NbSelected() > 0)
|
||||
{
|
||||
mySource = IterSource_Selected;
|
||||
mySelIter = aCtx;
|
||||
mySelIter->InitCurrent();
|
||||
mySelIter->InitSelected();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1256,7 +1243,7 @@ public:
|
||||
{
|
||||
case IterSource_All: return myMapIter.More();
|
||||
case IterSource_List: return mySeqIter.More();
|
||||
case IterSource_Selected: return mySelIter->MoreCurrent();
|
||||
case IterSource_Selected: return mySelIter->MoreSelected();
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
@@ -1281,7 +1268,7 @@ public:
|
||||
}
|
||||
case IterSource_Selected:
|
||||
{
|
||||
mySelIter->NextCurrent();
|
||||
mySelIter->NextSelected();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1321,10 +1308,10 @@ private:
|
||||
}
|
||||
case IterSource_Selected:
|
||||
{
|
||||
if (mySelIter->MoreCurrent())
|
||||
if (mySelIter->MoreSelected())
|
||||
{
|
||||
myCurrentName = GetMapOfAIS().Find1 (mySelIter->Current());
|
||||
myCurrent = mySelIter->Current();
|
||||
myCurrentName = GetMapOfAIS().Find1 (mySelIter->SelectedInteractive());
|
||||
myCurrent = mySelIter->SelectedInteractive();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2363,14 +2350,14 @@ static int VDonly2 (Draw_Interpretor& ,
|
||||
if (anArgIter >= theArgNb)
|
||||
{
|
||||
// display only selected objects
|
||||
if (aCtx->NbCurrents() < 1)
|
||||
if (aCtx->NbSelected() < 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (aCtx->InitCurrent(); aCtx->MoreCurrent(); aCtx->NextCurrent())
|
||||
for (aCtx->InitSelected(); aCtx->MoreSelected(); aCtx->NextSelected())
|
||||
{
|
||||
aDispSet.Add (aCtx->Current());
|
||||
aDispSet.Add (aCtx->SelectedInteractive());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2512,13 +2499,13 @@ int VRemove (Draw_Interpretor& theDI,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (aCtx->NbCurrents() > 0)
|
||||
else if (aCtx->NbSelected() > 0)
|
||||
{
|
||||
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
|
||||
anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
|
||||
if (!aCtx->IsCurrent (anIO))
|
||||
if (!aCtx->IsSelected (anIO))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -2645,7 +2632,7 @@ int VErase (Draw_Interpretor& theDI,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!toEraseAll && aCtx->NbCurrents() > 0)
|
||||
else if (!toEraseAll && aCtx->NbSelected() > 0)
|
||||
{
|
||||
// Erase selected objects
|
||||
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
|
||||
@@ -2653,7 +2640,7 @@ int VErase (Draw_Interpretor& theDI,
|
||||
{
|
||||
const Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
|
||||
if (!anIO.IsNull()
|
||||
&& aCtx->IsCurrent (anIO))
|
||||
&& aCtx->IsSelected (anIO))
|
||||
{
|
||||
theDI << anIter.Key2().ToCString() << " ";
|
||||
if (toEraseInView)
|
||||
@@ -2903,12 +2890,12 @@ int VBounding (Draw_Interpretor& theDI,
|
||||
bndPresentation (theDI, aPrs, aName, anAction);
|
||||
}
|
||||
}
|
||||
else if (aCtx->NbCurrents() > 0)
|
||||
else if (aCtx->NbSelected() > 0)
|
||||
{
|
||||
// remove all currently selected objects
|
||||
for (aCtx->InitCurrent(); aCtx->MoreCurrent(); aCtx->NextCurrent())
|
||||
for (aCtx->InitSelected(); aCtx->MoreSelected(); aCtx->NextSelected())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anIO = aCtx->Current();
|
||||
Handle(AIS_InteractiveObject) anIO = aCtx->SelectedInteractive();
|
||||
Handle(PrsMgr_Presentation) aPrs = findPresentation (aCtx, anIO, aMode);
|
||||
if (!aPrs.IsNull())
|
||||
{
|
||||
@@ -3537,7 +3524,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
||||
Standard_Integer aSelMode = -1;
|
||||
if (isSelectable == 1 || (isSelectable == -1 && aCtx->GetAutoActivateSelection()))
|
||||
{
|
||||
aSelMode = aShape->HasSelectionMode() ? aShape->SelectionMode() : -1;
|
||||
aSelMode = aShape->GlobalSelectionMode();
|
||||
}
|
||||
|
||||
aCtx->Display (aShape, aDispMode, aSelMode,
|
||||
@@ -3588,7 +3575,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
||||
Standard_Integer aSelMode = -1;
|
||||
if (isSelectable == 1 || (isSelectable == -1 && aCtx->GetAutoActivateSelection()))
|
||||
{
|
||||
aSelMode = aShape->HasSelectionMode() ? aShape->SelectionMode() : -1;
|
||||
aSelMode = aShape->GlobalSelectionMode();
|
||||
}
|
||||
|
||||
if (aShape->Type() == AIS_KOI_Datum)
|
||||
@@ -3990,11 +3977,11 @@ static int VActivatedMode (Draw_Interpretor& di, Standard_Integer argc, const ch
|
||||
// on load tous les objets displayees et on Activate les objets de la liste
|
||||
AIS_ListOfInteractive ListOfIO;
|
||||
// on sauve dans une AISListOfInteractive tous les objets currents
|
||||
if (TheAISContext()->NbCurrents()>0 ){
|
||||
TheAISContext()->UnhilightCurrents(Standard_False);
|
||||
if (TheAISContext()->NbSelected()>0 ){
|
||||
TheAISContext()->UnhilightSelected(Standard_False);
|
||||
|
||||
for (TheAISContext()->InitCurrent(); TheAISContext()->MoreCurrent(); TheAISContext()->NextCurrent() ){
|
||||
ListOfIO.Append(TheAISContext()->Current() );
|
||||
for (TheAISContext()->InitSelected(); TheAISContext()->MoreSelected(); TheAISContext()->NextSelected() ){
|
||||
ListOfIO.Append(TheAISContext()->SelectedInteractive() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4042,7 +4029,7 @@ static int VActivatedMode (Draw_Interpretor& di, Standard_Integer argc, const ch
|
||||
TheAISContext()->UnhilightSelected(Standard_False);
|
||||
// il y a des objets selected,on les parcourt
|
||||
for (TheAISContext()->InitSelected(); TheAISContext()->MoreSelected(); TheAISContext()->NextSelected() ){
|
||||
Handle(AIS_InteractiveObject) aIO=TheAISContext()->Interactive();
|
||||
Handle(AIS_InteractiveObject) aIO=TheAISContext()->SelectedInteractive();
|
||||
|
||||
|
||||
if (HaveMode(aIO,aMode) ) {
|
||||
@@ -4373,12 +4360,12 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (aCtx->NbCurrents() > 0
|
||||
if (aCtx->NbSelected() > 0
|
||||
&& !toShowAll)
|
||||
{
|
||||
for (aCtx->InitCurrent(); aCtx->MoreCurrent(); aCtx->NextCurrent())
|
||||
for (aCtx->InitSelected(); aCtx->MoreSelected(); aCtx->NextSelected())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObj = aCtx->Current();
|
||||
Handle(AIS_InteractiveObject) anObj = aCtx->SelectedInteractive();
|
||||
TCollection_AsciiString aName = GetMapOfAIS().Find1 (anObj);
|
||||
aName.LeftJustify (20, ' ');
|
||||
theDI << aName << " ";
|
||||
@@ -5275,7 +5262,7 @@ static Standard_Integer VLoadSelection (Draw_Interpretor& /*theDi*/,
|
||||
}
|
||||
|
||||
aCtx->Load (aShape, -1, Standard_False);
|
||||
aCtx->Activate (aShape, aShape->SelectionMode(), Standard_True);
|
||||
aCtx->Activate (aShape, aShape->GlobalSelectionMode(), Standard_True);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -318,7 +318,7 @@ static int VSize (Draw_Interpretor& di, Standard_Integer argc, const char** argv
|
||||
TheAISContext()->CloseLocalContext();
|
||||
|
||||
// On set le booleen ThereIsCurrent
|
||||
if (TheAISContext() -> NbCurrents() > 0) {ThereIsCurrent=Standard_True;}
|
||||
if (TheAISContext() -> NbSelected() > 0) {ThereIsCurrent=Standard_True;}
|
||||
else {ThereIsCurrent=Standard_False;}
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ static int VSize (Draw_Interpretor& di, Standard_Integer argc, const char** argv
|
||||
Handle(AIS_InteractiveObject) aShape=
|
||||
Handle(AIS_InteractiveObject)::DownCast(it.Key1());
|
||||
|
||||
if (!aShape.IsNull() && TheAISContext()->IsCurrent(aShape) )
|
||||
if (!aShape.IsNull() && TheAISContext()->IsSelected(aShape) )
|
||||
{
|
||||
|
||||
// On verifie que l'AIS InteraciveObject selectionne est bien
|
||||
@@ -493,7 +493,7 @@ static int VPlaneTrihedron (Draw_Interpretor& di, Standard_Integer argc, const c
|
||||
|
||||
Handle(AIS_InteractiveObject) theIOB;
|
||||
for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
|
||||
theIOB = TheAISContext()->Interactive();
|
||||
theIOB = TheAISContext()->SelectedInteractive();
|
||||
}
|
||||
// on le downcast
|
||||
Handle(AIS_Plane) PlaneB =(Handle(AIS_Plane)::DownCast (theIOB));
|
||||
@@ -4177,16 +4177,21 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/,
|
||||
}
|
||||
|
||||
// Check the arguments
|
||||
if (theArgc != 3 && theArgc != 4)
|
||||
if (theArgc < 3 && theArgc > 5)
|
||||
{
|
||||
std::cerr << "vselmode error : expects at least 2 arguments.\n"
|
||||
<< "Type help "<< theArgv[0] <<" for more information." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aLastArg (theArgv[theArgc - 1]);
|
||||
aLastArg.LowerCase();
|
||||
Standard_Boolean isToOpenLocalCtx = aLastArg == "-local";
|
||||
|
||||
// get objects to change selection mode
|
||||
AIS_ListOfInteractive aTargetIOs;
|
||||
if (theArgc == 3)
|
||||
Standard_Integer anArgNb = isToOpenLocalCtx ? theArgc - 1 : theArgc;
|
||||
if (anArgNb == 3)
|
||||
{
|
||||
anAISContext->DisplayedObjects (aTargetIOs);
|
||||
}
|
||||
@@ -4206,8 +4211,8 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/,
|
||||
}
|
||||
}
|
||||
|
||||
const Standard_Integer aSelectionMode = Draw::Atoi (theArgc == 3 ? theArgv[1] : theArgv[2]);
|
||||
const Standard_Boolean toTurnOn = Draw::Atoi (theArgc == 3 ? theArgv[2] : theArgv[3]);
|
||||
const Standard_Integer aSelectionMode = Draw::Atoi (anArgNb == 3 ? theArgv[1] : theArgv[2]);
|
||||
const Standard_Boolean toTurnOn = Draw::Atoi (anArgNb == 3 ? theArgv[2] : theArgv[3]);
|
||||
if (aSelectionMode == 0 && anAISContext->HasOpenedContext())
|
||||
{
|
||||
anAISContext->CloseLocalContext();
|
||||
@@ -4220,6 +4225,12 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/,
|
||||
for (AIS_ListIteratorOfListOfInteractive aTargetIt (aTargetIOs); aTargetIt.More(); aTargetIt.Next())
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anIO = aTargetIt.Value();
|
||||
TColStd_ListOfInteger anActiveModes;
|
||||
anAISContext->ActivatedModes (anIO, anActiveModes);
|
||||
if (!anActiveModes.IsEmpty())
|
||||
{
|
||||
anAISContext->Deactivate (anIO);
|
||||
}
|
||||
if (!InList (anAISContext, anIO, aSelectionMode))
|
||||
{
|
||||
anAISContext->Activate (anIO);
|
||||
@@ -4241,7 +4252,7 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/,
|
||||
|
||||
if (aSelectionMode != 0 && toTurnOn) // Turn on specified mode
|
||||
{
|
||||
if (!anAISContext->HasOpenedContext())
|
||||
if (!anAISContext->HasOpenedContext() && isToOpenLocalCtx)
|
||||
{
|
||||
anAISContext->OpenLocalContext (Standard_False);
|
||||
}
|
||||
@@ -4249,6 +4260,10 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/,
|
||||
for (AIS_ListIteratorOfListOfInteractive aTargetIt (aTargetIOs); aTargetIt.More(); aTargetIt.Next())
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anIO = aTargetIt.Value();
|
||||
if (InList (anAISContext, anIO, 0))
|
||||
{
|
||||
anAISContext->Deactivate (anIO, 0);
|
||||
}
|
||||
if (!InList (anAISContext, anIO, aSelectionMode))
|
||||
{
|
||||
anAISContext->Load (anIO, -1, Standard_True);
|
||||
@@ -4259,11 +4274,6 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/,
|
||||
|
||||
if (aSelectionMode != 0 && !toTurnOn) // Turn off specified mode
|
||||
{
|
||||
if (!anAISContext->HasOpenedContext())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (AIS_ListIteratorOfListOfInteractive aTargetIt (aTargetIOs); aTargetIt.More(); aTargetIt.Next())
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anIO = aTargetIt.Value();
|
||||
|
@@ -688,6 +688,7 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft
|
||||
// View setup
|
||||
Handle(V3d_View) aView = a3DViewer->CreateView();
|
||||
aView->SetWindow (VT_GetWindow());
|
||||
ViewerTest::GetAISContext()->RedrawImmediate (a3DViewer);
|
||||
|
||||
ViewerTest::CurrentView(aView);
|
||||
ViewerTest_myViews.Bind (aViewNames.GetViewName(), aView);
|
||||
@@ -1378,7 +1379,7 @@ void VT_ProcessKeyPress (const char* buf_ret)
|
||||
aContext->DefaultDrawer()->SetTypeOfHLR(Prs3d_TOH_PolyAlgo);
|
||||
else
|
||||
aContext->DefaultDrawer()->SetTypeOfHLR(Prs3d_TOH_Algo);
|
||||
if (aContext->NbCurrents()==0 || aContext->NbSelected() == 0)
|
||||
if (aContext->NbSelected()==0)
|
||||
{
|
||||
AIS_ListOfInteractive aListOfShapes;
|
||||
aContext->DisplayedObjects(aListOfShapes);
|
||||
@@ -1397,9 +1398,9 @@ void VT_ProcessKeyPress (const char* buf_ret)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (aContext->InitCurrent();aContext->MoreCurrent();aContext->NextCurrent())
|
||||
for (aContext->InitSelected();aContext->MoreSelected();aContext->NextSelected())
|
||||
{
|
||||
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(aContext->Current());
|
||||
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(aContext->SelectedInteractive());
|
||||
if (aShape.IsNull())
|
||||
continue;
|
||||
if(aShape->TypeOfHLR() == Prs3d_TOH_PolyAlgo)
|
||||
@@ -1418,18 +1419,11 @@ void VT_ProcessKeyPress (const char* buf_ret)
|
||||
std::cout << "setup Shaded display mode" << std::endl;
|
||||
|
||||
Handle(AIS_InteractiveContext) Ctx = ViewerTest::GetAISContext();
|
||||
if(Ctx->NbCurrents()==0 ||
|
||||
Ctx->NbSelected()==0)
|
||||
if(Ctx->NbSelected()==0)
|
||||
Ctx->SetDisplayMode(AIS_Shaded);
|
||||
else{
|
||||
if(Ctx->HasOpenedContext()){
|
||||
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
|
||||
Ctx->SetDisplayMode(Ctx->Interactive(),1,Standard_False);
|
||||
}
|
||||
else{
|
||||
for(Ctx->InitCurrent();Ctx->MoreCurrent();Ctx->NextCurrent())
|
||||
Ctx->SetDisplayMode(Ctx->Current(),1,Standard_False);
|
||||
}
|
||||
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
|
||||
Ctx->SetDisplayMode(Ctx->SelectedInteractive(),1,Standard_False);
|
||||
Ctx->UpdateCurrentViewer();
|
||||
}
|
||||
}
|
||||
@@ -1439,18 +1433,11 @@ void VT_ProcessKeyPress (const char* buf_ret)
|
||||
std::cout << "reset display mode to defaults" << std::endl;
|
||||
|
||||
Handle(AIS_InteractiveContext) Ctx = ViewerTest::GetAISContext();
|
||||
if(Ctx->NbCurrents()==0 ||
|
||||
Ctx->NbSelected()==0)
|
||||
if(Ctx->NbSelected()==0)
|
||||
Ctx->SetDisplayMode(AIS_WireFrame);
|
||||
else{
|
||||
if(Ctx->HasOpenedContext()){
|
||||
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
|
||||
Ctx->UnsetDisplayMode(Ctx->Interactive(),Standard_False);
|
||||
}
|
||||
else{
|
||||
for(Ctx->InitCurrent();Ctx->MoreCurrent();Ctx->NextCurrent())
|
||||
Ctx->UnsetDisplayMode(Ctx->Current(),Standard_False);
|
||||
}
|
||||
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
|
||||
Ctx->UnsetDisplayMode(Ctx->SelectedInteractive(),Standard_False);
|
||||
Ctx->UpdateCurrentViewer();
|
||||
}
|
||||
|
||||
@@ -1479,18 +1466,11 @@ void VT_ProcessKeyPress (const char* buf_ret)
|
||||
{
|
||||
std::cout << "setup WireFrame display mode" << std::endl;
|
||||
Handle(AIS_InteractiveContext) Ctx = ViewerTest::GetAISContext();
|
||||
if(Ctx->NbCurrents()==0 ||
|
||||
Ctx->NbSelected()==0)
|
||||
if(Ctx->NbSelected()==0)
|
||||
Ctx->SetDisplayMode(AIS_WireFrame);
|
||||
else{
|
||||
if(Ctx->HasOpenedContext()){
|
||||
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
|
||||
Ctx->SetDisplayMode(Ctx->Interactive(),0,Standard_False);
|
||||
}
|
||||
else{
|
||||
for(Ctx->InitCurrent();Ctx->MoreCurrent();Ctx->NextCurrent())
|
||||
Ctx->SetDisplayMode(Ctx->Current(),0,Standard_False);
|
||||
}
|
||||
for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
|
||||
Ctx->SetDisplayMode(Ctx->SelectedInteractive(),0,Standard_False);
|
||||
Ctx->UpdateCurrentViewer();
|
||||
}
|
||||
}
|
||||
@@ -1542,7 +1522,6 @@ void VT_ProcessKeyPress (const char* buf_ret)
|
||||
{
|
||||
Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
|
||||
if (!aCtx.IsNull()
|
||||
&& aCtx->NbCurrents() > 0
|
||||
&& aCtx->NbSelected() > 0)
|
||||
{
|
||||
Draw_Interprete ("verase");
|
||||
@@ -3395,11 +3374,11 @@ static int VExport(Draw_Interpretor& di, Standard_Integer argc, const char** arg
|
||||
{
|
||||
if (aFileName.Value (aLen - 2) == '.')
|
||||
{
|
||||
aFormatStr = aFileName.SubString (aLen - 1, aLen);
|
||||
aFormatStr = aFileName.ToCString() + aLen - 2;
|
||||
}
|
||||
else if (aFileName.Value (aLen - 3) == '.')
|
||||
{
|
||||
aFormatStr = aFileName.SubString (aLen - 2, aLen);
|
||||
aFormatStr = aFileName.ToCString() + aLen - 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6242,14 +6221,7 @@ static Standard_Integer VChangeSelected (Draw_Interpretor& di,
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(aContext->HasOpenedContext())
|
||||
{
|
||||
aContext->AddOrRemoveSelected(anAISObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
aContext->AddOrRemoveCurrentObject(anAISObject);
|
||||
}
|
||||
aContext->AddOrRemoveSelected(anAISObject);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user