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.
* 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.
+
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);
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. ;
+++ /dev/null
-// 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
+++ /dev/null
-// 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
#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
#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>
//=======================================================================
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()),
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();
{
// 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())
//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);
- }
}
//=======================================================================
//=======================================================================
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);
}
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);
}
//=======================================================================
const Standard_Integer theDispMode,
const Standard_Integer theSelectionMode,
const Standard_Boolean theToUpdateViewer,
- const Standard_Boolean theToAllowDecomposition,
const AIS_DisplayStatus theDispStatus)
{
if (theIObj.IsNull())
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);
}
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);
{
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.
{
if (!aStatus->IsSModeIn (theSelectionMode))
aStatus->AddSelectionMode (theSelectionMode);
- mgrSelector->Activate (theIObj, theSelectionMode, myMainSel);
+ mgrSelector->Activate (theIObj, theSelectionMode);
}
}
}
//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())
{
}
setContextToObject (theIObj);
- if (HasOpenedContext())
- {
- myLocalContexts (myCurLocalIndex)->Load (theIObj, theToAllowDecomposition, theSelMode);
- return;
- }
-
if (!myObjects.IsBound (theIObj))
{
Standard_Integer aDispMode, aHiMod, aSelModeDef;
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();
//=======================================================================
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)
//=======================================================================
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();
//=======================================================================
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());
//=======================================================================
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()))
{
}
}
-//=======================================================================
-//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 :
{
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;
}
//=======================================================================
}
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);
}
}
}
-//=======================================================================
-//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 :
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)
void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIObj, const Standard_Boolean updateviewer)
{
if(anIObj.IsNull()) return;
+ if(!myObjects.IsBound(anIObj)) return;
- if (!HasOpenedContext())
- {
- if(!myObjects.IsBound(anIObj)) return;
-
- const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
- aStatus->SetHilightStatus (Standard_False);
- aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
+ 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
+ if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
- myLocalContexts(myCurLocalIndex)->Unhilight(anIObj);
+ unhighlightGlobal (anIObj);
}
+
if(updateviewer) myMainVwr->Update();
}
//=======================================================================
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();
}
//=======================================================================
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;
}
//=======================================================================
//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;
}
//=======================================================================
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;
}
//=======================================================================
{
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()
}
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);
}
}
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();
}
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;
}
TColStd_ListIteratorOfListOfInteger aModesIter (aModes);
for (; aModesIter.More(); aModesIter.Next())
{
- mgrSelector->Activate (theIO, aModesIter.Value(), myMainSel);
+ mgrSelector->Activate (theIO, aModesIter.Value());
}
}
mgrSelector->Update(theIObj);
- for (Standard_Integer aContextIdx = 1; aContextIdx <= myLocalContexts.Extent(); aContextIdx++)
- {
- myLocalContexts (aContextIdx)->ClearOutdatedSelection (theIObj, Standard_False);
- }
-
if (theUpdateViewer)
{
- if (!myObjects.IsBound (theIObj))
- {
- return;
- }
-
- switch (myObjects (theIObj)->GraphicStatus())
+ const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
+ if (aStatus != NULL
+ && (*aStatus)->GraphicStatus() == AIS_DS_Displayed)
{
- case AIS_DS_Displayed:
- case AIS_DS_Temporary:
- myMainVwr->Update();
- break;
- default:
- break;
+ myMainVwr->Update();
}
}
}
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
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())
{
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;
}
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);
//=======================================================================
void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecision)
{
- if (HasOpenedContext())
- {
- myLocalContexts (myCurLocalIndex)->SetPixelTolerance (thePrecision);
- }
- else
- {
- myMainSel->SetPixelTolerance (thePrecision);
- }
+ myMainSel->SetPixelTolerance (thePrecision);
}
//=======================================================================
//=======================================================================
Standard_Integer AIS_InteractiveContext::PixelTolerance() const
{
- return HasOpenedContext()
- ? myLocalContexts (myCurLocalIndex)->PixelTolerance()
- : myMainSel->PixelTolerance();
+ return myMainSel->PixelTolerance();
}
//=======================================================================
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);
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());
#ifndef _AIS_InteractiveContext_HeaderFile
#define _AIS_InteractiveContext_HeaderFile
-#include <AIS_DataMapOfILC.hxx>
#include <AIS_DataMapOfIOStatus.hxx>
#include <AIS_DisplayMode.hxx>
#include <AIS_DisplayStatus.hxx>
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;
//! 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
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().
//! 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,
//! 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()
//! 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.
//! 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!
//! 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().
//! 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
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
//! 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.
//! 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.
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.
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;
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;
};
#include <AIS_GlobalStatus.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_InteractiveObject.hxx>
-#include <AIS_LocalContext.hxx>
#include <AIS_MapIteratorOfMapOfInteractive.hxx>
#include <AIS_MapOfInteractive.hxx>
#include <AIS_Selection.hxx>
throw Standard_ProgramError ("AIS_InteractiveContext::MoveTo() - invalid argument");
}
- if (HasOpenedContext())
- {
- myWasLastMain = Standard_True;
- return myLocalContexts (myCurLocalIndex)->MoveTo (theXPix, theYPix, theView, theToRedrawOnUpdate);
- }
-
myCurDetected = 0;
myCurHighlighted = 0;
myDetectedSeq.Clear();
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::AddSelect (const Handle(SelectMgr_EntityOwner)& theObject)
{
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->AddSelect (theObject);
- }
mySelection->AddSelect (theObject);
Standard_Integer aSelNum = NbSelected();
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
-
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->Select (theXPMin, theYPMin,
- theXPMax, theYPMax,
- theView, toUpdateViewer);
- }
-
ClearSelected (Standard_False);
-
myWasLastMain = Standard_True;
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
aCurOwner->SetSelected (Standard_True);
}
- HilightSelected (toUpdateViewer);
+ if (myAutoHilight)
+ {
+ HilightSelected (toUpdateViewer);
+ }
Standard_Integer aSelNum = NbSelected();
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
-
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->Select (thePolyline, theView, toUpdateViewer);
- }
-
ClearSelected (Standard_False);
-
myWasLastMain = Standard_True;
myMainSel->Pick (thePolyline, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
anOwner->SetSelected (Standard_True);
}
- HilightSelected (toUpdateViewer);
+ if (myAutoHilight)
+ {
+ HilightSelected (toUpdateViewer);
+ }
Standard_Integer aSelNum = NbSelected();
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdateViewer)
{
- if (HasOpenedContext())
+ if (myAutoHilight)
{
- if(myWasLastMain)
- {
- return myLocalContexts(myCurLocalIndex)->Select (toUpdateViewer);
- }
- else
- {
- myLocalContexts(myCurLocalIndex)->SetSelected (Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable()), toUpdateViewer);
- return AIS_SOP_OneSelected;
- }
+ clearDynamicHighlight();
}
-
- clearDynamicHighlight();
if (myWasLastMain && !myLastinMain.IsNull())
{
if (!myLastinMain->IsSelected()
}
else
{
- unhighlightSelected (Standard_True);
+ if (myAutoHilight)
+ {
+ unhighlightSelected (Standard_True);
+ }
mySelection->Clear();
if (toUpdateViewer && myWasLastMain)
//=======================================================================
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Boolean toUpdateViewer)
{
- if (HasOpenedContext())
+ if (myAutoHilight)
{
- if(myWasLastMain)
- {
- return myLocalContexts (myCurLocalIndex)->ShiftSelect (toUpdateViewer);
- }
- else
- {
- myLocalContexts (myCurLocalIndex)->AddOrRemoveSelected (myLastPicked, toUpdateViewer);
-
- Standard_Integer aSelNum = NbSelected();
- return (aSelNum == 0) ? AIS_SOP_NothingSelected
- : (aSelNum == 1) ? AIS_SOP_OneSelected
- : AIS_SOP_SeveralSelected;
- }
+ clearDynamicHighlight();
}
-
- clearDynamicHighlight();
if (myWasLastMain && !myLastinMain.IsNull())
{
AddOrRemoveSelected (myLastinMain, toUpdateViewer);
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
}
- if (HasOpenedContext())
+ if (myAutoHilight)
{
- return myLocalContexts(myCurLocalIndex)->ShiftSelect (theXPMin, theYPMin, theXPMax, theYPMax,
- theView, toUpdateViewer);
+ UnhilightSelected (Standard_False);
}
-
- UnhilightSelected (Standard_False);
-
myWasLastMain = Standard_True;
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
anOwner->SetSelected (aSelStatus == AIS_SS_Added);
}
- HilightSelected (toUpdateViewer);
+ if (myAutoHilight)
+ {
+ HilightSelected (toUpdateViewer);
+ }
Standard_Integer aSelNum = NbSelected();
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
}
- if (HasOpenedContext())
+ if (myAutoHilight)
{
- return myLocalContexts(myCurLocalIndex)->ShiftSelect (thePolyline, theView, toUpdateViewer);
+ UnhilightSelected (Standard_False);
}
-
- UnhilightSelected (Standard_False);
-
myWasLastMain = Standard_True;
myMainSel->Pick (thePolyline, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
anOwner->SetSelected (aSelStatus == AIS_SS_Added);
}
- HilightSelected (toUpdateViewer);
+ if (myAutoHilight)
+ {
+ HilightSelected (toUpdateViewer);
+ }
Standard_Integer aSelNum = NbSelected();
: AIS_SOP_SeveralSelected;
}
-//=======================================================================
-//function : SetCurrentObject
-//purpose : OBSOLETE, please use SetSelected() instead
-//TODO : Remove in process of local context deletion
-//=======================================================================
-void AIS_InteractiveContext::SetCurrentObject (const Handle(AIS_InteractiveObject)& theObject,
- const Standard_Boolean theToUpdateViewer)
-{
- if (HasOpenedContext())
- return;
-
- SetSelected (theObject, theToUpdateViewer);
-}
-
-//=======================================================================
-//function : AddOrRemoveCurrentObject
-//purpose : OBSOLETE, please use AddOrRemoveSelected() instead
-//TODO : Remove in process of local context deletion
-//=======================================================================
-void AIS_InteractiveContext::AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
- const Standard_Boolean theIsToUpdateViewer)
-{
- if (HasOpenedContext())
- return;
-
- AddOrRemoveSelected (theObj, theIsToUpdateViewer);
-}
-//=======================================================================
-//function : UpdateCurrent
-//purpose : OBSOLETE, please use UpdateSelected() instead
-//TODO : Remove in process of local context deletion
-//=======================================================================
-void AIS_InteractiveContext::UpdateCurrent()
-{
- UpdateSelected (Standard_True);
-}
-
-//=======================================================================
-//function : IsCurrent
-//purpose : OBSOLETE, please use IsSelected() instead
-//TODO : Remove in process of local context deletion
-//=======================================================================
-Standard_Boolean AIS_InteractiveContext::IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const
-{
- return IsSelected (theObject);
-}
-
-//=======================================================================
-//function : InitCurrent
-//purpose : OBSOLETE, please use InitSelected() instead
-//TODO : Remove in process of local context deletion
-//=======================================================================
-void AIS_InteractiveContext::InitCurrent()
-{
- if (HasOpenedContext())
- return;
-
- InitSelected();
-}
-
-//=======================================================================
-//function : MoreCurrent
-//purpose : OBSOLETE, please use MoreSelected() instead
-//TODO : Remove in process of local context deletion
-//=======================================================================
-Standard_Boolean AIS_InteractiveContext::MoreCurrent() const
-{
- return !HasOpenedContext() && MoreSelected();
-}
-
-//=======================================================================
-//function : NextCurrent
-//purpose : OBSOLETE, please use NextSelected() instead
-//TODO : Remove in process of local context deletion
-//=======================================================================
-void AIS_InteractiveContext::NextCurrent()
-{
- if (HasOpenedContext())
- return;
-
- NextSelected();
-}
-
-//=======================================================================
-//function : Current
-//purpose : OBSOLETE, please use SelectedInteractive() instead
-//TODO : Remove in process of local context deletion
-//=======================================================================
-Handle(AIS_InteractiveObject) AIS_InteractiveContext::Current() const
-{
- return HasOpenedContext() ? NULL : SelectedInteractive();
-}
-
-//=======================================================================
-//function : NbCurrents
-//purpose : OBSOLETE, please use NbSelected() instead
-//TODO : Remove in process of local context deletion
-//=======================================================================
-Standard_Integer AIS_InteractiveContext::NbCurrents()
-{
- return HasOpenedContext() ? -1 : NbSelected();
-}
-
-//=======================================================================
-//function : HilightCurrents
-//purpose : OBSOLETE, please use HilightSelected() instead
-//TODO : Remove in process of local context deletion
-//=======================================================================
-void AIS_InteractiveContext::HilightCurrents (const Standard_Boolean theToUpdateViewer)
-{
- if (HasOpenedContext())
- return;
-
- HilightSelected (theToUpdateViewer);
-}
-
-//=======================================================================
-//function : UnhilightCurrents
-//purpose : OBSOLETE, please use UnhilightSelected() instead
-//TODO : Remove in process of local context deletion
-//=======================================================================
-void AIS_InteractiveContext::UnhilightCurrents (const Standard_Boolean theToUpdateViewer)
-{
- if (HasOpenedContext())
- return;
-
- UnhilightSelected (theToUpdateViewer);
-}
-
-//=======================================================================
-//function : ClearCurrents
-//purpose : OBSOLETE, please use ClearCurrents() instead
-//TODO : Remove in process of local context deletion
-//=======================================================================
-void AIS_InteractiveContext::ClearCurrents(const Standard_Boolean theToUpdateViewer)
-{
- if (HasOpenedContext())
- return;
-
- ClearSelected (theToUpdateViewer);
-}
-
-
//=======================================================================
//function : HilightSelected
//purpose :
//=======================================================================
void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdateViewer)
{
- if (HasOpenedContext())
- {
- return myLocalContexts (myCurLocalIndex)->HilightPicked (theToUpdateViewer);
- }
-
// In case of selection without using local context
clearDynamicHighlight();
AIS_MapOfObjSelectedOwners anObjOwnerMap;
//=======================================================================
void AIS_InteractiveContext::UnhilightSelected (const Standard_Boolean theToUpdateViewer)
{
- if (HasOpenedContext())
- {
- return myLocalContexts (myCurLocalIndex)->UnhilightPicked (theToUpdateViewer);
- }
-
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
//=======================================================================
void AIS_InteractiveContext::ClearSelected (const Standard_Boolean theToUpdateViewer)
{
- if (HasOpenedContext())
- return myLocalContexts (myCurLocalIndex)->ClearSelected (theToUpdateViewer);
-
if (NbSelected() == 0)
return;
- unhighlightSelected();
+ if (myAutoHilight)
+ {
+ unhighlightSelected();
+ }
mySelection->Clear();
- clearDynamicHighlight();
-
- if (theToUpdateViewer)
- UpdateCurrentViewer();
-}
-
-//=======================================================================
-//function : UpdateSelected
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::UpdateSelected (const Standard_Boolean theToUpdateViewer)
-{
- if (HasOpenedContext())
+ if (myAutoHilight)
{
- return myLocalContexts(myCurLocalIndex)->UpdateSelected (theToUpdateViewer);
+ clearDynamicHighlight();
}
- HilightSelected (theToUpdateViewer);
+ if (theToUpdateViewer)
+ UpdateCurrentViewer();
}
//=======================================================================
void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& theObject,
const Standard_Boolean theToUpdateViewer)
{
- if (HasOpenedContext())
- {
- return myLocalContexts (myCurLocalIndex)->SetSelected (theObject, theToUpdateViewer);
- }
-
if (theObject.IsNull())
{
return;
}
const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (theObject, anOwner);
- if (NbSelected() == 1 && myObjects (theObject)->IsHilighted())
+ if (NbSelected() == 1 && myObjects (theObject)->IsHilighted() && myAutoHilight)
{
Handle(Prs3d_Drawer) aCustomStyle;
if (HighlightStyle (theObject, aCustomStyle))
}
Handle(AIS_InteractiveObject) aSelectable = Handle(AIS_InteractiveObject)::DownCast (aSelOwner->Selectable());
- Unhilight (aSelectable, Standard_False);
+ if (myAutoHilight)
+ {
+ Unhilight (aSelectable, Standard_False);
+ }
aSelOwner->SetSelected (Standard_False);
if (aSelOwner == aSelectable->GlobalSelOwner())
{
// added to avoid untimely viewer update...
mySelection->ClearAndSelect (anOwner);
- Handle(Prs3d_Drawer) aCustomStyle;
- if (HighlightStyle (theObject, aCustomStyle))
+ if (myAutoHilight)
{
- if (!aCustomStyle.IsNull() && anObjSelStyle != aCustomStyle)
+ Handle(Prs3d_Drawer) aCustomStyle;
+ if (HighlightStyle (theObject, aCustomStyle))
+ {
+ if (!aCustomStyle.IsNull() && anObjSelStyle != aCustomStyle)
+ {
+ HilightWithColor (theObject, anObjSelStyle, Standard_False);
+ }
+ }
+ else
{
HilightWithColor (theObject, anObjSelStyle, Standard_False);
}
}
- else
- {
- HilightWithColor (theObject, anObjSelStyle, Standard_False);
- }
anOwner->SetSelected (Standard_True);
if (theToUpdateViewer)
if (NbSelected() == 1 && theOwner->IsSelected() && !theOwner->IsForcedHilight())
{
Handle(Prs3d_Drawer) aCustomStyle;
- if (HighlightStyle (theOwner, aCustomStyle))
+ if (myAutoHilight && HighlightStyle (theOwner, aCustomStyle))
{
if (!aCustomStyle.IsNull() && anObjSelStyle != aCustomStyle)
{
if (!myObjects.IsBound (anObject))
Display (anObject, Standard_False);
- unhighlightSelected();
+ if (myAutoHilight)
+ {
+ unhighlightSelected();
+ }
mySelection->ClearAndSelect (theOwner);
- Handle(Prs3d_Drawer) aCustomStyle;
- if (!HighlightStyle (theOwner, aCustomStyle) ||
- (!aCustomStyle.IsNull() && aCustomStyle != anObjSelStyle))
+ if (myAutoHilight)
{
- theOwner->SetSelected (Standard_True);
- highlightSelected (theOwner);
+ Handle(Prs3d_Drawer) aCustomStyle;
+ if (!HighlightStyle (theOwner, aCustomStyle) ||
+ (!aCustomStyle.IsNull() && aCustomStyle != anObjSelStyle))
+ {
+ theOwner->SetSelected (Standard_True);
+ highlightSelected (theOwner);
+ }
}
theOwner->SetSelected (Standard_True);
- if (theOwner == anObject->GlobalSelOwner())
+ if (myAutoHilight && theOwner == anObject->GlobalSelOwner())
{
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObject);
aState->SetHilightStatus (Standard_True);
void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
const Standard_Boolean theToUpdateViewer)
{
- if (theObject.IsNull())
- {
- return;
- }
-
- if (HasOpenedContext())
- {
- return myLocalContexts (myCurLocalIndex)->AddOrRemoveSelected (theObject, theToUpdateViewer);
- }
-
- if (!myObjects.IsBound (theObject))
+ if (theObject.IsNull()
+ || !myObjects.IsBound (theObject))
{
return;
}
AddOrRemoveSelected (anOwner, theToUpdateViewer);
}
}
-//=======================================================================
-//function : AddOrRemoveSelected
-//purpose :
-//=======================================================================
-
-void AIS_InteractiveContext::AddOrRemoveSelected (const TopoDS_Shape& aShap,
- const Standard_Boolean updateviewer)
-{
- if(!HasOpenedContext()) {
-#ifdef OCCT_DEBUG
- cout<<" Attempt to remove a selected shape with no opened local context"<<endl;
-#endif
- return;
- }
-
- myLocalContexts(myCurLocalIndex)->AddOrRemoveSelected(aShap,updateviewer);
- if(updateviewer) UpdateCurrentViewer();
-
-}
//=======================================================================
//function : AddOrRemoveSelected
void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
const Standard_Boolean theToUpdateViewer)
{
- if (HasOpenedContext())
- return myLocalContexts(myCurLocalIndex)->AddOrRemoveSelected (theOwner, theToUpdateViewer);
-
if (theOwner.IsNull() || !theOwner->HasSelectable())
return;
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
theOwner->SetSelected (aSelStat == AIS_SS_Added);
- const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
- const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
- Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
- if (theOwner->IsSelected())
- {
- highlightSelected (theOwner);
- if (isGlobal)
- {
- aStatus->SetHilightStatus (Standard_True);
- aStatus->SetHilightStyle (getSelStyle (anObj, theOwner));
- }
- }
- else
+
+ if (myAutoHilight)
{
- if (theOwner->IsAutoHilight())
+ const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
+ const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
+ Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
+ if (theOwner->IsSelected())
{
- theOwner->Unhilight (myMainPM);
+ highlightSelected (theOwner);
+ if (isGlobal)
+ {
+ aStatus->SetHilightStatus (Standard_True);
+ aStatus->SetHilightStyle (getSelStyle (anObj, theOwner));
+ }
}
else
{
- anObj->ClearSelected();
+ if (theOwner->IsAutoHilight())
+ {
+ theOwner->Unhilight (myMainPM);
+ }
+ else
+ {
+ anObj->ClearSelected();
+ }
+ aStatus->SetHilightStatus (Standard_False);
+ aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
}
- aStatus->SetHilightStatus (Standard_False);
- aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
}
if (theToUpdateViewer)
//=======================================================================
Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(AIS_InteractiveObject)& theObj) const
{
- if(HasOpenedContext())
- return myLocalContexts(myCurLocalIndex)->IsSelected (theObj);
+ if (theObj.IsNull())
+ {
+ return Standard_False;
+ }
- if (theObj.IsNull() || !myObjects.IsBound (theObj))
+ const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theObj);
+ if (aStatus == NULL)
+ {
return Standard_False;
+ }
const Standard_Integer aGlobalSelMode = theObj->GlobalSelectionMode();
- const TColStd_ListOfInteger& anActivatedModes = myObjects (theObj)->SelectionModes();
+ const TColStd_ListOfInteger& anActivatedModes = (*aStatus)->SelectionModes();
for (TColStd_ListIteratorOfListOfInteger aModeIter (anActivatedModes); aModeIter.More(); aModeIter.Next())
{
if (aModeIter.Value() == aGlobalSelMode)
}
//=======================================================================
-//function : IsSelected
-//purpose : Returns true is the owner given is selected
-//=======================================================================
-Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const
-{
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->IsSelected (theOwner);
- }
- return !theOwner.IsNull()
- && theOwner->IsSelected();
-}
-
-//=======================================================================
-//function : InitSelected
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::InitSelected()
-{
- if (HasOpenedContext())
- {
- myLocalContexts (myCurLocalIndex)->InitSelected();
- return;
- }
-
- mySelection->Init();
-}
-
-//=======================================================================
-//function : MoreSelected
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_InteractiveContext::MoreSelected() const
-{
- if (HasOpenedContext())
- return myLocalContexts (myCurLocalIndex)->MoreSelected();
-
- return mySelection->More();
-}
-
-//=======================================================================
-//function : NextSelected
+//function : FirstSelectedObject
//purpose :
//=======================================================================
-void AIS_InteractiveContext::NextSelected()
+Handle(AIS_InteractiveObject) AIS_InteractiveContext::FirstSelectedObject() const
{
- if(HasOpenedContext())
- {
- return myLocalContexts (myCurLocalIndex)->NextSelected();
- }
-
- mySelection->Next();
+ return !mySelection->Objects().IsEmpty()
+ ? Handle(AIS_InteractiveObject)::DownCast (mySelection->Objects().First()->Selectable())
+ : Handle(AIS_InteractiveObject)();
}
//=======================================================================
//=======================================================================
Standard_Boolean AIS_InteractiveContext::HasSelectedShape() const
{
- if(HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->HasSelectedShape();
- }
if (!mySelection->More())
return Standard_False;
- const Handle(StdSelect_BRepOwner) anOwner =
- Handle(StdSelect_BRepOwner)::DownCast (mySelection->Value());
-
+ const Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (mySelection->Value());
return !anOwner.IsNull() && anOwner->HasShape();
}
//=======================================================================
TopoDS_Shape AIS_InteractiveContext::SelectedShape() const
{
- if (HasOpenedContext())
- {
- return myLocalContexts (myCurLocalIndex)->SelectedShape();
- }
-
if (!mySelection->More())
return TopoDS_Shape();
- const Handle(StdSelect_BRepOwner) anOwner =
- Handle(StdSelect_BRepOwner)::DownCast (mySelection->Value());
+ const Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (mySelection->Value());
if (anOwner.IsNull() || !anOwner->HasSelectable())
return TopoDS_Shape();
return anOwner->Shape().Located (anOwner->Location() * anOwner->Shape().Location());
}
-//=======================================================================
-//function : SelectedInteractive
-//purpose :
-//=======================================================================
-Handle(AIS_InteractiveObject) AIS_InteractiveContext::SelectedInteractive() const
-{
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->SelectedInteractive();
- }
-
- return !mySelection->More()
- ? Handle(AIS_InteractiveObject)()
- : Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
-}
-//=======================================================================
-//function : SelectedOwner
-//purpose :
-//=======================================================================
-Handle(SelectMgr_EntityOwner) AIS_InteractiveContext::SelectedOwner() const
-{
- if(HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->SelectedOwner();
- }
-
- return !mySelection->More()
- ? Handle(SelectMgr_EntityOwner)()
- : mySelection->Value();
-}
-
//=======================================================================
//function : EntityOwners
//purpose :
}
}
-//=======================================================================
-//function : NbSelected
-//purpose :
-//=======================================================================
-Standard_Integer AIS_InteractiveContext::NbSelected()
-{
- if (HasOpenedContext())
- {
- return myLocalContexts (myCurLocalIndex)->Selection()->Extent();
- }
- return mySelection->Extent();
-}
-
-//=======================================================================
-//function : HasApplicative
-//purpose :
-//=======================================================================
- Standard_Boolean AIS_InteractiveContext::HasApplicative() const
-{
- return SelectedInteractive()->HasOwner();
-}
-
-//=======================================================================
-//function : Applicative
-//purpose :
-//=======================================================================
-Handle(Standard_Transient) AIS_InteractiveContext::Applicative() const
-{
- return SelectedInteractive()->GetOwner();
-}
-
-//==================================================
-// Function: HasDetected
-// Purpose :
-//==================================================
-Standard_Boolean AIS_InteractiveContext::HasDetected() const
-{
- if(HasOpenedContext())
- return myLocalContexts(myCurLocalIndex)->HasDetected();
-
- return !myLastPicked.IsNull();
-}
-
//=======================================================================
//function : HasDetectedShape
//purpose :
//=======================================================================
-
Standard_Boolean AIS_InteractiveContext::HasDetectedShape() const
{
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->HasDetectedShape();
- }
-
Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (myLastPicked);
return !anOwner.IsNull()
&& anOwner->HasShape();
//=======================================================================
const TopoDS_Shape& AIS_InteractiveContext::DetectedShape() const
{
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->DetectedShape();
- }
-
Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (myLastPicked);
return anOwner->Shape();
}
-//=======================================================================
-//function : DetectedInteractive
-//purpose :
-//=======================================================================
-Handle(AIS_InteractiveObject) AIS_InteractiveContext::DetectedInteractive() const
-{
- if (HasOpenedContext())
- return myLocalContexts(myCurLocalIndex)->DetectedInteractive();
-
- return Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable());
-}
-
-//=======================================================================
-//function : HasNextDetected
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_InteractiveContext::HasNextDetected() const
-{
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->HasNextDetected();
- }
-
- return !myDetectedSeq.IsEmpty() && myCurHighlighted <= myDetectedSeq.Upper();
-}
-
-
-//=======================================================================
-//function : DetectedOwner
-//purpose :
-//=======================================================================
-Handle(SelectMgr_EntityOwner) AIS_InteractiveContext::DetectedOwner() const
-{
- if (HasOpenedContext())
- return myLocalContexts(myCurLocalIndex)->DetectedOwner();
-
- return myLastPicked;
-}
-
//=======================================================================
//function : HilightNextDetected
//purpose :
Standard_Integer AIS_InteractiveContext::HilightNextDetected (const Handle(V3d_View)& theView,
const Standard_Boolean theToRedrawImmediate)
{
- if (HasOpenedContext())
- {
- return myLocalContexts (myCurLocalIndex)->HilightNextDetected (theView, theToRedrawImmediate);
- }
-
myMainPM->ClearImmediateDraw();
if (myDetectedSeq.IsEmpty())
{
Standard_Integer AIS_InteractiveContext::HilightPreviousDetected (const Handle(V3d_View)& theView,
const Standard_Boolean theToRedrawImmediate)
{
- if (HasOpenedContext())
- {
- return myLocalContexts (myCurLocalIndex)->HilightPreviousDetected (theView, theToRedrawImmediate);
- }
-
myMainPM->ClearImmediateDraw();
if (myDetectedSeq.IsEmpty())
{
return myCurHighlighted;
}
-//=======================================================================
-//function : InitDetected
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::InitDetected()
-{
- if (HasOpenedContext())
- {
- myLocalContexts (myCurLocalIndex)->InitDetected();
- return;
- }
-
- if (!myDetectedSeq.IsEmpty())
- {
- myCurDetected = myDetectedSeq.Lower();
- }
-}
-
-//=======================================================================
-//function : MoreDetected
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_InteractiveContext::MoreDetected() const
-{
- if (HasOpenedContext())
- {
- return myLocalContexts (myCurLocalIndex)->MoreDetected();
- }
-
- return myCurDetected >= myDetectedSeq.Lower() && myCurDetected <= myDetectedSeq.Upper();
-}
-
-//=======================================================================
-//function : NextDetected
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::NextDetected()
-{
- if (HasOpenedContext())
- {
- myLocalContexts (myCurLocalIndex)->NextDetected();
- return;
- }
-
- myCurDetected++;
-}
-
//=======================================================================
//function : DetectedCurrentOwner
//purpose :
//=======================================================================
Handle(SelectMgr_EntityOwner) AIS_InteractiveContext::DetectedCurrentOwner() const
{
- if (HasOpenedContext())
- {
- return myLocalContexts (myCurLocalIndex)->DetectedCurrentOwner();
- }
-
return MoreDetected()
? myMainSel->Picked (myDetectedSeq (myCurDetected))
: Handle(SelectMgr_EntityOwner)();
//=======================================================================
const TopoDS_Shape& AIS_InteractiveContext::DetectedCurrentShape() const
{
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->DetectedCurrentShape();
- }
-
Standard_DISABLE_DEPRECATION_WARNINGS
Handle(AIS_Shape) aCurrentShape = Handle(AIS_Shape)::DownCast (DetectedCurrentObject());
Standard_ENABLE_DEPRECATION_WARNINGS
//=======================================================================
Handle(AIS_InteractiveObject) AIS_InteractiveContext::DetectedCurrentObject() const
{
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->DetectedCurrentObject();
- }
-
return MoreDetected()
? Handle(AIS_InteractiveObject)::DownCast (myMainSel->Picked (myDetectedSeq (myCurDetected))->Selectable())
: Handle(AIS_InteractiveObject)();
}
-
-//=======================================================================
-//function : FirstSelectedObject
-//purpose :
-//=======================================================================
-Handle(AIS_InteractiveObject) AIS_InteractiveContext::FirstSelectedObject()
-{
- Handle(AIS_InteractiveObject) anObject;
-
- if (HasOpenedContext())
- return anObject;
-
- InitSelected();
- if (MoreSelected())
- {
- return SelectedInteractive();
- }
- return anObject;
-}
-
-//=======================================================================
-//function : RedrawImmediate
-//purpose : Redisplays immediate strucures of the viewer given according to their visibility
-//=======================================================================
-void AIS_InteractiveContext::RedrawImmediate (const Handle(V3d_Viewer)& theViewer)
-{
- myMainPM->RedrawImmediate (theViewer);
-}
// 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>
#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 :
{
return;
}
- else if (HasOpenedContext())
- {
- myLocalContexts (myCurLocalIndex)->SetSelectionModeActive (theObj, theMode, theIsActive, theActiveFilter);
- return;
- }
const Handle(AIS_GlobalStatus)* aStat = myObjects.Seek (theObj);
if (aStat == NULL)
{
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);
}
}
{
for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
{
- mgrSelector->Deactivate (theObj, aModeIter.Value(), myMainSel);
+ mgrSelector->Deactivate (theObj, aModeIter.Value());
}
(*aStat)->ClearSelectionModes();
break;
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());
}
}
break;
}
}
- mgrSelector->Activate (theObj, theMode, myMainSel);
+ mgrSelector->Activate (theObj, theMode);
}
(*aStat)->AddSelectionMode (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 :
//=======================================================================
//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());
-
- }
- }
- else{
- if(myLocalContexts(myCurLocalIndex)->IsIn(anIObj)){
- for(ItL.Initialize(myLocalContexts(myCurLocalIndex)->SelectionModes(anIObj));
- 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());
}
}
}
-//=======================================================================
-//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*/)
-{
-}
-
//=======================================================================
//function : SubIntensityOn
//purpose :
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();
}
//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();
- }
+ const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theObj);
+ if (aStatus == NULL
+ || !(*aStatus)->IsSubIntensityOn())
+ {
+ return;
+ }
+
+ (*aStatus)->SubIntensityOff();
+ Standard_Boolean toUpdateMain = Standard_False;
+ if ((*aStatus)->GraphicStatus() == AIS_DS_Displayed)
+ {
+ myMainPM->Unhighlight (theObj);
+ toUpdateMain = Standard_True;
}
- 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();
+ if (IsSelected (theObj))
+ {
+ highlightSelected (theObj->GlobalSelOwner());
}
-}
-//=======================================================================
-//function : SubIntensityOn
-//purpose : ALL THE DISPLAYED OBJECTS HAVE SUBINTENSITY...
-//=======================================================================
-void AIS_InteractiveContext::SubIntensityOn (const Standard_Boolean theIsToUpdateViewer)
-{
- if (!HasOpenedContext())
- return;
-
- turnOnSubintensity();
-
- if (theIsToUpdateViewer)
+ if (theToUpdateViewer && toUpdateMain)
+ {
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();
}
//=======================================================================
//=======================================================================
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);
}
//=======================================================================
//=======================================================================
void AIS_InteractiveContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilter)
{
- if(HasOpenedContext())
- myLocalContexts(myCurLocalIndex)->RemoveFilter (aFilter);
- else
- myFilters->Remove(aFilter);
+ myFilters->Remove(aFilter);
}
//=======================================================================
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();
}
//=======================================================================
//=======================================================================
const SelectMgr_ListOfFilter& AIS_InteractiveContext::Filters() const
{
- if(HasOpenedContext())
- return myLocalContexts(myCurLocalIndex)->ListOfFilter();
return myFilters->StoredFilters();
}
//=======================================================================
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 :
Standard_Integer AIS_InteractiveContext::PurgeDisplay()
{
- if(HasOpenedContext()) return 0;
-
Standard_Integer NbStr = PurgeViewer(myMainVwr);
myMainVwr->Update();
return NbStr;
-
}
Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
{
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
- }
return myMainPM->IsImmediateModeOn();
}
Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
{
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->BeginImmediateDraw();
- }
-
if (myMainPM->IsImmediateModeOn())
{
myMainPM->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;
Standard_Boolean AIS_InteractiveContext::EndImmediateDraw (const Handle(V3d_View)& theView)
{
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->EndImmediateDraw (theView->Viewer());
- }
-
if (!myMainPM->IsImmediateModeOn())
{
return Standard_False;
Standard_Boolean AIS_InteractiveContext::EndImmediateDraw()
{
- if (HasOpenedContext())
- {
- return myLocalContexts(myCurLocalIndex)->EndImmediateDraw (myMainVwr);
- }
-
if (!myMainPM->IsImmediateModeOn())
{
return Standard_False;
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();
- }
-}
+++ /dev/null
-// 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.
-
-//Modified by ROB : Traque des UpdateConversion intempestifs.
-
-#include <AIS_DataMapIteratorOfDataMapOfSelStat.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
-#include <AIS_ListOfInteractive.hxx>
-#include <AIS_LocalContext.hxx>
-#include <AIS_LocalStatus.hxx>
-#include <AIS_Shape.hxx>
-#include <Aspect_TypeOfMarker.hxx>
-#include <Graphic3d_Structure.hxx>
-#include <Prs3d_LineAspect.hxx>
-#include <Prs3d_PlaneAspect.hxx>
-#include <Prs3d_PointAspect.hxx>
-#include <Prs3d_Presentation.hxx>
-#include <SelectMgr_CompositionFilter.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-#include <SelectMgr_Filter.hxx>
-#include <SelectMgr_OrFilter.hxx>
-#include <SelectMgr_SelectableObject.hxx>
-#include <SelectMgr_SelectionManager.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <StdSelect_ShapeTypeFilter.hxx>
-#include <StdSelect_ViewerSelector3d.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-#include <TopoDS_Shape.hxx>
-#include <V3d_View.hxx>
-#include <V3d_Viewer.hxx>
-
-#include <stdio.h>
-IMPLEMENT_STANDARD_RTTIEXT(AIS_LocalContext,Standard_Transient)
-
-//=======================================================================
-//function : AIS_LocalContext
-//purpose :
-//=======================================================================
-
-
-AIS_LocalContext::AIS_LocalContext(){}
-
-AIS_LocalContext::AIS_LocalContext(const Handle(AIS_InteractiveContext)& aCtx,
- const Standard_Integer Index,
- const Standard_Boolean LoadDisplayed,
- const Standard_Boolean AcceptStandardModes,
- const Standard_Boolean AcceptEraseOfTemp,
- const Standard_Boolean /*BothViewers*/):
-myCTX(aCtx),
-myLoadDisplayed(LoadDisplayed),
-myAcceptStdMode(AcceptStandardModes),
-myAcceptErase(AcceptEraseOfTemp),
-mySM(aCtx->SelectionManager()),
-myMainVS(aCtx->MainSelector()),
-myFilters(new SelectMgr_OrFilter()),
-myAutoHilight(Standard_True),
-myMapOfOwner (new SelectMgr_IndexedMapOfOwner()),
-mySelection(new AIS_Selection()),
-mylastindex(0),
-mylastgood(0),
-myCurDetected(0),
-myAISCurDetected(0),
-mySubintStyle (new Prs3d_Drawer())
-{
- mySubintStyle->Link (aCtx->SelectionStyle());
- mySubintStyle->SetColor (aCtx->SelectionStyle()->Color());
- mySubintStyle->SetTransparency (aCtx->SelectionStyle()->Transparency());
- mySubintStyle->SetMethod (aCtx->SelectionStyle()->Method());
-
- // bind self to AIS_InteractiveContext::myLocalContexts. Further, the
- // constructor executes logic that implies that the context is already
- // created and mapped.
- aCtx->myLocalContexts.Bind (Index, this);
-
- myMainVS->ResetSelectionActivationStatus();
- myMainPM = aCtx->MainPrsMgr();
-
- mySM->Add(myMainVS);
- if(myLoadDisplayed) LoadContextObjects();
- Process();
-
-}
-
-
-//=======================================================================
-//function : SetContext
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::SetContext(const Handle(AIS_InteractiveContext)& aCtx)
-{ myCTX = aCtx;}
-
-//=======================================================================
-//function : Display
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::Display(const Handle(AIS_InteractiveObject)& anInteractive,
- const Standard_Integer WhichMode,
- const Standard_Boolean AllowShapeDecomposition,
- const Standard_Integer ActivationMode)
-{
- if(myActiveObjects.IsBound(anInteractive)){
- const Handle(AIS_LocalStatus)& STAT = myActiveObjects(anInteractive);
-
- if(STAT->DisplayMode() == -1){
- if(!myMainPM->IsDisplayed(anInteractive,WhichMode))
- myMainPM->Display(anInteractive,WhichMode);
- if(STAT->IsTemporary())
- STAT->SetDisplayMode(WhichMode);
- }
- else if(STAT->DisplayMode()!=WhichMode && STAT->IsTemporary()){
- myMainPM->Erase(anInteractive,STAT->DisplayMode());
- STAT->SetDisplayMode(WhichMode);
- if(!myMainPM->IsDisplayed(anInteractive,WhichMode))
- myMainPM->Display(anInteractive,WhichMode);
- }
-
- if(ActivationMode!=-1){
- if(!STAT->IsActivated(ActivationMode)){
- STAT->ClearSelectionModes();
- mySM->Load(anInteractive,myMainVS);
- STAT->AddSelectionMode(ActivationMode);
- mySM->Activate(anInteractive,ActivationMode,myMainVS);
- }
- }
- }
- else {
- Handle(AIS_LocalStatus) Att = new AIS_LocalStatus();
-
- if(anInteractive->AcceptShapeDecomposition() && AllowShapeDecomposition)
- Att->SetDecomposition(Standard_True);
- else
- Att->SetDecomposition(Standard_False);
- // status temporary or not
- if(myCTX->DisplayStatus(anInteractive) == AIS_DS_None ||
- myCTX->DisplayStatus(anInteractive) == AIS_DS_Temporary)
- Att->SetTemporary(Standard_True);
- else
- Att->SetTemporary(Standard_False);
-
-
-
- if(!myCTX->IsDisplayed(anInteractive,WhichMode)){
-
- //storing information....
- Att->SetDisplayMode(WhichMode);
- if (ActivationMode!=-1)
- Att->AddSelectionMode(ActivationMode);
- Standard_Integer HiMod = anInteractive->HasHilightMode()? anInteractive->HilightMode(): WhichMode;
- Att->SetHilightMode(HiMod);
-
- if(!myMainPM->IsDisplayed(anInteractive,WhichMode))
- myMainPM->Display(anInteractive,WhichMode);
-
- if(ActivationMode!=-1){
- mySM->Load(anInteractive,myMainVS);
- mySM->Activate(anInteractive,ActivationMode,myMainVS);
- }
- }
- else{
- Standard_Integer HiMod = anInteractive->HasHilightMode()? anInteractive->HilightMode(): WhichMode;
- Att->SetHilightMode(HiMod);
- }
- myActiveObjects.Bind(anInteractive,Att);
- }
- Process(anInteractive);
-
-
-
-
- return Standard_True;
-}
-
-//=======================================================================
-//function : Load
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::
-Load(const Handle(AIS_InteractiveObject)& anInteractive,
- const Standard_Boolean AllowShapeDecomposition,
- const Standard_Integer ActivationMode)
-{
- if (myActiveObjects.IsBound (anInteractive))
- {
- if (const Handle(SelectMgr_Selection)& aSel = anInteractive->Selection (ActivationMode))
- {
- if (aSel->GetSelectionState() != SelectMgr_SOS_Activated)
- {
- if (!myMainVS->Contains (anInteractive))
- {
- mySM->Load (anInteractive, myMainVS);
- }
- mySM->Activate (anInteractive, ActivationMode, myMainVS);
- return Standard_True;
- }
- }
- return Standard_False;
- }
-
- Handle(AIS_LocalStatus) Att = new AIS_LocalStatus();
-
- if(anInteractive->AcceptShapeDecomposition() && AllowShapeDecomposition)
- Att->SetDecomposition(Standard_True);
- else
- Att->SetDecomposition(Standard_False);
-
- if(!myCTX->IsDisplayed(anInteractive))
- Att->SetTemporary(Standard_True);
- else
- Att->SetTemporary(Standard_False);
- Att->SetDisplayMode(-1);
-
- //storing information....
- if(ActivationMode!=-1)
- Att->AddSelectionMode(ActivationMode);
- Standard_Integer HiMod = anInteractive->HasHilightMode()? anInteractive->HilightMode():0;
- Att->SetHilightMode(HiMod);
- //Action
-
- mySM->Load(anInteractive,myMainVS);
- if(ActivationMode != -1){
- mySM->Activate(anInteractive,ActivationMode,myMainVS);
- }
- myActiveObjects.Bind(anInteractive,Att);
- Process(anInteractive);
- return Standard_True;
-}
-
-//=======================================================================
-//function : ClearPrs
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::
-ClearPrs(const Handle(AIS_InteractiveObject)& anInteractive,
- const Standard_Integer aMode)
-{
- if(!myActiveObjects.IsBound(anInteractive))
- return Standard_False;
-
- Standard_Boolean jobdone(Standard_False);
- const Handle(AIS_LocalStatus)& STAT = myActiveObjects(anInteractive);
-
- //Display step
- if(STAT->IsSubIntensityOn()) {
- STAT->SubIntensityOff();
- if(STAT->HilightMode()==aMode)
- myMainPM->Unhighlight(anInteractive);
- }
- myMainPM->Clear(anInteractive,aMode); // correction connexions 23/09/97
- jobdone = Standard_True;
- if(STAT->DisplayMode()==aMode)
- STAT->SetDisplayMode(-1);
- return jobdone;
-}
-//=======================================================================
-//function : Erase
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::
-Erase(const Handle(AIS_InteractiveObject)& anInteractive)
-{
- if(!myActiveObjects.IsBound(anInteractive))
- return Standard_False;
- const Handle(AIS_LocalStatus)& STAT = myActiveObjects(anInteractive);
-
- //Display step
- if(STAT->IsSubIntensityOn()) {
- STAT->SubIntensityOff();
- myMainPM->Unhighlight (anInteractive);
- }
-
- Standard_Boolean status(Standard_False);
-
- if(STAT->DisplayMode()!=-1) {
- if(IsSelected(anInteractive))
- AddOrRemoveSelected(anInteractive);
- if(myMainPM->IsHighlighted(anInteractive,STAT->HilightMode()))
- {
- myMainPM->Unhighlight (anInteractive);
- }
- myMainPM->SetVisibility (anInteractive, STAT->DisplayMode(), Standard_False);
- STAT->SetDisplayMode(-1);
- status = Standard_True;
- }
- if(STAT->IsTemporary()){
- if(myMainPM->IsDisplayed(anInteractive,STAT->HilightMode()))
- myMainPM->SetVisibility (anInteractive, STAT->HilightMode(), Standard_False);
- }
-
- // Deactivate selectable entities of interactive object
- const Handle(SelectMgr_SelectableObject)& anObj = anInteractive; // to avoid ambiguity
- if (mySM->Contains (anObj))
- {
- while (!STAT->SelectionModes().IsEmpty())
- {
- mySM->Deactivate (anInteractive, STAT->SelectionModes().Last(), myMainVS);
- STAT->RemoveSelectionMode (STAT->SelectionModes().Last());
- }
- }
-
- ClearOutdatedSelection (anInteractive, Standard_True);
-
- return status;
-}
-
-
-//=======================================================================
-//function : SetShapeDecomposition
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::SetShapeDecomposition(const Handle(AIS_InteractiveObject)& aStoredObject,
- const Standard_Boolean aStatus)
-{
- if(!myActiveObjects.IsBound(aStoredObject)) return;
-
- if(aStatus == myActiveObjects(aStoredObject)->Decomposed())
- return;
-
- myActiveObjects(aStoredObject)->SetDecomposition(aStatus);
-
- Process(aStoredObject);
-}
-
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::Clear(const AIS_ClearMode aType)
-{
- switch (aType){
- case AIS_CM_All:
- {
- ClearObjects();
- myFilters->Clear();
- while(!myListOfStandardMode.IsEmpty())
- DeactivateStandardMode(AIS_Shape::SelectionType(myListOfStandardMode.Last()));
- break;
- }
- case AIS_CM_Interactive:
- ClearObjects();
- break;
- case AIS_CM_Filters:
- myFilters->Clear();
- break;
- case AIS_CM_StandardModes:
- {
- while(!myListOfStandardMode.IsEmpty())
- DeactivateStandardMode(AIS_Shape::SelectionType(myListOfStandardMode.Last()));
- break;
- }
- case AIS_CM_TemporaryShapePrs:
- ClearDetected();
- }
-}
-
-//=======================================================================
-//function : SetSelectionModeActive
-//purpose :
-//=======================================================================
-void AIS_LocalContext::SetSelectionModeActive (const Handle(AIS_InteractiveObject)& theObj,
- const Standard_Integer theMode,
- const Standard_Boolean theIsActive,
- const AIS_SelectionModesConcurrency theActiveFilter)
-{
- const Handle(AIS_LocalStatus)* aStat = myActiveObjects.Seek (theObj);
- if (aStat == NULL)
- {
- return;
- }
-
- if (!theIsActive
- || (theMode == -1
- && theActiveFilter == AIS_SelectionModesConcurrency_Single))
- {
- if (theMode == -1)
- {
- for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
- {
- mySM->Deactivate (theObj, aModeIter.Value(), myMainVS);
- }
- (*aStat)->ClearSelectionModes();
- }
- else
- {
- mySM->Deactivate (theObj, theMode, myMainVS);
- (*aStat)->RemoveSelectionMode (theMode);
- }
- return;
- }
- else if (theMode == -1)
- {
- return;
- }
- else if ((*aStat)->SelectionModes().Size() == 1
- && (*aStat)->SelectionModes().First() == theMode)
- {
- return;
- }
-
- switch (theActiveFilter)
- {
- case AIS_SelectionModesConcurrency_Single:
- {
- for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
- {
- mySM->Deactivate (theObj, aModeIter.Value(), myMainVS);
- }
- (*aStat)->ClearSelectionModes();
- break;
- }
- case AIS_SelectionModesConcurrency_GlobalOrLocal:
- {
- const Standard_Integer aGlobSelMode = theObj->GlobalSelectionMode();
- TColStd_ListOfInteger aRemovedModes;
- for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
- {
- if ((theMode == aGlobSelMode && aModeIter.Value() != aGlobSelMode)
- || (theMode != aGlobSelMode && aModeIter.Value() == aGlobSelMode))
- {
- mySM->Deactivate (theObj, aModeIter.Value(), myMainVS);
- aRemovedModes.Append (aModeIter.Value());
- }
- }
- if (aRemovedModes.Size() == (*aStat)->SelectionModes().Size())
- {
- (*aStat)->ClearSelectionModes();
- }
- else
- {
- for (TColStd_ListIteratorOfListOfInteger aModeIter (aRemovedModes); aModeIter.More(); aModeIter.Next())
- {
- (*aStat)->RemoveSelectionMode (aModeIter.Value());
- }
- }
- break;
- }
- case AIS_SelectionModesConcurrency_Multiple:
- {
- break;
- }
- }
- mySM->Activate (theObj, theMode, myMainVS);
- (*aStat)->AddSelectionMode (theMode);
-}
-
-//=======================================================================
-//function : Remove
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::Remove(const Handle(AIS_InteractiveObject)& aSelectable)
-{
- if(!myActiveObjects.IsBound (aSelectable))
- {
- return Standard_False;
- }
-
- if (IsSelected (aSelectable))
- {
- AddOrRemoveSelected (aSelectable, Standard_False);
- }
-
- const Handle(AIS_LocalStatus)& Att = myActiveObjects (aSelectable);
-
- TColStd_ListIteratorOfListOfInteger It;
-
- // Deactivate standard modes
- if (Att->Decomposed())
- {
- for (It.Initialize (myListOfStandardMode); It.More(); It.Next())
- {
- mySM->Deactivate (aSelectable, It.Value(), myMainVS);
- }
- }
-
- // If object or temporary presentations
- if (Att->IsTemporary())
- {
- if (Att->IsSubIntensityOn())
- {
- myMainPM->Unhighlight (aSelectable);
- }
-
- myMainPM->Erase (aSelectable, Att->DisplayMode());
- if (myMainPM->IsDisplayed (aSelectable, Att->HilightMode()))
- {
- myMainPM->Erase (aSelectable, Att->HilightMode());
- }
- }
- // If subintensity used
- else if (Att->IsSubIntensityOn())
- {
- myCTX->SubIntensityOff (aSelectable, Standard_False);
- }
-
- // Deactivate stored selection modes
- for (It.Initialize (Att->SelectionModes()); It.More(); It.Next())
- {
- mySM->Deactivate (aSelectable, It.Value(), myMainVS);
- }
-
- // Remove the interactive object from selection manager
- const Handle(SelectMgr_SelectableObject)& anObj = aSelectable; // to avoid ambiguity
- if (mySM->Contains (anObj))
- {
- mySM->Remove (anObj);
- }
- ClearOutdatedSelection (aSelectable, Standard_True);
-
- // This should be done at the very end because most methods use
- // myActiveObjects even during clean-up
- myActiveObjects.UnBind (aSelectable);
- return Standard_True;
-}
-
-//=======================================================================
-//function : ActivateStandardMode
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::ActivateStandardMode(const TopAbs_ShapeEnum aType)
-{
-
- //check if it is not in the list
- TColStd_ListIteratorOfListOfInteger It(myListOfStandardMode);
- for(;It.More();It.Next())
- if(It.Value()==aType) return;
- Standard_Integer IMode = AIS_Shape::SelectionMode(aType);
-
-
- // create a hidden filter answering ok to the type except for :
- // if the type is shape...
- // if the filters already impact at the type <aType>
- if(aType != TopAbs_SHAPE){
- if(myStdFilters[IMode].IsNull())
- myStdFilters[IMode] = new StdSelect_ShapeTypeFilter(aType);
- if(!HasFilters(aType))
- myFilters->Add(myStdFilters[IMode]);
- }
-
- // the mode is activated for all objects of type Shape
- // accepting the decomposition in standard mode.
- myListOfStandardMode.Append(IMode);
-
- AIS_DataMapIteratorOfDataMapOfSelStat ItM(myActiveObjects);
-
- for(;ItM.More();ItM.Next()){
- if(ItM.Value()->Decomposed())
- myCTX->SelectionManager()->Activate(ItM.Key(),
- IMode,
- myMainVS);
- ItM.Value()->AddSelectionMode (IMode);
- }
-
-}
-
-//=======================================================================
-//function : DeActivateStandardMode
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::DeactivateStandardMode(const TopAbs_ShapeEnum aType)
-{
- TColStd_ListIteratorOfListOfInteger It(myListOfStandardMode);
- Standard_Integer IMode = AIS_Shape::SelectionMode(aType);
- for(;It.More();It.Next())
- if(It.Value()==IMode) {
- AIS_DataMapIteratorOfDataMapOfSelStat ItM(myActiveObjects);
-
- for(;ItM.More();ItM.Next()){
- if(ItM.Value()->Decomposed()){
- myCTX->SelectionManager()->Deactivate(ItM.Key(),
- IMode,
- myMainVS);
- ItM.Value()->RemoveSelectionMode(IMode);
- }
- }
- myListOfStandardMode.Remove(It);
- if(myFilters->IsIn(myStdFilters[IMode]))
- myFilters->Remove(myStdFilters[IMode]);
- return;
- }
-}
-
-//=======================================================================
-//function : AddFilter
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::AddFilter(const Handle(SelectMgr_Filter)& aFilter)
-{
- // it is checked if the filter impacts at the type of active sub-shape
- // for which a filter of type has been already implemented...
-
- TColStd_ListIteratorOfListOfInteger It(myListOfStandardMode);
-
- for(;It.More();It.Next()){
- if(aFilter->ActsOn(AIS_Shape::SelectionType(It.Value())))
- if(myFilters->IsIn(myStdFilters[It.Value()]))
- myFilters->Remove(myStdFilters[It.Value()]);
- }
- myFilters->Add(aFilter);
-}
-
-//=======================================================================
-//function : RemoveFilter
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilter)
-{
- if(myFilters->IsIn(aFilter)) myFilters->Remove(aFilter);
-
- // it is checked if the filter for type standard is active.
- // if yes, it is checked there are still similarities among the
- // remaining filters...
- // otherwise, the standard filter is restored to
- // continu selecting active modes...
- TColStd_ListIteratorOfListOfInteger It(myListOfStandardMode);
- TopAbs_ShapeEnum SE;
- for(;It.More();It.Next()){
- SE = AIS_Shape::SelectionType(It.Value());
- if(aFilter->ActsOn(SE))
- if(!HasFilters(SE))
- myFilters->Add(myStdFilters[It.Value()]);
- }
-}
-
-//=======================================================================
-//function : Terminate
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::Terminate (const Standard_Boolean theToUpdate)
-{
- ClearDetected();
- Clear();
- myMapOfOwner->Clear();
-
- mylastindex=0;
- // clear the selector...
- myMainVS->Clear();
-
- for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
- {
- aSelIter.Value()->SetSelected (Standard_False);
- }
- mySelection->Clear();
-
- Handle(V3d_View) aDummyView;
- myMainVS->ClearSensitive (aDummyView);
-
- if (theToUpdate)
- {
- myCTX->UpdateCurrentViewer();
- }
-}
-
-
-//=======================================================================
-//function : SubIntensity
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::SubIntensityOn(const Handle(AIS_InteractiveObject)& anObject)
-{
- if(!myActiveObjects.IsBound(anObject)) return;
- mySubintStyle->SetColor (myCTX->SubIntensityColor());
-
- const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject);
-
- if(Att->IsTemporary())
- {
- myMainPM->Color (anObject, mySubintStyle, Att->DisplayMode());
- }
-
- Att->SubIntensityOn();
-}
-//=======================================================================
-//function : SubIntensity
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::SubIntensityOff(const Handle(AIS_InteractiveObject)& anObject)
-{
- if(!myActiveObjects.IsBound(anObject)) return;
-
- const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject);
-
- if(Att->IsTemporary())
- myMainPM->Unhighlight(anObject);
- Att->SubIntensityOff();
-}
-
-
-//=======================================================================
-//function : Hilight
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::Hilight(const Handle(AIS_InteractiveObject)& anObject)
-{
- if(!myActiveObjects.IsBound(anObject)){
- Standard_Integer HiMod = anObject->HasHilightMode()? anObject->HilightMode() : 0;
- Handle(AIS_LocalStatus) Att = new AIS_LocalStatus(Standard_True,
- Standard_False,
- -1,-1,HiMod);
- myActiveObjects.Bind(anObject,Att);
-
- }
- const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject);
- myMainPM->Color(anObject, myCTX->getHiStyle (anObject, anObject->GlobalSelOwner()), Att->HilightMode());
- Att->SubIntensityOn();
-}
-//=======================================================================
-//function : Hilight
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::Hilight (const Handle(AIS_InteractiveObject)& theObj,
- const Handle(Prs3d_Drawer)& theStyle)
-{
- if (!myActiveObjects.IsBound (theObj))
- {
- Handle(AIS_LocalStatus) aStatus = new AIS_LocalStatus
- (Standard_True, Standard_False, -1, -1, theObj->HasHilightMode() ? theObj->HilightMode() : 0);
- myActiveObjects.Bind (theObj, aStatus);
- }
- const Handle(AIS_LocalStatus)& aStatus = myActiveObjects (theObj);
- myMainPM->Color (theObj, theStyle, aStatus->HilightMode());
- aStatus->SubIntensityOn();
- aStatus->SetHilightStyle (theStyle);
-}
-
-//=======================================================================
-//function : Unhilight
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::Unhilight(const Handle(AIS_InteractiveObject)& anObject)
-{
- if(!myActiveObjects.IsBound(anObject)) return;
-
- // chieck if by hazard the object is somewhere else...
- Standard_Integer Indx;
- Standard_DISABLE_DEPRECATION_WARNINGS
- Standard_Boolean IsSomeWhereElse =
- myCTX->IsInLocal(anObject,Indx) && Indx != myCTX->IndexOfCurrentLocal();
- Standard_ENABLE_DEPRECATION_WARNINGS
-
- const Handle(AIS_LocalStatus)& Att = myActiveObjects(anObject);
- myMainPM->Unhighlight (anObject);
- if(Att->IsTemporary() && Att->DisplayMode()==-1)
- if(!IsSomeWhereElse)
- myMainPM->SetVisibility (anObject, Att->HilightMode(), Standard_False);
-
- Att->SubIntensityOff();
- Att->SetHilightStyle (Handle(Prs3d_Drawer)());
-}
-
-
-//=======================================================================
-//function : IsIn
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::
-IsIn(const Handle(AIS_InteractiveObject)& anObject) const
-{
- return myActiveObjects.IsBound(anObject);
-}
-
-//=======================================================================
-//function : IsHilighted
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::IsHilighted(const Handle(AIS_InteractiveObject)& anObject) const
-{
- if(!myActiveObjects.IsBound(anObject)) return Standard_False;
- return myActiveObjects(anObject)->IsSubIntensityOn();
-}
-
-Standard_Boolean AIS_LocalContext::HighlightStyle (const Handle(AIS_InteractiveObject)& theObject,
- Handle(Prs3d_Drawer)& theStyle) const
-{
- if (!myActiveObjects.IsBound (theObject))
- return Standard_False;
-
- if (myActiveObjects (theObject)->IsSubIntensityOn())
- {
- theStyle = myActiveObjects (theObject)->HilightStyle();
- return Standard_True;
- }
-
- return Standard_False;
-}
-
-
-void AIS_LocalContext::SetDisplayPriority(const Handle(AIS_InteractiveObject)& anObject,
- const Standard_Integer Prior)
-{
- if(!myActiveObjects.IsBound(anObject)) return;
- const Handle(AIS_LocalStatus)& STAT = myActiveObjects(anObject);
- if(STAT->DisplayMode()==-1) return;
- myMainPM->SetDisplayPriority(anObject,STAT->DisplayMode(),Prior);
- if(STAT->IsSubIntensityOn())
- myMainPM->SetDisplayPriority(anObject,STAT->HilightMode(),Prior);
-
-
-}
-
-//=======================================================================
-//function : DisplayedObjects
-//purpose :
-//=======================================================================
-Standard_Integer AIS_LocalContext::DisplayedObjects(TColStd_MapOfTransient& theMap) const
-{
- Standard_Integer NbDisp(0);
- for(AIS_DataMapIteratorOfDataMapOfSelStat it(myActiveObjects);it.More();it.Next()){
- const Handle(SelectMgr_SelectableObject)& SO = it.Key();
- if(!theMap.Contains(SO))
- if(it.Value()->DisplayMode()!=-1){
- theMap.Add(SO);
- NbDisp++;
- }
- }
- return NbDisp;
-}
-
-
-//=======================================================================
-//function : IsDisplayed
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::IsDisplayed(const Handle(AIS_InteractiveObject)& anObject) const
-{
- if(!myActiveObjects.IsBound(anObject)) return Standard_False;
- return (myActiveObjects(anObject)->DisplayMode()!=-1);
-}
-
-//=======================================================================
-//function : IsDisplayed
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::IsDisplayed(const Handle(AIS_InteractiveObject)& anObject,
- const Standard_Integer aMode) const
-{
- if(!myActiveObjects.IsBound(anObject)) return Standard_False;
- return (myActiveObjects(anObject)->DisplayMode()==aMode);
-}
-
-//=======================================================================
-//function : SelectionModes
-//purpose :
-//=======================================================================
-
-const TColStd_ListOfInteger& AIS_LocalContext::
-SelectionModes(const Handle(AIS_InteractiveObject)& anObject) const
-{
- return myActiveObjects(anObject)->SelectionModes();
-}
-
-//=======================================================================
-//function : Status
-//purpose :
-//=======================================================================
-
-TCollection_AsciiString AIS_LocalContext::Status() const
-{
- TCollection_AsciiString t;
- return t;
-}
-
-const Handle(AIS_LocalStatus)& AIS_LocalContext::Status(const Handle(AIS_InteractiveObject)& anObject) const
-{
- return myActiveObjects(anObject);
-}
-
-//=======================================================================
-//function : LoadContextObjects
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::LoadContextObjects()
-{
- if (!myLoadDisplayed)
- {
- return;
- }
-
- AIS_ListOfInteractive LL;
- myCTX->DisplayedObjects(LL,Standard_True);
- for (AIS_ListIteratorOfListOfInteractive It (LL); It.More(); It.Next())
- {
- const Handle(AIS_InteractiveObject)& anObj = It.Value();
- Handle(AIS_LocalStatus) Att = new AIS_LocalStatus();
- Att->SetDecomposition((anObj->AcceptShapeDecomposition() && myAcceptStdMode));
- Att->SetTemporary(Standard_False);
- Att->SetHilightMode(anObj->HasHilightMode()? anObj->HilightMode(): 0);
- for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anObj->Selections()); aSelIter.More(); aSelIter.Next())
- {
- const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
- aSel->SetSelectionState (SelectMgr_SOS_Deactivated);
- }
- myActiveObjects.Bind(anObj,Att);
- }
-}
-
-void AIS_LocalContext::UnloadContextObjects()
-{
- AIS_ListIteratorOfListOfInteractive It;
- if(myLoadDisplayed)
- {
- AIS_ListOfInteractive LL;
- myCTX->DisplayedObjects(LL,Standard_True);
-
- for (It.Initialize(LL);It.More();It.Next())
- {
- myActiveObjects.UnBind(It.Value());
- }
- }
-}
-//=======================================================================
-//function : Process
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::Process(const Handle(SelectMgr_SelectableObject)& anObject)
-{
- if(!myActiveObjects.IsBound(anObject)) return;
- if(myActiveObjects(anObject)->Decomposed())
- ActivateStandardModes(anObject);
- else
- {
- TColStd_ListIteratorOfListOfInteger It(myActiveObjects(anObject)->SelectionModes());
- for(;It.More();It.Next())
- myCTX->SelectionManager()->Activate(anObject,It.Value(),myMainVS);
- }
-}
-
-//=======================================================================
-//function : Process
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::Process()
-{
-
- myMainVS->Clear();
-
- AIS_DataMapIteratorOfDataMapOfSelStat It(myActiveObjects);
-
- for(;It.More();It.Next()){
- myCTX->SelectionManager()->Load(It.Key(),myMainVS);
- if(It.Value()->Decomposed())
- ActivateStandardModes(It.Key());
- else if( myCTX->GetAutoActivateSelection() )
- {
- It.Value()->AddSelectionMode(0);
- myCTX->SelectionManager()->Activate(It.Key(),0,myMainVS);
- }
- }
-
-}
-
-//=======================================================================
-//function : ActivateModes
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::ActivateStandardModes(const Handle(SelectMgr_SelectableObject)& anObject)
-{
- if(!myActiveObjects.IsBound(anObject)) return;
-
- TColStd_ListIteratorOfListOfInteger itl (myListOfStandardMode);
-
- const Handle(AIS_LocalStatus)& LS = myActiveObjects(anObject);
- if(LS->Decomposed()){
- for(;itl.More();itl.Next()){
- myCTX->SelectionManager()->Activate(anObject,itl.Value(),myMainVS);
- LS->AddSelectionMode(itl.Value());
- }
- }
-}
-
-
-//=======================================================================
-//function : ClearObjects
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::ClearObjects()
-{
- AIS_DataMapIteratorOfDataMapOfSelStat It(myActiveObjects);
- for(;It.More();It.Next())
- {
- Handle(AIS_InteractiveObject) SO =
- Handle(AIS_InteractiveObject)::DownCast(It.Key());
-
- const Handle(AIS_LocalStatus)& CurAtt = It.Value();
- //TColStd_ListIteratorOfListOfInteger ItL;
- // if object is temporary the presentations managed by myMainPM are removed
- AIS_DisplayStatus TheDS = myCTX->DisplayStatus(SO);
-
- if(TheDS != AIS_DS_Displayed)
- {
- if (myMainPM->IsDisplayed(SO,CurAtt->DisplayMode()))
- {
- if (CurAtt->IsSubIntensityOn() && myMainPM->IsHighlighted (SO, CurAtt->HilightMode()))
- {
- myMainPM->Unhighlight (SO);
- }
- myMainPM->Erase (SO, CurAtt->DisplayMode());
- }
-
- if (CurAtt->IsTemporary())
- {
- myMainPM->Erase (SO, CurAtt->DisplayMode());
- //myMainPM->Clear(SO,CurAtt->DisplayMode());
- }
- }
- else {
- if (CurAtt->IsSubIntensityOn())
- {
- myCTX->SubIntensityOff(SO, Standard_False);
- }
- Standard_Integer DiMo = SO->HasDisplayMode()?
- SO->DisplayMode():myCTX->DisplayMode();
- if(CurAtt->DisplayMode()!=-1 &&
- CurAtt->DisplayMode()!= DiMo)
- myMainPM->Erase(SO,CurAtt->DisplayMode());
- }
-
- TColStd_ListIteratorOfListOfInteger aSelModeIter (CurAtt->SelectionModes());
- for ( ; aSelModeIter.More(); aSelModeIter.Next())
- {
- Standard_Integer aSelMode = aSelModeIter.Value();
- mySM->Deactivate (SO, aSelMode, myMainVS);
- }
-
- }
- ClearSelected( Standard_False );
-
- // Clear selection structures for temporary objects, created in local context
- for (AIS_DataMapIteratorOfDataMapOfSelStat anIter (myActiveObjects); anIter.More(); anIter.Next())
- {
- if (anIter.Value()->IsTemporary())
- {
- mySM->Remove (anIter.Key(), myMainVS);
- }
- }
-
- myActiveObjects.Clear();
-}
-
-
-Standard_Boolean AIS_LocalContext::IsDecompositionOn() const
-{return !myListOfStandardMode.IsEmpty();}
-
-
-
-
-//=======================================================================
-//function : HasAlreadyFilters
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::
-HasFilters(const TopAbs_ShapeEnum aType) const
-{
- return myFilters->ActsOn(aType);
-}
-
-void AIS_LocalContext::ClearDetected()
-{
- for(Standard_Integer I=1;I<=myMapOfOwner->Extent();I++)
- {
- if(!myMapOfOwner->FindKey (I).IsNull())
- {
- if(myMapOfOwner->FindKey (I)->IsHilighted(myMainPM))
- myMapOfOwner->FindKey (I)->Unhilight(myMainPM);
- else
- {
- const Handle(SelectMgr_SelectableObject)& SO =
- myMapOfOwner->FindKey (I)->Selectable();
- if(myActiveObjects.IsBound(SO))
- {
- const Handle(AIS_LocalStatus)& Att = myActiveObjects(SO);
-
- if(Att->IsTemporary() &&
- Att->DisplayMode()==-1 &&
- Att->SelectionModes().IsEmpty())
- {
- myMapOfOwner->FindKey (I)->Clear(myMainPM);
- }
- }
- }
- }
- }
-}
-
-//=======================================================================
-//function : BeginImmediateDraw
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_LocalContext::BeginImmediateDraw()
-{
- if (myMainPM->IsImmediateModeOn())
- {
- myMainPM->BeginImmediateDraw();
- return Standard_True;
- }
- return Standard_False;
-}
-
-//=======================================================================
-//function : ImmediateAdd
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_LocalContext::ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj,
- const Standard_Integer theMode)
-{
- if (!myMainPM->IsImmediateModeOn())
- {
- return Standard_False;
- }
-
- myMainPM->AddToImmediateList (myMainPM->Presentation (theObj, theMode)->Presentation());
- return Standard_True;
-}
-
-//=======================================================================
-//function : EndImmediateDraw
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_LocalContext::EndImmediateDraw (const Handle(V3d_Viewer)& theViewer)
-{
- if (!myMainPM->IsImmediateModeOn())
- {
- return Standard_False;
- }
-
- myMainPM->EndImmediateDraw (theViewer);
- return Standard_True;
-}
-
-// =======================================================================
-// function : ClearImmediateDraw
-// purpose :
-// =======================================================================
-void AIS_LocalContext::ClearImmediateDraw()
-{
- myMainPM->ClearImmediateDraw();
-}
-
-//=======================================================================
-//function : IsImmediateModeOn
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_LocalContext::IsImmediateModeOn() const
-{
- return myMainPM->IsImmediateModeOn();
-}
-
-void AIS_LocalContext::SetPixelTolerance(const Standard_Integer aPrecision) {
-
- myMainVS->SetPixelTolerance(aPrecision);
-}
-
-Standard_Integer AIS_LocalContext::PixelTolerance() const {
-
- return myMainVS->PixelTolerance();
-}
-
-//=======================================================================
-//function : SetSelectionSensitivity
-//purpose : Allows to manage sensitivity of a particular selection of interactive object theObject
-//=======================================================================
-void AIS_LocalContext::SetSelectionSensitivity (const Handle(AIS_InteractiveObject)& theObject,
- const Standard_Integer theMode,
- const Standard_Integer theNewSensitivity)
-{
- mySM->SetSelectionSensitivity (theObject, theMode, theNewSensitivity);
-}
+++ /dev/null
-// 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
+++ /dev/null
-// 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());}
+++ /dev/null
-// Created on: 1996-10-30
-// 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.
-
-// Modified by rob Thu Apr 02 1998
-// - use of optimisation in SelectMgr_ViewerSelector
-// -> Best management in detected entities...
-
-#include <AIS_InteractiveContext.hxx>
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_LocalContext.hxx>
-#include <AIS_LocalStatus.hxx>
-#include <AIS_Selection.hxx>
-#include <AIS_Shape.hxx>
-#include <Aspect_Grid.hxx>
-#include <Geom_Transformation.hxx>
-#include <Graphic3d_ArrayOfTriangles.hxx>
-#include <Graphic3d_Group.hxx>
-#include <NCollection_Map.hxx>
-#include <OSD_Environment.hxx>
-#include <Prs3d_Drawer.hxx>
-#include <Prs3d_Presentation.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-#include <Select3D_SensitiveTriangulation.hxx>
-#include <SelectBasics_SensitiveEntity.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-#include <SelectMgr_Filter.hxx>
-#include <SelectMgr_OrFilter.hxx>
-#include <SelectMgr_SelectableObject.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <SelectMgr_SelectionManager.hxx>
-#include <SelectMgr_SequenceOfOwner.hxx>
-#include <Standard_Transient.hxx>
-#include <StdSelect_BRepOwner.hxx>
-#include <StdSelect_ViewerSelector3d.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_MapIteratorOfMapOfTransient.hxx>
-#include <TColStd_MapOfTransient.hxx>
-#include <V3d_View.hxx>
-
-namespace
-{
- TopoDS_Shape AIS_LocalContext_myDummyShape;
-}
-
-//==================================================
-// Function: MoveTo
-// Purpose :
-//==================================================
-AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
- const Standard_Integer theYpix,
- const Handle(V3d_View)& theView,
- const Standard_Boolean theToRedrawImmediate)
-{
- // check that ViewerSelector gives
- if (theView->Viewer() != myCTX->CurrentViewer())
- {
- return AIS_SOD_Error;
- }
-
- myAISCurDetected = 0;
-
- myCurDetected = 0;
- myDetectedSeq.Clear();
- myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
- myMainVS->Pick (theXpix, theYpix, theView);
-
- const Standard_Integer aDetectedNb = myMainVS->NbPicked();
- for (Standard_Integer aDetIter = 1; aDetIter <= aDetectedNb; ++aDetIter)
- {
- Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (aDetIter);
- if (!anOwner.IsNull()
- && myFilters->IsOk (anOwner))
- {
- myDetectedSeq.Append (aDetIter); // normally they are already arranged in correct order...
- }
- }
-
- // result of courses..
- if (aDetectedNb == 0 || myDetectedSeq.IsEmpty())
- {
- if (mylastindex != 0 && mylastindex <= myMapOfOwner->Extent())
- {
- myMainPM->ClearImmediateDraw();
- Unhilight (myMapOfOwner->FindKey (mylastindex), theView);
- if (theToRedrawImmediate)
- {
- theView->RedrawImmediate();
- }
- }
-
- mylastindex = 0;
- return aDetectedNb == 0
- ? AIS_SOD_Nothing
- : AIS_SOD_AllBad;
- }
-
- // all owners detected by the selector are passed to the
- // filters and correct ones are preserved...
- myCurDetected = 1;
- Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (myDetectedSeq (myCurDetected));
- manageDetected (anOwner, theView, theToRedrawImmediate);
- if (myDetectedSeq.Length() == 1)
- {
- return aDetectedNb == 1
- ? AIS_SOD_OnlyOneDetected
- : AIS_SOD_OnlyOneGood;
- }
- else
- {
- return AIS_SOD_SeveralGood;
- }
-}
-
-//=======================================================================
-//function : AddSelect
-//purpose :
-//=======================================================================
-AIS_StatusOfPick AIS_LocalContext::AddSelect (const Handle(SelectMgr_EntityOwner)& theObject)
-{
- mySelection->AddSelect (theObject);
-
- Standard_Integer aSelNum = mySelection->Extent();
- return (aSelNum == 1) ? AIS_SOP_OneSelected
- : (aSelNum > 1) ? AIS_SOP_SeveralSelected
- : AIS_SOP_Error;
-}
-
-//=======================================================================
-//function : Select
-//purpose :
-//=======================================================================
-AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Boolean toUpdateViewer)
-{
- if (myAutoHilight)
- {
- UnhilightPicked (Standard_False);
- }
-
- Standard_Integer aDetIndex = DetectedIndex();
- if (aDetIndex <= 0)
- {
- ClearSelected (toUpdateViewer);
- return mySelection->IsEmpty() ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
- }
-
- const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (aDetIndex);
-
- ClearSelected (Standard_False);
-
- if (!anOwner->IsSelected()) // anOwner is not selected
- {
- anOwner->SetSelected (Standard_True);
- mySelection->Select (anOwner);
- }
-
- if (myAutoHilight)
- {
- const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
- for (V3d_ListOfViewIterator anActiveViewIter (aViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
- {
- Unhilight (anOwner, anActiveViewIter.Value());
- }
-
- // advanced selection highlighting mechanism
- if (!anOwner->IsAutoHilight() && anOwner->HasSelectable())
- {
- Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
- UpdateSelected (anIO, Standard_False);
- }
-
- if (toUpdateViewer)
- {
- myCTX->CurrentViewer()->Update();
- }
- }
-
- return (mySelection->Extent() == 1) ? AIS_SOP_OneSelected : AIS_SOP_SeveralSelected;
-}
-
-//=======================================================================
-//function : Select
-//purpose :
-//=======================================================================
-AIS_StatusOfPick AIS_LocalContext::Select (const Standard_Integer theXPMin,
- const Standard_Integer theYPMin,
- const Standard_Integer theXPMax,
- const Standard_Integer theYPMax,
- const Handle(V3d_View)& theView,
- const Standard_Boolean toUpdateViewer)
-{
- if (theView->Viewer() == myCTX->CurrentViewer())
- {
- myMainVS->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
- if (myAutoHilight)
- {
- UnhilightPicked (Standard_False);
- }
-
- Standard_Integer aSelNum = mySelection->Extent();
- if (myMainVS->NbPicked() == 0)
- {
- ClearSelected (toUpdateViewer);
- mylastindex = 0;
- return aSelNum == 0 ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
- }
-
- ClearSelected (Standard_False);
-
- for (Standard_Integer aPickIter = 1; aPickIter <= myMainVS->NbPicked(); ++aPickIter)
- {
- const Handle(SelectMgr_EntityOwner)& anOwner = myMainVS->Picked (aPickIter);
- if (myFilters->IsOk (anOwner))
- {
- // it can be helpful to classify this owner immediately...
- if (!anOwner->IsSelected())
- {
- anOwner->SetSelected (Standard_True);
- mySelection->Select (anOwner);
- }
- }
- }
-
- if (myAutoHilight)
- {
- HilightPicked (toUpdateViewer);
- }
- }
-
- Standard_Integer aSelNum = mySelection->Extent();
-
- return (aSelNum == 1) ? AIS_SOP_OneSelected
- : (aSelNum > 1) ? AIS_SOP_SeveralSelected
- : AIS_SOP_Error;
-}
-
-//==================================================
-// Function: Select
-// Purpose : Selection by polyline
-//==================================================
-AIS_StatusOfPick AIS_LocalContext::Select (const TColgp_Array1OfPnt2d& thePolyline,
- const Handle(V3d_View)& theView,
- const Standard_Boolean toUpdateViewer)
-{
- if (theView->Viewer() == myCTX->CurrentViewer())
- {
- myMainVS->Pick (thePolyline, theView);
-
- Standard_Integer aLastSelNum = mySelection->Extent();
- if (myMainVS->NbPicked() == 0)
- {
- // Nothing is selected clear selection.
- ClearSelected (toUpdateViewer);
- mylastindex = 0;
-
- // Return state to know if something was unselected
- return aLastSelNum == 0 ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
- }
-
- if (myAutoHilight)
- {
- UnhilightPicked (Standard_False);
- }
-
- // Clear previous selection without update to process this selection
- ClearSelected (Standard_False);
-
- for (Standard_Integer aPickIter = 1; aPickIter <= myMainVS->NbPicked(); ++aPickIter)
- {
- const Handle(SelectMgr_EntityOwner)& anOwner = myMainVS->Picked (aPickIter);
- if (myFilters->IsOk (anOwner))
- {
- // it can be helpful to classify this owner immediately...
- if (!anOwner->IsSelected())
- {
- mySelection->AddSelect (anOwner);
- anOwner->SetSelected (Standard_True);
- }
- }
- }
-
- if (myAutoHilight)
- {
- HilightPicked (toUpdateViewer);
- }
- }
-
- Standard_Integer aSelNum = mySelection->Extent();
- return (aSelNum == 1) ? AIS_SOP_OneSelected
- : (aSelNum > 1) ? AIS_SOP_SeveralSelected
- : AIS_SOP_Error;
-}
-
-//=======================================================================
-//function : ShiftSelect
-//purpose :
-//=======================================================================
-AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Boolean toUpdateViewer)
-{
- Standard_Integer aDetIndex = DetectedIndex();
-
- if(aDetIndex > 0)
- {
- Standard_Integer aSelNum = mySelection->Extent();
- const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (aDetIndex);
- Standard_Boolean toSelect = anOwner->IsSelected() ? Standard_False : Standard_True;
- mySelection->Select (anOwner);
- anOwner->SetSelected (toSelect);
-
- if(myAutoHilight)
- {
- myMainPM->ClearImmediateDraw();
- const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
- for (V3d_ListOfViewIterator anActiveViewIter (aViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
- {
- Unhilight (anOwner, anActiveViewIter.Value());
- }
-
- // advanced selection highlighting mechanism
- if (!anOwner->IsAutoHilight() && anOwner->HasSelectable())
- {
- Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
- UpdateSelected (anIO, Standard_False);
- }
-
- if (toUpdateViewer)
- {
- myCTX->CurrentViewer()->Update();
- }
- }
-
- Standard_Integer NS = mySelection->Extent();
- if( NS == 1 ) return AIS_SOP_OneSelected;
- else if( NS > 1 ) return AIS_SOP_SeveralSelected;
- return aSelNum == 0 ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
- }
- return AIS_SOP_Error;
-}
-
-//=======================================================================
-//function : ShiftSelect
-//purpose :
-//=======================================================================
-AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const Standard_Integer theXPMin,
- const Standard_Integer theYPMin,
- const Standard_Integer theXPMax,
- const Standard_Integer theYPMax,
- const Handle(V3d_View)& theView,
- const Standard_Boolean toUpdateViewer)
-{
- myMainPM->ClearImmediateDraw();
-
- if (theView->Viewer() == myCTX->CurrentViewer())
- {
- myMainVS->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
-
- Standard_Integer aLastSelNum = mySelection->Extent();
- if (myMainVS->NbPicked() == 0)
- {
- // Nothing is selected clear selection, but don't clear the selection
- // as it is shift selection and previous selection matters.
- // Return state to know if something was unselected
- return aLastSelNum == 0 ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
- }
-
- if (myAutoHilight)
- {
- UnhilightPicked (Standard_False);
- }
-
- for (Standard_Integer aPickIter = 1; aPickIter <= myMainVS->NbPicked(); ++aPickIter)
- {
- const Handle(SelectMgr_EntityOwner)& anOwner = myMainVS->Picked (aPickIter);
- if(myFilters->IsOk (anOwner))
- {
- Standard_Boolean toSelect = anOwner->IsSelected() ? Standard_False : Standard_True;
- mySelection->Select (anOwner);
- anOwner->SetSelected (toSelect);
- }
- }
-
- if (myAutoHilight)
- {
- HilightPicked (toUpdateViewer);
- }
- }
-
- Standard_Integer aSelNum = mySelection->Extent();
-
- return (aSelNum == 1) ? AIS_SOP_OneSelected
- : (aSelNum > 1) ? AIS_SOP_SeveralSelected
- : AIS_SOP_Error;
-}
-
-//==================================================
-// Function: Select
-// Purpose : Selection by polyline
-//==================================================
-AIS_StatusOfPick AIS_LocalContext::ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
- const Handle(V3d_View)& theView,
- const Standard_Boolean toUpdateViewer)
-{
- if (theView->Viewer() == myCTX->CurrentViewer())
- {
- myMainVS->Pick (thePolyline, theView);
-
- Standard_Integer aLastSelNum = mySelection->Extent();
- if (myMainVS->NbPicked() == 0)
- {
- // Nothing is selected clear selection, but don't clear the selection
- // as it is shift selection and previous selection matters.
- // Return state to know if something was unselected
- return aLastSelNum == 0 ? AIS_SOP_NothingSelected : AIS_SOP_Removed;
- }
-
- if (myAutoHilight)
- {
- UnhilightPicked (Standard_False);
- }
-
- for (Standard_Integer aPickIter = 1; aPickIter <= myMainVS->NbPicked(); ++aPickIter)
- {
- const Handle(SelectMgr_EntityOwner)& anOwner = myMainVS->Picked (aPickIter);
- if (myFilters->IsOk (anOwner))
- {
- Standard_Boolean toSelect = anOwner->IsSelected() ? Standard_False : Standard_True;
- mySelection->Select (anOwner);
- anOwner->SetSelected (toSelect);
- }
- }
- if (myAutoHilight)
- {
- HilightPicked (toUpdateViewer);
- }
- }
-
- Standard_Integer aSelNum = mySelection->Extent();
-
- return (aSelNum == 1) ? AIS_SOP_OneSelected
- : (aSelNum > 1) ? AIS_SOP_SeveralSelected
- : AIS_SOP_Error;
-}
-
-//==================================================
-// Function: Hilight
-// Purpose :
-//==================================================
-void AIS_LocalContext::Hilight (const Handle(SelectMgr_EntityOwner)& theOwner,
- const Handle(V3d_View)& theView)
-{
- if (theView.IsNull())
- {
- return;
- }
-
- const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
- const Handle(Prs3d_Drawer)& aHiStyle = myCTX->getHiStyle (anObj, theOwner);
- const Standard_Integer aHiMode = myCTX->getHilightMode (anObj, aHiStyle, -1);
- myMainPM->BeginImmediateDraw();
- theOwner->HilightWithColor (myMainPM, aHiStyle, aHiMode);
- myMainPM->EndImmediateDraw (theView->Viewer());
-}
-
-//==================================================
-// Function: Unhilight
-// Purpose :
-//==================================================
-void AIS_LocalContext::Unhilight (const Handle(SelectMgr_EntityOwner)& theOwner,
- const Handle(V3d_View)& theView)
-{
- if (theView.IsNull())
- {
- return;
- }
-
- const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
- if (IsSelected (theOwner))
- {
- if (theOwner->IsAutoHilight())
- {
- const Handle(Prs3d_Drawer)& aSelStyle = myCTX->getSelStyle (anObj, theOwner);
- const Standard_Integer aHiMode = myCTX->getHilightMode (anObj, aSelStyle, -1);
- theOwner->HilightWithColor (myMainPM, aSelStyle, aHiMode);
- }
- }
- else
- {
- theOwner->Unhilight (myMainPM);
- }
-}
-
-//=======================================================================
-//function : HilightPicked
-//purpose :
-//=======================================================================
-void AIS_LocalContext::HilightPicked (const Standard_Boolean theToUpdateviewer)
-{
- if (mySelection.IsNull())
- {
- return;
- }
-
- typedef NCollection_Shared<SelectMgr_SequenceOfOwner> SelectMgr_HSequenceOfOwner;
- typedef NCollection_DataMap <Handle(SelectMgr_SelectableObject), Handle(SelectMgr_HSequenceOfOwner) > SelectMgr_DataMapOfObjectOwners;
- SelectMgr_DataMapOfObjectOwners aMap;
-
- // to avoid problems when there is a loop searching for selected objects...
- for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
- {
- const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
- Handle(SelectMgr_SelectableObject) aSelObj = anOwner->Selectable();
- if (anOwner->IsAutoHilight())
- {
- Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast(aSelObj);
- const Handle(Prs3d_Drawer)& aSelStyle = myCTX->getSelStyle (anIO, anOwner);
- const Standard_Integer aHiMode = myCTX->getHilightMode (anIO, aSelStyle, -1);
- anOwner->HilightWithColor (myMainPM, aSelStyle, aHiMode);
- continue;
- }
-
- Handle(SelectMgr_HSequenceOfOwner) aSeq;
- if (aMap.Find (aSelObj, aSeq))
- {
- aSeq->Append (anOwner);
- }
- else
- {
- aSeq = new SelectMgr_HSequenceOfOwner();
- aSeq->Append (anOwner);
- aMap.Bind (aSelObj, aSeq);
- }
- }
-
- for (SelectMgr_DataMapOfObjectOwners::Iterator aMapIter (aMap); aMapIter.More(); aMapIter.Next())
- {
- aMapIter.Key()->HilightSelected (myMainPM, *aMapIter.Value());
- }
-
- if (theToUpdateviewer)
- {
- myCTX->CurrentViewer()->Update();
- }
-}
-
-//==================================================
-// Function: UnhilightPicked
-// Purpose :
-//==================================================
-void AIS_LocalContext::UnhilightPicked (const Standard_Boolean theToUpdateViewer)
-{
- myMainPM->ClearImmediateDraw();
- if (mySelection.IsNull())
- {
- return;
- }
-
- NCollection_Map<Handle(SelectMgr_SelectableObject)> anObjMap;
- for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
- {
- const Handle(SelectMgr_EntityOwner)& anOwner = aSelIter.Value();
- Handle(SelectMgr_SelectableObject) aSelObj = anOwner->Selectable();
- Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (aSelObj);
- anObjMap.Add (aSelObj);
- anOwner->Unhilight (myMainPM);
- }
-
- for (NCollection_Map<Handle(SelectMgr_SelectableObject)>::Iterator aMapIter (anObjMap);
- aMapIter.More(); aMapIter.Next())
- {
- if (!aMapIter.Key()->IsAutoHilight())
- {
- aMapIter.Key()->ClearSelected();
- }
- }
-
- if (theToUpdateViewer)
- {
- myCTX->CurrentViewer()->Update();
- }
-}
-
-//=======================================================================
-//function : IsSelected
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_LocalContext::IsSelected(const Handle(AIS_InteractiveObject)& anIObj) const
-{
- return (!FindSelectedOwnerFromIO(anIObj).IsNull());
-}
-
-//=======================================================================
-//function : IsSelected
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const
-{
- return !theOwner.IsNull() && theOwner->IsSelected();
-}
-
-//==================================================
-// Function:
-// Purpose :
-//==================================================
-void AIS_LocalContext::
-InitSelected()
-{
- mySelection->Init();
-}
-
-//==================================================
-// Function:
-// Purpose :
-//==================================================
-Standard_Boolean AIS_LocalContext::
-MoreSelected() const
-{
- return mySelection->More();
-}
-
-//==================================================
-// Function:
-// Purpose :
-//==================================================
-void AIS_LocalContext::
-NextSelected()
-{
- mySelection->Next();
-}
-
-//==================================================
-// Function: HasShape
-// Purpose :
-//==================================================
-Standard_Boolean AIS_LocalContext::HasShape() const
-{
- if (!mySelection->More())
- {
- return Standard_False;
- }
-
- Handle(StdSelect_BRepOwner) aBROwner = Handle(StdSelect_BRepOwner)::DownCast(mySelection->Value());
- return !aBROwner.IsNull()
- && aBROwner->HasShape()
- && aBROwner->ComesFromDecomposition();
-}
-
-//================================================================
-// Function : HasSelectedShape
-// Purpose : Checks if there is a selected shape regardless of its decomposition status
-//================================================================
-Standard_Boolean AIS_LocalContext::HasSelectedShape() const
-{
- if (!mySelection->More())
- {
- return Standard_False;
- }
-
- Handle(StdSelect_BRepOwner) aBrepOwner = Handle(StdSelect_BRepOwner)::DownCast (mySelection->Value());
- return !aBrepOwner.IsNull()
- && aBrepOwner->HasShape();
-}
-
-//==================================================
-// Function: SelectedShape
-// Purpose :
-//==================================================
-TopoDS_Shape AIS_LocalContext::SelectedShape() const
-{
- if (!mySelection->More())
- {
- return TopoDS_Shape();
- }
-
- Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(mySelection->Value());
- if (aBRO.IsNull())
- {
- return TopoDS_Shape();
- }
-
- return aBRO->Shape().Located (aBRO->Location() * aBRO->Shape().Location());
-}
-
-//==================================================
-// Function: SelectedInteractive
-// Purpose :
-//==================================================
-Handle(AIS_InteractiveObject) AIS_LocalContext::SelectedInteractive() const
-{
- return !mySelection->More()
- ? Handle(AIS_InteractiveObject)()
- : Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
-}
-
-//==================================================
-// Function: SelectedOwner
-// Purpose :
-//==================================================
-Handle(SelectMgr_EntityOwner) AIS_LocalContext::SelectedOwner() const
-{
- return !mySelection->More()
- ? Handle(SelectMgr_EntityOwner)()
- : mySelection->Value();
-}
-
-//==================================================
-// Function:
-// Purpose :
-//==================================================
-Standard_Boolean AIS_LocalContext::HasApplicative() const
-{
- Handle(AIS_InteractiveObject) anIO = SelectedInteractive();
- return !anIO.IsNull()
- && anIO->HasOwner();
-}
-
-//==================================================
-// Function:
-// Purpose :
-//==================================================
-const Handle(Standard_Transient)& AIS_LocalContext::
-SelectedApplicative() const
-{
- return SelectedInteractive()->GetOwner();
-}
-
-
-
-//=======================================================================
-//function : UpdateSelection
-//purpose : should disappear...
-//=======================================================================
-void AIS_LocalContext::UpdateSelected(const Standard_Boolean updateviewer)
-{
- UnhilightPicked(Standard_False);
- HilightPicked(updateviewer);
-}
-
-//================================================================
-// Function : UpdateSelected
-// Purpose : Part of advanced selection mechanism.
-// Highlightes or clears selection presentation for the given IO
-//================================================================
-void AIS_LocalContext::UpdateSelected(const Handle(AIS_InteractiveObject)& anobj,
- const Standard_Boolean updateviewer)
-{
- if (anobj.IsNull() || anobj->IsAutoHilight())
- return;
-
- SelectMgr_SequenceOfOwner aSeq;
- for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
- {
- if (aSelIter.Value()->IsSameSelectable (anobj))
- {
- aSeq.Append (aSelIter.Value());
- }
- }
-
- if ( aSeq.Length() )
- anobj->HilightSelected( myMainPM, aSeq );
- else
- anobj->ClearSelected();
-
- if(updateviewer){
- myCTX->CurrentViewer()->Update();
- }
-}
-
-//==================================================
-// Function: ClearSelected
-// Purpose :
-//==================================================
-void AIS_LocalContext::ClearSelected (const Standard_Boolean updateviewer)
-{
- UnhilightPicked(updateviewer);
- for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
- {
- aSelIter.Value()->SetSelected (Standard_False);
- }
- mySelection->Clear();
- mylastindex = 0;
-}
-
-//==================================================
-// Function: ClearOutdatedSelection
-// Purpose :
-//==================================================
-void AIS_LocalContext::ClearOutdatedSelection (const Handle(AIS_InteractiveObject)& theIO,
- const Standard_Boolean toClearDeactivated)
-{
- // 1. Collect selectable entities
- SelectMgr_IndexedMapOfOwner aValidOwners;
- const TColStd_ListOfInteger& aModes = SelectionModes (theIO);
- for (TColStd_ListIteratorOfListOfInteger aModeIter (aModes); aModeIter.More(); aModeIter.Next())
- {
- const int aMode = aModeIter.Value();
- if (!theIO->HasSelection(aMode))
- {
- continue;
- }
-
- if (toClearDeactivated && !mySM->IsActivated(theIO, aMode, myMainVS))
- {
- continue;
- }
-
- const Handle(SelectMgr_Selection)& aSelection = theIO->Selection (aMode);
- for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
- {
- if (Handle(SelectBasics_SensitiveEntity) anEntity = aSelEntIter.Value()->BaseSensitive())
- {
- if (Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId()))
- {
- aValidOwners.Add (anOwner);
- }
- }
- }
- }
-
- // 2. Refresh context's detection and selection and keep only active owners.
- // Keep last detected object for lastindex initialization.
- Handle(SelectMgr_EntityOwner) aLastPicked;
- if (IsValidIndex (mylastindex))
- {
- aLastPicked = myMapOfOwner->FindKey (mylastindex);
- }
-
- // Remove entity owners from detected sequences
- for (Standard_Integer anIdx = 1; anIdx <= myDetectedSeq.Length(); ++anIdx)
- {
- Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (myDetectedSeq (anIdx));
- if (anOwner.IsNull() || !anOwner->IsSameSelectable (theIO) || aValidOwners.Contains (anOwner))
- {
- continue;
- }
-
- myDetectedSeq.Remove (anIdx--);
- if (myCurDetected > anIdx)
- {
- --myCurDetected;
- }
- if (myAISCurDetected > anIdx)
- {
- --myAISCurDetected;
- }
- }
- myCurDetected = Max (myCurDetected, 1);
- myAISCurDetected = Max (myAISCurDetected, 1);
-
- // 3. AIS_Selection : remove entity owners from AIS_Selection
- const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
- NCollection_List<Handle(SelectMgr_EntityOwner)> aRemoveEntites;
- for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
- {
- Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
- if (!anOwner->IsSameSelectable (theIO))
- {
- continue;
- }
-
- if (!aValidOwners.Contains (anOwner))
- {
- aRemoveEntites.Append (anOwner);
- anOwner->SetSelected (Standard_False);
- for (V3d_ListOfViewIterator anActiveViewIter (aViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
- {
- Unhilight (anOwner, anActiveViewIter.Value());
- }
- }
- }
-
- for (NCollection_List<Handle(SelectMgr_EntityOwner)>::Iterator anIterRemove (aRemoveEntites);
- anIterRemove.More(); anIterRemove.Next())
- {
- mySelection->Select (anIterRemove.Value());
- }
-
- // 4. AIS_LocalContext - myMapOfOwner : remove entity owners from myMapOfOwner
- SelectMgr_IndexedMapOfOwner anOwnersToKeep;
- for (Standard_Integer anIdx = 1; anIdx <= myMapOfOwner->Extent(); anIdx++)
- {
- Handle(SelectMgr_EntityOwner) anOwner = myMapOfOwner->FindKey (anIdx);
- if (anOwner.IsNull())
- {
- continue;
- }
-
- if (!anOwner->IsSameSelectable (theIO) || aValidOwners.Contains (anOwner))
- {
- anOwnersToKeep.Add (anOwner);
- }
- else
- {
- for (V3d_ListOfViewIterator anActiveViewIter (aViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
- {
- Unhilight (anOwner, anActiveViewIter.Value());
- }
- }
- }
- myMapOfOwner->Clear();
- myMapOfOwner->Assign (anOwnersToKeep);
-
- if (myDetectedSeq.IsEmpty() && !aLastPicked.IsNull())
- {
- myMainPM->ClearImmediateDraw();
- mylastindex = 0;
- }
- else if (!aLastPicked.IsNull())
- {
- // For a case when the last detected owner was unhilighted and removed as outdated we
- // need to check if there were other detected owners with less priority. If yes then
- // one from the remaining should be treated.
- Standard_Integer anIndex = 1, aDetectedSeqLength = myDetectedSeq.Length();
- for (; anIndex <= aDetectedSeqLength; anIndex++)
- {
- if (aLastPicked == myMainVS->Picked (myDetectedSeq.Value(anIndex)))
- {
- break; // detected owner was not removed
- }
- }
- if (anIndex <= aDetectedSeqLength)
- {
- // Last detected owner was not removed, update mylastindex variable
- mylastindex = myMapOfOwner->FindIndex (aLastPicked);
- }
- else
- {
- // Last detected owner was removed. First object from sequence become detected.
- // Pass any active view because in current implementation the highlighting is
- // synchronized in all view.
- manageDetected (myMainVS->Picked (myDetectedSeq.First()),
- aViewer->ActiveViewIterator().Value(),
- Standard_False);
- }
- }
-}
-
-//=======================================================================
-//function : SetSelected
-//purpose :
-//=======================================================================
-void AIS_LocalContext::SetSelected(const Handle(AIS_InteractiveObject)& anIObj,
- const Standard_Boolean updateviewer)
-{
- if(!IsValidForSelection(anIObj)) return;
- UnhilightPicked(Standard_False);
-
- //1st case, owner already <anIObj> as owner
- // and not separated is found...
-
- Handle(SelectMgr_EntityOwner) EO = FindSelectedOwnerFromIO(anIObj);
- if(EO.IsNull()){
- //check if global selection there is an owner that can be triturated...
- if (anIObj->HasSelection (anIObj->GlobalSelectionMode()))
- {
- EO = anIObj->GlobalSelOwner();
- }
- if(EO.IsNull())
- EO = new SelectMgr_EntityOwner((const Handle(SelectMgr_SelectableObject)&)anIObj);
- }
-
- ClearSelected(Standard_False);
-
- mySelection->Select(EO);
- EO->SetSelected (Standard_True);
-
- HilightPicked(updateviewer);
-}
-
-//=======================================================================
-//function : AddOrRemoveSelected
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::AddOrRemoveSelected(const Handle(AIS_InteractiveObject)& anIObj,
- const Standard_Boolean updateviewer)
-{
- if(!IsValidForSelection(anIObj)) return;
- UnhilightPicked(Standard_False);
- // first check if it is selected...
- Handle(SelectMgr_EntityOwner) EO;
-
- EO = FindSelectedOwnerFromIO(anIObj);
-
- if (EO.IsNull())
- {
- if(anIObj->HasSelection (anIObj->GlobalSelectionMode()))
- {
- EO = anIObj->GlobalSelOwner();
- }
- if(EO.IsNull())
- {
- EO = new SelectMgr_EntityOwner((const Handle(SelectMgr_SelectableObject)&)anIObj);
- }
- }
-
- if (!mySelection.IsNull())
- {
- AIS_SelectStatus aStatus = mySelection->Select(EO);
- EO->SetSelected (aStatus == AIS_SS_Added);
- }
-
- HilightPicked(updateviewer);
-}
-
-//=======================================================================
-//function : AddOrRemoveSelected
-//purpose : To check...
-//=======================================================================
-void AIS_LocalContext::AddOrRemoveSelected(const TopoDS_Shape& Sh,
- const Standard_Boolean updateviewer)
-{
- UnhilightPicked (Standard_False);
- Handle(SelectMgr_EntityOwner) EO = FindSelectedOwnerFromShape(Sh);
- if (!EO.IsNull())
- {
- mySelection->Select(EO);
- EO->SetSelected (Standard_True);
- }
- HilightPicked (updateviewer);
-}
-
-void AIS_LocalContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
- const Standard_Boolean toUpdateViewer)
-{
- if(myAutoHilight)
- {
- UnhilightPicked (Standard_False);
- }
-
- Standard_Boolean toSelect = theOwner->IsSelected() ? Standard_False : Standard_True;
-
- mySelection->Select(theOwner);
- theOwner->SetSelected (toSelect);
-
- if(myAutoHilight)
- {
- HilightPicked (toUpdateViewer);
- }
-}
-
-//==================================================
-// Function: manageDetected
-// Purpose :
-//==================================================
-void AIS_LocalContext::manageDetected (const Handle(SelectMgr_EntityOwner)& thePickOwner,
- const Handle(V3d_View)& theView,
- const Standard_Boolean theToRedrawImmediate)
-{
- if (thePickOwner.IsNull())
- {
- myMainPM->ClearImmediateDraw();
- if (theToRedrawImmediate)
- {
- theView->RedrawImmediate();
- }
- return;
- }
-
- if (!myFilters->IsOk (thePickOwner))
- {
- if (mylastindex != 0)
- {
- mylastgood = mylastindex;
- }
- if (theToRedrawImmediate)
- {
- theView->RedrawImmediate();
- }
- return;
- }
-
- //=======================================================================================================
- // 2 cases : a- object is in the map of picks:
- // 1. this is the same index as the last detected: -> Do nothing
- // 2. otherwise :
- // - if lastindex = 0 (no object was detected at the last step)
- // the object presentation is highlighted and lastindex = index(objet)
- // - othrwise :
- // the presentation of the object corresponding to lastindex is "unhighlighted"
- // it is removed if the object is not visualized but only active
- // then the presentation of the detected object is highlighted and lastindex = index(objet)
- // b- the object is not in the map of picked objects
- // - if lastindex != 0 (object detected at the last step) it is unhighlighted ...
- // if the object was decomposed, presentation is created for the detected shape and the couple
- // (Proprietaire,Prs)is added in the map.
- // otherwise the couple(proprietaire, NullPrs) is placed in the map and the interactive object
- // itself is highlighted.
- //
- //=======================================================================================================
-
- const Standard_Integer aNewIndex = myMapOfOwner->Contains (thePickOwner)
- ? myMapOfOwner->FindIndex (thePickOwner)
- : myMapOfOwner->Add (thePickOwner);
-
- // For the advanced mesh selection mode the owner indices comparison
- // is not effective because in that case only one owner manage the
- // selection in current selection mode. It is necessary to check the current detected
- // entity and hilight it only if the detected entity is not the same as
- // previous detected (IsForcedHilight call)
- if (aNewIndex != mylastindex
- || thePickOwner->IsForcedHilight())
- {
- myMainPM->ClearImmediateDraw();
- if (mylastindex != 0
- && mylastindex <= myMapOfOwner->Extent())
- {
- const Handle(SelectMgr_EntityOwner)& aLastOwner = myMapOfOwner->FindKey (mylastindex);
- Unhilight (aLastOwner, theView);
- }
-
- if (myAutoHilight)
- {
- if (!thePickOwner->IsSelected() || myCTX->ToHilightSelected())
- {
- Hilight (thePickOwner, theView);
- }
- if (theToRedrawImmediate)
- {
- theView->RedrawImmediate();
- }
- }
-
- mylastindex = aNewIndex;
- }
-
- if (mylastindex != 0)
- {
- mylastgood = mylastindex;
- }
-}
-
-//=======================================================================
-//function : HasDetectedShape
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::HasDetectedShape() const
-{
- if(mylastindex==0) return Standard_False;
- return IsShape(mylastindex);
-}
-
-//=======================================================================
-//function : DetectedShape
-//purpose :
-//=======================================================================
-
-const TopoDS_Shape&
-AIS_LocalContext::DetectedShape() const
-{
- if(mylastindex != 0)
- {
- Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(myMapOfOwner->FindKey (mylastindex));
- if(BROwnr.IsNull()) return AIS_LocalContext_myDummyShape;
- return BROwnr->Shape();
- }
- return AIS_LocalContext_myDummyShape;
-}
-
-//=======================================================================
-//function : DetectedInteractive
-//purpose :
-//=======================================================================
-
-Handle(AIS_InteractiveObject)
-AIS_LocalContext::DetectedInteractive() const
-{
- Handle(AIS_InteractiveObject) Iobj;
- if(IsValidIndex(mylastindex)){
- Handle(SelectMgr_SelectableObject) SO = myMapOfOwner->FindKey(mylastindex)->Selectable();
- Iobj = Handle(AIS_InteractiveObject)::DownCast (SO);
- }
- return Iobj;
-}
-//=======================================================================
-//function : DetectedInteractive
-//purpose :
-//=======================================================================
-Handle(SelectMgr_EntityOwner) AIS_LocalContext::DetectedOwner() const
-{
- Handle(SelectMgr_EntityOwner) bid;
- if(!IsValidIndex(mylastindex)) return bid;
- return myMapOfOwner->FindKey(mylastindex);
-}
-
-
-//=======================================================================
-//function : ComesFromDecomposition
-//purpose :
-//=======================================================================
-
-Standard_Boolean AIS_LocalContext::ComesFromDecomposition(const Standard_Integer PickedIndex) const
-{
- const Handle(SelectMgr_EntityOwner)& OWN = myMapOfOwner->FindKey(PickedIndex);
- Handle(SelectMgr_SelectableObject) aSel = OWN->Selectable();
- if (myActiveObjects.IsBound (aSel)) { // debug of jmi
- const Handle(AIS_LocalStatus)& Stat = myActiveObjects(aSel);
- return Stat->Decomposed();
- }
- return Standard_False;
-}
-
-//=======================================================================
-//function : DisplaySensitive
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::DisplaySensitive(const Handle(V3d_View)& aviou)
-{
- myMainVS->DisplaySensitive(aviou);
-}
-
-//=======================================================================
-//function : ClearSensitive
-//purpose :
-//=======================================================================
-
-void AIS_LocalContext::ClearSensitive(const Handle(V3d_View)& aviou)
-{
- myMainVS->ClearSensitive(aviou);
-}
-
-
-//=======================================================================
-//function : IsShape
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_LocalContext::IsShape(const Standard_Integer Index) const
-{
- Handle(SelectMgr_EntityOwner) aEO (myMapOfOwner->FindKey(Index));
- if (aEO.IsNull() || ! aEO->IsKind(STANDARD_TYPE(StdSelect_BRepOwner)))
- return Standard_False;
- return
- ComesFromDecomposition(Index);
-}
-
-Standard_Boolean AIS_LocalContext::IsValidForSelection(const Handle(AIS_InteractiveObject)& anIObj) const
-{
- const Handle(SelectMgr_SelectableObject)& aSelObj = anIObj; // to avoid ambiguity
- // Shape was not transfered from AIS_Shape to EntityOwner
- Handle(AIS_Shape) shape = Handle(AIS_Shape)::DownCast(anIObj);
- if( !shape.IsNull() )
- return myFilters->IsOk(new StdSelect_BRepOwner(shape->Shape(), aSelObj));
- return myFilters->IsOk(new SelectMgr_EntityOwner(aSelObj));
-}
-
-
-//=======================================================================
-//function : HilightNextDetected
-//purpose :
-//=======================================================================
-Standard_Integer AIS_LocalContext::HilightNextDetected (const Handle(V3d_View)& theView,
- const Standard_Boolean theToRedrawImmediate)
-{
- // go to the next owner
- if (myDetectedSeq.IsEmpty())
- {
- return 0;
- }
-
- const Standard_Integer aLen = myDetectedSeq.Length();
- if (++myCurDetected > aLen)
- {
- myCurDetected = 1;
- }
- Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (myDetectedSeq (myCurDetected));
- if (anOwner.IsNull())
- {
- return 0;
- }
- manageDetected (anOwner, theView, theToRedrawImmediate);
- return myCurDetected;
-}
-
-//=======================================================================
-//function : HilightPreviousDetected
-//purpose :
-//=======================================================================
-Standard_Integer AIS_LocalContext::HilightPreviousDetected (const Handle(V3d_View)& theView,
- const Standard_Boolean theToRedrawImmediate)
-{
- if (myDetectedSeq.IsEmpty())
- {
- return 0;
- }
-
- const Standard_Integer aLen = myDetectedSeq.Length();
- if (--myCurDetected < 1)
- {
- myCurDetected = aLen;
- }
- Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (myDetectedSeq (myCurDetected));
- if (anOwner.IsNull())
- {
- return 0;
- }
-
- manageDetected (anOwner, theView, theToRedrawImmediate);
- return myCurDetected;
-}
-
-//=======================================================================
-//function : UnhilightLastDetected
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_LocalContext::UnhilightLastDetected (const Handle(V3d_View)& theView)
-{
- return UnhilightLastDetected (theView->Viewer());
-}
-
-//=======================================================================
-//function : UnhilightLastDetected
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_LocalContext::UnhilightLastDetected (const Handle(V3d_Viewer)& theViewer)
-{
- if (!IsValidIndex (mylastindex))
- {
- return Standard_False;
- }
-
- myMainPM->BeginImmediateDraw();
- const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (mylastindex);
- anOwner->Unhilight (myMainPM);
- myMainPM->EndImmediateDraw (theViewer);
- mylastindex = 0;
- return Standard_True;
-}
-
-//=======================================================================
-//function : FindSelectedOwnerFromIO
-//purpose : it is checked if one of the selected owners really presents IObj
-//=======================================================================
-Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromIO (const Handle(AIS_InteractiveObject)& theObj) const
-{
- Handle(SelectMgr_EntityOwner) EO,bid;
- if (theObj.IsNull()
- || mySelection.IsNull())
- {
- return Handle(SelectMgr_EntityOwner)();
- }
-
- for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
- {
- if (!aSelIter.Value()->IsSameSelectable (theObj))
- {
- continue;
- }
-
- Handle(StdSelect_BRepOwner) aBROwner = Handle(StdSelect_BRepOwner)::DownCast(aSelIter.Value());
- if (aBROwner.IsNull()
- || !aBROwner->ComesFromDecomposition())
- {
- return aSelIter.Value();
- }
- }
- return Handle(SelectMgr_EntityOwner)();
-}
-
-//=======================================================================
-//function : FindSelectedOwnerFromShape
-//purpose : it is checked if one of the selected owners really presents IObj
-//=======================================================================
-Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromShape(const TopoDS_Shape& sh) const
-{
- Handle(SelectMgr_EntityOwner) EO, bid;
- if (sh.IsNull()) return EO;
-
- if(mySelection.IsNull()) {
- return EO;
- }
-
- Standard_Boolean found(Standard_False);
-
- if (!found) {
- NCollection_List<Handle(SelectBasics_EntityOwner)> anActiveOwners;
- myMainVS->ActiveOwners (anActiveOwners);
- for (NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt (anActiveOwners); anOwnersIt.More(); anOwnersIt.Next())
- {
- EO = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
- Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(EO);
- if (!BROwnr.IsNull() && BROwnr->HasShape() && BROwnr->Shape() == sh) {
- found = Standard_True;
- break;
- }
- }
- }
-
- if(found) return EO;
- return bid;
-}
-
-//=======================================================================
-//function : AIS_LocalContext::InitDetected
-//purpose :
-//=======================================================================
-void AIS_LocalContext::InitDetected()
-{
- myAISCurDetected = !myDetectedSeq.IsEmpty() ? myDetectedSeq.Lower() : 0;
-}
-
-//=======================================================================
-//function : AIS_LocalContext::MoreDetected
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_LocalContext::MoreDetected() const
-{
- return myAISCurDetected >= myDetectedSeq.Lower()
- && myAISCurDetected <= myDetectedSeq.Upper();
-}
-
-//=======================================================================
-//function : AIS_LocalContext::NextDetected
-//purpose :
-//=======================================================================
-void AIS_LocalContext::NextDetected()
-{
- myAISCurDetected++;
-}
-
-//=======================================================================
-//function : DetectedCurrentShape
-//purpose :
-//=======================================================================
-const TopoDS_Shape& AIS_LocalContext::DetectedCurrentShape() const
-{
- Handle(AIS_Shape) aCurrentShape = Handle(AIS_Shape)::DownCast (DetectedCurrentObject());
-
- if (aCurrentShape.IsNull())
- {
- return AIS_LocalContext_myDummyShape;
- }
-
- return aCurrentShape->Shape();
-}
-
-//=======================================================================
-//function : DetectedCurrentOwner
-//purpose :
-//=======================================================================
-Handle(SelectMgr_EntityOwner) AIS_LocalContext::DetectedCurrentOwner() const
-{
- return MoreDetected()
- ? myMainVS->Picked (myDetectedSeq (myAISCurDetected))
- : Handle(SelectMgr_EntityOwner)();
-}
-
-//=======================================================================
-//function : DetectedCurrentObject
-//purpose :
-//=======================================================================
-Handle(AIS_InteractiveObject) AIS_LocalContext::DetectedCurrentObject() const
-{
- if (!MoreDetected())
- {
- return Handle(AIS_InteractiveObject)();
- }
- return Handle(AIS_InteractiveObject)::DownCast (myMainVS->Picked (myDetectedSeq (myAISCurDetected))->Selectable());
-}
-
-//=======================================================================
-//function : RestoreActivatedModes
-//purpose :
-//=======================================================================
-void AIS_LocalContext::RestoreActivatedModes() const
-{
- for (AIS_DataMapOfSelStat::Iterator anIter (myActiveObjects); anIter.More(); anIter.Next())
- {
- const TColStd_ListOfInteger& anActivatedModes = anIter.Value()->SelectionModes();
- for (TColStd_ListIteratorOfListOfInteger aModesIter (anActivatedModes); aModesIter.More(); aModesIter.Next())
- {
- mySM->Activate (anIter.Key(), aModesIter.Value(), myMainVS);
- }
- }
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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
+++ /dev/null
-// 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;}
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
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
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)
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);
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) {
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();
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);
#include <QABugs.hxx>
#include <AIS_InteractiveContext.hxx>
-#include <AIS_LocalContext.hxx>
#include <AIS_Shape.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepOffsetAPI_MakePipe.hxx>
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 :
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
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);
__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);
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);
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Graphic3d_ClipPlane.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
#include <fstream>
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)
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>
#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>
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);
SelectMgr_CompositionFilter.cxx
SelectMgr_CompositionFilter.hxx
SelectMgr_CompositionFilter.lxx
-SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors.hxx
-SelectMgr_DataMapOfObjectSelectors.hxx
SelectMgr_EntityOwner.cxx
SelectMgr_EntityOwner.hxx
SelectMgr_Filter.cxx
SelectMgr_SequenceOfFilter.hxx
SelectMgr_SequenceOfOwner.hxx
SelectMgr_SequenceOfSelection.hxx
-SelectMgr_SequenceOfSelector.hxx
SelectMgr_SOPtr.hxx
SelectMgr_SortCriterion.hxx
SelectMgr_StateOfSelection.hxx
+++ /dev/null
-// 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
+++ /dev/null
-// 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
#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);
}
//==================================================
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 :
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;
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())
{
{
if (theObject->HasSelection (theMode))
{
- theSelector->RemoveSelectionOfObject (theObject, aSelection);
+ mySelector->RemoveSelectionOfObject (theObject, aSelection);
}
theObject->RecomputePrimitives (theMode);
// pass through SelectMgr_TOU_Partial
case SelectMgr_TOU_Partial:
{
theObject->UpdateTransformations (aSelection);
- theSelector->RebuildObjectsTree();
+ mySelector->RebuildObjectsTree();
break;
}
default:
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;
}
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));
}
}
// 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())
- {
- theSelector->Deactivate (aSelIter.Value());
- }
- }
- else if (!aSel.IsNull())
+ for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
{
- theSelector->Deactivate (aSel);
+ mySelector->Deactivate (aSelIter.Value());
}
- 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);
}
}
//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;
}
{
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;
}
//=======================================================================
// 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);
}
}
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();
}
//=======================================================================
// 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);
}
}
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();
}
//==================================================
{
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);
}
//==================================================
{
return;
}
- if (!myGlobal.Contains (theObject)
- && !myLocal.IsBound (theObject))
+ if (!myGlobal.Contains (theObject))
{
return;
}
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())
{
case SelectMgr_TOU_Partial:
{
theObject->UpdateTransformations (aSelection);
- rebuildSelectionStructures();
- break;
- }
- default:
- break;
- }
- 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();
+ mySelector->RebuildObjectsTree();
break;
}
default:
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);
- }
}
}
// 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)
{
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);
}
}
const Standard_Integer aPrevSens = aSel->Sensitivity();
aSel->SetSensitivity (theNewSens);
- if (myGlobal.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))
+ if (myGlobal.Contains (theObject)
+ && mySelector->Contains (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;
}
}
//=======================================================================
void SelectMgr_SelectionManager::UpdateSelection (const Handle(SelectMgr_SelectableObject)& theObject)
{
- if (myGlobal.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))
+ if (myGlobal.Contains (theObject)
+ && mySelector->Contains (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);
}
}
#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;
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;
//! 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,
//! 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);
//! 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;
};
+++ /dev/null
-// 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
#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>
return 1;
}
- Standard_DISABLE_DEPRECATION_WARNINGS
- if (aCtx->HasOpenedContext())
- {
- aCtx->CloseLocalContext();
- }
- Standard_ENABLE_DEPRECATION_WARNINGS
-
Standard_Integer anArgIter = 1;
for (; anArgIter < theArgNb; ++anArgIter)
{
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)
{
toPrintInfo = Standard_False;
}
- else if (anArg == "-local")
- {
- toRemoveLocal = Standard_True;
- }
else if (anUpdateTool.parseRedrawMode (anArg))
{
continue;
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)
{
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;
}
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)
{
continue;
}
- else if (anArgCase == "-local")
- {
- toEraseLocal = Standard_True;
- }
else if (anArgCase == "-view"
|| anArgCase == "-inview")
{
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
else if (!toEraseAll && aCtx->NbSelected() > 0)
{
// Erase selected objects
- const Standard_Boolean aHasOpenedContext = aCtx->HasOpenedContext();
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
anIter.More(); anIter.Next())
{
{
aCtx->SetViewAffinity (anIO, aView, Standard_False);
}
- else if (aHasOpenedContext)
- {
- aCtx->Erase (anIO, Standard_False);
- }
}
}
}
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;
}
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())
{
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;
{
toDisplayInView = Standard_True;
}
- else if (aNameCase == "-local")
- {
- aDispStatus = AIS_DS_Temporary;
- toDisplayLocal = Standard_True;
- }
else if (aNameCase == "-redisplay")
{
toReDisplay = Standard_True;
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)
{
{
aShape->SetHilightMode (anObjHighMode);
}
- if (!toDisplayLocal)
- GetMapOfAIS().Bind (aShape, aName);
+ GetMapOfAIS().Bind (aShape, aName);
Standard_Integer aDispMode = aShape->HasDisplayMode()
? aShape->DisplayMode()
: (aShape->AcceptDisplayMode (aCtx->DisplayMode())
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())
{
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);
}
AIS_ListOfInteractive aListOfIO;
- aContextAIS->DisplayedObjects(aListOfIO, false);
+ aContextAIS->DisplayedObjects (aListOfIO);
theDi << aListOfIO.Extent() << "\n";
return 0;
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)
{
}
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
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())
theDI << "\n";
}
printLocalSelectionInfo (aCtx, theDI);
- Standard_DISABLE_DEPRECATION_WARNINGS
- if (aCtx->HasOpenedContext())
- printLocalSelectionInfo (aCtx->LocalContext(), theDI);
- Standard_ENABLE_DEPRECATION_WARNINGS
return 0;
}
// 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())
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)
{
GetMapOfAIS().Bind (aShape, aName);
}
- aCtx->Load (aShape, -1, Standard_False);
+ aCtx->Load (aShape, -1);
aCtx->Activate (aShape, aShape->GlobalSelectionMode(), Standard_True);
}
}
__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",
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]"
}
NCollection_Sequence<TCollection_AsciiString> anObjNames;
- Standard_Integer toOpenLocalCtx = -1;
Standard_Integer aSelectionMode = -1;
Standard_Boolean toTurnOn = Standard_True;
AIS_SelectionModesConcurrency aSelModeConcurrency = AIS_SelectionModesConcurrency_GlobalOrLocal;
{
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;
}
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;
{
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)
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
+++ /dev/null
-puts "==========="
-puts "BUC26658"
-puts "==========="
-puts "=================================="
-puts "It takes visual check for this BUG"
-puts "=================================="
-
-vinit
-BUC26658
+++ /dev/null
-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
+++ /dev/null
-
-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
+++ /dev/null
-puts "==========="
-puts "BUC60818"
-puts "==========="
-
-vinit
-BUC60818
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png
-
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
-
-
+++ /dev/null
-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
+++ /dev/null
-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
-
+++ /dev/null
-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
-
+++ /dev/null
-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
-
+++ /dev/null
-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
+++ /dev/null
-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
-
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
#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>
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();
}
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();
if (theToDisplay)
{
aContext->Display(aPresentation, false);
- aContext->Load(aPresentation, -1, true);
+ aContext->Load(aPresentation, -1);
}
else
aContext->Erase(aPresentation, false);