mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0032184: Visualization - remove ambiguous AIS_GlobalStatus constructor
Auxiliary AIS_GlobalStatus constructor has been removed. AIS_InteractiveContext::setObjectStatus() no more adds an invalid -1 mode to AIS_GlobalStatus. Never updated property AIS_GlobalStatus::GetLayerIndex() has been removed; AIS_InteractiveContext::SetTransformPersistence() has been corrected to use ZLayer defined within object itself.
This commit is contained in:
parent
33425a46b8
commit
42ddd0028c
@ -16,58 +16,15 @@
|
|||||||
|
|
||||||
#include <AIS_GlobalStatus.hxx>
|
#include <AIS_GlobalStatus.hxx>
|
||||||
|
|
||||||
#include <AIS_DisplayMode.hxx>
|
|
||||||
#include <Standard_Type.hxx>
|
|
||||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_GlobalStatus, Standard_Transient)
|
IMPLEMENT_STANDARD_RTTIEXT(AIS_GlobalStatus, Standard_Transient)
|
||||||
|
|
||||||
AIS_GlobalStatus::AIS_GlobalStatus():
|
// =======================================================================
|
||||||
myDispMode(AIS_WireFrame),
|
// function : AIS_GlobalStatus
|
||||||
myLayerIndex(0),
|
// purpose :
|
||||||
myIsHilit(Standard_False),
|
// =======================================================================
|
||||||
mySubInt(Standard_False)
|
AIS_GlobalStatus::AIS_GlobalStatus()
|
||||||
|
: myDispMode (0),
|
||||||
|
myIsHilit(Standard_False),
|
||||||
|
mySubInt (Standard_False)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
AIS_GlobalStatus::AIS_GlobalStatus (const Standard_Integer theDMode,
|
|
||||||
const Standard_Integer theSMode,
|
|
||||||
const Standard_Integer theLayer):
|
|
||||||
myDispMode (theDMode),
|
|
||||||
myLayerIndex (theLayer),
|
|
||||||
myIsHilit (Standard_False),
|
|
||||||
mySubInt (Standard_False)
|
|
||||||
{
|
|
||||||
mySelModes.Append (theSMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AIS_GlobalStatus::RemoveSelectionMode(const Standard_Integer aMode)
|
|
||||||
{
|
|
||||||
TColStd_ListIteratorOfListOfInteger anIt (mySelModes);
|
|
||||||
for (; anIt.More(); anIt.Next())
|
|
||||||
{
|
|
||||||
if (anIt.Value() == aMode)
|
|
||||||
{
|
|
||||||
mySelModes.Remove (anIt);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AIS_GlobalStatus::ClearSelectionModes()
|
|
||||||
{
|
|
||||||
mySelModes.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean AIS_GlobalStatus::IsSModeIn(const Standard_Integer aMode) const
|
|
||||||
{
|
|
||||||
TColStd_ListIteratorOfListOfInteger anIt (mySelModes);
|
|
||||||
for (; anIt.More(); anIt.Next())
|
|
||||||
{
|
|
||||||
if (anIt.Value() == aMode)
|
|
||||||
{
|
|
||||||
return Standard_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
@ -29,34 +29,25 @@
|
|||||||
|
|
||||||
DEFINE_STANDARD_HANDLE(AIS_GlobalStatus, Standard_Transient)
|
DEFINE_STANDARD_HANDLE(AIS_GlobalStatus, Standard_Transient)
|
||||||
|
|
||||||
//! Stores information about objects in graphic context:
|
//! Stores information about objects in graphic context:
|
||||||
//! - Status Of Display : in the main viewer
|
|
||||||
//! hidden in the main viewer
|
|
||||||
//! - Displayed Modes
|
|
||||||
//! - Active Selection Modes
|
|
||||||
//! - is the Interactive Object Current ?
|
|
||||||
//! - Layer Index
|
|
||||||
class AIS_GlobalStatus : public Standard_Transient
|
class AIS_GlobalStatus : public Standard_Transient
|
||||||
{
|
{
|
||||||
DEFINE_STANDARD_RTTIEXT(AIS_GlobalStatus, Standard_Transient)
|
DEFINE_STANDARD_RTTIEXT(AIS_GlobalStatus, Standard_Transient)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//! Default constructor.
|
||||||
Standard_EXPORT AIS_GlobalStatus();
|
Standard_EXPORT AIS_GlobalStatus();
|
||||||
|
|
||||||
Standard_EXPORT AIS_GlobalStatus (const Standard_Integer theDispMode,
|
|
||||||
const Standard_Integer theSelMode,
|
|
||||||
const Standard_Integer theLayerIndex = 0);
|
|
||||||
|
|
||||||
void AddSelectionMode (const Standard_Integer theMode) { if (!IsSModeIn (theMode)) mySelModes.Append (theMode); }
|
|
||||||
|
|
||||||
//! Sets display mode.
|
|
||||||
void SetDisplayMode (const Standard_Integer theMode) { myDispMode = theMode; }
|
|
||||||
|
|
||||||
//! Returns the display mode.
|
//! Returns the display mode.
|
||||||
Standard_Integer DisplayMode() const { return myDispMode; }
|
Standard_Integer DisplayMode() const { return myDispMode; }
|
||||||
|
|
||||||
void SetLayerIndex (const Standard_Integer theIndex) { myLayerIndex = theIndex; }
|
//! Sets display mode.
|
||||||
|
void SetDisplayMode (const Standard_Integer theMode) { myDispMode = theMode; }
|
||||||
|
|
||||||
|
//! Returns TRUE if object is highlighted
|
||||||
|
Standard_Boolean IsHilighted() const { return myIsHilit; }
|
||||||
|
|
||||||
|
//! Sets highlighted state.
|
||||||
void SetHilightStatus (const Standard_Boolean theStatus) { myIsHilit = theStatus; }
|
void SetHilightStatus (const Standard_Boolean theStatus) { myIsHilit = theStatus; }
|
||||||
|
|
||||||
//! Changes applied highlight style for a particular object
|
//! Changes applied highlight style for a particular object
|
||||||
@ -65,36 +56,47 @@ public:
|
|||||||
//! Returns applied highlight style for a particular object
|
//! Returns applied highlight style for a particular object
|
||||||
const Handle(Prs3d_Drawer)& HilightStyle() const { return myHiStyle; }
|
const Handle(Prs3d_Drawer)& HilightStyle() const { return myHiStyle; }
|
||||||
|
|
||||||
|
//! Returns active selection modes of the object.
|
||||||
|
const TColStd_ListOfInteger& SelectionModes() const { return mySelModes; }
|
||||||
|
|
||||||
|
//! Return TRUE if selection mode was registered.
|
||||||
|
Standard_Boolean IsSModeIn (Standard_Integer theMode) const
|
||||||
|
{
|
||||||
|
return mySelModes.Contains (theMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Add selection mode.
|
||||||
|
Standard_Boolean AddSelectionMode (const Standard_Integer theMode)
|
||||||
|
{
|
||||||
|
if (!mySelModes.Contains (theMode))
|
||||||
|
{
|
||||||
|
mySelModes.Append (theMode);
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Remove selection mode.
|
||||||
|
Standard_Boolean RemoveSelectionMode (const Standard_Integer theMode)
|
||||||
|
{
|
||||||
|
return mySelModes.Remove (theMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Remove all selection modes.
|
||||||
|
void ClearSelectionModes()
|
||||||
|
{
|
||||||
|
mySelModes.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
Standard_Boolean IsSubIntensityOn() const { return mySubInt; }
|
Standard_Boolean IsSubIntensityOn() const { return mySubInt; }
|
||||||
|
|
||||||
void SubIntensityOn() { mySubInt = Standard_True; }
|
void SetSubIntensity (Standard_Boolean theIsOn) { mySubInt = theIsOn; }
|
||||||
|
|
||||||
void SubIntensityOff() { mySubInt = Standard_False; }
|
|
||||||
|
|
||||||
Standard_EXPORT void RemoveSelectionMode (const Standard_Integer aMode);
|
|
||||||
|
|
||||||
Standard_EXPORT void ClearSelectionModes();
|
|
||||||
|
|
||||||
//! keeps the active selection modes of the object
|
|
||||||
//! in the main viewer.
|
|
||||||
const TColStd_ListOfInteger& SelectionModes() const { return mySelModes; }
|
|
||||||
|
|
||||||
Standard_Boolean IsHilighted() const { return myIsHilit; }
|
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean IsSModeIn (const Standard_Integer aMode) const;
|
|
||||||
|
|
||||||
//! Returns layer index.
|
|
||||||
Standard_Integer GetLayerIndex() const
|
|
||||||
{
|
|
||||||
return myLayerIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
TColStd_ListOfInteger mySelModes;
|
TColStd_ListOfInteger mySelModes;
|
||||||
Handle(Prs3d_Drawer) myHiStyle;
|
Handle(Prs3d_Drawer) myHiStyle;
|
||||||
Standard_Integer myDispMode;
|
Standard_Integer myDispMode;
|
||||||
Standard_Integer myLayerIndex;
|
|
||||||
Standard_Boolean myIsHilit;
|
Standard_Boolean myIsHilit;
|
||||||
Standard_Boolean mySubInt;
|
Standard_Boolean mySubInt;
|
||||||
|
|
||||||
|
@ -495,8 +495,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
|||||||
}
|
}
|
||||||
if (!mgrSelector->IsActivated (theIObj, theSelectionMode))
|
if (!mgrSelector->IsActivated (theIObj, theSelectionMode))
|
||||||
{
|
{
|
||||||
if (!aStatus->IsSModeIn (theSelectionMode))
|
aStatus->AddSelectionMode (theSelectionMode);
|
||||||
aStatus->AddSelectionMode (theSelectionMode);
|
|
||||||
mgrSelector->Activate (theIObj, theSelectionMode);
|
mgrSelector->Activate (theIObj, theSelectionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2402,7 +2401,7 @@ void AIS_InteractiveContext::SetTransformPersistence (const Handle(AIS_Interacti
|
|||||||
|
|
||||||
mgrSelector->UpdateSelection (theObject);
|
mgrSelector->UpdateSelection (theObject);
|
||||||
|
|
||||||
const Standard_Integer aLayerId = myObjects.Find (theObject)->GetLayerIndex();
|
const Graphic3d_ZLayerId aLayerId = theObject->ZLayer();
|
||||||
const Handle(V3d_Viewer)& aCurViewer = CurrentViewer();
|
const Handle(V3d_Viewer)& aCurViewer = CurrentViewer();
|
||||||
for (V3d_ListOfViewIterator anActiveViewIter (aCurViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
|
for (V3d_ListOfViewIterator anActiveViewIter (aCurViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
|
||||||
{
|
{
|
||||||
@ -2432,7 +2431,12 @@ void AIS_InteractiveContext::setObjectStatus (const Handle(AIS_InteractiveObject
|
|||||||
theIObj->SetDisplayStatus (theStatus);
|
theIObj->SetDisplayStatus (theStatus);
|
||||||
if (theStatus != PrsMgr_DisplayStatus_None)
|
if (theStatus != PrsMgr_DisplayStatus_None)
|
||||||
{
|
{
|
||||||
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (theDispMode, theSelectionMode);
|
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus();
|
||||||
|
aStatus->SetDisplayMode (theDispMode);
|
||||||
|
if (theSelectionMode != -1)
|
||||||
|
{
|
||||||
|
aStatus->AddSelectionMode (theSelectionMode);
|
||||||
|
}
|
||||||
myObjects.Bind (theIObj, aStatus);
|
myObjects.Bind (theIObj, aStatus);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2647,7 +2651,7 @@ void AIS_InteractiveContext::turnOnSubintensity (const Handle(AIS_InteractiveObj
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
aStatus->SubIntensityOn();
|
aStatus->SetSubIntensity (true);
|
||||||
myMainPM->Color (anObjsIter.Key(), aSubStyle, theDispMode != -1 ? theDispMode : aStatus->DisplayMode());
|
myMainPM->Color (anObjsIter.Key(), aSubStyle, theDispMode != -1 ? theDispMode : aStatus->DisplayMode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2664,7 +2668,7 @@ void AIS_InteractiveContext::turnOnSubintensity (const Handle(AIS_InteractiveObj
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aStatus->SubIntensityOn();
|
aStatus->SetSubIntensity (true);
|
||||||
myMainPM->Color (theObject, aSubStyle, theDispMode != -1 ? theDispMode : aStatus->DisplayMode());
|
myMainPM->Color (theObject, aSubStyle, theDispMode != -1 ? theDispMode : aStatus->DisplayMode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3992,7 +3996,7 @@ void AIS_InteractiveContext::SubIntensityOff (const Handle(AIS_InteractiveObject
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*aStatus)->SubIntensityOff();
|
(*aStatus)->SetSubIntensity (false);
|
||||||
Standard_Boolean toUpdateMain = Standard_False;
|
Standard_Boolean toUpdateMain = Standard_False;
|
||||||
if (theObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
|
if (theObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
|
||||||
{
|
{
|
||||||
|
@ -671,28 +671,6 @@ for(;wex.More();wex.Next())
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Standard_Integer OCC166 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
|
|
||||||
{
|
|
||||||
|
|
||||||
Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
|
|
||||||
if(myAISContext.IsNull()) {
|
|
||||||
di << "use 'vinit' command before " << argv[0];
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100);
|
|
||||||
Handle(AIS_Shape) anAISBox = new AIS_Shape(aBox.Shape());
|
|
||||||
myAISContext->SetAutoActivateSelection (Standard_False);
|
|
||||||
myAISContext->Display(anAISBox, 1);
|
|
||||||
|
|
||||||
TColStd_ListOfInteger anActivatedModes;
|
|
||||||
myAISContext->ActivatedModes (anAISBox, anActivatedModes);
|
|
||||||
if(anActivatedModes.Extent() != 1 || anActivatedModes.First() != -1 )
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <TDocStd_Document.hxx>
|
#include <TDocStd_Document.hxx>
|
||||||
#include <DDocStd.hxx>
|
#include <DDocStd.hxx>
|
||||||
#include <PCDM_StoreStatus.hxx>
|
#include <PCDM_StoreStatus.hxx>
|
||||||
@ -4992,7 +4970,6 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands) {
|
|||||||
theCommands.Add("OCC305","OCC305 file",__FILE__,OCC305,group);
|
theCommands.Add("OCC305","OCC305 file",__FILE__,OCC305,group);
|
||||||
|
|
||||||
// New commands:
|
// New commands:
|
||||||
theCommands.Add("OCC166", "OCC166", __FILE__, OCC166, group);
|
|
||||||
theCommands.Add("OCC381_Save", "OCC381_Save Doc", __FILE__, OCC381_Save, group);
|
theCommands.Add("OCC381_Save", "OCC381_Save Doc", __FILE__, OCC381_Save, group);
|
||||||
theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group);
|
theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group);
|
||||||
|
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
puts "================="
|
|
||||||
puts "OCC166"
|
|
||||||
puts "================="
|
|
||||||
puts ""
|
|
||||||
|
|
||||||
vinit
|
|
||||||
|
|
||||||
if [ catch { OCC166 } res ] then {
|
|
||||||
puts "OCC166: Error"
|
|
||||||
} else {
|
|
||||||
puts "OCC166: OK"
|
|
||||||
}
|
|
||||||
|
|
||||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
|
Loading…
x
Reference in New Issue
Block a user