1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0025467: Visualization - Possibility to remove AIS_LocalContext class

Deprecated functionality related to Local Context has been removed.

The following classes and types have been removed:
AIS_LocalContext, AIS_DataMapOfILC, AIS_LocalStatus, SelectMgr_SequenceOfSelector, SelectMgr_DataMapOfObjectSelectors.
Value AIS_DS_Temporary has been removed from enumeration AIS_DisplayStatus.

The following methods related to Local Context have been removed from AIS_InteractiveContext:
::HasOpenedContext(), ::HighestIndex(), ::LocalContext(),
::LocalSelector(), ::OpenLocalContext(), ::CloseLocalContext(),
::IndexOfCurrentLocal(), ::CloseAllContexts(), ::ResetOriginalState(),
::ClearLocalContext(), ::UseDisplayedObjects(), ::NotUseDisplayedObjects(),
::SetShapeDecomposition(), ::SetTemporaryAttributes(),
::ActivateStandardMode(), ::DeactivateStandardMode(), ::KeepTemporary(),
::SubIntensityOn(), ::SubIntensityOff(),
::ActivatedStandardModes(), ::IsInLocal()
and ::AddOrRemoveSelected() taking TopoDS_Shape.

The methods AIS_InteractiveContext::Display() and ::Load()
taking argument theToAllowDecomposition have been marked as deprecated;
the new methods without this unused argument should be used instead.
AIS_InteractiveContext::DisplayedObjects() - removed argument theOnlyFromNeutral.

SelectMgr_SelectionManager has been simplified so that now it support only single Viewer Selector.

The argument -local has been removed from Draw Harness commands vselmode, vremove, vdisplay, vdisplayall, verase.
This commit is contained in:
kgv 2018-06-20 08:48:40 +03:00
parent d9f79dae49
commit 68dcee028d
58 changed files with 449 additions and 7766 deletions

View File

@ -1597,3 +1597,14 @@ Since OCCT 7.4.0 exception is thrown on the attempt of taking points in case of
* The method *TrackHistory* of the classes *BOPAlgo_RemoveFeatures* and *BRepAlgoAPI_Defeaturing* has been renamed to *SetToFillHistory*.
* The method *GetHistory* of the class *BRepAlgoAPI_Defeaturing* has been renamed to *History*.
@subsection upgrade_740_localcontext Local Context removal
Previously deprecated Local Context functionality has been removed from AIS package,
so that related methods have been removed from AIS_InteractiveContext interface:
::HasOpenedContext(), ::HighestIndex(), ::LocalContext(), ::LocalSelector(), ::OpenLocalContext(), ::CloseLocalContext(),
::IndexOfCurrentLocal(), ::CloseAllContexts(), ::ResetOriginalState(), ::ClearLocalContext(), ::UseDisplayedObjects(), ::NotUseDisplayedObjects(),
::SetShapeDecomposition(), ::SetTemporaryAttributes(), ::ActivateStandardMode(), ::DeactivateStandardMode(), ::KeepTemporary(),
::SubIntensityOn(), ::SubIntensityOff(), ::ActivatedStandardModes(), ::IsInLocal() ::AddOrRemoveSelected() taking TopoDS_Shape.
A set of deprecated methods previously related to Local Context and now redirecting to other methods has been preserved to simplify porting; they will be removed in next release.

View File

@ -133,8 +133,8 @@ CAnimationDoc::CAnimationDoc()
myAISContext->SetColor(myAisEngineBlock, Quantity_NOC_WHITE, Standard_False);
myAISContext->SetMaterial(myAisEngineBlock,Graphic3d_NOM_PLASTIC, Standard_False);
myAISContext->Display(myAisCylinderHead ,1,-1,Standard_False,Standard_False);
myAISContext->Display(myAisEngineBlock ,1,-1,Standard_False,Standard_False);
myAISContext->Display(myAisCylinderHead ,1,-1,Standard_False);
myAISContext->Display(myAisEngineBlock ,1,-1,Standard_False);
myAisCrankArm = new AIS_Shape (CrankArm);
myAISContext->SetColor (myAisCrankArm, Quantity_NOC_HOTPINK, Standard_False);
@ -146,9 +146,9 @@ CAnimationDoc::CAnimationDoc()
myAISContext->SetColor (myAisPropeller, Quantity_NOC_RED, Standard_False);
myAISContext->SetMaterial(myAisPropeller, Graphic3d_NOM_PLASTIC, Standard_False);
myAISContext->Display(myAisCrankArm ,1,-1,Standard_False,Standard_False);
myAISContext->Display(myAisPropeller ,1,-1,Standard_False,Standard_False);
myAISContext->Display(myAisPiston ,1,-1,Standard_True,Standard_False);
myAISContext->Display(myAisCrankArm, 1,-1,Standard_False);
myAISContext->Display(myAisPropeller, 1,-1,Standard_False);
myAISContext->Display(myAisPiston, 1,-1,Standard_True);
m_Xmin = -300. ;
m_Ymin = -300. ;

View File

@ -1,20 +0,0 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef AIS_DataMapIteratorOfDataMapOfILC_HeaderFile
#define AIS_DataMapIteratorOfDataMapOfILC_HeaderFile
#include <AIS_DataMapOfILC.hxx>
#endif

View File

@ -1,29 +0,0 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef AIS_DataMapOfILC_HeaderFile
#define AIS_DataMapOfILC_HeaderFile
#include <Standard_Integer.hxx>
#include <AIS_LocalContext.hxx>
#include <TColStd_MapIntegerHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Standard_Integer,Handle(AIS_LocalContext),TColStd_MapIntegerHasher> AIS_DataMapOfILC;
typedef NCollection_DataMap<Standard_Integer,Handle(AIS_LocalContext),TColStd_MapIntegerHasher>::Iterator AIS_DataMapIteratorOfDataMapOfILC;
#endif

View File

@ -17,20 +17,12 @@
#ifndef _AIS_DisplayStatus_HeaderFile
#define _AIS_DisplayStatus_HeaderFile
//! To give the display status of an Interactive Object.
//! This will be one of the following:
//! - DS_Displayed: the Interactive Object is
//! displayed in the main viewer;
//! - DS_Erased: the Interactive Object is hidden in main viewer;
//! - DS_Temporary: the Interactive Object is temporarily displayed;
//! - DS_None: the Interactive Object is nowhere displayed.
enum AIS_DisplayStatus
{
AIS_DS_Displayed,
AIS_DS_Erased,
AIS_DS_Temporary,
AIS_DS_None
AIS_DS_Displayed, //!< the Interactive Object is displayed in the main viewer
AIS_DS_Erased, //!< the Interactive Object is hidden in main viewer
AIS_DS_None //!< the Interactive Object is nowhere displayed
};
#endif // _AIS_DisplayStatus_HeaderFile

View File

@ -16,14 +16,11 @@
#include <AIS_InteractiveContext.hxx>
#include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
#include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
#include <AIS_ConnectedInteractive.hxx>
#include <AIS_GlobalStatus.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_LocalStatus.hxx>
#include <AIS_MapIteratorOfMapOfInteractive.hxx>
#include <AIS_MultipleConnectedInteractive.hxx>
#include <AIS_Shape.hxx>
@ -107,7 +104,6 @@ namespace
//=======================================================================
AIS_InteractiveContext::AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer):
mgrSelector(new SelectMgr_SelectionManager()),
myMainPM(new PrsMgr_PresentationManager3d(MainViewer->StructureManager())),
myMainVwr(MainViewer),
myMainSel(new StdSelect_ViewerSelector3d()),
@ -116,13 +112,14 @@ myToHilightSelected(Standard_True),
mySelection(new AIS_Selection()),
myFilters(new SelectMgr_OrFilter()),
myDefaultDrawer(new Prs3d_Drawer()),
myCurLocalIndex(0),
myCurDetected(0),
myCurHighlighted(0),
myPickingStrategy (SelectMgr_PickingStrategy_FirstAcceptable),
myAutoHilight(Standard_True),
myIsAutoActivateSelMode(Standard_True)
{
mgrSelector->Add (myMainSel);
mgrSelector = new SelectMgr_SelectionManager (myMainSel);
myStyles[Prs3d_TypeOfHighlight_None] = myDefaultDrawer;
myStyles[Prs3d_TypeOfHighlight_Selected] = new Prs3d_Drawer();
myStyles[Prs3d_TypeOfHighlight_Dynamic] = new Prs3d_Drawer();
@ -178,11 +175,7 @@ AIS_InteractiveContext::~AIS_InteractiveContext()
{
// clear the current selection
mySelection->Clear();
// let's remove one reference explicitly. this operation's supposed to
// be performed when mgrSelector will be destroyed but anyway...
const Handle(SelectMgr_ViewerSelector)& aSelector = myMainSel; // to avoid ambiguity
mgrSelector->Remove (aSelector);
mgrSelector.Nullify();
Handle(AIS_InteractiveContext) aNullContext;
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
@ -211,46 +204,15 @@ void AIS_InteractiveContext::UpdateCurrentViewer()
//function : DisplayedObjects
//purpose :
//=======================================================================
void AIS_InteractiveContext::DisplayedObjects (AIS_ListOfInteractive& theListOfIO,
const Standard_Boolean theOnlyFromNeutral) const
void AIS_InteractiveContext::DisplayedObjects (AIS_ListOfInteractive& theListOfIO) const
{
if (!HasOpenedContext()
|| theOnlyFromNeutral)
{
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
{
theListOfIO.Append (anObjIter.Key());
}
}
return;
}
// neutral point
TColStd_MapOfTransient aDispMap;
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
{
aDispMap.Add (anObjIter.Key());
theListOfIO.Append (anObjIter.Key());
}
}
// parse all local contexts...
for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
{
const Handle(AIS_LocalContext)& aLocCtx = aCtxIter.Value();
aLocCtx->DisplayedObjects (aDispMap);
}
Handle(AIS_InteractiveObject) anObj;
for (TColStd_MapIteratorOfMapOfTransient aDispMapIter (aDispMap); aDispMapIter.More(); aDispMapIter.Next())
{
const Handle(Standard_Transient)& aTransient = aDispMapIter.Key();
anObj = Handle(AIS_InteractiveObject)::DownCast (aTransient);
theListOfIO.Append (anObj);
}
}
//=======================================================================
@ -259,8 +221,7 @@ void AIS_InteractiveContext::DisplayedObjects (AIS_ListOfInteractive& theListOfI
//=======================================================================
void AIS_InteractiveContext::DisplayedObjects (const AIS_KindOfInteractive theKind,
const Standard_Integer theSign,
AIS_ListOfInteractive& theListOfIO,
const Standard_Boolean /*OnlyFromNeutral*/) const
AIS_ListOfInteractive& theListOfIO) const
{
ObjectsByDisplayStatus (theKind, theSign, AIS_DS_Displayed, theListOfIO);
}
@ -406,9 +367,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
Standard_Integer aDispMode = 0, aHiMod = -1, aSelMode = -1;
GetDefModes (theIObj, aDispMode, aHiMod, aSelMode);
Display (theIObj, aDispMode, myIsAutoActivateSelMode ? aSelMode : -1,
theToUpdateViewer, theIObj->AcceptShapeDecomposition());
Display (theIObj, aDispMode, myIsAutoActivateSelMode ? aSelMode : -1, theToUpdateViewer);
}
//=======================================================================
@ -446,7 +405,6 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
const Standard_Integer theDispMode,
const Standard_Integer theSelectionMode,
const Standard_Boolean theToUpdateViewer,
const Standard_Boolean theToAllowDecomposition,
const AIS_DisplayStatus theDispStatus)
{
if (theIObj.IsNull())
@ -457,7 +415,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
if (theDispStatus == AIS_DS_Erased)
{
Erase (theIObj, theToUpdateViewer);
Load (theIObj, theSelectionMode, theToAllowDecomposition);
Load (theIObj, theSelectionMode);
if (Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (theIObj))
{
(*aStatusPtr)->SetDisplayMode (theDispMode);
@ -466,25 +424,6 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
}
setContextToObject (theIObj);
if (theDispStatus == AIS_DS_Temporary
&& !HasOpenedContext())
{
return;
}
else if (HasOpenedContext())
{
if (theDispStatus == AIS_DS_None
|| theDispStatus == AIS_DS_Temporary)
{
myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
if (theToUpdateViewer)
{
myMainVwr->Update();
}
return;
}
}
if (!myObjects.IsBound (theIObj))
{
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
@ -498,16 +437,12 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
{
mgrSelector->Load (theIObj);
}
mgrSelector->Activate (theIObj, theSelectionMode, myMainSel);
mgrSelector->Activate (theIObj, theSelectionMode);
}
}
else
{
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() == AIS_DS_Temporary)
{
return;
}
// Mark the presentation modes hidden of interactive object different from aDispMode.
// Then make sure aDispMode is displayed and maybe highlighted.
@ -541,7 +476,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
{
if (!aStatus->IsSModeIn (theSelectionMode))
aStatus->AddSelectionMode (theSelectionMode);
mgrSelector->Activate (theIObj, theSelectionMode, myMainSel);
mgrSelector->Activate (theIObj, theSelectionMode);
}
}
}
@ -557,8 +492,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
//purpose :
//=======================================================================
void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer theSelMode,
const Standard_Boolean theToAllowDecomposition)
const Standard_Integer theSelMode)
{
if (theIObj.IsNull())
{
@ -566,12 +500,6 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
}
setContextToObject (theIObj);
if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->Load (theIObj, theToAllowDecomposition, theSelMode);
return;
}
if (!myObjects.IsBound (theIObj))
{
Standard_Integer aDispMode, aHiMod, aSelModeDef;
@ -606,26 +534,7 @@ void AIS_InteractiveContext::Erase (const Handle(AIS_InteractiveObject)& theIObj
theIObj->ClearSelected();
}
Standard_Boolean wasInCtx = Standard_False;
if (HasOpenedContext())
{
// First it is checked if it is possible to remove in the current local context
// then one tries to remove in other local contexts, if they allow it...
wasInCtx = myLocalContexts (myCurLocalIndex)->Erase (theIObj);
for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
{
if (aCtxIter.Value()->AcceptErase())
{
wasInCtx = aCtxIter.Value()->Erase (theIObj) || wasInCtx;
}
}
}
if (!wasInCtx)
{
EraseGlobal (theIObj, Standard_False);
}
EraseGlobal (theIObj, Standard_False);
if (theToUpdateViewer)
{
myMainVwr->Update();
@ -638,11 +547,6 @@ void AIS_InteractiveContext::Erase (const Handle(AIS_InteractiveObject)& theIObj
//=======================================================================
void AIS_InteractiveContext::EraseAll (const Standard_Boolean theToUpdateViewer)
{
if (HasOpenedContext())
{
return;
}
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
@ -663,11 +567,6 @@ void AIS_InteractiveContext::EraseAll (const Standard_Boolean theToUpdateViewer)
//=======================================================================
void AIS_InteractiveContext::DisplayAll (const Standard_Boolean theToUpdateViewer)
{
if (HasOpenedContext())
{
return;
}
for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
{
const AIS_DisplayStatus aStatus = anObjIter.Value()->GraphicStatus();
@ -689,11 +588,6 @@ void AIS_InteractiveContext::DisplayAll (const Standard_Boolean theToUpdateViewe
//=======================================================================
void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdateViewer)
{
if (HasOpenedContext())
{
return;
}
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter.Value()->Selectable());
@ -712,11 +606,6 @@ void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdate
//=======================================================================
void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateViewer)
{
if (HasOpenedContext())
{
return;
}
Standard_Boolean isFound = Standard_False;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Init (mySelection->Objects()))
{
@ -731,71 +620,6 @@ void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateVi
}
}
//=======================================================================
//function :
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveContext::KeepTemporary(const Handle(AIS_InteractiveObject)& anIObj,
const Standard_Integer WhichContext)
{
if(anIObj.IsNull()) return Standard_False;
if(!HasOpenedContext()) return Standard_False;
if(myObjects.IsBound(anIObj)) return Standard_False;
if(WhichContext!=-1 && !myLocalContexts.IsBound(WhichContext)) return Standard_False;
// Protection : if one tries to preserve a temporary object
// which is not in the local active context... rob 11-06-97
Standard_Integer IsItInLocal = myCurLocalIndex;
Standard_Boolean Found(Standard_False);
while(IsItInLocal>0 && !Found){
if(!myLocalContexts.IsBound(IsItInLocal))
IsItInLocal--;
else if(myLocalContexts(IsItInLocal)->IsIn(anIObj))
Found = Standard_True;
else
IsItInLocal--;
}
if(!Found) return Standard_False;
// const Handle(AIS_LocalStatus)& LS = (WhichContext== -1) ?
// myLocalContexts(IsItInLocal)->Status(anIObj):myLocalContexts(WhichContext)->Status(anIObj);
// CLE
// const Handle(AIS_LocalStatus)& LS = myLocalContexts(IsItInLocal)->Status(anIObj);
Handle(AIS_LocalStatus) LS = myLocalContexts(IsItInLocal)->Status(anIObj);
// ENDCLE
if(LS->IsTemporary()){
Standard_Integer DM,HM,SM;
GetDefModes(anIObj,DM,HM,SM);
SM = LS->SelectionModes().IsEmpty() ? SM : LS->SelectionModes().First();
if(LS->DisplayMode()!= DM ){
Standard_Integer LSM = LS->SelectionModes().IsEmpty() ? -1 : LS->SelectionModes().First();
myLocalContexts(IsItInLocal)->Display(anIObj,DM,LS->Decomposed(),LSM);
}
Handle (AIS_GlobalStatus) GS = new AIS_GlobalStatus(AIS_DS_Displayed,
DM,
SM,
Standard_False);
// GS->SubIntensityOn();
myObjects.Bind(anIObj,GS);
myMainVwr->StructureManager()->RegisterObject (anIObj);
mgrSelector->Load(anIObj);
mgrSelector->Activate(anIObj,SM,myMainSel);
LS->SetTemporary(Standard_False);
}
return Standard_True;
}
//=======================================================================
//function : DisplayStatus
//purpose :
@ -806,19 +630,8 @@ AIS_DisplayStatus AIS_InteractiveContext::DisplayStatus (const Handle(AIS_Intera
{
return AIS_DS_None;
}
else if (myObjects.IsBound (theIObj))
{
return myObjects (theIObj)->GraphicStatus();
}
for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
{
if (aCtxIter.Value()->IsIn (theIObj))
{
return AIS_DS_Temporary;
}
}
return AIS_DS_None;
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
return aStatus != NULL ? (*aStatus)->GraphicStatus() : AIS_DS_None;
}
//=======================================================================
@ -841,19 +654,6 @@ void AIS_InteractiveContext::Remove (const Handle(AIS_InteractiveObject)& theIOb
}
theIObj->SetContext (Handle(AIS_InteractiveContext)());
}
if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->Remove (theIObj);
for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
{
if (aCtxIter.Value()->AcceptErase())
{
aCtxIter.Value()->Remove (theIObj);
}
}
}
ClearGlobal (theIObj, theToUpdateViewer);
}
@ -876,43 +676,6 @@ void AIS_InteractiveContext::RemoveAll (const Standard_Boolean theToUpdateViewer
}
}
//=======================================================================
//function : ClearPrs
//purpose :
//=======================================================================
void AIS_InteractiveContext::ClearPrs (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer theMode,
const Standard_Boolean theToUpdateViewer)
{
if (theIObj.IsNull())
{
return;
}
if (!HasOpenedContext())
{
ClearGlobalPrs (theIObj, theMode, theToUpdateViewer);
return;
}
Standard_Boolean wasInCtx = myLocalContexts (myCurLocalIndex)->ClearPrs (theIObj, theMode);
for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
{
if (aCtxIter.Value()->AcceptErase())
{
wasInCtx = aCtxIter.Value()->ClearPrs (theIObj, theMode) || wasInCtx;
}
}
if (!wasInCtx)
{
ClearGlobalPrs (theIObj, theMode, theToUpdateViewer);
}
else if (theToUpdateViewer)
{
myMainVwr->Update();
}
}
//=======================================================================
//function : HilightWithColor
//purpose :
@ -925,23 +688,16 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
return;
setContextToObject (theObj);
if (!HasOpenedContext())
{
if (!myObjects.IsBound (theObj))
return;
if (!myObjects.IsBound (theObj))
return;
const Handle(AIS_GlobalStatus)& aStatus = myObjects (theObj);
aStatus->SetHilightStatus (Standard_True);
const Handle(AIS_GlobalStatus)& aStatus = myObjects (theObj);
aStatus->SetHilightStatus (Standard_True);
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
highlightGlobal (theObj, theStyle, aStatus->DisplayMode());
aStatus->SetHilightStyle (theStyle);
}
}
else
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
myLocalContexts (myCurLocalIndex)->Hilight (theObj, theStyle);
highlightGlobal (theObj, theStyle, aStatus->DisplayMode());
aStatus->SetHilightStyle (theStyle);
}
if (theIsToUpdate)
@ -955,24 +711,17 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIObj, const Standard_Boolean updateviewer)
{
if(anIObj.IsNull()) return;
if(!myObjects.IsBound(anIObj)) return;
if (!HasOpenedContext())
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
aStatus->SetHilightStatus (Standard_False);
aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
if(!myObjects.IsBound(anIObj)) return;
const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
aStatus->SetHilightStatus (Standard_False);
aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
unhighlightGlobal (anIObj);
}
}
else
{
myLocalContexts(myCurLocalIndex)->Unhilight(anIObj);
unhighlightGlobal (anIObj);
}
if(updateviewer) myMainVwr->Update();
}
@ -982,27 +731,9 @@ void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIO
//=======================================================================
Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(AIS_InteractiveObject)& theObj) const
{
if (!HasOpenedContext())
{
if (!myObjects.IsBound (theObj))
return Standard_False;
return myObjects (theObj)->IsHilighted();
}
Standard_DISABLE_DEPRECATION_WARNINGS
Standard_Integer aCtxIdx = HighestIndex();
Standard_ENABLE_DEPRECATION_WARNINGS
for (; aCtxIdx >= 1; aCtxIdx--)
{
if (myLocalContexts.IsBound (aCtxIdx))
{
if (myLocalContexts (aCtxIdx)->IsHilighted (theObj))
return Standard_True;
}
}
return Standard_False;
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theObj);
return aStatus != NULL
&& (*aStatus)->IsHilighted();
}
//=======================================================================
@ -1035,19 +766,16 @@ Standard_Boolean AIS_InteractiveContext::IsHilighted (const Handle(SelectMgr_Ent
Standard_Boolean AIS_InteractiveContext::HighlightStyle (const Handle(AIS_InteractiveObject)& theObj,
Handle(Prs3d_Drawer)& theStyle) const
{
if (HasOpenedContext())
myLocalContexts (myCurLocalIndex)->HighlightStyle (theObj, theStyle);
if (IsHilighted (theObj))
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theObj);
if (aStatus != NULL
&& (*aStatus)->IsHilighted())
{
theStyle = myObjects (theObj)->HilightStyle();
theStyle = (*aStatus)->HilightStyle();
return Standard_True;
}
else
{
theStyle.Nullify();
return Standard_False;
}
theStyle.Nullify();
return Standard_False;
}
//=======================================================================
@ -1090,22 +818,13 @@ Standard_Boolean AIS_InteractiveContext::HighlightStyle (const Handle(SelectMgr_
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveContext::IsDisplayed(const Handle(AIS_InteractiveObject)& anIObj) const
Standard_Boolean AIS_InteractiveContext::IsDisplayed(const Handle(AIS_InteractiveObject)& theObj) const
{
if(anIObj.IsNull()) return Standard_False;
if(theObj.IsNull()) return Standard_False;
if(myObjects.IsBound(anIObj))
if(myObjects(anIObj)->GraphicStatus()==AIS_DS_Displayed)
return Standard_True;
AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
for(;ItM.More();ItM.Next()){
if(ItM.Value()->IsDisplayed(anIObj))
return Standard_True;
}
return Standard_False;
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theObj);
return aStatus != NULL
&& (*aStatus)->GraphicStatus() == AIS_DS_Displayed;
}
//=======================================================================
@ -1120,24 +839,10 @@ Standard_Boolean AIS_InteractiveContext::IsDisplayed (const Handle(AIS_Interacti
return Standard_False;
}
if (myObjects.IsBound (theIObj))
{
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() == AIS_DS_Displayed
&& aStatus->DisplayMode() == theMode)
{
return Standard_True;
}
}
for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
{
if (aCtxIter.Value()->IsDisplayed (theIObj, theMode))
{
return Standard_True;
}
}
return Standard_False;
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
return aStatus != NULL
&& (*aStatus)->GraphicStatus() == AIS_DS_Displayed
&& (*aStatus)->DisplayMode() == theMode;
}
//=======================================================================
@ -1150,14 +855,11 @@ Standard_Integer AIS_InteractiveContext::DisplayPriority (const Handle(AIS_Inter
{
return -1;
}
else if (!myObjects.IsBound (theIObj))
{
return 0;
}
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() == AIS_DS_Displayed
|| aStatus->GraphicStatus() == AIS_DS_Erased)
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
if (aStatus != NULL
&& ((*aStatus)->GraphicStatus() == AIS_DS_Displayed
|| (*aStatus)->GraphicStatus() == AIS_DS_Erased))
{
Standard_Integer aDispMode = theIObj->HasDisplayMode()
? theIObj->DisplayMode()
@ -1182,23 +884,17 @@ void AIS_InteractiveContext::SetDisplayPriority (const Handle(AIS_InteractiveObj
}
setContextToObject (theIObj);
if (myObjects.IsBound (theIObj))
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
if (aStatus != NULL
&& ((*aStatus)->GraphicStatus() == AIS_DS_Displayed
|| (*aStatus)->GraphicStatus() == AIS_DS_Erased))
{
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() == AIS_DS_Displayed
|| aStatus->GraphicStatus() == AIS_DS_Erased)
{
Standard_Integer aDisplayMode = theIObj->HasDisplayMode()
? theIObj->DisplayMode()
: (theIObj->AcceptDisplayMode (myDefaultDrawer->DisplayMode())
? myDefaultDrawer->DisplayMode()
: 0);
myMainPM->SetDisplayPriority (theIObj, aDisplayMode, thePriority);
}
}
else if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetDisplayPriority (theIObj, thePriority);
Standard_Integer aDisplayMode = theIObj->HasDisplayMode()
? theIObj->DisplayMode()
: (theIObj->AcceptDisplayMode (myDefaultDrawer->DisplayMode())
? myDefaultDrawer->DisplayMode()
: 0);
myMainPM->SetDisplayPriority (theIObj, aDisplayMode, thePriority);
}
}
@ -1262,9 +958,9 @@ void AIS_InteractiveContext::RecomputePrsOnly (const Handle(AIS_InteractiveObjec
return;
}
if (HasOpenedContext()
|| (myObjects.IsBound (theIObj)
&& myObjects (theIObj)->GraphicStatus() == AIS_DS_Displayed))
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
if (aStatus != NULL
&& (*aStatus)->GraphicStatus() == AIS_DS_Displayed)
{
myMainVwr->Update();
}
@ -1282,17 +978,9 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
mgrSelector->RecomputeSelection (theIO);
if (HasOpenedContext())
{
for (Standard_Integer aContextIdx = 1; aContextIdx <= myLocalContexts.Extent(); aContextIdx++)
{
myLocalContexts (aContextIdx)->ClearOutdatedSelection (theIO, Standard_False);
}
return;
}
if (!myObjects.IsBound (theIO) ||
myObjects (theIO)->GraphicStatus() != AIS_DS_Displayed)
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIO);
if (aStatus == NULL
|| (*aStatus)->GraphicStatus() != AIS_DS_Displayed)
{
return;
}
@ -1302,7 +990,7 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
TColStd_ListIteratorOfListOfInteger aModesIter (aModes);
for (; aModesIter.More(); aModesIter.Next())
{
mgrSelector->Activate (theIO, aModesIter.Value(), myMainSel);
mgrSelector->Activate (theIO, aModesIter.Value());
}
}
@ -1327,26 +1015,13 @@ void AIS_InteractiveContext::Update (const Handle(AIS_InteractiveObject)& theIOb
mgrSelector->Update(theIObj);
for (Standard_Integer aContextIdx = 1; aContextIdx <= myLocalContexts.Extent(); aContextIdx++)
{
myLocalContexts (aContextIdx)->ClearOutdatedSelection (theIObj, Standard_False);
}
if (theUpdateViewer)
{
if (!myObjects.IsBound (theIObj))
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
if (aStatus != NULL
&& (*aStatus)->GraphicStatus() == AIS_DS_Displayed)
{
return;
}
switch (myObjects (theIObj)->GraphicStatus())
{
case AIS_DS_Displayed:
case AIS_DS_Temporary:
myMainVwr->Update();
break;
default:
break;
myMainVwr->Update();
}
}
}
@ -1383,15 +1058,7 @@ void AIS_InteractiveContext::SetLocation (const Handle(AIS_InteractiveObject)& t
theIObj->SetLocalTransformation (theLoc.Transformation());
if (!HasOpenedContext())
{
mgrSelector->Update (theIObj, Standard_False);
}
else
{
Handle(StdSelect_ViewerSelector3d) aTempSel = myLocalContexts (myCurLocalIndex)->MainSelector();
mgrSelector->Update (theIObj, aTempSel, Standard_False);
}
mgrSelector->Update (theIObj, Standard_False);
// if the object or its part is highlighted dynamically, it is necessary to apply location transformation
// to its highlight structure immediately
@ -2155,11 +1822,6 @@ void AIS_InteractiveContext::UnsetTransparency (const Handle(AIS_InteractiveObje
void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
const Standard_Boolean theToUpdateViewer)
{
if (HasOpenedContext())
{
return;
}
Standard_Boolean isFound = Standard_False;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
@ -2298,8 +1960,7 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
if (aStatus->GraphicStatus() == AIS_DS_Temporary
|| aStatus->GraphicStatus() == AIS_DS_Erased)
if (aStatus->GraphicStatus() == AIS_DS_Erased)
{
return;
}
@ -2343,7 +2004,7 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
{
mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
mgrSelector->Deactivate (theIObj, aSelModeIter.Value());
}
aStatus->ClearSelectionModes();
aStatus->SetGraphicStatus (AIS_DS_Erased);
@ -2644,14 +2305,7 @@ Standard_Boolean AIS_InteractiveContext::IsoOnTriangulation() const
//=======================================================================
void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecision)
{
if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetPixelTolerance (thePrecision);
}
else
{
myMainSel->SetPixelTolerance (thePrecision);
}
myMainSel->SetPixelTolerance (thePrecision);
}
//=======================================================================
@ -2660,9 +2314,7 @@ void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecis
//=======================================================================
Standard_Integer AIS_InteractiveContext::PixelTolerance() const
{
return HasOpenedContext()
? myLocalContexts (myCurLocalIndex)->PixelTolerance()
: myMainSel->PixelTolerance();
return myMainSel->PixelTolerance();
}
//=======================================================================
@ -2673,56 +2325,15 @@ void AIS_InteractiveContext::SetSelectionSensitivity (const Handle(AIS_Interacti
const Standard_Integer theMode,
const Standard_Integer theNewSensitivity)
{
if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetSelectionSensitivity (theObject, theMode, theNewSensitivity);
return;
}
mgrSelector->SetSelectionSensitivity (theObject, theMode, theNewSensitivity);
}
//=======================================================================
//function : IsInLocal
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveContext::IsInLocal (const Handle(AIS_InteractiveObject)& theIObj,
Standard_Integer& theIndex) const
{
if (theIObj.IsNull())
{
return Standard_False;
}
// if it exists at neutral point 0 index is returned
if (myObjects.IsBound (theIObj))
{
theIndex = 0;
return Standard_False;
}
for (Standard_Integer aCtxIter = 1; aCtxIter <= myLocalContexts.Extent(); ++aCtxIter)
{
if (myLocalContexts.IsBound (aCtxIter))
{
if(myLocalContexts (aCtxIter)->IsIn (theIObj))
{
theIndex = aCtxIter;
return Standard_True;
}
}
}
theIndex = -1;
return Standard_False;
}
//=======================================================================
//function : InitAttributes
//purpose :
//=======================================================================
void AIS_InteractiveContext::InitAttributes()
{
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_BRASS);
myDefaultDrawer->ShadingAspect()->SetMaterial (aMat);
@ -2880,12 +2491,9 @@ void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView,
const Standard_Real theMargin,
const Standard_Boolean theToUpdate)
{
const Handle(AIS_Selection)& aSelection = HasOpenedContext()
? myLocalContexts(myCurLocalIndex)->Selection()
: mySelection;
Bnd_Box aBndSelected;
AIS_MapOfObjectOwners anObjectOwnerMap;
for (AIS_NListOfEntityOwner::Iterator aSelIter (aSelection->Objects()); aSelIter.More(); aSelIter.Next())
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());

View File

@ -17,7 +17,6 @@
#ifndef _AIS_InteractiveContext_HeaderFile
#define _AIS_InteractiveContext_HeaderFile
#include <AIS_DataMapOfILC.hxx>
#include <AIS_DataMapOfIOStatus.hxx>
#include <AIS_DisplayMode.hxx>
#include <AIS_DisplayStatus.hxx>
@ -47,14 +46,13 @@
class SelectMgr_SelectionManager;
class V3d_Viewer;
class AIS_InteractiveObject;
class SelectMgr_OrFilter;
class V3d_View;
class AIS_LocalContext;
class TopLoc_Location;
class TCollection_ExtendedString;
class Prs3d_LineAspect;
class Prs3d_BasicAspect;
class TopoDS_Shape;
class SelectMgr_EntityOwner;
class SelectMgr_Filter;
@ -69,7 +67,6 @@ class SelectMgr_Filter;
//! By default, global selection mode is equal to 0, but it might be redefined if needed.
class AIS_InteractiveContext : public Standard_Transient
{
friend class AIS_LocalContext;
DEFINE_STANDARD_RTTIEXT(AIS_InteractiveContext, Standard_Transient)
public: //! @name object display management
@ -113,15 +110,27 @@ public: //! @name object display management
const Standard_Integer theDispMode,
const Standard_Integer theSelectionMode,
const Standard_Boolean theToUpdateViewer,
const Standard_Boolean theToAllowDecomposition = Standard_True,
const AIS_DisplayStatus theDispStatus = AIS_DS_None);
//! Allows you to load the Interactive Object with a given selection mode,
//! and/or with the desired decomposition option, whether the object is visualized or not.
//! If AllowDecomp = Standard_True and, if the interactive object is of the "Shape" type,
//! these "standard" selection modes will be automatically activated as a function of the modes present in the Local Context.
//! The loaded objects will be selectable but displayable in highlighting only when detected by the Selector.
Standard_EXPORT void Load (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer SelectionMode = -1, const Standard_Boolean AllowDecomp = Standard_False);
Standard_EXPORT void Load (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theSelectionMode = -1);
Standard_DEPRECATED("Deprecated method Display() with obsolete argument theToAllowDecomposition")
void Display (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer theDispMode,
const Standard_Integer theSelectionMode,
const Standard_Boolean theToUpdateViewer,
const Standard_Boolean theToAllowDecomposition,
const AIS_DisplayStatus theDispStatus = AIS_DS_None)
{
(void )theToAllowDecomposition;
Display (theIObj, theDispMode, theSelectionMode, theToUpdateViewer, theDispStatus);
}
Standard_DEPRECATED("Deprecated method Load() with obsolete last argument theToAllowDecomposition")
void Load (const Handle(AIS_InteractiveObject)& theObj, Standard_Integer theSelectionMode, Standard_Boolean ) { Load (theObj, theSelectionMode); }
//! Hides the object. The object's presentations are simply flagged as invisible and therefore excluded from redrawing.
//! To show hidden objects, use Display().
@ -144,9 +153,9 @@ public: //! @name object display management
//! Empties the graphic presentation of the mode indexed by aMode.
//! Warning! Removes theIObj. theIObj is still active if it was previously activated.
Standard_EXPORT void ClearPrs (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer theMode,
const Standard_Boolean theToUpdateViewer);
void ClearPrs (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer theMode,
const Standard_Boolean theToUpdateViewer) { ClearGlobalPrs (theIObj, theMode, theToUpdateViewer); }
//! Removes Object from every viewer.
Standard_EXPORT void Remove (const Handle(AIS_InteractiveObject)& theIObj,
@ -354,17 +363,17 @@ public: //! @name mouse picking logic (detection and dynamic highlighting of ent
//! Returns true if there is a mouse-detected entity in context.
//! @sa DetectedOwner()/HasNextDetected()/HilightPreviousDetected()/HilightNextDetected().
Standard_EXPORT Standard_Boolean HasDetected() const;
Standard_Boolean HasDetected() const { return !myLastPicked.IsNull(); }
//! Returns the owner of the detected sensitive primitive which is currently dynamically highlighted.
//! WARNING! This method is irrelevant to InitDetected()/MoreDetected()/NextDetected().
//! @sa HasDetected()/HasNextDetected()/HilightPreviousDetected()/HilightNextDetected().
Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedOwner() const;
const Handle(SelectMgr_EntityOwner)& DetectedOwner() const { return myLastPicked; }
//! Returns the interactive objects last detected in context.
//! In general this is just a wrapper for Handle(AIS_InteractiveObject)::DownCast(DetectedOwner()->Selectable()).
//! @sa DetectedOwner()
Standard_EXPORT Handle(AIS_InteractiveObject) DetectedInteractive() const;
Handle(AIS_InteractiveObject) DetectedInteractive() const { return Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable()); }
//! Returns true if there is a detected shape in local context.
//! @sa HasDetected()/DetectedShape()
@ -378,7 +387,7 @@ public: //! @name mouse picking logic (detection and dynamic highlighting of ent
//! returns True if other entities were detected in the last mouse detection
//! @sa HilightPreviousDetected()/HilightNextDetected().
Standard_EXPORT Standard_Boolean HasNextDetected() const;
Standard_Boolean HasNextDetected() const { return !myDetectedSeq.IsEmpty() && myCurHighlighted <= myDetectedSeq.Upper(); }
//! If more than 1 object is detected by the selector, only the "best" owner is hilighted at the mouse position.
//! This Method allows the user to hilight one after another the other detected entities.
@ -397,16 +406,22 @@ public: //! @name iteration through detected entities
//! Initialization for iteration through mouse-detected objects in
//! interactive context or in local context if it is opened.
//! @sa DetectedCurrentOwner()/MoreDetected()/NextDetected().
Standard_EXPORT void InitDetected();
void InitDetected()
{
if (!myDetectedSeq.IsEmpty())
{
myCurDetected = myDetectedSeq.Lower();
}
}
//! Return TRUE if there is more mouse-detected objects after the current one
//! during iteration through mouse-detected interactive objects.
//! @sa DetectedCurrentOwner()/InitDetected()/NextDetected().
Standard_EXPORT Standard_Boolean MoreDetected() const;
Standard_Boolean MoreDetected() const { return myCurDetected >= myDetectedSeq.Lower() && myCurDetected <= myDetectedSeq.Upper(); }
//! Gets next current object during iteration through mouse-detected interactive objects.
//! @sa DetectedCurrentOwner()/InitDetected()/MoreDetected().
Standard_EXPORT void NextDetected();
void NextDetected() { ++myCurDetected; }
//! Returns the owner from detected list pointed by current iterator position.
//! WARNING! This method is irrelevant to DetectedOwner() which returns last picked Owner regardless of iterator position!
@ -507,53 +522,57 @@ public: //! @name Selection management
//! Updates the list of selected objects:
//! i.e. highlights the newly selected ones and unhighlights previously selected objects.
//! @sa HilightSelected().
Standard_EXPORT void UpdateSelected (const Standard_Boolean theToUpdateViewer);
void UpdateSelected (Standard_Boolean theToUpdateViewer) { HilightSelected (theToUpdateViewer); }
//! Empties previous selected objects in order to get the selected objects detected by the selector using UpdateSelected.
Standard_EXPORT void ClearSelected (const Standard_Boolean theToUpdateViewer);
//! No right to Add a selected Shape (Internal Management of shape Selection).
//! A Previous selected shape may only be removed.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape& theShape,
const Standard_Boolean theToUpdateViewer);
//! Allows to highlight or unhighlight the owner given depending on its selection status
Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
const Standard_Boolean theToUpdateViewer);
//! Returns true is the owner given is selected
Standard_EXPORT Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const;
Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const { return !theOwner.IsNull() && theOwner->IsSelected(); }
//! Returns true is the object given is selected
Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& theObj) const;
//! Returns the first selected object in the list of current selected.
Standard_EXPORT Handle(AIS_InteractiveObject) FirstSelectedObject();
Standard_EXPORT Handle(AIS_InteractiveObject) FirstSelectedObject() const;
//! Count a number of selected entities using InitSelected()+MoreSelected()+NextSelected() iterator.
//! @sa SelectedOwner()/InitSelected()/MoreSelected()/NextSelected().
Standard_EXPORT Standard_Integer NbSelected();
Standard_Integer NbSelected() { return mySelection->Extent(); }
//! Initializes a scan of the selected objects.
//! @sa SelectedOwner()/MoreSelected()/NextSelected().
Standard_EXPORT void InitSelected();
void InitSelected() { mySelection->Init(); }
//! Returns true if there is another object found by the scan of the list of selected objects.
//! @sa SelectedOwner()/InitSelected()/NextSelected().
Standard_EXPORT Standard_Boolean MoreSelected() const;
Standard_Boolean MoreSelected() const { return mySelection->More(); }
//! Continues the scan to the next object in the list of selected objects.
//! @sa SelectedOwner()/InitSelected()/MoreSelected().
Standard_EXPORT void NextSelected();
void NextSelected() { mySelection->Next(); }
//! Returns the owner of the selected entity.
//! @sa InitSelected()/MoreSelected()/NextSelected().
Standard_EXPORT Handle(SelectMgr_EntityOwner) SelectedOwner() const;
Handle(SelectMgr_EntityOwner) SelectedOwner() const
{
return !mySelection->More()
? Handle(SelectMgr_EntityOwner)()
: mySelection->Value();
}
//! Return Handle(AIS_InteractiveObject)::DownCast (SelectedOwner()->Selectable()).
//! @sa SelectedOwner().
Standard_EXPORT Handle(AIS_InteractiveObject) SelectedInteractive() const;
Handle(AIS_InteractiveObject) SelectedInteractive() const
{
return !mySelection->More()
? Handle(AIS_InteractiveObject)()
: Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
}
//! Returns TRUE if the interactive context has a shape selected.
//! @sa SelectedShape().
@ -571,11 +590,11 @@ public: //! @name Selection management
//! Returns SelectedInteractive()->HasOwner().
//! @sa SelectedOwner().
Standard_EXPORT Standard_Boolean HasApplicative() const;
Standard_Boolean HasApplicative() const { return SelectedInteractive()->HasOwner(); }
//! Returns SelectedInteractive()->GetOwner().
//! @sa SelectedOwner().
Standard_EXPORT Handle(Standard_Transient) Applicative() const;
Handle(Standard_Transient) Applicative() const { return SelectedInteractive()->GetOwner(); }
public: //! @name immediate mode rendering
@ -596,7 +615,7 @@ public: //! @name immediate mode rendering
Standard_EXPORT Standard_Boolean IsImmediateModeOn() const;
//! Redraws immediate structures in all views of the viewer given taking into account its visibility.
Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
void RedrawImmediate (const Handle(V3d_Viewer)& theViewer) { myMainPM->RedrawImmediate (theViewer); }
public: //! @name management of active Selection Modes
@ -712,11 +731,11 @@ public: //! @name common properties
//! Returns the list of displayed objects of a particular Type WhichKind and Signature WhichSignature.
//! By Default, WhichSignature equals -1. This means that there is a check on type only.
Standard_EXPORT void DisplayedObjects (AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
Standard_EXPORT void DisplayedObjects (AIS_ListOfInteractive& aListOfIO) const;
//! gives the list of displayed objects of a particular Type and signature.
//! by Default, <WhichSignature> = -1 means control only on <WhichKind>.
Standard_EXPORT void DisplayedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
Standard_EXPORT void DisplayedObjects (const AIS_KindOfInteractive theWhichKind, const Standard_Integer theWhichSignature, AIS_ListOfInteractive& theListOfIO) const;
//! Returns the list theListOfIO of erased objects (hidden objects) particular Type WhichKind and Signature WhichSignature.
//! By Default, WhichSignature equals 1. This means that there is a check on type only.
@ -724,7 +743,7 @@ public: //! @name common properties
//! gives the list of erased objects (hidden objects)
//! Type and signature by Default, <WhichSignature> = -1 means control only on <WhichKind>.
Standard_EXPORT void ErasedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& theListOfIO) const;
Standard_EXPORT void ErasedObjects (const AIS_KindOfInteractive theWhichKind, const Standard_Integer theWhichSignature, AIS_ListOfInteractive& theListOfIO) const;
//! Returns the list theListOfIO of objects with indicated display status particular Type WhichKind and Signature WhichSignature.
//! By Default, WhichSignature equals 1. This means that there is a check on type only.
@ -1022,196 +1041,77 @@ public: //! @name iso-line display attributes
public: //! @name Local Context management (deprecated)
//! Returns true if there is an open context.
Standard_Boolean HasOpenedContext() const { return myCurLocalIndex != 0; }
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT Standard_Integer HighestIndex() const;
//! For advanced usage! You should use other (non-internal) methods of class AIS_InteractiveContext without trying to obtain an instance of AIS_LocalContext.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Handle(AIS_LocalContext) LocalContext() const { return myCurLocalIndex > 0 ? myLocalContexts (myCurLocalIndex) : Handle(AIS_LocalContext)(); }
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT Handle(StdSelect_ViewerSelector3d) LocalSelector() const;
//! Opens local contexts and specifies how this is to be done.
//! The options listed above function in the following manner:
//! - UseDisplayedObjects - allows you to load or not load the interactive objects visualized at Neutral Point in the local context which you open.
//! If false, the local context is empty after being opened. If true, the objects at Neutral Point are loaded by their default selection mode.
//! - AllowShapeDecomposition - AIS_Shape allows or prevents decomposition in standard shape location mode of objects at Neutral Point which are type-"privileged".
//! This Flag is only taken into account when UseDisplayedObjects is true.
//! - AcceptEraseOfObjects - authorises other local contexts to erase the interactive objects present in this context. This option is rarely used.
//! - BothViewers - Has no use currently defined.
//! This method returns the index of the created local context.
//! It should be kept and used to close the context.
//! Opening a local context allows you to prepare an environment for temporary presentations and selections which will disappear once the local context is closed.
//! You can open several local contexts, but only the last one will be active.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT Standard_Integer OpenLocalContext (const Standard_Boolean UseDisplayedObjects = Standard_True, const Standard_Boolean AllowShapeDecomposition = Standard_True, const Standard_Boolean AcceptEraseOfObjects = Standard_False, const Standard_Boolean BothViewers = Standard_False);
//! Allows you to close local contexts. For greater security, you should close the context with the index Index given on opening.
//! When you close a local context, the one before, which is still on the stack, reactivates.
//! If none is left, you return to Neutral Point.
//! If a local context is open and if updateviewer equals Standard_False, the presentation of the Interactive Object activates the selection mode;
//! the object is displayed but no viewer will be updated.
//! Warning
//! When the index isn't specified, the current context is closed.
//! This option can be dangerous, as other Interactive Functions can open local contexts without necessarily warning the user.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT void CloseLocalContext (const Standard_Integer theIndex = -1,
const Standard_Boolean theToUpdateViewer = Standard_True);
//! returns -1 if no opened local context.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT Standard_Integer IndexOfCurrentLocal() const;
//! Allows you to close all local contexts at one go and return to Neutral Point.
//! If a local context is open and if updateviewer equals Standard_False, the presentation of the Interactive Object activates the selection mode;
//! the object is displayed but no viewer will be updated.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT void CloseAllContexts (const Standard_Boolean theToUpdateViewer);
//! to be used only with no opened local context..
//! displays and activates objects in their original state before local contexts were opened...
Standard_EXPORT void ResetOriginalState (const Standard_Boolean theToUpdateViewer);
//! clears Objects/Filters/Activated Modes list in the current opened local context.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT void ClearLocalContext (const AIS_ClearMode TheMode = AIS_CM_All);
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT void UseDisplayedObjects();
//! when a local Context is opened, one is able to use/not use the displayed objects at neutral point at anytime.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT void NotUseDisplayedObjects();
//! to be Used only with opened local context and
//! if <anIobj> is of type shape...
//! if <aStatus> = True <anIobj> will be sensitive to
//! shape selection modes activation.
//! = False, <anIobj> will not be sensitive any more.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT void SetShapeDecomposition (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean aStatus);
//! Sets the temporary graphic attributes of the entity anObj.
//! These are provided by the attribute manager aDrawer and are valid for a particular local context only.
//! If a local context is open and if updateviewer equals Standard_False, the presentation of the Interactive Object activates the selection mode;
//! the object is displayed but no viewer will be updated.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT void SetTemporaryAttributes (const Handle(AIS_InteractiveObject)& theIObj,
const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Boolean theToUpdateViewer);
//! Provides an alternative to the Display methods when activating specific selection modes.
//! This has the effect of activating the corresponding selection mode aStandardActivation for all objects
//! in Local Context which accept decomposition into sub-shapes.
//! Every new Object which has been loaded into the interactive context and which answers these decomposition criteria
//! is automatically activated according to these modes.
//! Warning
//! If you have opened a local context by loading an object with the default options (<AllowShapeDecomposition >= Standard_True),
//! all objects of the "Shape" type are also activated with the same modes.
//! You can act on the state of these "Standard" objects by using SetShapeDecomposition(Status).
Standard_DEPRECATED ("Local Context is deprecated - ::Activate() and AIS_Shape::SelectionMode() should be used instead")
Standard_EXPORT void ActivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
//! Provides an alternative to the Display methods when deactivating specific selection modes.
//! This has the effect of deactivating the corresponding selection mode aStandardActivation for all objects
//! in Local Context which accept decomposition into sub-shapes.
Standard_DEPRECATED ("Local Context is deprecated - ::Deactivate() should be used instead")
Standard_EXPORT void DeactivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
//! Returns the list of activated standard selection modes available in a local context.
Standard_DEPRECATED ("Local Context is deprecated - list of activated Selection Modes should be tracked on application side; see also ::ActivatedModes()")
Standard_EXPORT const TColStd_ListOfInteger& ActivatedStandardModes() const;
//! returns if possible, the first local context where the object is seen
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT Standard_Boolean IsInLocal (const Handle(AIS_InteractiveObject)& anObject, Standard_Integer& TheIndex) const;
//! Sets the highlighting status aStatus of detected and selected entities.
//! Whether you are in Neutral Point or local context, this is automatically managed by the Interactive Context.
//! Sets the highlighting status of detected and selected entities.
//! This function allows you to disconnect the automatic mode.
Standard_EXPORT void SetAutomaticHilight (const Standard_Boolean aStatus);
void SetAutomaticHilight (Standard_Boolean theStatus) { myAutoHilight = theStatus; }
//! Returns true if the automatic highlight mode is active in an open context.
Standard_EXPORT Standard_Boolean AutomaticHilight() const;
//! Changes the status of a temporary object.
//! It will be kept at the neutral point, i.e. put in the list of displayed objects along with its temporary attributes.
//! These include display mode and selection mode, for example.
//! Returns true if done.
//! inWhichLocal gives the local context in which anIObj is displayed.
//! By default, the index -1 refers to the last Local Context opened.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT Standard_Boolean KeepTemporary (const Handle(AIS_InteractiveObject)& anIObj, const Standard_Integer InWhichLocal = -1);
//! Returns true if the automatic highlight mode is active.
Standard_Boolean AutomaticHilight() const { return myAutoHilight; }
public:
//! Updates the view of the current object in open context.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT void SetCurrentObject (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Boolean theToUpdateViewer);
void SetCurrentObject (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Boolean theToUpdateViewer) { SetSelected (theIObj, theToUpdateViewer); }
//! Allows to add or remove the object given to the list of current and highlight/unhighlight it correspondingly.
//! Is valid for global context only; for local context use method AddOrRemoveSelected.
//! Since this method makes sence only for neutral point selection of a whole object,
//! if 0 selection of the object is empty this method simply does nothing.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
const Standard_Boolean theIsToUpdateViewer);
void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
const Standard_Boolean theIsToUpdateViewer) { AddOrRemoveSelected (theObj, theIsToUpdateViewer); }
//! Updates the list of current objects, i.e. hilights new current objects, removes hilighting from former current objects.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT void UpdateCurrent();
void UpdateCurrent() { UpdateSelected (Standard_True); }
//! Returns true if there is a non-null interactive object in Neutral Point.
//! Objects selected when there is no open local context are called current objects;
//! those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const;
Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const { return IsSelected (theObject); }
//! Initializes a scan of the current selected objects in Neutral Point.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - ::InitSelected() should be called instead")
Standard_EXPORT void InitCurrent();
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
void InitCurrent() { InitSelected(); }
//! Returns true if there is another object found by the scan of the list of current objects.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - ::MoreSelected() should be called instead")
Standard_EXPORT Standard_Boolean MoreCurrent() const;
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_Boolean MoreCurrent() const { return MoreSelected(); }
//! Continues the scan to the next object in the list of current objects.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - ::NextSelected() should be called instead")
Standard_EXPORT void NextCurrent();
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
void NextCurrent() { NextSelected(); }
//! Returns the current interactive object.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - ::SelectedInteractive() should be called instead")
Standard_EXPORT Handle(AIS_InteractiveObject) Current() const;
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Handle(AIS_InteractiveObject) Current() const { return SelectedInteractive(); }
Standard_DEPRECATED ("Local Context is deprecated - ::NbSelected() should be called instead")
Standard_EXPORT Standard_Integer NbCurrents();
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_Integer NbCurrents() { return NbSelected(); }
//! Highlights current objects.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - ::HilightSelected() should be called instead")
Standard_EXPORT void HilightCurrents (const Standard_Boolean theToUpdateViewer);
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
void HilightCurrents (const Standard_Boolean theToUpdateViewer) { HilightSelected (theToUpdateViewer); }
//! Removes highlighting from current objects.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - ::UnhilightSelected() should be called instead")
Standard_EXPORT void UnhilightCurrents (const Standard_Boolean theToUpdateViewer);
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
void UnhilightCurrents (const Standard_Boolean theToUpdateViewer) { UnhilightSelected (theToUpdateViewer); }
//! Empties previous current objects in order to get the current objects detected by the selector using UpdateCurrent.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - ::ClearSelected() should be called instead")
Standard_EXPORT void ClearCurrents (const Standard_Boolean theToUpdateViewer);
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
void ClearCurrents (const Standard_Boolean theToUpdateViewer) { ClearSelected (theToUpdateViewer); }
//! @return current mouse-detected shape or empty (null) shape, if current interactive object
//! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
@ -1256,14 +1156,6 @@ public: //! @name sub-intensity management (deprecated)
Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Boolean theToUpdateViewer);
//! hilights/unhilights displayed objects which are displayed at neutral state with subintensity color.
//! Available only for active local context.
//! No effect if no local context.
Standard_EXPORT void SubIntensityOn (const Standard_Boolean theToUpdateViewer);
//! Removes subintensity option for all objects.
Standard_EXPORT void SubIntensityOff (const Standard_Boolean theToUpdateViewer);
protected: //! @name internal methods
Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
@ -1444,12 +1336,11 @@ protected: //! @name internal fields
Handle(SelectMgr_OrFilter) myFilters;
Handle(Prs3d_Drawer) myDefaultDrawer;
Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
AIS_DataMapOfILC myLocalContexts;
Standard_Integer myCurLocalIndex;
TColStd_SequenceOfInteger myDetectedSeq;
Standard_Integer myCurDetected;
Standard_Integer myCurHighlighted;
SelectMgr_PickingStrategy myPickingStrategy; //!< picking strategy to be applied within MoveTo()
Standard_Boolean myAutoHilight;
Standard_Boolean myIsAutoActivateSelMode;
};

File diff suppressed because it is too large Load Diff

View File

@ -15,12 +15,10 @@
// commercial license or contractual agreement.
#include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
#include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
#include <AIS_GlobalStatus.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_Selection.hxx>
#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
#include <Graphic3d_MapOfStructure.hxx>
@ -43,179 +41,6 @@
#include <V3d_View.hxx>
#include <V3d_Viewer.hxx>
//=======================================================================
//function : OpenLocalContext
//purpose :
//=======================================================================
Standard_Integer AIS_InteractiveContext::
OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
const Standard_Boolean AllowShapeDecomposition,
const Standard_Boolean AcceptEraseOfTemporary,
const Standard_Boolean /*BothViewers*/)
{
// the entities eventually detected just before the context was opened are unhighlighted...
if(!IsSelected(myLastPicked)){
if(!myLastPicked.IsNull()){
const Handle(AIS_InteractiveObject) aLastPickedAIS = Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable());
unhighlightGlobal (aLastPickedAIS);
}}
if (myCurLocalIndex > 0)
{
myLocalContexts (myCurLocalIndex)->UnhilightLastDetected (myMainVwr);
}
// entities connected to dynamic selection at neutral point are set to 0.
myLastinMain.Nullify();
myLastPicked.Nullify();
myWasLastMain = Standard_True;
Standard_DISABLE_DEPRECATION_WARNINGS
myCurLocalIndex = HighestIndex() + 1;
Standard_ENABLE_DEPRECATION_WARNINGS
Handle(AIS_LocalContext) NewLocal= new AIS_LocalContext(this,myCurLocalIndex,
UseDisplayedObjects,
AllowShapeDecomposition,
AcceptEraseOfTemporary);
// the AIS_LocalContext bind itself to myLocalContexts
// because procedures performed in AIS_LocalContext constructor
// already may access myLocalContexts(myCurLocalIndex) (like methods AIS_LocalContext::IsSelected()).
#ifdef OCCT_DEBUG
cout<<"\tOpen Local Context No "<<myCurLocalIndex<<endl;
if(UseDisplayedObjects){
cout<<"\t\tObjects from Neutral Point loaded"<<endl;
if(AllowShapeDecomposition)
cout<<"\t\tDecomposition Authorized for Loaded Shapes"<<endl;
else
cout<<"\t\tNo Decomposition Authorized for Loaded Shapes"<<endl;
}
else
cout<<"\t\tNo Objects Were Loaded "<<endl;
#endif
return myCurLocalIndex;
}
//=======================================================================
//function : CloseLocalContext
//purpose :
//=======================================================================
void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
const Standard_Boolean updateviewer)
{
Standard_Boolean debugmode(Standard_False);
#ifdef OCCT_DEBUG
debugmode = Standard_True;
#endif
Standard_Integer GoodIndex = (Index ==-1) ? myCurLocalIndex : Index;
if(debugmode) cout<<"Call to CloseLocalContext - Index "<<GoodIndex<<endl;
if(!HasOpenedContext()){
if(debugmode) cout<<"\t But No Local Context is opened"<<endl;
return;
}
if(!myLocalContexts.IsBound(GoodIndex)) {
if(debugmode) cout<<" Attempt to Close a non-existent Local Context"<<endl;
return;
}
// the only open local context is closed...
if(myLocalContexts.Extent()==1 && GoodIndex == myCurLocalIndex){
myLocalContexts(myCurLocalIndex)->Terminate( updateviewer );
myLocalContexts.UnBind(myCurLocalIndex);
myCurLocalIndex = 0;
ResetOriginalState(Standard_False);
if(debugmode)
cout<<"No More Opened Local Context "<<endl;
}
// Otherwise the local context will be still open after the current is closed
else{
Handle(StdSelect_ViewerSelector3d) VS = myLocalContexts(GoodIndex)->MainSelector();
myLocalContexts(GoodIndex)->Terminate();
myLocalContexts.UnBind(GoodIndex);
// the current is closed...
if(GoodIndex==myCurLocalIndex){
Standard_DISABLE_DEPRECATION_WARNINGS
myCurLocalIndex = HighestIndex();
Standard_ENABLE_DEPRECATION_WARNINGS
}
else if(debugmode)
cout<<"a No Current Local Context WasClosed"<<endl;
// restore activated selections of current local context
myLocalContexts (myCurLocalIndex)->RestoreActivatedModes();
if(debugmode) cout<<"Index Of CurrentLocalContext:"<<myCurLocalIndex<<endl;
}
if(updateviewer) myMainVwr->Update();
}
//=======================================================================
//function : CloseAllContexts
//purpose :
//=======================================================================
Standard_DISABLE_DEPRECATION_WARNINGS
void AIS_InteractiveContext::CloseAllContexts(const Standard_Boolean updateviewer)
{
while(!myLocalContexts.IsEmpty()){
CloseLocalContext(myCurLocalIndex,Standard_False);
}
ResetOriginalState(Standard_False);
if(updateviewer) myMainVwr->Update();
}
Standard_ENABLE_DEPRECATION_WARNINGS
//=======================================================================
//function : IndexOfCurrentLocal
//purpose :
//=======================================================================
Standard_Integer AIS_InteractiveContext::IndexOfCurrentLocal() const
{
return myCurLocalIndex;
}
//=======================================================================
//function : ClearLocalContext
//purpose :
//=======================================================================
void AIS_InteractiveContext::ClearLocalContext(const AIS_ClearMode aMode)
{
if (!HasOpenedContext()) return;
myLocalContexts(myCurLocalIndex)->Clear(aMode);
}
//=======================================================================
//function : HighestIndex
//purpose :
//=======================================================================
Standard_Integer AIS_InteractiveContext::HighestIndex() const
{
AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
Standard_Integer HiInd = 0;
for(;It.More();It.Next())
HiInd = (It.Key()>HiInd) ? It.Key() : HiInd;
return HiInd;
}
//=======================================================================
//function : SetSelectionModeActive
//purpose :
@ -230,11 +55,6 @@ void AIS_InteractiveContext::SetSelectionModeActive (const Handle(AIS_Interactiv
{
return;
}
else if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->SetSelectionModeActive (theObj, theMode, theIsActive, theActiveFilter);
return;
}
const Handle(AIS_GlobalStatus)* aStat = myObjects.Seek (theObj);
if (aStat == NULL)
@ -253,12 +73,12 @@ void AIS_InteractiveContext::SetSelectionModeActive (const Handle(AIS_Interactiv
{
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
mgrSelector->Deactivate (theObj, aModeIter.Value(), myMainSel);
mgrSelector->Deactivate (theObj, aModeIter.Value());
}
}
else
{
mgrSelector->Deactivate (theObj, theMode, myMainSel);
mgrSelector->Deactivate (theObj, theMode);
}
}
@ -292,7 +112,7 @@ void AIS_InteractiveContext::SetSelectionModeActive (const Handle(AIS_Interactiv
{
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
mgrSelector->Deactivate (theObj, aModeIter.Value(), myMainSel);
mgrSelector->Deactivate (theObj, aModeIter.Value());
}
(*aStat)->ClearSelectionModes();
break;
@ -306,7 +126,7 @@ void AIS_InteractiveContext::SetSelectionModeActive (const Handle(AIS_Interactiv
if ((theMode == aGlobSelMode && aModeIter.Value() != aGlobSelMode)
|| (theMode != aGlobSelMode && aModeIter.Value() == aGlobSelMode))
{
mgrSelector->Deactivate (theObj, aModeIter.Value(), myMainSel);
mgrSelector->Deactivate (theObj, aModeIter.Value());
aRemovedModes.Append (aModeIter.Value());
}
}
@ -328,7 +148,7 @@ void AIS_InteractiveContext::SetSelectionModeActive (const Handle(AIS_Interactiv
break;
}
}
mgrSelector->Activate (theObj, theMode, myMainSel);
mgrSelector->Activate (theObj, theMode);
}
(*aStat)->AddSelectionMode (theMode);
}
@ -345,24 +165,12 @@ void AIS_InteractiveContext::Activate (const Standard_Integer theMode,
for (AIS_ListIteratorOfListOfInteractive anIter (aDisplayedObjects); anIter.More(); anIter.Next())
{
Load (anIter.Value(), -1, Standard_True);
Load (anIter.Value(), -1);
Activate (anIter.Value(), theMode, theIsForce);
}
}
//=======================================================================
//function : LocalSelector
//purpose :
//=======================================================================
Handle( StdSelect_ViewerSelector3d ) AIS_InteractiveContext::LocalSelector() const
{
if( !HasOpenedContext() )
return Handle( StdSelect_ViewerSelector3d )();
else
return myLocalContexts( myCurLocalIndex )->MainSelector();
}
// ============================================================================
// function : Deactivate
// purpose :
@ -395,55 +203,19 @@ void AIS_InteractiveContext::Deactivate()
//=======================================================================
//function : ActivatedModes
//purpose :
//purpose :
//=======================================================================
void AIS_InteractiveContext::
ActivatedModes(const Handle(AIS_InteractiveObject)& anIObj,
TColStd_ListOfInteger& theList) const
void AIS_InteractiveContext::ActivatedModes (const Handle(AIS_InteractiveObject)& theObj,
TColStd_ListOfInteger& theList) const
{
TColStd_ListIteratorOfListOfInteger ItL;
if(!HasOpenedContext()){
if(myObjects.IsBound(anIObj)){
for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
ItL.More();
ItL.Next())
theList.Append(ItL.Value());
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theObj);
if (aStatus != NULL)
{
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStatus)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
theList.Append (aModeIter.Value());
}
}
else{
if(myLocalContexts(myCurLocalIndex)->IsIn(anIObj)){
for(ItL.Initialize(myLocalContexts(myCurLocalIndex)->SelectionModes(anIObj));
ItL.More();
ItL.Next())
theList.Append(ItL.Value());
}
}
}
//=======================================================================
//function : SetShapeDecomposition
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetShapeDecomposition(const Handle(AIS_InteractiveObject)& anIObj,
const Standard_Boolean StdModeSensitive)
{
if(!HasOpenedContext()) return;
myLocalContexts(myCurLocalIndex)->SetShapeDecomposition(anIObj,StdModeSensitive);
}
//=======================================================================
//function : SetTemporaryAttributes
//purpose :
//=======================================================================
void AIS_InteractiveContext::
SetTemporaryAttributes(const Handle(AIS_InteractiveObject)& /*anObj*/,
const Handle(Prs3d_Drawer)& /*aDrawer*/,
const Standard_Boolean /*updateviewer*/)
{
}
//=======================================================================
@ -454,16 +226,7 @@ void AIS_InteractiveContext::
SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
const Standard_Boolean updateviewer)
{
if(!HasOpenedContext())
{
turnOnSubintensity (anIObj);
}
else
{
turnOnSubintensity (anIObj, -1, Standard_False);
myLocalContexts(myCurLocalIndex)->SubIntensityOn (anIObj);
}
turnOnSubintensity (anIObj);
if (updateviewer)
myMainVwr->Update();
}
@ -472,83 +235,33 @@ SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
//purpose :
//=======================================================================
void AIS_InteractiveContext::
SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
const Standard_Boolean updateviewer)
void AIS_InteractiveContext::SubIntensityOff (const Handle(AIS_InteractiveObject)& theObj,
const Standard_Boolean theToUpdateViewer)
{
if(!HasOpenedContext()){
if(!myObjects.IsBound(anIObj))
return;
const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
if(!GB->IsSubIntensityOn())
return;
GB->SubIntensityOff();
Standard_Boolean UpdMain(Standard_False);
if(GB->GraphicStatus() == AIS_DS_Displayed)
{
myMainPM->Unhighlight (anIObj);
UpdMain = Standard_True;
}
if(IsSelected(anIObj))
highlightSelected (anIObj->GlobalSelOwner());
if(updateviewer){
if(UpdMain)
myMainVwr->Update();
}
}
else {
const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anIObj, anIObj->GlobalSelOwner());
if(myObjects.IsBound(anIObj)){
const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
STAT->SubIntensityOff();
myMainPM->Unhighlight (anIObj);
if (STAT->IsHilighted())
HilightWithColor (anIObj, anObjSelStyle, Standard_False);
}
else
myLocalContexts(myCurLocalIndex)->SubIntensityOff(anIObj);
if (IsSelected(anIObj))
HilightWithColor (anIObj, anObjSelStyle, Standard_False);
if(updateviewer) myMainVwr->Update();
}
}
//=======================================================================
//function : SubIntensityOn
//purpose : ALL THE DISPLAYED OBJECTS HAVE SUBINTENSITY...
//=======================================================================
void AIS_InteractiveContext::SubIntensityOn (const Standard_Boolean theIsToUpdateViewer)
{
if (!HasOpenedContext())
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theObj);
if (aStatus == NULL
|| !(*aStatus)->IsSubIntensityOn())
{
return;
turnOnSubintensity();
if (theIsToUpdateViewer)
myMainVwr->Update();
}
//=======================================================================
//function : SubIntensityOff
//purpose :
//=======================================================================
void AIS_InteractiveContext::SubIntensityOff(const Standard_Boolean updateviewer)
{
if(!HasOpenedContext()) return;
AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
for(;It.More();It.Next()){
const Handle(AIS_GlobalStatus)& STAT = It.Value();
if(STAT->IsSubIntensityOn())
STAT->SubIntensityOff();
myMainPM->Unhighlight (It.Key());
}
if(updateviewer) myMainVwr->Update();
(*aStatus)->SubIntensityOff();
Standard_Boolean toUpdateMain = Standard_False;
if ((*aStatus)->GraphicStatus() == AIS_DS_Displayed)
{
myMainPM->Unhighlight (theObj);
toUpdateMain = Standard_True;
}
if (IsSelected (theObj))
{
highlightSelected (theObj->GlobalSelOwner());
}
if (theToUpdateViewer && toUpdateMain)
{
myMainVwr->Update();
}
}
//=======================================================================
@ -557,30 +270,7 @@ void AIS_InteractiveContext::SubIntensityOff(const Standard_Boolean updateviewer
//=======================================================================
void AIS_InteractiveContext::AddFilter(const Handle(SelectMgr_Filter)& aFilter)
{
if(HasOpenedContext())
myLocalContexts(myCurLocalIndex)->AddFilter(aFilter);
else
myFilters->Add(aFilter);
}
//=======================================================================
//function : ActivateStandardMode
//purpose :
//=======================================================================
void AIS_InteractiveContext::ActivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
{
if(!HasOpenedContext()) return;
myLocalContexts(myCurLocalIndex)->ActivateStandardMode (aStandardActivation);
}
//=======================================================================
//function : DeActivateStandardMode
//purpose :
//=======================================================================
void AIS_InteractiveContext::DeactivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
{
if(!HasOpenedContext()) return;
myLocalContexts(myCurLocalIndex)->DeactivateStandardMode (aStandardActivation);
myFilters->Add(aFilter);
}
//=======================================================================
@ -589,10 +279,7 @@ void AIS_InteractiveContext::DeactivateStandardMode(const TopAbs_ShapeEnum aStan
//=======================================================================
void AIS_InteractiveContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilter)
{
if(HasOpenedContext())
myLocalContexts(myCurLocalIndex)->RemoveFilter (aFilter);
else
myFilters->Remove(aFilter);
myFilters->Remove(aFilter);
}
//=======================================================================
@ -602,19 +289,7 @@ void AIS_InteractiveContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilte
void AIS_InteractiveContext::RemoveFilters()
{
if(!HasOpenedContext())
myFilters->Clear();
else
myLocalContexts(myCurLocalIndex)->Clear(AIS_CM_Filters);
}
//=======================================================================
//function : ActivatedStandardModes
//purpose :
//=======================================================================
const TColStd_ListOfInteger& AIS_InteractiveContext::ActivatedStandardModes() const
{
return myLocalContexts(myCurLocalIndex)->StandardModes();
myFilters->Clear();
}
//=======================================================================
@ -623,8 +298,6 @@ const TColStd_ListOfInteger& AIS_InteractiveContext::ActivatedStandardModes() co
//=======================================================================
const SelectMgr_ListOfFilter& AIS_InteractiveContext::Filters() const
{
if(HasOpenedContext())
return myLocalContexts(myCurLocalIndex)->ListOfFilter();
return myFilters->StoredFilters();
}
@ -634,101 +307,38 @@ const SelectMgr_ListOfFilter& AIS_InteractiveContext::Filters() const
//=======================================================================
void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(V3d_View)& aviou)
{
if(HasOpenedContext())
myLocalContexts(myCurLocalIndex)->DisplaySensitive(aviou);
else
myMainSel->DisplaySensitive(aviou);
myMainSel->DisplaySensitive(aviou);
}
//=======================================================================
//function : DisplayActiveSensitive
//purpose :
//=======================================================================
void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(AIS_InteractiveObject)& anIObj,
const Handle(V3d_View)& aviou)
void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(AIS_InteractiveObject)& theObj,
const Handle(V3d_View)& theView)
{
TColStd_ListIteratorOfListOfInteger It;
Handle(StdSelect_ViewerSelector3d) VS;
if(HasOpenedContext()){
const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
if(!LC->IsIn(anIObj)) return;
It.Initialize(LC->SelectionModes(anIObj));
VS = LC->MainSelector();
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theObj);
if (aStatus == NULL)
{
return;
}
else{
if(!myObjects.IsBound(anIObj)) return;
It.Initialize(myObjects(anIObj)->SelectionModes());
VS = myMainSel;
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStatus)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
const Handle(SelectMgr_Selection)& aSel = theObj->Selection (aModeIter.Value());
myMainSel->DisplaySensitive (aSel, theObj->Transformation(), theView, Standard_False);
}
for(;It.More();It.Next()){
const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
VS->DisplaySensitive(Sel,anIObj->Transformation(), aviou,Standard_False);
}
}
//=======================================================================
//function : ClearActiveSensitive
//purpose :
//=======================================================================
void AIS_InteractiveContext::ClearActiveSensitive(const Handle(V3d_View)& aviou)
void AIS_InteractiveContext::ClearActiveSensitive (const Handle(V3d_View)& theView)
{
if(HasOpenedContext())
myLocalContexts(myCurLocalIndex)->ClearSensitive(aviou);
else
myMainSel->ClearSensitive(aviou);
myMainSel->ClearSensitive (theView);
}
//=======================================================================
//function : SetAutomaticHilight
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetAutomaticHilight(const Standard_Boolean aStatus)
{
if(HasOpenedContext())
myLocalContexts(myCurLocalIndex)->SetAutomaticHilight(aStatus);
}
//=======================================================================
//function : AutomaticHilight
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveContext::AutomaticHilight() const
{
if(HasOpenedContext())
return myLocalContexts(myCurLocalIndex)->AutomaticHilight();
return Standard_True;
}
//=======================================================================
//function : UseDisplayedObjects
//purpose :
//=======================================================================
void AIS_InteractiveContext::UseDisplayedObjects()
{
if(HasOpenedContext())
myLocalContexts(myCurLocalIndex)->LoadContextObjects();
}
//=======================================================================
//function : NotUseDisplayedObjects
//purpose :
//=======================================================================
void AIS_InteractiveContext::NotUseDisplayedObjects()
{
if(HasOpenedContext())
myLocalContexts(myCurLocalIndex)->UnloadContextObjects();
}
//=======================================================================
//function : PurgeDisplay
//purpose :
@ -736,12 +346,9 @@ void AIS_InteractiveContext::NotUseDisplayedObjects()
Standard_Integer AIS_InteractiveContext::PurgeDisplay()
{
if(HasOpenedContext()) return 0;
Standard_Integer NbStr = PurgeViewer(myMainVwr);
myMainVwr->Update();
return NbStr;
}
@ -781,10 +388,6 @@ Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& V
Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
{
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
}
return myMainPM->IsImmediateModeOn();
}
@ -795,11 +398,6 @@ Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
{
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->BeginImmediateDraw();
}
if (myMainPM->IsImmediateModeOn())
{
myMainPM->BeginImmediateDraw();
@ -816,11 +414,6 @@ Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
Standard_Boolean AIS_InteractiveContext::ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj,
const Standard_Integer theMode)
{
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->ImmediateAdd (theObj, theMode);
}
if (!myMainPM->IsImmediateModeOn())
{
return Standard_False;
@ -837,11 +430,6 @@ Standard_Boolean AIS_InteractiveContext::ImmediateAdd (const Handle(AIS_Interact
Standard_Boolean AIS_InteractiveContext::EndImmediateDraw (const Handle(V3d_View)& theView)
{
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->EndImmediateDraw (theView->Viewer());
}
if (!myMainPM->IsImmediateModeOn())
{
return Standard_False;
@ -858,11 +446,6 @@ Standard_Boolean AIS_InteractiveContext::EndImmediateDraw (const Handle(V3d_View
Standard_Boolean AIS_InteractiveContext::EndImmediateDraw()
{
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->EndImmediateDraw (myMainVwr);
}
if (!myMainPM->IsImmediateModeOn())
{
return Standard_False;
@ -871,51 +454,3 @@ Standard_Boolean AIS_InteractiveContext::EndImmediateDraw()
myMainPM->EndImmediateDraw (myMainVwr);
return Standard_True;
}
//=======================================================================
//function : ResetOriginalState
//purpose :
//=======================================================================
void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updateviewer)
{
Standard_Boolean upd_main(Standard_False);
TColStd_ListIteratorOfListOfInteger itl;
myMainSel->ResetSelectionActivationStatus();
for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){
const Handle(AIS_InteractiveObject)& iobj = it.Key();
const Handle(AIS_GlobalStatus)& STAT = it.Value();
switch(STAT->GraphicStatus()){
case AIS_DS_Displayed:{
upd_main = Standard_True;
// part display...
myMainPM->Display (iobj, STAT->DisplayMode());
if(STAT->IsHilighted())
{
const Handle(Prs3d_Drawer)& aStyle = STAT->HilightStyle();
if (!aStyle.IsNull() && getSelStyle (iobj, iobj->GlobalSelOwner()) != aStyle)
HilightWithColor(iobj,aStyle,Standard_False);
}
//part selection
for(itl.Initialize(STAT->SelectionModes());itl.More();itl.Next()){
if(itl.Value()!=-1)
mgrSelector->Activate(iobj,itl.Value(),myMainSel);
}
break;
}
case AIS_DS_Erased:{
EraseGlobal(iobj,Standard_False);
break;
}
default:
break;
}
}
if(updateviewer){
if(upd_main)
myMainVwr->Update();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,455 +0,0 @@
// Created on: 1996-09-04
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_LocalContext_HeaderFile
#define _AIS_LocalContext_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Boolean.hxx>
#include <StdSelect_ViewerSelector3d.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <TCollection_AsciiString.hxx>
#include <AIS_DataMapOfSelStat.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <SelectMgr_IndexedMapOfOwner.hxx>
#include <Standard_Integer.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <AIS_SequenceOfInteractive.hxx>
#include <AIS_SelectionModesConcurrency.hxx>
#include <Standard_Transient.hxx>
#include <AIS_ClearMode.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <SelectMgr_ListOfFilter.hxx>
#include <AIS_StatusOfDetection.hxx>
#include <AIS_StatusOfPick.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColStd_MapOfTransient.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Standard_Real.hxx>
#include <AIS_Selection.hxx>
class AIS_InteractiveContext;
class SelectMgr_SelectionManager;
class SelectMgr_OrFilter;
class SelectMgr_Filter;
class TCollection_AsciiString;
class AIS_InteractiveObject;
class V3d_View;
class V3d_Viewer;
class TopoDS_Shape;
class SelectMgr_EntityOwner;
class Standard_Transient;
class AIS_LocalStatus;
class SelectMgr_SelectableObject;
class AIS_LocalContext;
DEFINE_STANDARD_HANDLE(AIS_LocalContext, Standard_Transient)
//! Defines a specific context for selection.
//! It becomes possible to:
//! + Load InteractiveObjects with a mode to be
//! activated + associate InteractiveObjects with a
//! set of temporary selectable Objects.... + +
//! activate StandardMode of selection for Entities
//! inheriting BasicShape from AIS (Selection Of
//! vertices, edges, wires,faces... + Add Filters
//! acting on detected owners of sensitive primitives
//!
//! - automatically highlight shapes and
//! InteractiveObjects (highlight of detected shape +
//! highlight of detected selectable...
class AIS_LocalContext : public Standard_Transient
{
public:
Standard_EXPORT AIS_LocalContext();
//! Constructor By Default, the displayed objects are
//! automatically loaded.
Standard_EXPORT AIS_LocalContext(const Handle(AIS_InteractiveContext)& aCtx, const Standard_Integer anIndex, const Standard_Boolean LoadDisplayed = Standard_True, const Standard_Boolean AcceptStandardModes = Standard_True, const Standard_Boolean AcceptErase = Standard_False, const Standard_Boolean UseBothViewers = Standard_False);
//! authorize or not others contexts to erase
//! temporary displayed objects here;
void AcceptErase (const Standard_Boolean aStatus);
Standard_Boolean AcceptErase() const;
Standard_EXPORT void SetContext (const Handle(AIS_InteractiveContext)& aCtx);
const Handle(AIS_Selection)& Selection() const { return mySelection; }
Standard_EXPORT void Terminate (const Standard_Boolean updateviewer = Standard_True);
//! returns true if done...
Standard_EXPORT Standard_Boolean Display (const Handle(AIS_InteractiveObject)& anInteractive, const Standard_Integer DisplayMode = 0, const Standard_Boolean AllowShapeDecomposition = Standard_True, const Standard_Integer ActivationMode = 0);
//! loads <anInteractive> with nodisplay...
//! returns true if done
Standard_EXPORT Standard_Boolean Load (const Handle(AIS_InteractiveObject)& anInteractive, const Standard_Boolean AllowShapeDecomposition = Standard_True, const Standard_Integer ActivationMode = 0);
//! returns true if done...
Standard_EXPORT Standard_Boolean Erase (const Handle(AIS_InteractiveObject)& anInteractive);
Standard_EXPORT Standard_Boolean Remove (const Handle(AIS_InteractiveObject)& aSelectable);
Standard_EXPORT Standard_Boolean ClearPrs (const Handle(AIS_InteractiveObject)& anInteractive, const Standard_Integer aMode);
//! allows or forbids the shape decomposition into
//! Activated Standard Mode for <aStoredObject>
//! does nothing if the object doesn't inherits
//! BasicShape from AIS
Standard_EXPORT void SetShapeDecomposition (const Handle(AIS_InteractiveObject)& aStoredObject, const Standard_Boolean aStatus);
//! according to <atype> , clears the different parts of
//! the selector (filters, modeof activation, objects...)
Standard_EXPORT void Clear (const AIS_ClearMode atype = AIS_CM_All);
Standard_EXPORT void SetSelectionModeActive (const Handle(AIS_InteractiveObject)& theObj,
const Standard_Integer theMode,
const Standard_Boolean theIsActive,
const AIS_SelectionModesConcurrency theActiveFilter);
//! optional : activation of a mode which is not 0 for a selectable...
void ActivateMode (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode)
{
SetSelectionModeActive (theObj, theMode, Standard_True, AIS_SelectionModesConcurrency_GlobalOrLocal);
}
void DeactivateMode (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode)
{
SetSelectionModeActive (theObj, theMode, Standard_False, AIS_SelectionModesConcurrency_GlobalOrLocal);
}
void Deactivate (const Handle(AIS_InteractiveObject)& theObj)
{
SetSelectionModeActive (theObj, -1, Standard_False, AIS_SelectionModesConcurrency_Single);
}
//! decomposition of shapes into <aType>
Standard_EXPORT void ActivateStandardMode (const TopAbs_ShapeEnum aType);
Standard_EXPORT void DeactivateStandardMode (const TopAbs_ShapeEnum aType);
const TColStd_ListOfInteger& StandardModes() const;
Standard_EXPORT void AddFilter (const Handle(SelectMgr_Filter)& aFilter);
Standard_EXPORT void RemoveFilter (const Handle(SelectMgr_Filter)& aFilter);
const SelectMgr_ListOfFilter& ListOfFilter() const;
const Handle(SelectMgr_OrFilter)& Filter() const;
//! if <aStatus> = True , the shapes or subshapes detected
//! by the selector will be automatically hilighted in the
//! main viewer.
//! Else the user has to manage the detected shape outside the
//! Shape Selector....
void SetAutomaticHilight (const Standard_Boolean aStatus);
Standard_Boolean AutomaticHilight() const;
Standard_EXPORT AIS_StatusOfDetection MoveTo (const Standard_Integer theXpix, const Standard_Integer theYpix, const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate);
//! returns True if more than one entity
//! was detected at the last Mouse position.
Standard_Boolean HasNextDetected() const;
//! returns True if last detected. the next detected will
//! be first one (endless loop)
Standard_EXPORT Standard_Integer HilightNextDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate);
Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate);
//! returns True if something was done...
Standard_EXPORT Standard_Boolean UnhilightLastDetected (const Handle(V3d_Viewer)& theViewer);
//! returns True if something was done...
Standard_EXPORT Standard_Boolean UnhilightLastDetected (const Handle(V3d_View)& theView);
//! returns the number of selected
Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean updateviewer = Standard_True);
Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean updateviewer = Standard_True);
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer XPMin, const Standard_Integer YPMin, const Standard_Integer XPMax, const Standard_Integer YPMax, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Integer XPMin, const Standard_Integer YPMin, const Standard_Integer XPMax, const Standard_Integer YPMax, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& Polyline, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
Standard_EXPORT AIS_StatusOfPick ShiftSelect (const TColgp_Array1OfPnt2d& Polyline, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
Standard_EXPORT void HilightPicked (const Standard_Boolean updateviewer = Standard_True);
Standard_EXPORT void UnhilightPicked (const Standard_Boolean updateviewer = Standard_True);
Standard_EXPORT void UpdateSelected (const Standard_Boolean updateviewer = Standard_True);
//! Part of advanced selection highlighting mechanism.
//! If no owners belonging to anobj are selected, calls anobj->ClearSelected(),
//! otherwise calls anobj->HilightSelected(). This method can be used to avoid
//! redrawing the whole selection belonging to several Selectable Objects.
Standard_EXPORT void UpdateSelected (const Handle(AIS_InteractiveObject)& anobj, const Standard_Boolean updateviewer = Standard_True);
//! useful to update selection with objects coming from
//! Collector or stack
Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& anobj, const Standard_Boolean updateviewer = Standard_True);
//! useful to update selection with objects coming from
//! Collector or stack
Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& anobj, const Standard_Boolean updateviewer = Standard_True);
Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape& aShape, const Standard_Boolean updateviewer = Standard_True);
Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner, const Standard_Boolean toUpdateViewer = Standard_True);
//! Clears local context selection.
//! @param toUpdateViewer [in] if TRUE the viewer will be updated.
Standard_EXPORT void ClearSelected (const Standard_Boolean toUpdateViewer = Standard_True);
//! Clears outdated selection and detection of owners for the
//! interactive object. Use this method if selection structures
//! of the interactive object have changed. The method unhilights
//! and removes outdated entity owners from lists of selected
//! and detected owners.
//! @param theIO [in] the interactive object.
//! @param toClearDeactivated [in] pass TRUE to treat deactivated
//! entity owners as 'outdated' when clearing the selection.
Standard_EXPORT void ClearOutdatedSelection (const Handle(AIS_InteractiveObject)& theIO, const Standard_Boolean toClearDeactivated);
Standard_Boolean HasDetected() const;
//! Initialization for iteration through mouse-detected objects in local context.
Standard_EXPORT void InitDetected();
//! @return true if there is more mouse-detected objects after the current one
//! during iteration through mouse-detected interactive objects.
Standard_EXPORT Standard_Boolean MoreDetected() const;
//! Gets next current object during iteration through mouse-detected
//! interactive objects.
Standard_EXPORT void NextDetected();
//! @return current mouse-detected Owner or null object if there is no current detected.
Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedCurrentOwner() const;
//! @return current mouse-detected shape or empty (null) shape, if current interactive object
//! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
//! @return current mouse-detected interactive object or null object if there is no current detected.
Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
Standard_EXPORT Standard_Boolean HasDetectedShape() const;
Standard_EXPORT const TopoDS_Shape& DetectedShape() const;
Standard_EXPORT Handle(AIS_InteractiveObject) DetectedInteractive() const;
Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedOwner() const;
Standard_EXPORT void InitSelected();
Standard_EXPORT Standard_Boolean MoreSelected() const;
Standard_EXPORT void NextSelected();
//! returns TRUE if the detected entity is a shape
//! coming from a Decomposition of an element.
Standard_EXPORT Standard_Boolean HasShape() const;
//! returns true if current selection is not empty
//! and the owner of selected object contains a shape.
//! This method does not take into account decomposition
//! status of detected shape.
Standard_EXPORT Standard_Boolean HasSelectedShape() const;
Standard_EXPORT TopoDS_Shape SelectedShape() const;
Standard_EXPORT Handle(SelectMgr_EntityOwner) SelectedOwner() const;
Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& aniobj) const;
Standard_EXPORT Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& anOwner) const;
Standard_EXPORT Handle(AIS_InteractiveObject) SelectedInteractive() const;
//! returns TRUE if an interactive element
//! was associated with the current picked entity.
Standard_EXPORT Standard_Boolean HasApplicative() const;
Standard_EXPORT const Handle(Standard_Transient)& SelectedApplicative() const;
Standard_EXPORT void SetDisplayPriority (const Handle(AIS_InteractiveObject)& anObject, const Standard_Integer Prior);
Standard_EXPORT Standard_Integer DisplayedObjects (TColStd_MapOfTransient& theMapToFill) const;
Standard_EXPORT Standard_Boolean IsIn (const Handle(AIS_InteractiveObject)& anObject) const;
Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anObject) const;
Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anObject, const Standard_Integer aMode) const;
Standard_EXPORT const TColStd_ListOfInteger& SelectionModes (const Handle(AIS_InteractiveObject)& anObject) const;
Standard_EXPORT void SubIntensityOn (const Handle(AIS_InteractiveObject)& anObject);
Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& anObject);
Standard_EXPORT void Hilight (const Handle(AIS_InteractiveObject)& anObject);
Standard_EXPORT void Hilight (const Handle(AIS_InteractiveObject)& theObj,
const Handle(Prs3d_Drawer)& theStyle);
Standard_EXPORT void Unhilight (const Handle(AIS_InteractiveObject)& anObject);
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& anObject) const;
Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(AIS_InteractiveObject)& theObject,
Handle(Prs3d_Drawer)& theStyle) const;
//! Define the current selection sensitivity for
//! this local context according to the view size.
Standard_EXPORT void SetPixelTolerance (const Standard_Integer aPrecision = 2);
//! Returns the pixel tolerance.
Standard_EXPORT Standard_Integer PixelTolerance() const;
//! Allows to manage sensitivity of a particular selection of interactive object theObject
//! and changes previous sensitivity value of all sensitive entities in selection with theMode
//! to the given theNewSensitivity.
Standard_EXPORT void SetSelectionSensitivity (const Handle(AIS_InteractiveObject)& theObject,
const Standard_Integer theMode,
const Standard_Integer theNewSensitivity);
//! Resets the transient list of presentations previously displayed in immediate mode
//! and begins accumulation of new list by following AddToImmediateList()/Color()/Highlight() calls.
Standard_EXPORT Standard_Boolean BeginImmediateDraw();
//! Resets the transient list of presentations previously displayed in immediate mode.
Standard_EXPORT virtual void ClearImmediateDraw();
//! Stores presentation theMode of object theObj in the transient list of presentations to be displayed in immediate mode.
//! Will be taken in account in EndImmediateDraw method.
Standard_EXPORT Standard_Boolean ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0);
//! Allows rapid drawing of the view theView by avoiding an update of the whole background.
Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_Viewer)& theViewer);
//! Returns true if Presentation Manager is accumulating transient list of presentations to be displayed in immediate mode.
Standard_EXPORT Standard_Boolean IsImmediateModeOn() const;
Standard_EXPORT TCollection_AsciiString Status() const;
Standard_EXPORT const Handle(AIS_LocalStatus)& Status (const Handle(AIS_InteractiveObject)& anObject) const;
Standard_EXPORT void LoadContextObjects();
Standard_EXPORT void UnloadContextObjects();
Standard_EXPORT void DisplaySensitive (const Handle(V3d_View)& aView);
Standard_EXPORT void ClearSensitive (const Handle(V3d_View)& aView);
const Handle(StdSelect_ViewerSelector3d)& MainSelector() const;
Standard_EXPORT Handle(SelectMgr_EntityOwner) FindSelectedOwnerFromIO (const Handle(AIS_InteractiveObject)& anIObj) const;
Standard_EXPORT Handle(SelectMgr_EntityOwner) FindSelectedOwnerFromShape (const TopoDS_Shape& aShape) const;
//! Iterates through all interactive objects of local context and activates selection modes
//! stored in local status
Standard_EXPORT void RestoreActivatedModes() const;
DEFINE_STANDARD_RTTIEXT(AIS_LocalContext,Standard_Transient)
private:
Standard_EXPORT void Process (const Handle(SelectMgr_SelectableObject)& anObject);
Standard_EXPORT void Process();
Standard_EXPORT void ActivateStandardModes (const Handle(SelectMgr_SelectableObject)& anObject);
Standard_EXPORT void manageDetected (const Handle(SelectMgr_EntityOwner)& thePickOwner, const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate);
//! returns 0 if the detected entity was Not FilterOK...
Standard_Integer DetectedIndex();
Standard_EXPORT void Hilight (const Handle(SelectMgr_EntityOwner)& Own, const Handle(V3d_View)& aview);
Standard_EXPORT void Unhilight (const Handle(SelectMgr_EntityOwner)& Ownr, const Handle(V3d_View)& aview);
Standard_EXPORT void ClearObjects();
Standard_EXPORT void ClearDetected();
Standard_EXPORT Standard_Boolean IsDecompositionOn() const;
Standard_EXPORT Standard_Boolean IsShape (const Standard_Integer anIndex) const;
Standard_EXPORT Standard_Boolean IsValidForSelection (const Handle(AIS_InteractiveObject)& anIObj) const;
Standard_Boolean IsValidIndex (const Standard_Integer anIndex) const;
Standard_EXPORT Standard_Boolean ComesFromDecomposition (const Standard_Integer aPickedIndex) const;
Standard_EXPORT Standard_Boolean HasFilters (const TopAbs_ShapeEnum aType) const;
Handle(AIS_InteractiveContext) myCTX;
Standard_Boolean myLoadDisplayed;
Standard_Boolean myAcceptStdMode;
Standard_Boolean myAcceptErase;
Handle(SelectMgr_SelectionManager) mySM;
Handle(StdSelect_ViewerSelector3d) myMainVS;
Handle(PrsMgr_PresentationManager3d) myMainPM;
Handle(StdSelect_ViewerSelector3d) myCollVS;
AIS_DataMapOfSelStat myActiveObjects;
Handle(SelectMgr_OrFilter) myFilters;
TColStd_ListOfInteger myListOfStandardMode;
Handle(SelectMgr_Filter) myStdFilters[9];
Standard_Boolean myAutoHilight;
Handle(SelectMgr_IndexedMapOfOwner) myMapOfOwner;
Handle(AIS_Selection) mySelection;
Standard_Integer mylastindex;
Standard_Integer mylastgood;
Standard_Integer myCurrentOwner;
TColStd_SequenceOfInteger myDetectedSeq;
Standard_Integer myCurDetected;
Standard_Integer myAISCurDetected;
Handle(Prs3d_Drawer) mySubintStyle;
};
#include <AIS_LocalContext.lxx>
#endif // _AIS_LocalContext_HeaderFile

View File

@ -1,60 +0,0 @@
// Created on: 1997-01-17
// Created by: Robert COUBLANC
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <SelectMgr_AndFilter.hxx>
#include <SelectMgr_OrFilter.hxx>
inline void AIS_LocalContext::SetAutomaticHilight(const Standard_Boolean aStatus)
{myAutoHilight = aStatus;}
inline Standard_Boolean AIS_LocalContext::AutomaticHilight() const
{return myAutoHilight;}
inline const TColStd_ListOfInteger&
AIS_LocalContext::StandardModes() const
{return myListOfStandardMode;}
inline const SelectMgr_ListOfFilter& AIS_LocalContext::ListOfFilter() const
{return myFilters->StoredFilters();}
inline const Handle(SelectMgr_OrFilter)& AIS_LocalContext::Filter() const
{return myFilters;}
inline void AIS_LocalContext::AcceptErase(const Standard_Boolean aStatus)
{myAcceptErase = aStatus;}
inline Standard_Boolean AIS_LocalContext::AcceptErase() const
{return myAcceptErase;}
inline const Handle(StdSelect_ViewerSelector3d)&
AIS_LocalContext::MainSelector() const
{return myMainVS;}
inline Standard_Boolean AIS_LocalContext::HasDetected() const
{return mylastindex!=0;}
inline Standard_Integer AIS_LocalContext::DetectedIndex()
{
return mylastindex;
}
inline Standard_Boolean AIS_LocalContext::HasNextDetected() const
{return myCurDetected<myDetectedSeq.Length();}
inline Standard_Boolean AIS_LocalContext::IsValidIndex(const Standard_Integer indx) const
{ return (indx>0 && indx<=myMapOfOwner->Extent());}

File diff suppressed because it is too large Load Diff

View File

@ -1,111 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <AIS_LocalStatus.hxx>
#include <Standard_Type.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AIS_LocalStatus, Standard_Transient)
AIS_LocalStatus::AIS_LocalStatus (const Standard_Boolean theIsTemporary,
const Standard_Boolean theIsToDecompose,
const Standard_Integer theDisplayMode,
const Standard_Integer theSelectionMode,
const Standard_Integer theHilightMode,
const Standard_Boolean theIsSubIntensity,
const Handle(Prs3d_Drawer)& theStyle)
: myDecomposition (theIsToDecompose),
myIsTemporary (theIsTemporary),
myDMode (theDisplayMode),
myFirstDisplay (Standard_False),
myHMode (theHilightMode),
mySubIntensity (theIsSubIntensity),
myHiStyle (theStyle)
{
if (theSelectionMode != -1)
mySModes.Append (theSelectionMode);
}
//=======================================================================
//function : IsActivated
//purpose :
//=======================================================================
Standard_Boolean AIS_LocalStatus::
IsActivated(const Standard_Integer aSelMode) const
{
TColStd_ListIteratorOfListOfInteger It(mySModes);
for(;It.More();It.Next())
if(It.Value()==aSelMode)
return Standard_True;
return Standard_False;
}
//=======================================================================
//function : RemoveSelectionMode
//purpose :
//=======================================================================
void AIS_LocalStatus::RemoveSelectionMode(const Standard_Integer aMode)
{
TColStd_ListIteratorOfListOfInteger It(mySModes);
for(;It.More();It.Next())
{
if(It.Value()==aMode) {
mySModes.Remove(It);
return;
}
}
}
//=======================================================================
//function : ClearSelectionModes
//purpose :
//=======================================================================
void AIS_LocalStatus::ClearSelectionModes()
{mySModes.Clear();}
//=======================================================================
//function : AddSelectionMode
//purpose :
//=======================================================================
void AIS_LocalStatus::AddSelectionMode(const Standard_Integer aMode)
{
if(IsSelModeIn(aMode)) return;
if(aMode!=-1)
mySModes.Append(aMode);
else
mySModes.Clear();
}
//=======================================================================
//function : IsSelModeIn
//purpose :
//=======================================================================
Standard_Boolean AIS_LocalStatus::IsSelModeIn(const Standard_Integer aMode) const
{
for(TColStd_ListIteratorOfListOfInteger It(mySModes);
It.More();
It.Next()){
if(It.Value()==aMode)
return Standard_True;
}
return Standard_False;
}

View File

@ -1,110 +0,0 @@
// Created on: 1997-01-20
// Created by: Robert COUBLANC
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_LocalStatus_HeaderFile
#define _AIS_LocalStatus_HeaderFile
#include <Prs3d_Drawer.hxx>
#include <Standard_Transient.hxx>
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <TColStd_ListOfInteger.hxx>
DEFINE_STANDARD_HANDLE(AIS_LocalStatus, Standard_Transient)
//! Stored Info about temporary objects.
class AIS_LocalStatus : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(AIS_LocalStatus, Standard_Transient)
public:
Standard_EXPORT AIS_LocalStatus (const Standard_Boolean theIsTemporary = Standard_True,
const Standard_Boolean theIsToDecompose = Standard_False,
const Standard_Integer theDisplayMode = -1,
const Standard_Integer theSelectionMode = -1,
const Standard_Integer theHilightMode = 0,
const Standard_Boolean theIsSubIntensity = 0,
const Handle(Prs3d_Drawer)& theStyle = Handle(Prs3d_Drawer)());
Standard_Boolean Decomposed() const;
Standard_Boolean IsTemporary() const;
Standard_Integer DisplayMode() const;
const TColStd_ListOfInteger& SelectionModes() const;
Standard_EXPORT Standard_Boolean IsActivated (const Standard_Integer aSelMode) const;
Standard_Integer HilightMode() const;
Standard_Boolean IsSubIntensityOn() const;
const Handle(Prs3d_Drawer)& HilightStyle() const
{
return myHiStyle;
}
void SetDecomposition (const Standard_Boolean astatus);
void SetTemporary (const Standard_Boolean astatus);
void SetDisplayMode (const Standard_Integer aMode);
void SetFirstDisplay (const Standard_Boolean aStatus);
Standard_Boolean IsFirstDisplay() const;
Standard_EXPORT void AddSelectionMode (const Standard_Integer aMode);
Standard_EXPORT void RemoveSelectionMode (const Standard_Integer aMode);
Standard_EXPORT void ClearSelectionModes();
Standard_EXPORT Standard_Boolean IsSelModeIn (const Standard_Integer aMode) const;
void SetHilightMode (const Standard_Integer aMode);
void SetHilightStyle (const Handle(Prs3d_Drawer)& theStyle)
{
myHiStyle = theStyle;
}
void SubIntensityOn();
void SubIntensityOff();
void SetPreviousState (const Handle(Standard_Transient)& aStatus);
const Handle(Standard_Transient)& PreviousState() const;
private:
Standard_Boolean myDecomposition;
Standard_Boolean myIsTemporary;
Standard_Integer myDMode;
Standard_Boolean myFirstDisplay;
Standard_Integer myHMode;
TColStd_ListOfInteger mySModes;
Standard_Boolean mySubIntensity;
Handle(Standard_Transient) myPreviousState;
Handle(Prs3d_Drawer) myHiStyle;
};
#include <AIS_LocalStatus.lxx>
#endif // _AIS_LocalStatus_HeaderFile

View File

@ -1,65 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
inline Standard_Boolean AIS_LocalStatus::Decomposed() const
{return myDecomposition;}
inline Standard_Boolean AIS_LocalStatus::IsTemporary() const
{return myIsTemporary;}
inline Standard_Integer AIS_LocalStatus::DisplayMode() const
{return myDMode;}
inline const TColStd_ListOfInteger& AIS_LocalStatus::
SelectionModes() const
{return mySModes;}
inline Standard_Boolean AIS_LocalStatus::IsSubIntensityOn() const
{return mySubIntensity;}
inline void AIS_LocalStatus::SetDecomposition(const Standard_Boolean astatus)
{myDecomposition=astatus;}
inline void AIS_LocalStatus::SetTemporary(const Standard_Boolean astatus)
{myIsTemporary = astatus;}
inline void AIS_LocalStatus::SubIntensityOn()
{mySubIntensity = Standard_True;}
inline void AIS_LocalStatus::SubIntensityOff()
{mySubIntensity = Standard_False;}
inline void AIS_LocalStatus::
SetDisplayMode(const Standard_Integer aMode)
{myDMode = aMode;}
inline void AIS_LocalStatus::SetHilightMode(const Standard_Integer aMode)
{myHMode=aMode;}
inline Standard_Integer AIS_LocalStatus::HilightMode() const
{return myHMode;}
inline void AIS_LocalStatus::SetPreviousState(const Handle(Standard_Transient)& stat)
{ myPreviousState = stat;}
inline const Handle(Standard_Transient)&
AIS_LocalStatus::PreviousState() const
{return myPreviousState;}
inline void AIS_LocalStatus::SetFirstDisplay(const Standard_Boolean aStat)
{myFirstDisplay = aStat;}
inline Standard_Boolean AIS_LocalStatus::IsFirstDisplay() const
{return myFirstDisplay;}

View File

@ -39,11 +39,9 @@ AIS_ConcentricRelation.hxx
AIS_ConnectedInteractive.cxx
AIS_ConnectedInteractive.hxx
AIS_ConnectStatus.hxx
AIS_DataMapIteratorOfDataMapOfILC.hxx
AIS_DataMapIteratorOfDataMapofIntegerListOfinteractive.hxx
AIS_DataMapIteratorOfDataMapOfIOStatus.hxx
AIS_DataMapIteratorOfDataMapOfSelStat.hxx
AIS_DataMapOfILC.hxx
AIS_DataMapofIntegerListOfinteractive.hxx
AIS_DataMapOfIOStatus.hxx
AIS_DataMapOfSelStat.hxx
@ -96,13 +94,6 @@ AIS_Line.cxx
AIS_Line.hxx
AIS_ListIteratorOfListOfInteractive.hxx
AIS_ListOfInteractive.hxx
AIS_LocalContext.cxx
AIS_LocalContext.hxx
AIS_LocalContext.lxx
AIS_LocalContext_1.cxx
AIS_LocalStatus.cxx
AIS_LocalStatus.hxx
AIS_LocalStatus.lxx
AIS_Manipulator.hxx
AIS_Manipulator.cxx
AIS_ManipulatorMode.hxx

View File

@ -710,28 +710,6 @@ static Standard_Integer OCC984 (Draw_Interpretor& di, Standard_Integer argc, co
return 0;
}
static Standard_Integer OCC1786 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
if( argc != 2)
{
di << "Usage : " << argv[0] << " AutoHilight=0/1\n";
return 1;
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if(aContext.IsNull())
{
cerr << "use 'vinit' command before " << argv[0] << "\n";
return 1;
}
Standard_Integer AutoHilightInteger = Draw::Atoi(argv[1]);
Standard_Boolean AutoHilightBoolean = Standard_False;
if (AutoHilightInteger != 0) {
AutoHilightBoolean = Standard_True;
}
aContext->SetAutomaticHilight(AutoHilightBoolean);
return 0;
}
//#include <math.h>
// See QAOCC.cxx OCC6143
//static Standard_Integer OCC1723 (Draw_Interpretor& /*di*/, Standard_Integer argc, const char ** argv)
@ -1076,8 +1054,6 @@ void QABugs::Commands_14(Draw_Interpretor& theCommands) {
theCommands.Add ("OCC983", "OCC983 file", __FILE__, OCC983, group);
theCommands.Add ("OCC984", "OCC984 file", __FILE__, OCC984, group);
theCommands.Add ("OCC1786", "OCC1786 AutoHilight=0/1", __FILE__, OCC1786, group);
// theCommands.Add ("OCC1723", "OCC1723", __FILE__, OCC1723, group);
theCommands.Add ("OCC1919_get", "OCC1919_get", __FILE__, OCC1919_get, group);

View File

@ -243,53 +243,6 @@ static Standard_Integer BUC60970 (Draw_Interpretor& di, Standard_Integer argc, c
return 0;
}
static Standard_Integer BUC60818(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
if(argc!=1)
{
di << "Usage : " << argv[0] << "\n";
return -1;
}
Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
if(myAISContext.IsNull())
{
di << "use 'vinit' command before " << argv[0] << "\n";
return -1;
}
// TRIHEDRON
Handle(AIS_Trihedron) aTrihedron;
Handle(Geom_Axis2Placement) aTrihedronAxis=new Geom_Axis2Placement(gp::XOY());
aTrihedron=new AIS_Trihedron(aTrihedronAxis);
myAISContext->Display (aTrihedron, Standard_True);
Standard_DISABLE_DEPRECATION_WARNINGS
myAISContext->OpenLocalContext();
Standard_ENABLE_DEPRECATION_WARNINGS
myAISContext->Load(aTrihedron,0);
myAISContext->SetAutomaticHilight( Standard_False );
Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
double Xv,Yv;
myV3dView->Project(0,0,0,Xv,Yv);
Standard_Integer Xp,Yp;
myV3dView->Convert(Xv,Yv,Xp,Yp);
myAISContext->MoveTo (Xp,Yp, myV3dView, Standard_False);
myAISContext->MoveTo (Xp,Yp, myV3dView, Standard_True);
if (myAISContext->HasDetected( ))
di << "has detected shape : OK" << "\n";
else di << "has detected shape : bugged - Faulty " << "\n";
myAISContext->SetAutomaticHilight( Standard_True );
return 0;
}
static Standard_Integer BUC60915_1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
if (argc > 1) {
@ -545,64 +498,6 @@ static Standard_Integer OCC280 (Draw_Interpretor& di, Standard_Integer argc, con
return 0;
}
static Standard_Integer OCC232 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
{
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if(aContext.IsNull()) {
di << "use 'vinit' command before " << argv[0] << "\n";
return 1;
}
BRep_Builder builder;
TopoDS_Compound comp;
TopoDS_CompSolid cs1, cs2;
builder.MakeCompound(comp);
builder.MakeCompSolid(cs1);
builder.MakeCompSolid(cs2);
TopoDS_Shape sh1 = BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 0), 100, 100, 100).Shape();
TopoDS_Shape sh2 = BRepPrimAPI_MakeBox(gp_Pnt(100, 0, 0), 100, 100, 100).Shape();
TopoDS_Shape sh3 = BRepPrimAPI_MakeBox(gp_Pnt(200, 0, 0), 100, 100, 100).Shape();
builder.Add(cs1, sh1);
builder.Add(cs1, sh2);
builder.Add(cs1, sh3);
TopoDS_Shape sh4 = BRepPrimAPI_MakeBox(gp_Pnt(0, 500, 0), 100, 100, 100).Shape();
TopoDS_Shape sh5 = BRepPrimAPI_MakeBox(gp_Pnt(100, 500, 0), 100, 100, 100).Shape();
TopoDS_Shape sh6 = BRepPrimAPI_MakeBox(gp_Pnt(200, 500, 0), 100, 100, 100).Shape();
builder.Add(cs2, sh4);
builder.Add(cs2, sh5);
builder.Add(cs2, sh6);
builder.Add(comp, cs1);
builder.Add(comp, cs2);
Handle(AIS_Shape) ais = new AIS_Shape(comp);
aContext->Display (ais, Standard_False);
TopExp_Explorer exp(comp, TopAbs_COMPSOLID);
while(exp.More())
{
//printf("\n TopAbs_COMPSOLID is there \n");
di << "\n TopAbs_COMPSOLID is there \n";
exp.Next();
}
Handle (StdSelect_ShapeTypeFilter) filt = new StdSelect_ShapeTypeFilter(TopAbs_COMPSOLID);
aContext->AddFilter(filt);
Standard_DISABLE_DEPRECATION_WARNINGS
aContext->CloseAllContexts (Standard_False);
aContext->OpenLocalContext();
aContext->ActivateStandardMode(TopAbs_SOLID);
Standard_ENABLE_DEPRECATION_WARNINGS
aContext->UpdateCurrentViewer();
return 0;
}
static Standard_Integer OCC138LC (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
{
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
@ -1669,12 +1564,10 @@ void QABugs::Commands_17(Draw_Interpretor& theCommands) {
theCommands.Add ("BUC60842", "BUC60842", __FILE__, BUC60842, group);
theCommands.Add ("BUC60843", "BUC60843 result_shape name_of_circle name_of_curve [ par1 [ tol ] ]", __FILE__, BUC60843, group);
theCommands.Add ("BUC60970", "BUC60970 shape result", __FILE__, BUC60970, group);
theCommands.Add ("BUC60818", "BUC60818", __FILE__, BUC60818, group);
theCommands.Add ("BUC60915", "BUC60915", __FILE__, BUC60915_1, group);
theCommands.Add ("OCC138", "OCC138", __FILE__, OCC138, group);
theCommands.Add ("OCC353","OCC353",__FILE__,OCC353,group);
theCommands.Add ("OCC280","OCC280 hlr=0/1 setsurfecedetail=0/1; set perspecrive view",__FILE__,OCC280,group);
theCommands.Add ("OCC232", "OCC232", __FILE__, OCC232 , group);
theCommands.Add ("OCC138LC", "OCC138LC", __FILE__, OCC138LC, group);
theCommands.Add ("OCC566", "OCC566 shape [ xmin ymin zmin xmax ymax zmax] ; print bounding box", __FILE__, OCC566, group);
theCommands.Add ("OCC570", "OCC570 result", __FILE__, OCC570, group);

View File

@ -16,7 +16,6 @@
#include <QABugs.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_Shape.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepOffsetAPI_MakePipe.hxx>
@ -3220,103 +3219,6 @@ static Standard_Integer OCC24881 (Draw_Interpretor& di, Standard_Integer narg ,
return 0;
}
//=======================================================================
//function : OCC26172
//purpose :
//=======================================================================
static Standard_Integer OCC26172 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
{
if (theArgNb != 1)
{
std::cerr << "Error: wrong number of arguments! See usage:\n";
theDI.PrintHelp (theArgVec[0]);
return 1;
}
Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
if(anAISContext.IsNull())
{
std::cerr << "Error: no active view. Please call vinit.\n";
return 1;
}
gp_Pnt aStart (100, 100, 100);
gp_Pnt anEnd (300, 400, 600);
BRepBuilderAPI_MakeEdge anEdgeBuilder (aStart, anEnd);
TopoDS_Edge anEdge = anEdgeBuilder.Edge();
Handle(AIS_Shape) aTestAISShape = new AIS_Shape (anEdge);
anAISContext->Display (aTestAISShape, Standard_True);
// 2. activate it in selection modes
TColStd_SequenceOfInteger aModes;
aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_VERTEX));
aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_EDGE));
Standard_DISABLE_DEPRECATION_WARNINGS
anAISContext->OpenLocalContext();
Standard_ENABLE_DEPRECATION_WARNINGS
anAISContext->Deactivate (aTestAISShape);
anAISContext->Load (aTestAISShape, -1, true);
for (Standard_Integer anIt = 1; anIt <= aModes.Length(); ++anIt)
{
anAISContext->Activate (aTestAISShape, aModes (anIt));
}
// select entities in vertex selection mode
Handle(SelectMgr_Selection) aSelection = aTestAISShape->Selection (aModes (1));
Standard_DISABLE_DEPRECATION_WARNINGS
for (aSelection->Init(); aSelection->More(); aSelection->Next())
{
Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
if (anEntity.IsNull())
{
continue;
}
Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId());
if (anOwner.IsNull())
{
continue;
}
anAISContext->LocalContext()->AddOrRemoveSelected (anOwner);
}
Standard_ENABLE_DEPRECATION_WARNINGS
// select entities in edge selection mode
aSelection = aTestAISShape->Selection (aModes (2));
Standard_DISABLE_DEPRECATION_WARNINGS
for (aSelection->Init(); aSelection->More(); aSelection->Next())
{
Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
if (anEntity.IsNull())
{
continue;
}
Handle(SelectMgr_EntityOwner) anOwner =
Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId());
if (anOwner.IsNull())
{
continue;
}
anAISContext->LocalContext()->AddOrRemoveSelected (anOwner);
}
Standard_ENABLE_DEPRECATION_WARNINGS
// deactivate vertex mode and check clearing of outdated selection
anAISContext->Deactivate (aTestAISShape, aModes (1));
Standard_DISABLE_DEPRECATION_WARNINGS
anAISContext->LocalContext()->ClearOutdatedSelection (aTestAISShape, true);
Standard_ENABLE_DEPRECATION_WARNINGS
return 0;
}
//=======================================================================
//function : OCC26284
//purpose :
@ -4775,162 +4677,6 @@ static Standard_Integer OCC26746(
return 0;
}
DEFINE_STANDARD_HANDLE(QABugs_VertexFilter, SelectMgr_Filter)
class QABugs_VertexFilter: public SelectMgr_Filter
{
public:
Standard_EXPORT QABugs_VertexFilter() : SelectMgr_Filter() {}
Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)&) const
{
return Standard_False;
}
};
//=======================================================================
//function : BUC26658
//purpose : Checks selection in the context after using a selection filter
//=======================================================================
static Standard_Integer BUC26658 (Draw_Interpretor& theDI,
Standard_Integer /*theNArg*/,
const char ** theArgVal)
{
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if(aContext.IsNull()) {
theDI << "use 'vinit' command before " << theArgVal[0] << "\n";
return 1;
}
TopoDS_Shape aBoxShape = BRepPrimAPI_MakeBox(20,20,20).Shape();
Handle(AIS_Shape) anAISIO = new AIS_Shape(aBoxShape);
// visualization of the box in the local mode with possibility to
// select box vertices
Standard_DISABLE_DEPRECATION_WARNINGS
aContext->OpenLocalContext();
Standard_ENABLE_DEPRECATION_WARNINGS
int aDispMode = 0;// wireframe
anAISIO->SetDisplayMode(aDispMode);
aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed);
theDI.Eval(" vfit");
aContext->Load(anAISIO, -1, true); /// load allowing decomposition
aContext->Deactivate(anAISIO);
aContext->Activate(anAISIO, AIS_Shape::SelectionMode(TopAbs_VERTEX), false);
aContext->UpdateCurrentViewer();
// select a point on the box
Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
double Xv,Yv;
myV3dView->Project(20,20,0,Xv,Yv);
Standard_Integer Xp,Yp;
myV3dView->Convert(Xv,Yv,Xp,Yp);
aContext->MoveTo (Xp, Yp, myV3dView, Standard_False);
aContext->Select (Standard_False);
bool aHasSelected = false;
for (aContext->InitSelected(); aContext->MoreSelected() && !aHasSelected; aContext->NextSelected()) {
Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
if (!anIO.IsNull()) {
const TopoDS_Shape aShape = aContext->SelectedShape();
if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX)
aHasSelected = true;
}
}
if (aHasSelected)
cout << "has selected vertex : OK" << endl;
else {
theDI << "has selected vertex : bugged - Faulty\n";
return 1;
}
// filter to deny any selection in the viewer
Handle(QABugs_VertexFilter) aFilter = new QABugs_VertexFilter();
aContext->AddFilter(aFilter);
// update previous selection by hand
Standard_DISABLE_DEPRECATION_WARNINGS
aContext->LocalContext()->ClearOutdatedSelection(anAISIO, true);
Standard_ENABLE_DEPRECATION_WARNINGS
// check that there are no selected vertices
aContext->Select (Standard_True);
aHasSelected = false;
for (aContext->InitSelected(); aContext->MoreSelected() && !aHasSelected; aContext->NextSelected()) {
Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
if (!anIO.IsNull()) {
const TopoDS_Shape aShape = aContext->SelectedShape();
if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX)
aHasSelected = true;
}
}
if (!aHasSelected) cout << "has no selected vertex after filter : OK" << endl;
else {
theDI << "has no selected vertex after filter : bugged - Faulty\n";
return 1;
}
return 0;
}
//=======================================================================
//function : OCC26945_open
//purpose : Opens local context and activates given standard selection mode
//=======================================================================
static Standard_Integer OCC26945_open (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
{
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
return 1;
}
if (theArgc < 2)
{
std::cout << "Not enough arguments. See usage:\n";
theDI.PrintHelp (theArgv[0]);
return 1;
}
const TopAbs_ShapeEnum aSelType = AIS_Shape::SelectionType (Draw::Atoi (theArgv[1]));
Standard_DISABLE_DEPRECATION_WARNINGS
Standard_Integer aLocalCtxIdx = aCtx->OpenLocalContext();
aCtx->ActivateStandardMode (aSelType);
Standard_ENABLE_DEPRECATION_WARNINGS
theDI << aLocalCtxIdx;
return 0;
}
//=======================================================================
//function : OCC26945_close
//purpose : Closes local context with the id given
//=======================================================================
static Standard_Integer OCC26945_close (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
{
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
return 1;
}
if (theArgc < 2)
{
std::cout << "Not enough arguments. See usage:\n";
theDI.PrintHelp (theArgv[0]);
return 1;
}
const Standard_Integer aCtxToClose = Draw::Atoi (theArgv[1]);
Standard_DISABLE_DEPRECATION_WARNINGS
aCtx->CloseLocalContext (aCtxToClose);
Standard_ENABLE_DEPRECATION_WARNINGS
return 0;
}
//=======================================================================
//function : OCC27048
//purpose : Calculate value of B-spline surface N times
@ -5098,7 +4844,7 @@ static Standard_Integer OCC27523 (Draw_Interpretor& theDI, Standard_Integer theA
aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_VERTEX));
anAISContext->Deactivate (aTestAISShape);
anAISContext->Load (aTestAISShape, -1, true);
anAISContext->Load (aTestAISShape, -1);
anAISContext->Activate (aTestAISShape, 0);
anAISContext->Deactivate (aTestAISShape, 0);
@ -5446,7 +5192,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
__FILE__, OCC25545, group);
theCommands.Add ("OCC25547", "OCC25547", __FILE__, OCC25547, group);
theCommands.Add ("OCC24881", "OCC24881 shape", __FILE__, OCC24881, group);
theCommands.Add ("OCC26172", "OCC26172", __FILE__, OCC26172, group);
theCommands.Add ("xprojponf", "xprojponf p f", __FILE__, xprojponf, group);
theCommands.Add ("OCC24923", "OCC24923", __FILE__, OCC24923, group);
theCommands.Add ("OCC26139", "OCC26139 [-boxsize value] [-boxgrid value] [-compgrid value]", __FILE__, OCC26139, group);
@ -5477,17 +5222,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
theCommands.Add ("OCC25574", "OCC25574", __FILE__, OCC25574, group);
theCommands.Add ("OCC26746", "OCC26746 torus [toler NbCheckedPoints] ", __FILE__, OCC26746, group);
theCommands.Add ("BUC26658", "BUC26658 unexpected selection in the context using a selection filter", __FILE__, BUC26658, group);
theCommands.Add ("OCC26945_open",
"OCC26945 selectionModeToActivate"
"\n\t\t: Opens a new local context with selectionModeToActivate activated."
"\n\t\t: Prints the ID of newely opened local context in case of success.",
__FILE__, OCC26945_open, group);
theCommands.Add ("OCC26945_close",
"OCC26945 localCtxToClose"
"\n\t\t: Closes local context with the ID localCtxToClose",
__FILE__, OCC26945_close, group);
theCommands.Add ("OCC27048",
"OCC27048 surf U V N\nCalculate value of surface N times in the point (U, V)",
__FILE__, OCC27048, group);

View File

@ -26,6 +26,8 @@
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Graphic3d_ClipPlane.hxx>
#include <ViewerTest.hxx>
#include <AIS_Shape.hxx>
#include <fstream>
@ -64,70 +66,9 @@ static int BUC60623(Draw_Interpretor& di, Standard_Integer argc, const char ** a
return 0;
}
#include<ViewerTest.hxx>
#include<AIS_InteractiveContext.hxx>
#include<AIS_Shape.hxx>
static int BUC60569(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
if(argc!=2)
{
di << "Usage : " << argv[0] << " shape\n";
return -1;
}
Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
if(myAISContext.IsNull()) {
di << "use 'vinit' command before " << argv[0] << "\n";
return -1;
}
TopoDS_Shape theShape = DBRep::Get(argv[1]);
Handle(AIS_Shape) anAISShape = new AIS_Shape( theShape );
myAISContext->Display( anAISShape, Standard_True );
Standard_DISABLE_DEPRECATION_WARNINGS
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode(TopAbs_FACE);
Standard_ENABLE_DEPRECATION_WARNINGS
return 0;
}
static int BUC60614(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
if(argc!=2)
{
di << "Usage : "<< argv[0] << " shape\n";
return -1;
}
// di.Eval("vinit");
TopoDS_Shape theShape = DBRep::Get(argv[1]);
// ViewerTest::GetAISContext();
Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
if(myAISContext.IsNull()) {
di << "use 'vinit' command before " << argv[0] << "\n";
return -1;
}
Handle(AIS_Shape) anAISShape = new AIS_Shape( theShape );
myAISContext->Display( anAISShape, Standard_True );
Standard_DISABLE_DEPRECATION_WARNINGS
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode(TopAbs_COMPOUND);
Standard_ENABLE_DEPRECATION_WARNINGS
// myAISContext->ActivateStandardMode(TopAbs_SOLID);
// di.Eval("vfit");
// cout << "vfini" << endl;
return 0;
}
#include<BRepBuilderAPI_MakeVertex.hxx>
#include<TCollection_ExtendedString.hxx>
#include<AIS_InteractiveContext.hxx>
#include<AIS_LengthDimension.hxx>
static Standard_Integer BUC60632(Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
@ -183,36 +124,6 @@ static Standard_Integer BUC60652(Draw_Interpretor& di, Standard_Integer argc, co
return 0;
}
#include <Geom_Axis2Placement.hxx>
#include <AIS_Trihedron.hxx>
static Standard_Integer BUC60574(Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
{
Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
if(myAISContext.IsNull()) {
di << "use 'vinit' command before " << a[0] << "\n";
return -1;
}
Handle(Geom_Axis2Placement) atrihedronAxis = new Geom_Axis2Placement(gp::XOY());
Handle(AIS_Trihedron) atri = new AIS_Trihedron(atrihedronAxis);
gp_Trsf aTrsf;
gp_Vec trans(5,5,5);
aTrsf.SetTranslation(trans);
TopLoc_Location aLoc(aTrsf);
myAISContext->SetLocation(atri,aLoc);
myAISContext->Display(atri,0,-1,Standard_True, Standard_True);
Standard_DISABLE_DEPRECATION_WARNINGS
myAISContext->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False);
Standard_ENABLE_DEPRECATION_WARNINGS
myAISContext->Load(atri,3,Standard_True);
return 0;
}
#include <TopoDS_Solid.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <BRepPrimAPI_MakeSphere.hxx>
@ -222,110 +133,6 @@ static Standard_Integer BUC60574(Draw_Interpretor& di, Standard_Integer /*n*/, c
#include <V3d_View.hxx>
#include <gce_MakePln.hxx>
#define DEFAULT_COLOR Quantity_NOC_GOLDENROD
//=======================================================================
//function : GetColorFromName
//purpose : get the Quantity_NameOfColor from a string
//=======================================================================
static Quantity_NameOfColor GetColorFromName( const char *name )
{
Quantity_NameOfColor ret = DEFAULT_COLOR;
Standard_Boolean Found = Standard_False;
Standard_CString colstring;
for(Standard_Integer i=0;i<=514 && !Found;i++)
{
colstring = Quantity_Color::StringName(Quantity_NameOfColor(i));
if (!strcasecmp(name,colstring)) {
ret = (Quantity_NameOfColor)i;
Found = Standard_True;
}
}
return ret;
}
static Standard_Integer setcolor (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
{
Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
if(myAISContext.IsNull()) {
di << "use 'vinit' command before " << argv[0] << "\n";
return -1;
}
Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
switch (argc){
case 2:
{
di <<"case 2 : This command will change the background color to " << argv[1]<< "\n";
// setcolor <name>
// Change the background color of the view with a predefined name Graphic3d_NOC_<name>
myV3dView -> SetBackgroundColor(GetColorFromName(argv[1]));
myV3dView -> Redraw();
break;
}
case 3:
{
di <<"case 3 : This command will change the color of the objects to "<< argv[2]<< "\n";
// setcolor <object> <name>
// Change the object color with a predefined name
TopoDS_Shape aShape = DBRep::Get(argv[1]);
Handle(AIS_InteractiveObject) myShape = new AIS_Shape (aShape);
myAISContext->SetColor(myShape,GetColorFromName(argv[2]),Standard_True);
myAISContext->Display(myShape,Standard_True);
myAISContext->UpdateCurrentViewer();
// return 0;
break;
}
case 4:
{
di <<"case 4 : This command will change the background color to <r> <g> <b> :"<< argv[1] << argv[2] << argv[3] << "\n";
// setcolor <r> <g> <b>
// Change the background color of the view with the color values <r>,<g>,<b>
// A color value must be defined in the space [0.,1.]
Standard_Real QuantityOfRed = Draw::Atoi(argv[1]);
Standard_Real QuantityOfGreen = Draw::Atoi(argv[2]);
Standard_Real QuantityOfBlue = Draw::Atoi(argv[3]);
myV3dView->SetBackgroundColor(Quantity_TOC_RGB,QuantityOfRed,QuantityOfGreen,QuantityOfBlue);
myV3dView->Redraw();
break;
}
case 5:
{
di <<"case 5 : This command will change the color of the objects to <r> <g> <b> : "<<argv[2]<< argv[3]<< argv[4]<< "\n";
// setcolor <object> <r> <g> <b>
// change the object color with RGB values.
Standard_Real QuantityOfRed = Draw::Atof(argv[2]);
Standard_Real QuantityOfGreen = Draw::Atof(argv[3]);
Standard_Real QuantityOfBlue = Draw::Atof(argv[4]);
TopoDS_Shape aShape = DBRep::Get(argv[1]);
Handle(AIS_InteractiveObject) myShape = new AIS_Shape (aShape);
myAISContext->SetColor(myShape,Quantity_Color(QuantityOfRed,QuantityOfGreen,QuantityOfBlue,Quantity_TOC_RGB),Standard_True);
myAISContext->Display(myShape,Standard_True);
myAISContext->UpdateCurrentViewer();
// myShape->SetColor(Quantity_Color(QuantityOfRed,QuantityOfGreen,QuantityOfBlue,Quantity_TOC_RGB));
// myShape->Redisplay();
break;
}
}
return 0;
}
#include <Bnd_BoundSortBox.hxx>
#include <BRepBndLib.hxx>
#include <Bnd_HArray1OfBox.hxx>
@ -1446,15 +1253,9 @@ void QABugs::Commands_3(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
theCommands.Add("BUC60623","BUC60623 result Shape1 Shape2",__FILE__,BUC60623,group);
theCommands.Add("BUC60569","BUC60569 shape",__FILE__,BUC60569,group);
theCommands.Add("BUC60614","BUC60614 shape",__FILE__,BUC60614,group);
theCommands.Add("BUC60632","BUC60632 mode length",__FILE__,BUC60632,group);
theCommands.Add("BUC60652","BUC60652 face",__FILE__,BUC60652,group);
theCommands.Add("BUC60574","BUC60574 ",__FILE__,BUC60574,group);
theCommands.Add("GER61351","GER61351 name/object name/r g b/object r g b",__FILE__,setcolor,group);
theCommands.Add("setcolor","setcolor name/object name/r g b/object r g b",__FILE__,setcolor,group);
theCommands.Add("BUC60729","BUC60729",__FILE__,BUC60729,group);
theCommands.Add("BUC60724","BUC60724",__FILE__,BUC60724,group);
theCommands.Add("BUC60727","BUC60727",__FILE__,BUC60727,group);

View File

@ -5,8 +5,6 @@ SelectMgr_BaseFrustum.hxx
SelectMgr_CompositionFilter.cxx
SelectMgr_CompositionFilter.hxx
SelectMgr_CompositionFilter.lxx
SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors.hxx
SelectMgr_DataMapOfObjectSelectors.hxx
SelectMgr_EntityOwner.cxx
SelectMgr_EntityOwner.hxx
SelectMgr_Filter.cxx
@ -41,7 +39,6 @@ SelectMgr_SensitiveEntitySet.hxx
SelectMgr_SequenceOfFilter.hxx
SelectMgr_SequenceOfOwner.hxx
SelectMgr_SequenceOfSelection.hxx
SelectMgr_SequenceOfSelector.hxx
SelectMgr_SOPtr.hxx
SelectMgr_SortCriterion.hxx
SelectMgr_StateOfSelection.hxx

View File

@ -1,20 +0,0 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors_HeaderFile
#define SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors_HeaderFile
#include <SelectMgr_DataMapOfObjectSelectors.hxx>
#endif

View File

@ -1,29 +0,0 @@
// Created on: 1995-02-06
// Created by: Mister rmi
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef SelectMgr_DataMapOfObjectSelectors_HeaderFile
#define SelectMgr_DataMapOfObjectSelectors_HeaderFile
#include <SelectMgr_SelectableObject.hxx>
#include <SelectMgr_SequenceOfSelector.hxx>
#include <TColStd_MapTransientHasher.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject),SelectMgr_SequenceOfSelector,TColStd_MapTransientHasher> SelectMgr_DataMapOfObjectSelectors;
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject),SelectMgr_SequenceOfSelector,TColStd_MapTransientHasher>::Iterator SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors;
#endif

View File

@ -16,93 +16,29 @@
#include <SelectMgr_SelectionManager.hxx>
#include <OSD_Environment.hxx>
#include <SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors.hxx>
#include <SelectMgr_SelectableObject.hxx>
#include <SelectMgr_Selection.hxx>
#include <SelectMgr_SequenceOfSelector.hxx>
#include <SelectMgr_ViewerSelector.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SelectionManager,Standard_Transient)
namespace
{
static bool containsSelector (const SelectMgr_SequenceOfSelector& theSelectorsSeq,
const Handle(SelectMgr_ViewerSelector)& theSelector)
{
for (SelectMgr_SequenceOfSelector::Iterator aSelectorIter (theSelectorsSeq); aSelectorIter.More(); aSelectorIter.Next())
{
if (aSelectorIter.Value() == theSelector)
{
return true;
}
}
return false;
}
}
//==================================================
// Function: Create
// Purpose :
//==================================================
SelectMgr_SelectionManager::SelectMgr_SelectionManager()
SelectMgr_SelectionManager::SelectMgr_SelectionManager (const Handle(SelectMgr_ViewerSelector)& theSelector)
: mySelector (theSelector)
{
//
}
//==================================================
// Function: Add
// Purpose :
//==================================================
void SelectMgr_SelectionManager::Add (const Handle(SelectMgr_ViewerSelector)& theSelector)
{
mySelectors.Add (theSelector);
}
//==================================================
// Function: Remove
// Purpose :
//==================================================
void SelectMgr_SelectionManager::Remove (const Handle(SelectMgr_ViewerSelector)& theSelector)
{
for (SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors aSelIter (myLocal); aSelIter.More(); aSelIter.Next())
{
SelectMgr_SequenceOfSelector& theSelectors = myLocal.ChangeFind (aSelIter.Key());
for (SelectMgr_SequenceOfSelector::Iterator aSelectorIter (theSelectors); aSelectorIter.More(); aSelectorIter.Next())
{
if (aSelectorIter.Value() == theSelector)
{
theSelectors.Remove (aSelectorIter);
break;
}
}
}
mySelectors.Remove (theSelector);
}
//==================================================
// Function: Contains
// Purpose :
//==================================================
Standard_Boolean SelectMgr_SelectionManager::Contains (const Handle(SelectMgr_ViewerSelector)& theSelector) const
{
return mySelectors.Contains (theSelector);
}
//==================================================
// Function: Contains
// Purpose :
//==================================================
Standard_Boolean SelectMgr_SelectionManager::Contains (const Handle(SelectMgr_SelectableObject)& theObject) const
{
return myGlobal.Contains (theObject)
|| myLocal.IsBound (theObject);
return myGlobal.Contains (theObject);
}
//==================================================
@ -124,63 +60,14 @@ void SelectMgr_SelectionManager::Load (const Handle(SelectMgr_SelectableObject)&
return;
myGlobal.Add(theObject);
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
if (!mySelector->Contains (theObject) && theObject->HasOwnPresentations())
{
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.Key();
if (!aSelector->Contains (theObject) && theObject->HasOwnPresentations())
{
aSelector->AddSelectableObject (theObject);
}
mySelector->AddSelectableObject (theObject);
}
if (theMode != -1)
loadMode (theObject, theMode);
}
//==================================================
// Function: Load
// Purpose :
//==================================================
void SelectMgr_SelectionManager::Load (const Handle(SelectMgr_SelectableObject)& theObject,
const Handle(SelectMgr_ViewerSelector)& theSelector,
const Standard_Integer theMode)
{
mySelectors.Add (theSelector);
if (theMode != -1)
{
loadMode (theObject, theMode, theSelector);
}
if (theObject->HasOwnPresentations())
{
theSelector->AddSelectableObject (theObject);
}
if (SelectMgr_SequenceOfSelector* aSelectors = myLocal.ChangeSeek (theObject))
{
if (!containsSelector (*aSelectors, theSelector))
{
aSelectors->Append (theSelector);
}
}
else
{
if (!myGlobal.Contains (theObject))
{
for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
{
Load (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theSelector, theMode);
}
if (!theObject->HasOwnPresentations())
return;
SelectMgr_SequenceOfSelector aGlobSelectors;
aGlobSelectors.Append (theSelector);
myLocal.Bind (theObject, aGlobSelectors);
}
}
}
//==================================================
// Function: Remove
// Purpose :
@ -197,105 +84,34 @@ void SelectMgr_SelectionManager::Remove (const Handle(SelectMgr_SelectableObject
if (myGlobal.Contains (theObject))
{
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
if (mySelector->Contains (theObject))
{
const Handle(SelectMgr_ViewerSelector)& aCurSelector = aSelectorsIter.Key();
if (!aCurSelector->Contains (theObject))
{
continue;
}
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
aCurSelector->RemoveSelectionOfObject (theObject, aSelIter.Value());
mySelector->RemoveSelectionOfObject (theObject, aSelIter.Value());
aSelIter.Value()->UpdateBVHStatus (SelectMgr_TBU_Remove);
}
aCurSelector->RemoveSelectableObject (theObject);
mySelector->RemoveSelectableObject (theObject);
}
myGlobal.Remove (theObject);
}
else if (SelectMgr_SequenceOfSelector* aSelectors = myLocal.ChangeSeek (theObject))
{
for (SelectMgr_SequenceOfSelector::Iterator aSelectorIter (*aSelectors); aSelectorIter.More(); aSelectorIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aCurSelector = aSelectorIter.Value();
if (!aCurSelector->Contains (theObject))
continue;
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
aCurSelector->RemoveSelectionOfObject (theObject, aSelIter.Value());
aSelIter.Value()->UpdateBVHStatus (SelectMgr_TBU_Remove);
}
aCurSelector->RemoveSelectableObject (theObject);
}
myLocal.UnBind (theObject);
}
theObject->ClearSelections();
}
//==================================================
// Function: Remove
// Purpose :
//==================================================
void SelectMgr_SelectionManager::Remove (const Handle(SelectMgr_SelectableObject)& theObject,
const Handle(SelectMgr_ViewerSelector)& theSelector)
{
if (!theSelector->Contains (theObject))
return;
for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
{
Remove (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theSelector);
}
if (!theObject->HasOwnPresentations())
return;
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
theSelector->RemoveSelectionOfObject (theObject, aSelIter.Value());
aSelIter.Value()->UpdateBVHStatus (SelectMgr_TBU_Remove);
}
theSelector->RemoveSelectableObject (theObject);
if (SelectMgr_SequenceOfSelector* aSelectors = myLocal.ChangeSeek (theObject))
{
for (SelectMgr_SequenceOfSelector::Iterator aSelectorIter (*aSelectors); aSelectorIter.More(); aSelectorIter.Next())
{
if (aSelectorIter.Value() == theSelector)
{
aSelectors->Remove (aSelectorIter);
break;
}
}
if (aSelectors->IsEmpty())
{
myLocal.UnBind (theObject);
}
}
}
//==================================================
// Function: Activate
// Purpose :
//==================================================
void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode,
const Handle(SelectMgr_ViewerSelector)& theSelector)
const Standard_Integer theMode)
{
if (theMode == -1)
return;
if (!theSelector.IsNull() && !mySelectors.Contains (theSelector))
return;
for (PrsMgr_ListOfPresentableObjectsIter anChildIter (theObject->Children()); anChildIter.More(); anChildIter.Next())
{
Activate (Handle(SelectMgr_SelectableObject)::DownCast (anChildIter.Value()), theMode, theSelector);
Activate (Handle(SelectMgr_SelectableObject)::DownCast (anChildIter.Value()), theMode);
}
if (!theObject->HasOwnPresentations())
return;
@ -310,26 +126,6 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
loadMode (theObject, theMode);
}
if (theSelector.IsNull())
{
if (myGlobal.Contains (theObject))
{
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aCurSelector = aSelectorsIter.Key();
Activate (theObject, theMode, aCurSelector);
}
}
else if (SelectMgr_SequenceOfSelector* aSelectors = myLocal.ChangeSeek (theObject))
{
for (SelectMgr_SequenceOfSelector::Iterator aSelectorIter (*aSelectors); aSelectorIter.More(); aSelectorIter.Next())
{
Handle(SelectMgr_ViewerSelector) aCurSelector = aSelectorIter.Value();
Activate (theObject, theMode, aCurSelector);
}
}
}
const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode);
switch (aSelection->UpdateStatus())
{
@ -337,7 +133,7 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
{
if (theObject->HasSelection (theMode))
{
theSelector->RemoveSelectionOfObject (theObject, aSelection);
mySelector->RemoveSelectionOfObject (theObject, aSelection);
}
theObject->RecomputePrimitives (theMode);
// pass through SelectMgr_TOU_Partial
@ -346,7 +142,7 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
case SelectMgr_TOU_Partial:
{
theObject->UpdateTransformations (aSelection);
theSelector->RebuildObjectsTree();
mySelector->RebuildObjectsTree();
break;
}
default:
@ -359,14 +155,14 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
case SelectMgr_TBU_Add:
case SelectMgr_TBU_Renew:
{
theSelector->AddSelectionToObject (theObject, aSelection);
mySelector->AddSelectionToObject (theObject, aSelection);
break;
}
case SelectMgr_TBU_Remove:
{
if (aSelection->GetSelectionState() == SelectMgr_SOS_Deactivated)
{
theSelector->AddSelectionToObject (theObject, aSelection);
mySelector->AddSelectionToObject (theObject, aSelection);
}
break;
}
@ -377,18 +173,7 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
if (myGlobal.Contains (theObject))
{
theSelector->Activate (theObject->Selection (theMode));
}
else
{
if (SelectMgr_SequenceOfSelector* aSelectors = myLocal.ChangeSeek (theObject))
{
if (!containsSelector (*aSelectors, theSelector))
{
aSelectors->Append (theSelector);
}
theSelector->Activate (theObject->Selection (theMode));
}
mySelector->Activate (theObject->Selection (theMode));
}
}
@ -397,54 +182,32 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
// Purpose :
//==================================================
void SelectMgr_SelectionManager::Deactivate (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode,
const Handle(SelectMgr_ViewerSelector)& theSelector)
const Standard_Integer theMode)
{
for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
{
Deactivate (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector);
Deactivate (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode);
}
if (!theObject->HasOwnPresentations())
{
return;
}
if (!myGlobal.Contains(theObject)
&& !myLocal.IsBound (theObject))
if (!myGlobal.Contains(theObject))
{
return;
}
const Handle(SelectMgr_Selection)& aSel = theObject->Selection (theMode);
if (!theSelector.IsNull())
if (theMode == -1)
{
if (theMode == -1)
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
theSelector->Deactivate (aSelIter.Value());
}
mySelector->Deactivate (aSelIter.Value());
}
else if (!aSel.IsNull())
{
theSelector->Deactivate (aSel);
}
return;
}
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
else if (!aSel.IsNull())
{
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorIter.Key();
if (theMode == -1)
{
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
aSelector->Deactivate (aSelIter.Value());
}
}
else if (!aSel.IsNull())
{
aSelector->Deactivate (aSel);
}
mySelector->Deactivate (aSel);
}
}
@ -453,29 +216,27 @@ void SelectMgr_SelectionManager::Deactivate (const Handle(SelectMgr_SelectableOb
//purpose :
//=======================================================================
Standard_Boolean SelectMgr_SelectionManager::IsActivated (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode,
const Handle(SelectMgr_ViewerSelector)& theSelector) const
const Standard_Integer theMode) const
{
for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
{
if (IsActivated (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector))
if (IsActivated (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode))
return Standard_True;
}
if (!theObject->HasOwnPresentations())
{
return Standard_False;
}
if (!myGlobal.Contains(theObject)
&& !myLocal.IsBound (theObject))
if (!myGlobal.Contains(theObject))
{
return Standard_False;
}
if (theMode == -1 && theSelector.IsNull())
if (theMode == -1)
{
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
if (IsActivated (theObject, aSelIter.Value()->Mode()))
if (mySelector->Status (aSelIter.Value()) == SelectMgr_SOS_Activated)
{
return Standard_True;
}
@ -488,21 +249,8 @@ Standard_Boolean SelectMgr_SelectionManager::IsActivated (const Handle(SelectMgr
{
return Standard_False;
}
if (!theSelector.IsNull())
{
return theSelector->Status (aSelection) == SelectMgr_SOS_Activated;
}
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorIter.Key();
if (aSelector->Status (aSelection) == SelectMgr_SOS_Activated)
{
return Standard_True;
}
}
return Standard_False;
return !aSelection.IsNull()
&& mySelector->Status (aSelection) == SelectMgr_SOS_Activated;
}
//=======================================================================
@ -512,39 +260,27 @@ Standard_Boolean SelectMgr_SelectionManager::IsActivated (const Handle(SelectMgr
// or it was recomputed somehow
//=======================================================================
void SelectMgr_SelectionManager::ClearSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj,
const Standard_Integer theMode,
const Handle(SelectMgr_ViewerSelector)& theSelector)
const Standard_Integer theMode)
{
for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObj->Children()); anChildrenIter.More(); anChildrenIter.Next())
{
ClearSelectionStructures (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector);
ClearSelectionStructures (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode);
}
if (!theObj->HasOwnPresentations())
{
return;
}
if (!myGlobal.Contains(theObj)
&& !myLocal.IsBound (theObj))
if (!myGlobal.Contains(theObj))
{
return;
}
if (theSelector.IsNull())
{
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.Key();
ClearSelectionStructures (theObj, theMode, aSelector);
}
return;
}
if (theMode != -1)
{
if (const Handle(SelectMgr_Selection)& aSelection = theObj->Selection (theMode))
{
theSelector->RemoveSelectionOfObject (theObj, aSelection);
mySelector->RemoveSelectionOfObject (theObj, aSelection);
aSelection->UpdateBVHStatus (SelectMgr_TBU_Add);
}
}
@ -553,11 +289,11 @@ void SelectMgr_SelectionManager::ClearSelectionStructures (const Handle(SelectMg
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObj->Selections()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
theSelector->RemoveSelectionOfObject (theObj, aSelection);
mySelector->RemoveSelectionOfObject (theObj, aSelection);
aSelection->UpdateBVHStatus (SelectMgr_TBU_Add);
}
}
theSelector->RebuildObjectsTree();
mySelector->RebuildObjectsTree();
}
//=======================================================================
@ -566,38 +302,26 @@ void SelectMgr_SelectionManager::ClearSelectionStructures (const Handle(SelectMg
// defined by mode theMode to all viewer selectors contained that selection.
//=======================================================================
void SelectMgr_SelectionManager::RestoreSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj,
const Standard_Integer theMode,
const Handle(SelectMgr_ViewerSelector)& theSelector)
const Standard_Integer theMode)
{
for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObj->Children()); anChildrenIter.More(); anChildrenIter.Next())
{
RestoreSelectionStructures (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode, theSelector);
RestoreSelectionStructures (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode);
}
if (!theObj->HasOwnPresentations())
{
return;
}
if (!myGlobal.Contains(theObj)
&& !myLocal.IsBound (theObj))
if (!myGlobal.Contains(theObj))
{
return;
}
if (theSelector.IsNull())
{
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.Key();
RestoreSelectionStructures (theObj, theMode, aSelector);
}
return;
}
if (theMode != -1)
{
if (const Handle(SelectMgr_Selection)& aSelection = theObj->Selection (theMode))
{
theSelector->AddSelectionToObject (theObj, aSelection);
mySelector->AddSelectionToObject (theObj, aSelection);
aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
}
}
@ -606,31 +330,11 @@ void SelectMgr_SelectionManager::RestoreSelectionStructures (const Handle(Select
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObj->Selections()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
theSelector->AddSelectionToObject (theObj, aSelection);
mySelector->AddSelectionToObject (theObj, aSelection);
aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
}
}
theSelector->RebuildObjectsTree();
}
//=======================================================================
//function : rebuildSelectionStructures
//purpose : Internal function that marks 1st level BVH of object theObj
// as outdated
//=======================================================================
void SelectMgr_SelectionManager::rebuildSelectionStructures (const Handle(SelectMgr_ViewerSelector)& theSelector)
{
if (!theSelector.IsNull())
{
theSelector->RebuildObjectsTree();
return;
}
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.Key();
rebuildSelectionStructures (aSelector);
}
mySelector->RebuildObjectsTree();
}
//==================================================
@ -643,16 +347,11 @@ void SelectMgr_SelectionManager::recomputeSelectionMode (const Handle(SelectMgr_
{
theSelection->UpdateStatus (SelectMgr_TOU_Full);
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aCurSelector = aSelectorIter.Key();
ClearSelectionStructures (theObject, theMode, aCurSelector);
theObject->RecomputePrimitives (theMode);
RestoreSelectionStructures (theObject, theMode, aCurSelector);
theSelection->UpdateStatus (SelectMgr_TOU_None);
theSelection->UpdateBVHStatus (SelectMgr_TBU_None);
}
ClearSelectionStructures (theObject, theMode);
theObject->RecomputePrimitives (theMode);
RestoreSelectionStructures (theObject, theMode);
theSelection->UpdateStatus (SelectMgr_TOU_None);
theSelection->UpdateBVHStatus (SelectMgr_TBU_None);
}
//==================================================
@ -690,8 +389,7 @@ void SelectMgr_SelectionManager::RecomputeSelection (const Handle(SelectMgr_Sele
{
return;
}
if (!myGlobal.Contains (theObject)
&& !myLocal.IsBound (theObject))
if (!myGlobal.Contains (theObject))
{
return;
}
@ -736,7 +434,7 @@ void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
if (theIsForce)
if (theIsForce || mySelector->Status (aSelection) == SelectMgr_SOS_Activated)
{
switch (aSelection->UpdateStatus())
{
@ -751,7 +449,7 @@ void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject
case SelectMgr_TOU_Partial:
{
theObject->UpdateTransformations (aSelection);
rebuildSelectionStructures();
mySelector->RebuildObjectsTree();
break;
}
default:
@ -760,100 +458,6 @@ void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject
aSelection->UpdateStatus (SelectMgr_TOU_None);
aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
}
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorIter.Key();
Update (theObject, aSelector, Standard_False);
}
}
}
//==================================================
// Function: Update
// Purpose : Attention, it is required to know what is done...
//==================================================
void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject)& theObject,
const Handle(SelectMgr_ViewerSelector)& theSelector,
const Standard_Boolean theIsForce)
{
if (!mySelectors.Contains (theSelector))
{
return;
}
if (!myGlobal.Contains (theObject))
{
const SelectMgr_SequenceOfSelector* aSelectors = myLocal.Seek (theObject);
if (aSelectors == NULL
|| !containsSelector (*aSelectors, theSelector))
{
return;
}
}
for (PrsMgr_ListOfPresentableObjectsIter aChildIter (theObject->Children()); aChildIter.More(); aChildIter.Next())
{
Update (Handle(SelectMgr_SelectableObject)::DownCast (aChildIter.Value()), theSelector, theIsForce);
}
if (!theObject->HasOwnPresentations())
{
return;
}
for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
if (theIsForce)
{
switch (aSelection->UpdateStatus())
{
case SelectMgr_TOU_Full:
{
ClearSelectionStructures (theObject, aSelection->Mode());
theObject->RecomputePrimitives (aSelection->Mode());
RestoreSelectionStructures (theObject, aSelection->Mode());
// pass through SelectMgr_TOU_Partial
}
Standard_FALLTHROUGH
case SelectMgr_TOU_Partial:
{
theObject->UpdateTransformations (aSelection);
rebuildSelectionStructures();
break;
}
default:
break;
}
aSelection->UpdateStatus (SelectMgr_TOU_None);
aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
}
if (theSelector->Status (aSelection) == SelectMgr_SOS_Activated)
{
switch (aSelection->UpdateStatus())
{
case SelectMgr_TOU_Full:
{
ClearSelectionStructures (theObject, aSelection->Mode(), theSelector);
theObject->RecomputePrimitives (aSelection->Mode());
RestoreSelectionStructures (theObject, aSelection->Mode(), theSelector);
// pass through SelectMgr_TOU_Partial
}
Standard_FALLTHROUGH
case SelectMgr_TOU_Partial:
{
theObject->UpdateTransformations (aSelection);
theSelector->RebuildObjectsTree();
break;
}
default:
break;
}
aSelection->UpdateStatus (SelectMgr_TOU_None);
aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
}
}
}
@ -862,8 +466,7 @@ void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject
// Purpose : Private Method
//==================================================
void SelectMgr_SelectionManager::loadMode (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode,
const Handle(SelectMgr_ViewerSelector)& theSelector)
const Standard_Integer theMode)
{
if (theMode == -1)
{
@ -887,29 +490,10 @@ void SelectMgr_SelectionManager::loadMode (const Handle(SelectMgr_SelectableObje
Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode);
theObject->AddSelection (aNewSel, theMode);
if (!theSelector.IsNull())
{
theSelector->AddSelectionToObject (theObject, aNewSel);
aNewSel->UpdateBVHStatus (SelectMgr_TBU_None);
return;
}
if (myGlobal.Contains (theObject))
{
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorIter.Key();
aSelector->AddSelectionToObject (theObject, aNewSel);
aNewSel->UpdateBVHStatus (SelectMgr_TBU_None);
}
}
else if (SelectMgr_SequenceOfSelector* aSelectors = myLocal.ChangeSeek (theObject))
{
for (SelectMgr_SequenceOfSelector::Iterator aSelectorIter (*aSelectors); aSelectorIter.More(); aSelectorIter.Next())
{
aSelectorIter.Value()->AddSelectionToObject (theObject, aNewSel);
aNewSel->UpdateBVHStatus (SelectMgr_TBU_None);
}
mySelector->AddSelectionToObject (theObject, aNewSel);
aNewSel->UpdateBVHStatus (SelectMgr_TBU_None);
}
}
@ -964,29 +548,12 @@ void SelectMgr_SelectionManager::SetSelectionSensitivity (const Handle(SelectMgr
const Standard_Integer aPrevSens = aSel->Sensitivity();
aSel->SetSensitivity (theNewSens);
if (myGlobal.Contains (theObject))
if (myGlobal.Contains (theObject)
&& mySelector->Contains (theObject))
{
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.Key();
if (aSelector->Contains (theObject))
{
aSelector->myTolerances.Decrement (aPrevSens);
aSelector->myTolerances.Add (theNewSens);
aSelector->myToUpdateTolerance = Standard_True;
}
}
}
if (myLocal.IsBound (theObject))
{
const SelectMgr_SequenceOfSelector& aSelectors = myLocal (theObject);
for (SelectMgr_SequenceOfSelector::Iterator aLocalIter (aSelectors); aLocalIter.More(); aLocalIter.Next())
{
Handle(SelectMgr_ViewerSelector)& aCurSel = aLocalIter.ChangeValue();
aCurSel->myTolerances.Decrement (aPrevSens);
aCurSel->myTolerances.Add (theNewSens);
aCurSel->myToUpdateTolerance = Standard_True;
}
mySelector->myTolerances.Decrement (aPrevSens);
mySelector->myTolerances.Add (theNewSens);
mySelector->myToUpdateTolerance = Standard_True;
}
}
@ -996,28 +563,9 @@ void SelectMgr_SelectionManager::SetSelectionSensitivity (const Handle(SelectMgr
//=======================================================================
void SelectMgr_SelectionManager::UpdateSelection (const Handle(SelectMgr_SelectableObject)& theObject)
{
if (myGlobal.Contains (theObject))
if (myGlobal.Contains (theObject)
&& mySelector->Contains (theObject))
{
for (NCollection_Map<Handle(SelectMgr_ViewerSelector)>::Iterator aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{
const Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.Key();
if (aSelector->Contains (theObject))
{
aSelector->MoveSelectableObject (theObject);
}
}
}
if (myLocal.IsBound (theObject))
{
const SelectMgr_SequenceOfSelector& aSelectors = myLocal (theObject);
for (SelectMgr_SequenceOfSelector::Iterator aSelectorsIter (aSelectors); aSelectorsIter.More(); aSelectorsIter.Next())
{
Handle(SelectMgr_ViewerSelector)& aSelector = aSelectorsIter.ChangeValue();
if (aSelector->Contains (theObject))
{
aSelector->MoveSelectableObject (theObject);
}
}
mySelector->MoveSelectableObject (theObject);
}
}

View File

@ -17,10 +17,8 @@
#ifndef _SelectMgr_SelectionManager_HeaderFile
#define _SelectMgr_SelectionManager_HeaderFile
#include <SelectMgr_DataMapOfObjectSelectors.hxx>
#include <SelectMgr_ViewerSelector.hxx>
#include <SelectMgr_TypeOfUpdate.hxx>
#include <TColStd_MapOfTransient.hxx>
class SelectMgr_SelectableObject;
@ -33,16 +31,10 @@ class SelectMgr_SelectionManager : public Standard_Transient
public:
//! Constructs an empty selection manager object.
Standard_EXPORT SelectMgr_SelectionManager();
//! Adds the viewer selector theSelector to the list of known items.
Standard_EXPORT void Add (const Handle(SelectMgr_ViewerSelector)& theSelector);
//! Removes viewer selector theSelector from the list of known items.
Standard_EXPORT void Remove (const Handle(SelectMgr_ViewerSelector)& theSelector);
//! Returns true if the manager contains the viewer selector theSelector in a list of known items.
Standard_EXPORT Standard_Boolean Contains (const Handle(SelectMgr_ViewerSelector)& theSelector) const;
Standard_EXPORT SelectMgr_SelectionManager (const Handle(SelectMgr_ViewerSelector)& theSelector);
//! Return the Selector.
const Handle(SelectMgr_ViewerSelector)& Selector() const { return mySelector; }
//! Returns true if the manager contains the selectable object theObject.
Standard_EXPORT Standard_Boolean Contains (const Handle(SelectMgr_SelectableObject)& theObject) const;
@ -52,50 +44,38 @@ public:
//! the selection will be recalculated.
Standard_EXPORT void Load (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Integer theMode = -1);
//! Loads and computes selection mode theMode (if it is not equal to -1) and adds selectable object to BVH tree.
//! Does not perform check of existence of theObject in global context before addition, but adds theSelector to local context.
Standard_EXPORT void Load (const Handle(SelectMgr_SelectableObject)& theObject, const Handle(SelectMgr_ViewerSelector)& theSelector, const Standard_Integer theMode = -1);
//! Removes selectable object theObject from all viewer selectors it was added to previously, removes it from all contexts
//! and clears all computed selections of theObject.
Standard_EXPORT void Remove (const Handle(SelectMgr_SelectableObject)& theObject);
//! Removes theObject from theSelector, does not clear selections and unbind theObject from context maps.
Standard_EXPORT void Remove (const Handle(SelectMgr_SelectableObject)& theObject, const Handle(SelectMgr_ViewerSelector)& theSelector);
//! Activates the selection mode theMode in the selector theSelector for the selectable object anObject.
//! By default, theMode is equal to 0. If theSelector is set to default (NULL), the selection with the mode theMode
//! will be activated in all the viewers available.
Standard_EXPORT void Activate (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode = 0,
const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
const Standard_Integer theMode = 0);
//! Deactivates mode theMode of theObject in theSelector. If theMode value is set to default (-1), all
//! active selection modes will be deactivated. Likewise, if theSelector value is set to default (NULL), theMode
//! will be deactivated in all viewer selectors.
Standard_EXPORT void Deactivate (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode = -1,
const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
const Standard_Integer theMode = -1);
//! Returns true if the selection with theMode is active for the selectable object theObject and selector theSelector.
//! If all parameters are set to default values, it returns it there is any active selection in any known viewer selector for
//! object theObject.
Standard_EXPORT Standard_Boolean IsActivated (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode = -1,
const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)()) const;
const Standard_Integer theMode = -1) const;
//! Removes sensitive entities from all viewer selectors
//! after method Clear() was called to the selection they belonged to
//! or it was recomputed somehow.
Standard_EXPORT void ClearSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj,
const Standard_Integer theMode = -1,
const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
const Standard_Integer theMode = -1);
//! Re-adds newly calculated sensitive entities of recomputed selection
//! defined by mode theMode to all viewer selectors contained that selection.
Standard_EXPORT void RestoreSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj,
const Standard_Integer theMode = -1,
const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
const Standard_Integer theMode = -1);
//! Recomputes activated selections of theObject for all known viewer selectors according to theMode specified.
//! If theMode is set to default (-1), then all activated selections will be recomputed. If theIsForce is set to true,
@ -105,11 +85,7 @@ public:
//! Updates all selections of theObject in all viewer selectors according to its current update status.
//! If theIsForce is set to true, the call is equal to recomputation.
Standard_EXPORT void Update (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Boolean theIsForce = Standard_True);
//! Updates all selections of theObject in specified viewer selector according to its current update status.
//! If theIsForce is set to true, the call is equal to recomputation.
Standard_EXPORT void Update (const Handle(SelectMgr_SelectableObject)& theObject, const Handle(SelectMgr_ViewerSelector)& theSelector, const Standard_Boolean theIsForce = Standard_True);
//! Sets type of update of all selections of theObject to the given theType.
Standard_EXPORT void SetUpdateMode (const Handle(SelectMgr_SelectableObject)& theObject, const SelectMgr_TypeOfUpdate theType);
@ -139,18 +115,12 @@ private:
//! viewer selector theSelector. If theSelector is set to default value (NULL), the selection mode
//! created will be added to all known viewer selectors.
Standard_EXPORT void loadMode (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode,
const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
//! Internal function that marks 1st level BVH of the object theObj as
//! outdated.
Standard_EXPORT void rebuildSelectionStructures (const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
const Standard_Integer theMode);
private:
NCollection_Map<Handle(SelectMgr_ViewerSelector)> mySelectors;
Handle(SelectMgr_ViewerSelector) mySelector;
NCollection_Map<Handle(SelectMgr_SelectableObject)> myGlobal;
SelectMgr_DataMapOfObjectSelectors myLocal;
};

View File

@ -1,26 +0,0 @@
// Created on: 1995-02-06
// Created by: Mister rmi
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef SelectMgr_SequenceOfSelector_HeaderFile
#define SelectMgr_SequenceOfSelector_HeaderFile
#include <SelectMgr_ViewerSelector.hxx>
#include <NCollection_Sequence.hxx>
typedef NCollection_Sequence<Handle(SelectMgr_ViewerSelector)> SelectMgr_SequenceOfSelector;
#endif

View File

@ -41,7 +41,6 @@
#include <AIS_Relation.hxx>
#include <AIS_TypeFilter.hxx>
#include <AIS_SignatureFilter.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Aspect_InteriorStyle.hxx>
@ -2904,13 +2903,6 @@ static int VDonly2 (Draw_Interpretor& ,
return 1;
}
Standard_DISABLE_DEPRECATION_WARNINGS
if (aCtx->HasOpenedContext())
{
aCtx->CloseLocalContext();
}
Standard_ENABLE_DEPRECATION_WARNINGS
Standard_Integer anArgIter = 1;
for (; anArgIter < theArgNb; ++anArgIter)
{
@ -2992,7 +2984,6 @@ int VRemove (Draw_Interpretor& theDI,
Standard_Boolean isContextOnly = Standard_False;
Standard_Boolean toRemoveAll = Standard_False;
Standard_Boolean toPrintInfo = Standard_True;
Standard_Boolean toRemoveLocal = Standard_False;
Standard_Integer anArgIter = 1;
for (; anArgIter < theArgNb; ++anArgIter)
@ -3011,10 +3002,6 @@ int VRemove (Draw_Interpretor& theDI,
{
toPrintInfo = Standard_False;
}
else if (anArg == "-local")
{
toRemoveLocal = Standard_True;
}
else if (anUpdateTool.parseRedrawMode (anArg))
{
continue;
@ -3031,18 +3018,6 @@ int VRemove (Draw_Interpretor& theDI,
return 1;
}
Standard_DISABLE_DEPRECATION_WARNINGS
if (toRemoveLocal && !aCtx->HasOpenedContext())
{
std::cerr << "Error: local selection context is not open.\n";
return 1;
}
else if (!toRemoveLocal && aCtx->HasOpenedContext())
{
aCtx->CloseAllContexts (Standard_False);
}
Standard_ENABLE_DEPRECATION_WARNINGS
NCollection_List<TCollection_AsciiString> anIONameList;
if (toRemoveAll)
{
@ -3106,17 +3081,6 @@ int VRemove (Draw_Interpretor& theDI,
GetMapOfAIS().UnBind2 (anIter.Value());
}
}
// Close local context if it is empty
TColStd_MapOfTransient aLocalIO;
Standard_DISABLE_DEPRECATION_WARNINGS
if (aCtx->HasOpenedContext()
&& !aCtx->LocalContext()->DisplayedObjects (aLocalIO))
{
aCtx->CloseAllContexts (Standard_False);
}
Standard_ENABLE_DEPRECATION_WARNINGS
return 0;
}
@ -3141,7 +3105,6 @@ int VErase (Draw_Interpretor& theDI,
const Standard_Boolean toEraseAll = TCollection_AsciiString (theArgNb > 0 ? theArgVec[0] : "") == "veraseall";
Standard_Integer anArgIter = 1;
Standard_Boolean toEraseLocal = Standard_False;
Standard_Boolean toEraseInView = Standard_False;
TColStd_SequenceOfAsciiString aNamesOfEraseIO;
for (; anArgIter < theArgNb; ++anArgIter)
@ -3152,10 +3115,6 @@ int VErase (Draw_Interpretor& theDI,
{
continue;
}
else if (anArgCase == "-local")
{
toEraseLocal = Standard_True;
}
else if (anArgCase == "-view"
|| anArgCase == "-inview")
{
@ -3173,18 +3132,6 @@ int VErase (Draw_Interpretor& theDI,
return 1;
}
Standard_DISABLE_DEPRECATION_WARNINGS
if (toEraseLocal && !aCtx->HasOpenedContext())
{
std::cerr << "Error: local selection context is not open.\n";
return 1;
}
else if (!toEraseLocal && aCtx->HasOpenedContext())
{
aCtx->CloseAllContexts (Standard_False);
}
Standard_ENABLE_DEPRECATION_WARNINGS
if (!aNamesOfEraseIO.IsEmpty())
{
// Erase named objects
@ -3215,7 +3162,6 @@ int VErase (Draw_Interpretor& theDI,
else if (!toEraseAll && aCtx->NbSelected() > 0)
{
// Erase selected objects
const Standard_Boolean aHasOpenedContext = aCtx->HasOpenedContext();
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
anIter.More(); anIter.Next())
{
@ -3228,10 +3174,6 @@ int VErase (Draw_Interpretor& theDI,
{
aCtx->SetViewAffinity (anIO, aView, Standard_False);
}
else if (aHasOpenedContext)
{
aCtx->Erase (anIO, Standard_False);
}
}
}
@ -3282,16 +3224,11 @@ static int VDisplayAll (Draw_Interpretor& ,
}
Standard_Integer anArgIter = 1;
Standard_Boolean toDisplayLocal = Standard_False;
for (; anArgIter < theArgNb; ++anArgIter)
{
TCollection_AsciiString anArgCase (theArgVec[anArgIter]);
anArgCase.LowerCase();
if (anArgCase == "-local")
{
toDisplayLocal = Standard_True;
}
else if (anUpdateTool.parseRedrawMode (anArgCase))
if (anUpdateTool.parseRedrawMode (anArgCase))
{
continue;
}
@ -3306,18 +3243,6 @@ static int VDisplayAll (Draw_Interpretor& ,
return 1;
}
Standard_DISABLE_DEPRECATION_WARNINGS
if (toDisplayLocal && !aCtx->HasOpenedContext())
{
std::cerr << "Error: local selection context is not open.\n";
return 1;
}
else if (!toDisplayLocal && aCtx->HasOpenedContext())
{
aCtx->CloseLocalContext (Standard_False);
}
Standard_ENABLE_DEPRECATION_WARNINGS
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
anIter.More(); anIter.Next())
{
@ -4173,7 +4098,6 @@ static int VDisplay2 (Draw_Interpretor& theDI,
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
Standard_Integer isMutable = -1;
Graphic3d_ZLayerId aZLayer = Graphic3d_ZLayerId_UNKNOWN;
Standard_Boolean toDisplayLocal = Standard_False;
Standard_Boolean toReDisplay = Standard_False;
Standard_Integer isSelectable = -1;
Standard_Integer anObjDispMode = -2;
@ -4376,11 +4300,6 @@ static int VDisplay2 (Draw_Interpretor& theDI,
{
toDisplayInView = Standard_True;
}
else if (aNameCase == "-local")
{
aDispStatus = AIS_DS_Temporary;
toDisplayLocal = Standard_True;
}
else if (aNameCase == "-redisplay")
{
toReDisplay = Standard_True;
@ -4402,18 +4321,6 @@ static int VDisplay2 (Draw_Interpretor& theDI,
return 1;
}
// Prepare context for display
Standard_DISABLE_DEPRECATION_WARNINGS
if (toDisplayLocal && !aCtx->HasOpenedContext())
{
aCtx->OpenLocalContext (Standard_False);
}
else if (!toDisplayLocal && aCtx->HasOpenedContext())
{
aCtx->CloseAllContexts (Standard_False);
}
Standard_ENABLE_DEPRECATION_WARNINGS
// Display interactive objects
for (Standard_Integer anIter = 1; anIter <= aNamesOfDisplayIO.Length(); ++anIter)
{
@ -4445,9 +4352,8 @@ static int VDisplay2 (Draw_Interpretor& theDI,
{
aShape->SetHilightMode (anObjHighMode);
}
if (!toDisplayLocal)
GetMapOfAIS().Bind (aShape, aName);
GetMapOfAIS().Bind (aShape, aName);
Standard_Integer aDispMode = aShape->HasDisplayMode()
? aShape->DisplayMode()
: (aShape->AcceptDisplayMode (aCtx->DisplayMode())
@ -4459,9 +4365,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
aSelMode = aShape->GlobalSelectionMode();
}
aCtx->Display (aShape, aDispMode, aSelMode,
Standard_False, aShape->AcceptShapeDecomposition(),
aDispStatus);
aCtx->Display (aShape, aDispMode, aSelMode, Standard_False, aDispStatus);
if (toDisplayInView)
{
for (V3d_ListOfViewIterator aViewIter (aCtx->CurrentViewer()->DefinedViewIterator()); aViewIter.More(); aViewIter.Next())
@ -4538,9 +4442,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
{
aCtx->Erase (aShape, Standard_False);
}
aCtx->Display (aShape, aDispMode, aSelMode,
Standard_False, aShape->AcceptShapeDecomposition(),
aDispStatus);
aCtx->Display (aShape, aDispMode, aSelMode, Standard_False, aDispStatus);
if (toDisplayInView)
{
aCtx->SetViewAffinity (aShape, ViewerTest::CurrentView(), Standard_True);
@ -4580,7 +4482,7 @@ static Standard_Integer VNbDisplayed (Draw_Interpretor& theDi,
}
AIS_ListOfInteractive aListOfIO;
aContextAIS->DisplayedObjects(aListOfIO, false);
aContextAIS->DisplayedObjects (aListOfIO);
theDi << aListOfIO.Extent() << "\n";
return 0;
@ -4842,9 +4744,8 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
if (toPrintEntities)
{
theDI << "Detected entities:\n";
Standard_DISABLE_DEPRECATION_WARNINGS
Handle(StdSelect_ViewerSelector3d) aSelector = aCtx->HasOpenedContext() ? aCtx->LocalSelector() : aCtx->MainSelector();
Standard_ENABLE_DEPRECATION_WARNINGS
Handle(StdSelect_ViewerSelector3d) aSelector = aCtx->MainSelector();
SelectMgr_SelectingVolumeManager aMgr = aSelector->GetManager();
for (Standard_Integer aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter)
{
@ -4894,12 +4795,10 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
}
NCollection_Map<Handle(AIS_InteractiveObject)> aDetected;
Standard_DISABLE_DEPRECATION_WARNINGS
for (aCtx->InitDetected(); aCtx->MoreDetected(); aCtx->NextDetected())
{
aDetected.Add (aCtx->DetectedCurrentObject());
aDetected.Add (Handle(AIS_InteractiveObject)::DownCast (aCtx->DetectedCurrentOwner()->Selectable()));
}
Standard_ENABLE_DEPRECATION_WARNINGS
const Standard_Boolean toShowAll = (theArgNb >= 2 && *theArgVec[1] == '*');
if (theArgNb >= 2
@ -4924,7 +4823,7 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
return 0;
}
if (!aCtx->HasOpenedContext() && aCtx->NbSelected() > 0 && !toShowAll)
if (aCtx->NbSelected() > 0 && !toShowAll)
{
NCollection_DataMap<Handle(SelectMgr_EntityOwner), TopoDS_Shape> anOwnerShapeMap;
for (aCtx->InitSelected(); aCtx->MoreSelected(); aCtx->NextSelected())
@ -4965,10 +4864,6 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
theDI << "\n";
}
printLocalSelectionInfo (aCtx, theDI);
Standard_DISABLE_DEPRECATION_WARNINGS
if (aCtx->HasOpenedContext())
printLocalSelectionInfo (aCtx->LocalContext(), theDI);
Standard_ENABLE_DEPRECATION_WARNINGS
return 0;
}
@ -5777,20 +5672,10 @@ static Standard_Integer VLoadSelection (Draw_Interpretor& /*theDi*/,
// Parse input arguments
TColStd_SequenceOfAsciiString aNamesOfIO;
Standard_Boolean isLocal = Standard_False;
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
const TCollection_AsciiString aName = theArgVec[anArgIter];
TCollection_AsciiString aNameCase = aName;
aNameCase.LowerCase();
if (aNameCase == "-local")
{
isLocal = Standard_True;
}
else
{
aNamesOfIO.Append (aName);
}
const TCollection_AsciiString aName = theArgVec[anArgIter];
aNamesOfIO.Append (aName);
}
if (aNamesOfIO.IsEmpty())
@ -5799,18 +5684,6 @@ static Standard_Integer VLoadSelection (Draw_Interpretor& /*theDi*/,
return 1;
}
// Prepare context
Standard_DISABLE_DEPRECATION_WARNINGS
if (isLocal && !aCtx->HasOpenedContext())
{
aCtx->OpenLocalContext (Standard_False);
}
else if (!isLocal && aCtx->HasOpenedContext())
{
aCtx->CloseAllContexts (Standard_False);
}
Standard_ENABLE_DEPRECATION_WARNINGS
// Load selection of interactive objects
for (Standard_Integer anIter = 1; anIter <= aNamesOfIO.Length(); ++anIter)
{
@ -5829,7 +5702,7 @@ static Standard_Integer VLoadSelection (Draw_Interpretor& /*theDi*/,
GetMapOfAIS().Bind (aShape, aName);
}
aCtx->Load (aShape, -1, Standard_False);
aCtx->Load (aShape, -1);
aCtx->Activate (aShape, aShape->GlobalSelectionMode(), Standard_True);
}
}
@ -5935,17 +5808,13 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
__FILE__,VDonly2,group);
theCommands.Add("vdisplayall",
"vidsplayall [-local]"
"\n\t\t: Displays all erased interactive objects (see vdir and vstate)."
"\n\t\t: Option -local enables displaying of the objects in local"
"\n\t\t: selection context.",
"vdisplayall"
"\n\t\t: Displays all erased interactive objects (see vdir and vstate).",
__FILE__, VDisplayAll, group);
theCommands.Add("veraseall",
"veraseall [-local]"
"\n\t\t: Erases all objects displayed in the viewer."
"\n\t\t: Option -local enables erasing of the objects in local"
"\n\t\t: selection context.",
"veraseall"
"\n\t\t: Erases all objects displayed in the viewer.",
__FILE__, VErase, group);
theCommands.Add("verasetype",
@ -6181,8 +6050,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
theCommands.Add ("vloadselection",
"vloadselection [-context] [name1] ... [nameN] : allows to load selection"
"\n\t\t: primitives for the shapes with names given without displaying them."
"\n\t\t: -local - open local context before selection computation",
"\n\t\t: primitives for the shapes with names given without displaying them.",
__FILE__, VLoadSelection, group);
theCommands.Add("vbsdf", "vbsdf [name] [options]"

View File

@ -4343,7 +4343,6 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/,
}
NCollection_Sequence<TCollection_AsciiString> anObjNames;
Standard_Integer toOpenLocalCtx = -1;
Standard_Integer aSelectionMode = -1;
Standard_Boolean toTurnOn = Standard_True;
AIS_SelectionModesConcurrency aSelModeConcurrency = AIS_SelectionModesConcurrency_GlobalOrLocal;
@ -4351,15 +4350,10 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/,
{
TCollection_AsciiString anArgCase (theArgv[anArgIter]);
anArgCase.LowerCase();
if (toOpenLocalCtx == -1
&& anArgCase == "-local")
{
toOpenLocalCtx = 1;
}
else if (anArgCase == "-set"
|| anArgCase == "-replace"
|| anArgCase == "-single"
|| anArgCase == "-exclusive")
if (anArgCase == "-set"
|| anArgCase == "-replace"
|| anArgCase == "-single"
|| anArgCase == "-exclusive")
{
aSelModeConcurrency = AIS_SelectionModesConcurrency_Single;
}
@ -4428,27 +4422,9 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/,
anAISContext->DisplayedObjects (aTargetIOs);
}
Standard_DISABLE_DEPRECATION_WARNINGS
if (aSelectionMode == 0 && anAISContext->HasOpenedContext())
{
anAISContext->CloseLocalContext();
}
else if (aSelectionMode != 0 && toTurnOn)
{
if (!anAISContext->HasOpenedContext() && toOpenLocalCtx == 1)
{
anAISContext->OpenLocalContext (Standard_False);
}
}
Standard_ENABLE_DEPRECATION_WARNINGS
for (AIS_ListIteratorOfListOfInteractive aTargetIt (aTargetIOs); aTargetIt.More(); aTargetIt.Next())
{
const Handle(AIS_InteractiveObject)& anIO = aTargetIt.Value();
if (toOpenLocalCtx == 1 && toTurnOn && aSelectionMode != 0)
{
anAISContext->Load (anIO, -1, Standard_True);
}
anAISContext->SetSelectionModeActive (anIO, aSelectionMode, toTurnOn, aSelModeConcurrency);
}
return 0;

View File

@ -2278,7 +2278,7 @@ static LRESULT WINAPI AdvViewerWindowProc( HWND hwnd,
{
int aHeight = aRect.bottom - aRect.top;
GetRubberBand()->SetRectangle (X_ButtonPress, aHeight - Y_ButtonPress, X_Motion, aHeight - Y_Motion);
ViewerTest::GetAISContext()->Display (GetRubberBand(), 0, -1, Standard_False, Standard_True, AIS_DS_Displayed);
ViewerTest::GetAISContext()->Display (GetRubberBand(), 0, -1, Standard_False, AIS_DS_Displayed);
toRedraw = true;
}
if (toRedraw)
@ -2702,7 +2702,7 @@ int ViewerMainLoop(Standard_Integer argc, const char** argv)
unsigned int aWidth, aHeight, aBorderWidth, aDepth;
XGetGeometry (aDisplay, aWindow, &aRoot, &anX, &anY, &aWidth, &aHeight, &aBorderWidth, &aDepth);
GetRubberBand()->SetRectangle (X_ButtonPress, aHeight - Y_ButtonPress, X_Motion, aHeight - Y_Motion);
ViewerTest::GetAISContext()->Display (GetRubberBand(), 0, -1, Standard_False, Standard_True, AIS_DS_Displayed);
ViewerTest::GetAISContext()->Display (GetRubberBand(), 0, -1, Standard_False, AIS_DS_Displayed);
ViewerTest::GetAISContext()->CurrentViewer()->RedrawImmediate();
}
else

View File

@ -1,9 +0,0 @@
puts "==========="
puts "BUC26658"
puts "==========="
puts "=================================="
puts "It takes visual check for this BUG"
puts "=================================="
vinit
BUC26658

View File

@ -1,25 +0,0 @@
puts "==========="
puts "BUC60574"
puts "==========="
puts "=================================="
puts "It takes visual check for this BUG"
puts "=================================="
vinit
BUC60574
vselect 220 210
puts ""
set x_coord 205
set y_coord 205
checkcolor $x_coord $y_coord 0.8 0.8 0.8
if {$stat != 1} {
puts "OK: Plane of trihedron was selected properly "
}
## modified colors
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,15 +0,0 @@
puts "================"
puts "BUC60614"
puts "================"
puts "The application crashs when you set the selection mode to compound."
puts ""
box b 10 30 50
compound b c
vinit
BUC60614 c
vmoveto 200 200
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,9 +0,0 @@
puts "==========="
puts "BUC60818"
puts "==========="
vinit
BUC60818
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,97 +0,0 @@
puts "================"
puts "OCC1629"
puts "OCC2707"
puts "================"
puts ""
#######################################################################################
# Viewer is always updated on closing local contexts
#######################################################################################
box b1 10 10 10
box b2 50 50 50 10 10 10
vinit
vdisplay b1 b2
vfit
# box b2
set x1 321
set y1 120
set x2 336
set y2 145
set x3 367
set y3 144
# box b1
set x4 44
set y4 314
set x5 72
set y5 314
set Selection_R 0.8
set Selection_G 0.8
set Selection_B 0.8
#QASetChoiceMode EDGE ON
vselmode 2 1 -local
set BeforeNbSelected [vnbselected]
vselect 0 0 1
vselect ${x1} ${y1} 1
vselect ${x2} ${y2} 1
vselect ${x3} ${y3} 1
vselect ${x4} ${y4} 1
vselect ${x5} ${y5} 1
set AfterNbSelected [vnbselected]
checkcolor ${x1} ${y1} ${Selection_R} ${Selection_G} ${Selection_B}
checkcolor ${x2} ${y2} ${Selection_R} ${Selection_G} ${Selection_B}
checkcolor ${x3} ${y3} ${Selection_R} ${Selection_G} ${Selection_B}
checkcolor ${x4} ${y4} ${Selection_R} ${Selection_G} ${Selection_B}
checkcolor ${x5} ${y5} ${Selection_R} ${Selection_G} ${Selection_B}
if {${BeforeNbSelected} == 0} {
puts "OCC1629: OK (case 6: before selection)"
} else {
puts "OCC1629: Error (case 6: before selection)"
}
if {${AfterNbSelected} == 5} {
puts "OCC1629: OK (case 7: after selection)"
} else {
puts "OCC1629: Error (case 7: after selection)"
}
vselmode 0 1
#
puts "NOTES:"
puts ""
puts "Viewer is not updated on closing local context,"
puts "but we can not check it by automatic test!"
puts ""
puts "5 edges must be selected on the viewer,"
puts "but must be CloseNbSelected = 0 !"
puts ""
#
set CloseNbSelected [vnbselected]
checkcolor ${x1} ${y1} 1 1 0
checkcolor ${x2} ${y2} 1 1 0
checkcolor ${x3} ${y3} 1 1 0
checkcolor ${x4} ${y4} 1 1 0
checkcolor ${x5} ${y5} 1 1 0
if {${CloseNbSelected} == 0} {
puts "OCC1629: OK (case 13: after close local context)"
} else {
puts "OCC1629: Error (case 13: after close local context)"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,71 +0,0 @@
puts "================"
puts "OCC1786"
puts "OCC2707"
puts "================"
#######################################################################################
# AIS_LC::AddOrRemoveSelected(Handle(SelectMgr_EntityOwner), ..) works too slow
#######################################################################################
box b1 10 10 10
box b2 20 20 20 10 10 10
vinit
vdisplay b1 b2
vfit
# box b1
set x11 57 ; set y11 322
set x12 118 ; set y12 322
# box b2
set x21 290 ; set y21 186
set x22 352 ; set y22 186
set Selection_R 0.8
set Selection_G 0.8
set Selection_B 0.8
set Idle_R 1
set Idle_G 1
set Idle_B 0
#QASetChoiceMode EDGE ON
vselmode 2 1
set AutoHilight 0
OCC1786 ${AutoHilight}
set BeforeNbSelected [vnbselected]
checkcolor ${x12} ${y12} ${Idle_R} ${Idle_G} ${Idle_B}
checkcolor ${x21} ${y21} ${Idle_R} ${Idle_G} ${Idle_B}
checkcolor ${x22} ${y22} ${Idle_R} ${Idle_G} ${Idle_B}
if {${BeforeNbSelected} == 0} {
puts "OCC1786: OK (case 4: before selection)"
} else {
puts "OCC1786: Error (case 4: before selection)"
}
# Select edges
vselect 0 0 1
vselect ${x11} ${y11} 1
vselect ${x12} ${y12} 1
vselect ${x21} ${y21} 1
vselect ${x22} ${y22} 1
vselect 0 0 1
set AfterNbSelected [vnbselected]
checkcolor ${x11} ${y11} ${Selection_R} ${Selection_G} ${Selection_B}
checkcolor ${x12} ${y12} ${Selection_R} ${Selection_G} ${Selection_B}
checkcolor ${x21} ${y21} ${Selection_R} ${Selection_G} ${Selection_B}
checkcolor ${x22} ${y22} ${Selection_R} ${Selection_G} ${Selection_B}
if {${AfterNbSelected} == 4} {
puts "OCC1786: OK (case 9: after selection)"
} else {
puts "OCC1786: Error (case 9: after selection)"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,81 +0,0 @@
puts "========"
puts "OCC232"
puts "Pick filter does NOT work for TopAbs_COMPSOLID topology"
puts "========"
vinit
OCC232
vfit
# selected point of first CompSolid
set x1 69
set y1 204
set x2 116
set y2 231
#set x3 160; set y3 257 - it's bad for lin,aki.
set x3 159
set y3 256
# selected point of second CompSolid
set x4 298
set y4 76
set x5 339
set y5 100
set x6 381
set y6 124
set Cyan_R 0
set Cyan_G 1
set Cyan_B 1
set Cyan "$Cyan_R $Cyan_G $Cyan_B"
set Yellow_R 1
set Yellow_G 1
set Yellow_B 0
set Yellow "$Yellow_R $Yellow_G $Yellow_B"
# There is not selection
puts "There is not selection"
set result11 [regexp "$Yellow" [vreadpixel $x1 $y1 rgb]]
set result12 [regexp "$Yellow" [vreadpixel $x2 $y2 rgb]]
set result13 [regexp "$Yellow" [vreadpixel $x3 $y3 rgb]]
set result14 [regexp "$Yellow" [vreadpixel $x4 $y4 rgb]]
set result15 [regexp "$Yellow" [vreadpixel $x5 $y5 rgb]]
set result16 [regexp "$Yellow" [vreadpixel $x6 $y6 rgb]]
# Move a mouse
puts "Move a mouse"
vmoveto $x2 $y2
# Second box of first CompSolid is selected
puts "Second box of first CompSolid is selected"
set result21 [regexp "$Yellow" [vreadpixel $x1 $y1 rgb]]
set result22 [regexp "$Yellow" [vreadpixel $x3 $y3 rgb]]
set result23 [regexp "$Yellow" [vreadpixel $x4 $y4 rgb]]
set result24 [regexp "$Yellow" [vreadpixel $x5 $y5 rgb]]
set result25 [regexp "$Yellow" [vreadpixel $x6 $y6 rgb]]
if { ![checkplatform -windows] } {
set result31 [regexp "$Cyan" [vreadpixel $x2 $y2 rgb]]
if { $result31 == 0 } {
set IsFaulty 1
}
}
set IsFaulty 0
if { !($result11 && $result12 && $result13 && $result14 && $result15 && $result16)
|| !($result21 && $result22 && $result23 && $result24 && $result25) } {
set IsFaulty 1
}
if {$IsFaulty != 0} {
puts "Error : OCC232"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,62 +0,0 @@
puts "============"
puts "OCC24966"
puts "============"
puts ""
####################################################################################
# Problem in local selection mode with selected objects staying in the viewer
# Outdated entity owners remain selected after recompute of presentation in
# local context.
# The following cases are tested:
# o Recompute should not clear per-object selection (neutral selection context).
# o Recompute should clear per-owner selection (local selection context).
####################################################################################
set check_recomputed_x 227
set check_recomputed_y 269
set check_untouched_x 239
set check_untouched_y 309
vinit View1
vpoint p1 100 100 0
vpoint p2 150 150 0
vpoint p3 100 150 0
vplane pln1 p1 p2 p3
veraseall
vdisplay pln1 p1 p2 p3
vselect 0 0 2500 2500
vchangeplane pln1 x=100 y=100 z=200 dx=0.707 dy=0.707 dz=0.707
vfit
checkcolor $check_recomputed_x $check_recomputed_y 0.8 0.8 0.8
if { $stat != 1 } {
puts "Error : Neutral selection of updated object is erased."
}
checkcolor $check_untouched_x $check_untouched_y 0.8 0.8 0.8
if { $stat != 1 } {
puts "Error : Neutral selection of unmodified object is erased."
}
vinit View2
vpoint p4 100 100 0
vpoint p5 150 150 0
vpoint p6 100 150 0
vplane pln2 p4 p5 p6
veraseall
vdisplay -local pln2 p4 p5 p6
vselect 0 0 2500 2500
vchangeplane pln2 x=100 y=100 z=200 dx=0.707 dy=0.707 dz=0.707
vfit
checkcolor $check_recomputed_x $check_recomputed_y 0 1 0
if { $stat != 1 } {
puts "Error : Local (renewed) selection of updated object is not updated."
}
checkcolor $check_untouched_x $check_untouched_y 0.8 0.8 0.8
if { $stat != 1 } {
puts "Error : Local selection of unmodified object is erased."
}
vdump ${imagedir}/${casename}_View1.png
vdump ${imagedir}/${casename}_View2.png

View File

@ -1,23 +0,0 @@
puts "============"
puts "0024966: Visualization - Problem in local selection mode with selected objects staying in the viewer after erase"
puts "Selected entity owners coming from decomposition are not erased in local selection context"
puts "============"
puts ""
pload MODELING VISUALIZATION
vclear
vinit View1
vertex p1 100 100 0
vertex p2 150 300 0
edge e1 p1 p2
vdisplay e1
vselmode e1 2 1 -local
vselmode e1 1 1 -local
vselect 0 0 2500 2500
verase -local
if { "[vreadpixel 261 204 rgb name]" != "BLACK" } { puts "Error : Selection is not erased." }
vdump ${imagedir}/${casename}.png

View File

@ -1,25 +0,0 @@
puts "============"
puts "OCC25528"
puts "============"
puts ""
####################################################################################
# Visualization - Exception on removing an interactive object from
# a local context
# vremove -local <obj_name> crashes if there is an opened local context
####################################################################################
pload ALL
box b 1 2 3
vinit
vdisplay b
vfit
# opening a local context for local selection
vselmode b 4 1 -local
# Select a face just to simulate the scenario used in a real application
vselect 200 200
# This line should not lead to exception
vremove -local b
# Screenshot should be empty (box removed successfully)
vdump ${imagedir}/${casename}.png

View File

@ -1,33 +0,0 @@
puts "============"
puts "CR26076"
puts "============"
puts ""
##########################################################################################
puts "Visualization - empty bounding box of a shape after closing local context"
##########################################################################################
pload VISUALIZATION MODELING
vinit
box b1 1 1 1
box b2 4 5 6
# display box b1 in global context
vdisplay b1
# display box b2 in local context only
vdisplay -local b2
vfit
# display only box b1 by closing local context and erasing box b2
vdonly b1
vfit
# check that selection works properly
vmoveto 100 100
checkcolor 205 205 0 1 1
vdump ${imagedir}/${casename}.png

View File

@ -1,29 +0,0 @@
puts "============"
puts "CR26172"
puts "============"
puts ""
##########################################################################################
puts "Locally selected object stays in the viewer after object deactivation in the local context"
##########################################################################################
set check_x 102
set check_y 333
pload VISUALIZATION MODELING
vinit View1
vclear
vaxo
OCC26172
vfit
# check that the selection is cleared properly
checkcolor $check_x $check_y 0.8 0.8 0.8
if { [checkcolor $check_x $check_y 0.8 0.8 0.8] != 1 } {
puts "Error: selection is cleared incorrectly by AIS_LocalContext::ClearOutdatedSelection()"
}
vdump ${imagedir}/${casename}.png

View File

@ -1,71 +0,0 @@
puts "============"
puts "CR26945"
puts "Visualization - selection does not work after closing one of local contexts in stack"
puts "============"
puts ""
pload VISUALIZATION MODELING QAcommands
vinit
vclear
box b 1 1 1
vdisplay b
vfit
vaspects b -setWidth 2
set edge_x 380
set edge_y 281
set vert_x 379
set vert_y 305
set pick_face_x 250
set pick_face_y 300
set pick_vert_x 380
set pick_vert_y 309
# open local ctx with face selection enabled
OCC26945_open 4
vmoveto $pick_face_x $pick_face_y
if {[vreadpixel $edge_x $edge_y name] != "CYAN1 1"} {
puts "ERROR: Can not select face in local context 1"
}
vmoveto 0 0
# open local ctx with vertex selection enabled
set aVertIdx [OCC26945_open 1]
vmoveto $pick_vert_x $pick_vert_y
if {[vreadpixel $vert_x $vert_y name] != "CYAN1 1"} {
puts "ERROR: Can not select vertex in local context 2"
}
vmoveto 0 0
# open local ctx with edge selection enabled
set anEdgeIdx [OCC26945_open 2]
vmoveto $edge_x $edge_y
if {[vreadpixel $edge_x $edge_y name] != "CYAN1 1"} {
puts "ERROR: Can not select edge in local context 3"
}
vmoveto 0 0
# close local ctx with vertex selection enabled.
# edge selection should be active.
OCC26945_close $aVertIdx
vmoveto $edge_x $edge_y
if {[vreadpixel $edge_x $edge_y name] != "CYAN1 1"} {
puts "ERROR: Can not select edge after closing local context 2"
}
vmoveto 0 0
# close local ctx with edge selection enabled.
# face selection should be active.
OCC26945_close $anEdgeIdx
vmoveto $pick_face_x $pick_face_y
if {[vreadpixel $edge_x $edge_y name] != "CYAN1 1"} {
puts "ERROR: Can not select face after closing local context 3"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,40 +0,0 @@
puts "=================================="
puts "BUC60569"
puts "OCC597"
puts "=================================="
puts "It takes visual check for this BUG"
puts "=================================="
restore [locate_data_file buc60569a.rle] result
tclean result
vinit
checkshape result
BUC60569 result
vfit
vselect 250 190
set x_coord 335
set y_coord 331
checkcolor $x_coord $y_coord 0.8 0.8 0.8
if {$stat != 1} {
puts "Error : The right face is NOT Selected by Select command."
}
vselect 180 350 1
set x_coord 101
set y_coord 347
checkcolor $x_coord $y_coord 0.8 0.8 0.8
if {$stat != 1} {
puts "Error : The left face is NOT Selected by Shift Select command."
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,30 +0,0 @@
puts "=================================="
puts "BUC60569"
puts "OCC597"
puts "=================================="
puts "It takes visual check for this BUG"
puts "=================================="
puts ""
restore [locate_data_file buc60569a.rle] result
tclean result
vinit
vhighlightselected 0
checkshape result
BUC60569 result
vfit
vselect 250 190
vselect 180 350 1
vmoveto 250 190
set x_coord 335
set y_coord 331
checkcolor $x_coord $y_coord 0.8 0.8 0.8
if {$stat != 1} {
puts "Error : The right face is highlighted by Move To command."
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,35 +0,0 @@
puts "=================================="
puts "BUC60569"
puts "OCC597"
puts "=================================="
puts ""
puts "=================================="
puts "It takes visual check for this BUG"
puts "=================================="
puts ""
restore [locate_data_file buc60569a.rle] result
tclean result
vinit
checkshape result
BUC60569 result
vfit
vselect 250 190
vselect 180 350 1
vmoveto 250 190
vmoveto 180 350
set x_coord 101
set y_coord 347
checkcolor $x_coord $y_coord 0 1 1
if {$stat != 1} {
puts "Error : The left face is highlighted by Move To command"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,45 +0,0 @@
puts "=================================="
puts "BUC60569"
puts "OCC597"
puts "=================================="
puts ""
puts "=================================="
puts "It takes visual check for this BUG"
puts "=================================="
puts ""
restore [locate_data_file buc60569a.rle] result
tclean result
vinit
checkshape result
BUC60569 result
vfit
vselect 250 190
vselect 180 350 1
vmoveto 250 190
vmoveto 180 350
vselect 390 390
set x_coord 335
set y_coord 331
checkcolor $x_coord $y_coord 1 1 0
if {$stat != 1} {
puts "Error : The right face is NOT deSelected."
}
set x_coord 101
set y_coord 347
checkcolor $x_coord $y_coord 1 1 0
if {$stat != 1} {
puts "Error : The left face is NOT deSelected"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,48 +0,0 @@
puts "=================================="
puts "BUC60569"
puts "OCC597"
puts "=================================="
puts ""
puts "=================================="
puts "It takes visual check for this BUG"
puts "=================================="
puts ""
restore [locate_data_file buc60569a.rle] result
tclean result
vinit
checkshape result
BUC60569 result
vfit
vselect 250 190
vselect 180 350 1
vmoveto 250 190
vmoveto 180 350
vselect 390 390
vselect 250 190 1
set x_coord 335
set y_coord 331
checkcolor $x_coord $y_coord 0.8 0.8 0.8
if {$stat != 1} {
puts "Error : The right face is NOT Selected by Shift Select command"
}
vselect 180 350 1
set x_coord 101
set y_coord 347
checkcolor $x_coord $y_coord 0.8 0.8 0.8
if {$stat != 1} {
puts "Error : The left face is Selected by Shift Select command"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,38 +0,0 @@
puts "=================================="
puts "BUC60569"
puts "OCC597"
puts "=================================="
puts ""
puts "=================================="
puts "It takes visual check for this BUG"
puts "=================================="
puts ""
restore [locate_data_file buc60569a.rle] result
tclean result
vinit
checkshape result
BUC60569 result
vfit
vselect 250 190
vselect 180 350 1
vmoveto 250 190
vmoveto 180 350
vselect 390 390
vselect 250 190 1
vselect 180 350 1
vmoveto 250 190
set x_coord 335
set y_coord 331
checkcolor $x_coord $y_coord 0 1 1
if {$stat != 1} {
puts "Error : The right face is NOT highlighted by Move To command."
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,40 +0,0 @@
puts "=================================="
puts "BUC60569"
puts "OCC597"
puts "=================================="
puts ""
puts "=================================="
puts "It takes visual check for this BUG"
puts "=================================="
puts ""
restore [locate_data_file buc60569a.rle] result
tclean result
vinit
checkshape result
BUC60569 result
vfit
vselect 250 190
vselect 180 350 1
vmoveto 250 190
vmoveto 180 350
vselect 390 390
vselect 250 190 1
vselect 180 350 1
vmoveto 250 190
vmoveto 180 350
set x_coord 335
set y_coord 331
checkcolor $x_coord $y_coord 0.8 0.8 0.8
if {$stat != 1} {
puts "Error : The right face is NOT highlighted by Move To command."
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,17 +0,0 @@
puts "==============="
puts " GER61351 "
puts "=================================="
puts "CASE 1 :takes visual check "
puts "=================================="
vinit
GER61351 RED2
set x_coord 200
set y_coord 200
if {"[vreadpixel $x_coord $y_coord rgb name]" != "RED2"} {
puts "Error : Background color is NOT RED2."
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,22 +0,0 @@
puts "==============="
puts " GER61351 "
puts " CASE 2 "
puts "==============="
puts ""
puts "=================================="
puts "It takes visual check for this BUG"
puts "=================================="
vinit
GER61351 0 255 0
set x_coord 200
set y_coord 200
#checkcolor $x_coord $y_coord 0 1 0
if {"[vreadpixel $x_coord $y_coord rgb name]" != "GREEN"} {
puts "Error : Background color is NOT 0 1 0."
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,21 +0,0 @@
puts "==============="
puts " GER61351 "
puts "=================================="
puts "CASE 3 :takes visual check "
puts "=================================="
vinit
box b 10 20 30
GER61351 b RED2
vfit
set x_coord 89
set y_coord 363
checkcolor $x_coord $y_coord 0.93 0 0
if {$stat != 1} {
puts "Error : Box color is NOT RED2."
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,29 +0,0 @@
puts "TODO OCC12345 ALL: An exception was caught"
puts "TODO OCC12345 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO OCC12345 ALL: TEST INCOMPLETE"
puts "==============="
puts " GER61351 "
puts " CASE 4 "
puts "==============="
puts ""
puts "=================================="
puts "It takes visual check for this BUG"
puts "=================================="
vinit
box b 30 20 10
GER61351 b 0 0 255
vfit
set x_coord 89
set y_coord 363
checkcolor $x_coord $y_coord 0 1 1
if {$stat != 1} {
puts "Error : Box color is NOT 0 0 1"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,29 +0,0 @@
puts "TODO OCC12345 ALL: An exception was caught"
puts "TODO OCC12345 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO OCC12345 ALL: TEST INCOMPLETE"
puts "==============="
puts " GER61351 "
puts " CASE 5 "
puts "==============="
puts ""
puts "=================================="
puts "It takes visual check for this BUG"
puts "=================================="
vinit
box b 20 10 30
GER61351 b 0 255 255
vfit
set x_coord 89
set y_coord 363
checkcolor $x_coord $y_coord 0 1 1
if {$stat != 1} {
puts "Error : Box color is NOT 0 1 1"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,21 +0,0 @@
puts "==============="
puts " GER61351 "
puts "============================"
puts "CASE 6 takes visual check "
puts "============================"
vinit
box b 20 10 30
GER61351 b CYAN3
vfit
set x_coord 88
set y_coord 316
checkcolor $x_coord $y_coord 0 0.8 0.8
if {$stat != 1} {
puts "Error : Box color is NOT CYAN3"
}
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -17,9 +17,6 @@
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <AIS_ListOfInteractive.hxx>
#if OCC_VERSION_HEX < 0x060901
#include <AIS_LocalContext.hxx>
#endif
#include <AIS_Selection.hxx>
#include <AIS_Shape.hxx>
#include <AIS_Trihedron.hxx>
@ -237,23 +234,11 @@ void VInspector_Tools::AddOrRemoveSelectedShapes (const Handle(AIS_InteractiveCo
theContext->UnhilightSelected(Standard_False);
//TODO: processing in local context only
#if OCC_VERSION_HEX < 0x060901
Handle(AIS_LocalContext) aLContext = theContext->LocalContext();
TCollection_AsciiString aSelectionName = aLContext->SelectionName();
aLContext->UnhilightPicked(Standard_False);
#endif
for (NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt(theOwners);
anOwnersIt.More(); anOwnersIt.Next())
{
Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
#if OCC_VERSION_HEX > 0x060901
theContext->AddOrRemoveSelected (anOwner, Standard_False);
#else
AIS_Selection::Selection(aSelectionName.ToCString())->Select(anOwner);
anOwner->SetSelected(Standard_True);
#endif
}
theContext->UpdateCurrentViewer();
}

View File

@ -356,7 +356,7 @@ bool VInspector_Window::OpenFile(const TCollection_AsciiString& theFileName)
Handle(AIS_Shape) aPresentation = new AIS_Shape (aShape);
aContext->Display (aPresentation, false);
aContext->Load (aPresentation, -1/*selection mode*/, true);
aContext->Load (aPresentation, -1/*selection mode*/);
aContext->UpdateCurrentViewer();
UpdateTreeModel();
@ -576,7 +576,7 @@ void VInspector_Window::displaySelectedPresentations(const bool theToDisplay)
if (theToDisplay)
{
aContext->Display(aPresentation, false);
aContext->Load(aPresentation, -1, true);
aContext->Load(aPresentation, -1);
}
else
aContext->Erase(aPresentation, false);