mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0028407: Visualization - remove ::UpdateMode() from Graphic3d_StructureManager
This commit is contained in:
@@ -86,12 +86,12 @@ void Graphic3d_CView::Activate()
|
||||
if (anAnswer == Graphic3d_TOA_YES
|
||||
|| anAnswer == Graphic3d_TOA_COMPUTE)
|
||||
{
|
||||
Display (aStruct, Aspect_TOU_WAIT);
|
||||
Display (aStruct);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Update (myStructureManager->UpdateMode());
|
||||
Update();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -122,11 +122,11 @@ void Graphic3d_CView::Deactivate()
|
||||
if (anAnswer == Graphic3d_TOA_YES
|
||||
|| anAnswer == Graphic3d_TOA_COMPUTE)
|
||||
{
|
||||
Erase (aStruct, Aspect_TOU_WAIT);
|
||||
Erase (aStruct);
|
||||
}
|
||||
}
|
||||
|
||||
Update (myStructureManager->UpdateMode());
|
||||
Update();
|
||||
myIsActive = Standard_False;
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ void Graphic3d_CView::Remove()
|
||||
|
||||
for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (aDisplayedStructs); aStructIter.More(); aStructIter.Next())
|
||||
{
|
||||
Erase (aStructIter.Value(), Aspect_TOU_WAIT);
|
||||
Erase (aStructIter.Value());
|
||||
}
|
||||
|
||||
myStructsToCompute.Clear();
|
||||
@@ -212,7 +212,7 @@ void Graphic3d_CView::SetComputedMode (const Standard_Boolean theMode)
|
||||
eraseStructure (aStruct->CStructure());
|
||||
displayStructure (myStructsComputed.Value (anIndex)->CStructure(), aStruct->DisplayPriority());
|
||||
|
||||
Display (aStruct, Aspect_TOU_WAIT);
|
||||
Display (aStruct);
|
||||
if (aStruct->IsHighlighted())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.Value (anIndex);
|
||||
@@ -262,7 +262,7 @@ void Graphic3d_CView::SetComputedMode (const Standard_Boolean theMode)
|
||||
displayStructure (aCompStruct->CStructure(), aStruct->DisplayPriority());
|
||||
}
|
||||
}
|
||||
Update (myStructureManager->UpdateMode());
|
||||
Update();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -347,16 +347,9 @@ void Graphic3d_CView::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
|
||||
// function : Update
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_CView::Update (const Aspect_TypeOfUpdate theUpdateMode,
|
||||
const Graphic3d_ZLayerId theLayerId)
|
||||
void Graphic3d_CView::Update (const Graphic3d_ZLayerId theLayerId)
|
||||
{
|
||||
InvalidateZLayerBoundingBox (theLayerId);
|
||||
|
||||
if (theUpdateMode == Aspect_TOU_ASAP)
|
||||
{
|
||||
Compute();
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -589,10 +582,9 @@ Graphic3d_TypeOfAnswer Graphic3d_CView::acceptDisplay (const Graphic3d_TypeOfStr
|
||||
void Graphic3d_CView::Compute()
|
||||
{
|
||||
// force HLRValidation to False on all structures calculated in the view
|
||||
const Standard_Integer aNbCompStructs = myStructsComputed.Length();
|
||||
for (Standard_Integer aStructIter = 1; aStructIter <= aNbCompStructs; ++aStructIter)
|
||||
for (Graphic3d_SequenceOfStructure::Iterator aStructIter (myStructsComputed); aStructIter.More(); aStructIter.Next())
|
||||
{
|
||||
myStructsComputed.Value (aStructIter)->SetHLRValidation (Standard_False);
|
||||
aStructIter.Value()->SetHLRValidation (Standard_False);
|
||||
}
|
||||
|
||||
if (!ComputedMode())
|
||||
@@ -615,7 +607,7 @@ void Graphic3d_CView::Compute()
|
||||
|
||||
for (NCollection_Sequence<Handle(Graphic3d_Structure)>::Iterator aStructIter (aStructsSeq); aStructIter.More(); aStructIter.Next())
|
||||
{
|
||||
Display (aStructIter.ChangeValue(), Aspect_TOU_WAIT);
|
||||
Display (aStructIter.ChangeValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -676,16 +668,6 @@ void Graphic3d_CView::Disconnect (const Handle(Graphic3d_Structure)& theMother,
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure)
|
||||
{
|
||||
Display (theStructure, myStructureManager->UpdateMode());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Display
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
const Aspect_TypeOfUpdate theUpdateMode)
|
||||
{
|
||||
if (!IsActive())
|
||||
{
|
||||
@@ -725,7 +707,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
|
||||
theStructure->CalculateBoundBox();
|
||||
displayStructure (theStructure->CStructure(), theStructure->DisplayPriority());
|
||||
Update (theUpdateMode, theStructure->GetZLayer());
|
||||
Update (theStructure->GetZLayer());
|
||||
return;
|
||||
}
|
||||
else if (anAnswer != Graphic3d_TOA_COMPUTE)
|
||||
@@ -746,7 +728,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
}
|
||||
|
||||
displayStructure (anOldStruct->CStructure(), theStructure->DisplayPriority());
|
||||
Update (theUpdateMode, anOldStruct->GetZLayer());
|
||||
Update (anOldStruct->GetZLayer());
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -769,7 +751,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
const Handle(Graphic3d_Structure)& aNewStruct = myStructsComputed.Value (aNewIndex);
|
||||
myStructsComputed.SetValue (anIndex, aNewStruct);
|
||||
displayStructure (aNewStruct->CStructure(), theStructure->DisplayPriority());
|
||||
Update (theUpdateMode, aNewStruct->GetZLayer());
|
||||
Update (aNewStruct->GetZLayer());
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -849,7 +831,7 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
myStructsDisplayed.Add (theStructure);
|
||||
displayStructure (aStruct->CStructure(), theStructure->DisplayPriority());
|
||||
|
||||
Update (theUpdateMode, aStruct->GetZLayer());
|
||||
Update (aStruct->GetZLayer());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -857,16 +839,6 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_CView::Erase (const Handle(Graphic3d_Structure)& theStructure)
|
||||
{
|
||||
Erase (theStructure, myStructureManager->UpdateMode());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Erase
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_CView::Erase (const Handle(Graphic3d_Structure)& theStructure,
|
||||
const Aspect_TypeOfUpdate theUpdateMode)
|
||||
{
|
||||
if (!IsDisplayed (theStructure))
|
||||
{
|
||||
@@ -893,7 +865,7 @@ void Graphic3d_CView::Erase (const Handle(Graphic3d_Structure)& theStructure,
|
||||
}
|
||||
}
|
||||
myStructsDisplayed.Remove (theStructure);
|
||||
Update (theUpdateMode, theStructure->GetZLayer());
|
||||
Update (theStructure->GetZLayer());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
#include <Aspect_Handle.hxx>
|
||||
#include <Aspect_RenderingContext.hxx>
|
||||
#include <Aspect_TypeOfUpdate.hxx>
|
||||
#include <Aspect_Window.hxx>
|
||||
#include <Graphic3d_BufferType.hxx>
|
||||
#include <Graphic3d_Camera.hxx>
|
||||
@@ -106,10 +105,11 @@ public:
|
||||
//! Computes the new presentation of the structure displayed in this view with the type Graphic3d_TOS_COMPUTED.
|
||||
Standard_EXPORT void ReCompute (const Handle(Graphic3d_Structure)& theStructure);
|
||||
|
||||
//! Updates screen in function of modifications of the structures
|
||||
//! and invalidates bounding box of specified ZLayerId.
|
||||
Standard_EXPORT void Update (const Aspect_TypeOfUpdate theUpdateMode,
|
||||
const Graphic3d_ZLayerId theLayerId = Graphic3d_ZLayerId_UNKNOWN);
|
||||
//! Invalidates bounding box of specified ZLayerId.
|
||||
Standard_EXPORT void Update (const Graphic3d_ZLayerId theLayerId = Graphic3d_ZLayerId_UNKNOWN);
|
||||
|
||||
//! Computes the new presentation of the structures displayed in this view with the type Graphic3d_TOS_COMPUTED.
|
||||
Standard_EXPORT void Compute();
|
||||
|
||||
//! Returns Standard_True if one of the structures displayed in the view contains Polygons, Triangles or Quadrangles.
|
||||
Standard_EXPORT Standard_Boolean ContainsFacet() const;
|
||||
@@ -158,9 +158,6 @@ private:
|
||||
//! Is it possible to display the structure in the view?
|
||||
Standard_EXPORT Graphic3d_TypeOfAnswer acceptDisplay (const Graphic3d_TypeOfStructure theStructType) const;
|
||||
|
||||
//! Computes the new presentation of the structures displayed in this view with the type Graphic3d_TOS_COMPUTED.
|
||||
Standard_EXPORT void Compute();
|
||||
|
||||
//! Clears the structure in this view.
|
||||
Standard_EXPORT void Clear (const Handle(Graphic3d_Structure)& theStructure, const Standard_Boolean theWithDestruction);
|
||||
|
||||
@@ -175,17 +172,9 @@ private:
|
||||
//! Displays the structure in the view.
|
||||
Standard_EXPORT void Display (const Handle(Graphic3d_Structure)& theStructure);
|
||||
|
||||
//! Display the structure in the view.
|
||||
Standard_EXPORT void Display (const Handle(Graphic3d_Structure)& theStructure,
|
||||
const Aspect_TypeOfUpdate theUpdateMode);
|
||||
|
||||
//! Erases the structure from the view.
|
||||
Standard_EXPORT void Erase (const Handle(Graphic3d_Structure)& theStructure);
|
||||
|
||||
//! Erases the structure from the view.
|
||||
Standard_EXPORT void Erase (const Handle(Graphic3d_Structure)& theStructure,
|
||||
const Aspect_TypeOfUpdate theUpdateMode);
|
||||
|
||||
//! Highlights the structure in the view.
|
||||
Standard_EXPORT void Highlight (const Handle(Graphic3d_Structure)& theStructure);
|
||||
|
||||
|
@@ -208,7 +208,7 @@ void Graphic3d_Group::Update() const
|
||||
return;
|
||||
}
|
||||
|
||||
myStructure->StructureManager()->Update (myStructure->StructureManager()->UpdateMode());
|
||||
myStructure->StructureManager()->Update();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -619,24 +619,10 @@ void Graphic3d_Structure::SetVisual (const Graphic3d_TypeOfStructure theVisual)
|
||||
}
|
||||
else
|
||||
{
|
||||
Aspect_TypeOfUpdate anUpdateMode = myStructureManager->UpdateMode();
|
||||
if (anUpdateMode == Aspect_TOU_WAIT)
|
||||
{
|
||||
Erase();
|
||||
myVisual = theVisual;
|
||||
SetComputeVisual (theVisual);
|
||||
Display();
|
||||
}
|
||||
else {
|
||||
// To avoid calling method : Update ()
|
||||
// Not useful and can be costly.
|
||||
myStructureManager->SetUpdateMode (Aspect_TOU_WAIT);
|
||||
Erase();
|
||||
myVisual = theVisual;
|
||||
SetComputeVisual (theVisual);
|
||||
myStructureManager->SetUpdateMode (anUpdateMode);
|
||||
Display();
|
||||
}
|
||||
Erase();
|
||||
myVisual = theVisual;
|
||||
SetComputeVisual (theVisual);
|
||||
Display();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1254,8 +1240,7 @@ void Graphic3d_Structure::Update (const bool theUpdateLayer) const
|
||||
return;
|
||||
}
|
||||
|
||||
myStructureManager->Update (myStructureManager->UpdateMode(),
|
||||
theUpdateLayer ? myCStructure->ZLayer() : Graphic3d_ZLayerId_UNKNOWN);
|
||||
myStructureManager->Update (theUpdateLayer ? myCStructure->ZLayer() : Graphic3d_ZLayerId_UNKNOWN);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@@ -30,7 +30,6 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_StructureManager,MMgt_TShared)
|
||||
// ========================================================================
|
||||
Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver)
|
||||
: myViewGenId (0, 31),
|
||||
myUpdateMode (Aspect_TOU_WAIT),
|
||||
myGraphicDriver (theDriver)
|
||||
{
|
||||
//
|
||||
@@ -51,12 +50,11 @@ Graphic3d_StructureManager::~Graphic3d_StructureManager()
|
||||
// function : Update
|
||||
// purpose :
|
||||
// ========================================================================
|
||||
void Graphic3d_StructureManager::Update (const Aspect_TypeOfUpdate theMode,
|
||||
const Graphic3d_ZLayerId theLayerId) const
|
||||
void Graphic3d_StructureManager::Update (const Graphic3d_ZLayerId theLayerId) const
|
||||
{
|
||||
for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next())
|
||||
{
|
||||
aViewIt.Value()->Update (theMode, theLayerId);
|
||||
aViewIt.Value()->Update (theLayerId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <Aspect_GenId.hxx>
|
||||
#include <Aspect_TypeOfHighlightMethod.hxx>
|
||||
#include <Aspect_TypeOfUpdate.hxx>
|
||||
#include <Graphic3d_CView.hxx>
|
||||
#include <Graphic3d_MapOfObject.hxx>
|
||||
#include <Graphic3d_MapOfStructure.hxx>
|
||||
@@ -66,31 +65,8 @@ public:
|
||||
//! Deletes the manager <me>.
|
||||
Standard_EXPORT ~Graphic3d_StructureManager();
|
||||
|
||||
//! Modifies the screen update mode.
|
||||
//!
|
||||
//! TOU_ASAP - as soon as possible
|
||||
//! TOU_WAIT - on demand (with the Update function)
|
||||
//! Note : Dynamic Operations and Update Mode
|
||||
//! Use SetUpdateMode to control when changes to
|
||||
//! the display are made. Use one of the following
|
||||
//! functions to update one or more views:
|
||||
//! - Update all views of the viewer: Graphic3d_StructureManager::Update()
|
||||
//! - Update one view of the viewer: Graphic3d_View::Update()
|
||||
//! Use one of the following functions to update the entire display:
|
||||
//! - Redraw all structures in all views: Graphic3d_StructureManager::Redraw()
|
||||
//! - Redraw all structures in one view: Graphic3d_View::Redraw()
|
||||
void SetUpdateMode (const Aspect_TypeOfUpdate theType) { myUpdateMode = theType; }
|
||||
|
||||
//! Returns the screen update mode.
|
||||
//!
|
||||
//! TOU_ASAP as soon as possible
|
||||
//! TOU_WAIT on demand (Update)
|
||||
Aspect_TypeOfUpdate UpdateMode() const { return myUpdateMode; }
|
||||
|
||||
//! Updates screen in function of modifications of the structures
|
||||
//! and invalidates bounding box of specified ZLayerId.
|
||||
Standard_EXPORT virtual void Update (const Aspect_TypeOfUpdate theMode = Aspect_TOU_ASAP,
|
||||
const Graphic3d_ZLayerId theLayerId = Graphic3d_ZLayerId_UNKNOWN) const;
|
||||
//! Invalidates bounding box of specified ZLayerId.
|
||||
Standard_EXPORT virtual void Update (const Graphic3d_ZLayerId theLayerId = Graphic3d_ZLayerId_UNKNOWN) const;
|
||||
|
||||
//! Deletes and erases the 3D structure manager.
|
||||
Standard_EXPORT virtual void Remove();
|
||||
@@ -193,7 +169,6 @@ protected:
|
||||
protected:
|
||||
|
||||
Aspect_GenId myViewGenId;
|
||||
Aspect_TypeOfUpdate myUpdateMode;
|
||||
Graphic3d_MapOfStructure myDisplayedStructure;
|
||||
Graphic3d_MapOfStructure myHighlightedStructure;
|
||||
Graphic3d_MapOfObject myRegisteredObjects;
|
||||
|
Reference in New Issue
Block a user