Remove the AIS_InteractiveContext::DisplayedModes() method.
Remove list of active display modes from AIS_GlobalStatus.
// commercial license or contractual agreement.
+#include <AIS_DisplayMode.hxx>
#include <AIS_GlobalStatus.hxx>
#include <Standard_Type.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
AIS_GlobalStatus::AIS_GlobalStatus():
myStatus(AIS_DS_None),
+myDispMode(AIS_WireFrame),
myLayerIndex(0),
myIsHilit(Standard_False),
myHiCol(Quantity_NOC_WHITE),
const Quantity_NameOfColor TheHiCol,
const Standard_Integer Layer):
myStatus(DS),
+myDispMode(DMode),
myLayerIndex(Layer),
myIsHilit(Standard_False),
myHiCol(TheHiCol),
mySubInt(Standard_False)
{
- myDispModes.Append(DMode);
mySelModes.Append(SMode);
}
-void AIS_GlobalStatus::RemoveDisplayMode(const Standard_Integer aMode)
-{
- TColStd_ListIteratorOfListOfInteger anIt (myDispModes);
- for (; anIt.More(); anIt.Next())
- {
- if (anIt.Value() == aMode)
- {
- myDispModes.Remove (anIt);
- return;
- }
- }
-}
-
void AIS_GlobalStatus::RemoveSelectionMode(const Standard_Integer aMode)
{
TColStd_ListIteratorOfListOfInteger anIt (mySelModes);
mySelModes.Clear();
}
-Standard_Boolean AIS_GlobalStatus::IsDModeIn(const Standard_Integer aMode) const
-{
- TColStd_ListIteratorOfListOfInteger anIt (myDispModes);
- for (; anIt.More(); anIt.Next())
- {
- if (anIt.Value() == aMode)
- {
- return Standard_True;
- }
- }
- return Standard_False;
-}
-
Standard_Boolean AIS_GlobalStatus::IsSModeIn(const Standard_Integer aMode) const
{
TColStd_ListIteratorOfListOfInteger anIt (mySelModes);
void SetGraphicStatus (const AIS_DisplayStatus aStat);
- void AddDisplayMode (const Standard_Integer aMode);
-
void AddSelectionMode (const Standard_Integer aMode);
+
+ //! Sets display mode.
+ void SetDisplayMode (const Standard_Integer theMode);
+
+ //! Returns the display mode.
+ Standard_Integer DisplayMode() const;
void SetLayerIndex (const Standard_Integer AnIndex);
void SubIntensityOff();
- Standard_EXPORT void RemoveDisplayMode (const Standard_Integer aMode);
-
Standard_EXPORT void RemoveSelectionMode (const Standard_Integer aMode);
Standard_EXPORT void ClearSelectionModes();
AIS_DisplayStatus GraphicStatus() const;
- //! keeps the information of displayed modes in the
- //! main viewer.
- const TColStd_ListOfInteger& DisplayedModes() const;
-
//! keeps the active selection modes of the object
//! in the main viewer.
const TColStd_ListOfInteger& SelectionModes() const;
Quantity_NameOfColor HilightColor() const;
- Standard_EXPORT Standard_Boolean IsDModeIn (const Standard_Integer aMode) const;
-
Standard_EXPORT Standard_Boolean IsSModeIn (const Standard_Integer aMode) const;
//! Returns layer index.
AIS_DisplayStatus myStatus;
- TColStd_ListOfInteger myDispModes;
+ Standard_Integer myDispMode;
TColStd_ListOfInteger mySelModes;
Standard_Integer myLayerIndex;
Standard_Boolean myIsHilit;
myStatus = aStat;
}
-inline void AIS_GlobalStatus::AddDisplayMode(const Standard_Integer aMode)
+inline void AIS_GlobalStatus::SetDisplayMode (const Standard_Integer theMode)
{
- if(!IsDModeIn(aMode)) myDispModes.Append(aMode);
+ myDispMode = theMode;
}
-
inline void AIS_GlobalStatus::AddSelectionMode(const Standard_Integer aMode)
{
if(!IsSModeIn(aMode)) mySelModes.Append(aMode);
return myStatus;
}
-inline const TColStd_ListOfInteger& AIS_GlobalStatus::DisplayedModes() const
+inline Standard_Integer AIS_GlobalStatus::DisplayMode() const
{
- return myDispModes;
+ return myDispMode;
}
inline const TColStd_ListOfInteger& AIS_GlobalStatus::SelectionModes() const
// Mark the presentation modes hidden of interactive object different from aDispMode.
// Then make sure aDispMode is displayed and maybe highlighted.
// Finally, activate selection mode <SelMode> if not yet activated.
- TColStd_ListOfInteger aModesToRemove;
- for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
+ const Standard_Integer anOldMode = aStatus->DisplayMode();
+ if (anOldMode != theDispMode)
{
- const Standard_Integer anOldMode = aDispModeIter.Value();
- if (anOldMode != theDispMode)
+ if(myMainPM->IsHighlighted (theIObj, anOldMode))
{
- aModesToRemove.Append (anOldMode);
- if(myMainPM->IsHighlighted (theIObj, anOldMode))
- {
- myMainPM->Unhighlight (theIObj, anOldMode);
- }
- myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
+ myMainPM->Unhighlight (theIObj, anOldMode);
}
+ myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
}
- for (TColStd_ListIteratorOfListOfInteger aRemModeIter (aModesToRemove); aRemModeIter.More(); aRemModeIter.Next())
- {
- aStatus->RemoveDisplayMode (aRemModeIter.Value());
- }
-
- if (!aStatus->IsDModeIn (theDispMode))
- {
- aStatus->AddDisplayMode (theDispMode);
- }
+ aStatus->SetDisplayMode (theDispMode);
myMainPM->Display (theIObj, theDispMode);
aStatus->SetGraphicStatus (AIS_DS_Displayed);
return AIS_DS_None;
}
-//=======================================================================
-//function : DisplayedModes
-//purpose :
-//=======================================================================
-const TColStd_ListOfInteger& AIS_InteractiveContext::DisplayedModes (const Handle(AIS_InteractiveObject)& theIObj) const
-{
- return myObjects (theIObj)->DisplayedModes();
-}
-
//=======================================================================
//function : Remove
//purpose :
{
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
if (aStatus->GraphicStatus() == AIS_DS_Displayed
- && aStatus->IsDModeIn (theMode))
+ && theIObj->DisplayMode() == theMode)
{
return Standard_True;
}
}
Handle(AIS_GlobalStatus) aStatus = anObjIter.Value();
- if (aStatus->IsDModeIn (myDisplayMode))
- {
- aStatus->RemoveDisplayMode (myDisplayMode);
- }
+ aStatus->SetDisplayMode (theMode);
- aStatus->AddDisplayMode (theMode);
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
myMainPM->Display (anObj, theMode);
}
// erase presentations for all display modes different from <aMode>
- TColStd_ListOfInteger aModesToRemove;
- for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
+ const Standard_Integer anOldMode = aStatus->DisplayMode();
+ if (anOldMode != theMode)
{
- const Standard_Integer anOldMode = aDispModeIter.Value();
- if (anOldMode != theMode)
+ if (myMainPM->IsHighlighted (theIObj, anOldMode))
{
- aModesToRemove.Append (anOldMode);
- if (myMainPM->IsHighlighted (theIObj, anOldMode))
- {
- myMainPM->Unhighlight (theIObj, anOldMode);
- }
- myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
+ myMainPM->Unhighlight (theIObj, anOldMode);
}
+ myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
}
- for (TColStd_ListIteratorOfListOfInteger aRemModeIter (aModesToRemove); aRemModeIter.More(); aRemModeIter.Next())
- {
- aStatus->RemoveDisplayMode (aRemModeIter.Value());
- }
-
- if (!aStatus->IsDModeIn (theMode))
- {
- aStatus->AddDisplayMode (theMode);
- }
+ aStatus->SetDisplayMode (theMode);
myMainPM->Display (theIObj, theMode);
Standard_Integer aDispMode, aHiMode, aSelMode;
}
const Handle(AIS_GlobalStatus)& aStatus = myObjects (theIObj);
- aStatus->RemoveDisplayMode (anOldMode);
- if (!aStatus->IsDModeIn(myDisplayMode))
- {
- aStatus->AddDisplayMode (myDisplayMode);
- }
+ aStatus->SetDisplayMode (myDisplayMode);
if (aStatus->GraphicStatus() == AIS_DS_Displayed)
{
}
theStatus += "\t| Active Display Modes in the MainViewer :\n";
- for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
- {
- theStatus += "\t|\t Mode ";
- theStatus += TCollection_AsciiString (aDispModeIter.Value());
- theStatus += "\n";
- }
+ theStatus += "\t|\t Mode ";
+ theStatus += TCollection_AsciiString (aStatus->DisplayMode());
+ theStatus += "\n";
+
if (IsSelected(theIObj)) theStatus +="\t| Selected\n";
theStatus += "\t| Active Selection Modes in the MainViewer :\n";
return;
}
- for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
+ if (aStatus->IsHilighted())
{
- if (aStatus->IsHilighted())
+ if (IsCurrent (theIObj))
{
- if (IsCurrent (theIObj))
- {
- AddOrRemoveCurrentObject (theIObj, Standard_False);
- }
- else if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
- {
- myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
- }
+ AddOrRemoveCurrentObject (theIObj, Standard_False);
+ }
+ else if (myMainPM->IsHighlighted (theIObj, aStatus->DisplayMode()))
+ {
+ myMainPM->Unhighlight (theIObj, aStatus->DisplayMode());
}
-
- myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
}
+ myMainPM->SetVisibility (theIObj, aStatus->DisplayMode(), Standard_False);
+
if (aStatus->IsHilighted()
&& theIObj->HasHilightMode())
{
}
if (IsSelected (theIObj)
- && !aStatus->IsDModeIn (aDispMode))
+ && aStatus->DisplayMode() != aDispMode)
{
myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
}
}
const Handle(AIS_GlobalStatus)& aStatus = myObjects (theIObj);
- if (aStatus->IsDModeIn (theMode))
+ if (aStatus->DisplayMode() == theMode)
{
const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
if (aDispMode == theMode
Standard_EXPORT AIS_DisplayStatus DisplayStatus (const Handle(AIS_InteractiveObject)& anIobj) const;
- //! Returns the list of active display modes for the entity aniobj.
- Standard_EXPORT const TColStd_ListOfInteger& DisplayedModes (const Handle(AIS_InteractiveObject)& aniobj) const;
-
//! Returns true if anIobj is displayed in the interactive context.
Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anIobj) const;
GB->SubIntensityOn();
Standard_Boolean UpdMain(Standard_False);
- for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
- if (GB->GraphicStatus()==AIS_DS_Displayed)
- {
- myMainPM->Color(anIObj,mySubIntensity,It.Value());
- UpdMain = Standard_True;
- }
+ if (GB->GraphicStatus() == AIS_DS_Displayed)
+ {
+ myMainPM->Color (anIObj, mySubIntensity, GB->DisplayMode());
+ UpdMain = Standard_True;
}
if(updateviewer){
if(UpdMain)
if(myObjects.IsBound(anIObj)){
const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
STAT->SubIntensityOn();
- TColStd_ListIteratorOfListOfInteger ItL;
- for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
- myMainPM->Color(anIObj,mySubIntensity,ItL.Value());
+ myMainPM->Color (anIObj, mySubIntensity, STAT->DisplayMode());
}
else
myLocalContexts(myCurLocalIndex)->SubIntensityOn(anIObj);
GB->SubIntensityOff();
Standard_Boolean UpdMain(Standard_False);
- for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
- if(GB->GraphicStatus()==AIS_DS_Displayed)
- {
- myMainPM->Unhighlight(anIObj,It.Value());
- UpdMain = Standard_True;
- }
+ if(GB->GraphicStatus() == AIS_DS_Displayed)
+ {
+ myMainPM->Unhighlight (anIObj, GB->DisplayMode());
+ UpdMain = Standard_True;
}
Standard_Integer DM,HM,SM;
if(myObjects.IsBound(anIObj)){
const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
STAT->SubIntensityOff();
- TColStd_ListIteratorOfListOfInteger ItL;
- for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
- myMainPM->Unhighlight(anIObj,ItL.Value());
+ myMainPM->Unhighlight (anIObj, STAT->DisplayMode());
if(STAT->IsHilighted())
Hilight(anIObj);
}
if(!HasOpenedContext()) return;
AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
- TColStd_ListIteratorOfListOfInteger ItM;
for(;It.More();It.Next()){
const Handle(AIS_GlobalStatus)& STAT = It.Value();
if(STAT->GraphicStatus()==AIS_DS_Displayed)
{
STAT->SubIntensityOn();
- for(ItM.Initialize(STAT->DisplayedModes());ItM.More();ItM.Next())
- {myMainPM->Color(It.Key(),mySubIntensity,ItM.Value());}
+ myMainPM->Color (It.Key(), mySubIntensity, STAT->DisplayMode());
}
}
if(updateviewer) myMainVwr->Update();
if(!HasOpenedContext()) return;
AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
- TColStd_ListIteratorOfListOfInteger ItL;
for(;It.More();It.Next()){
const Handle(AIS_GlobalStatus)& STAT = It.Value();
if(STAT->IsSubIntensityOn())
STAT->SubIntensityOff();
- for(ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
- myMainPM->Unhighlight(It.Key());
+ myMainPM->Unhighlight (It.Key());
}
if(updateviewer) myMainVwr->Update();
upd_main = Standard_True;
// part display...
- for(itl.Initialize(STAT->DisplayedModes());itl.More();itl.Next())
- myMainPM->Display(iobj,itl.Value());
+ myMainPM->Display (iobj, STAT->DisplayMode());
if(STAT->IsHilighted()){
if(STAT->HilightColor()!=Quantity_NOC_WHITE)
HilightWithColor(iobj,STAT->HilightColor(),Standard_False);