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

0025467: Visualization - Possibility to remove AIS_LocalContext class

Deprecated functionality related to Local Context has been removed.

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

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

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

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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