return;
}
- Graphic3d_MapOfStructure aDisplayedStructs (myStructsDisplayed);
-
- for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (aDisplayedStructs); aStructIter.More(); aStructIter.Next())
+ Graphic3d_ViewStructureMap aDisplayedStructs (myStructsDisplayed);
+ for (Graphic3d_ViewStructureMap::Iterator aStructIter (aDisplayedStructs); aStructIter.More(); aStructIter.Next())
{
- Erase (aStructIter.Value());
+ Erase (aStructIter.Key());
}
myStructsToCompute.Clear();
myIsInComputedMode = theMode;
if (!myIsInComputedMode)
{
- for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
+ for (Graphic3d_ViewStructureMap::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
{
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
const Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
return;
}
- for (Graphic3d_MapOfStructure::Iterator aDispStructIter (myStructsDisplayed); aDispStructIter.More(); aDispStructIter.Next())
+ for (Graphic3d_ViewStructureMap::Iterator aDispStructIter (myStructsDisplayed); aDispStructIter.More(); aDispStructIter.Next())
{
Handle(Graphic3d_Structure) aStruct = aDispStructIter.Key();
const Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
// =======================================================================
void Graphic3d_CView::DisplayedStructures (Graphic3d_MapOfStructure& theStructures) const
{
- for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
+ for (Graphic3d_ViewStructureMap::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
{
theStructures.Add (aStructIter.Key());
}
// Remove structures that were calculated for the previous orientation.
// Recalculation of new structures.
NCollection_Sequence<Handle(Graphic3d_Structure)> aStructsSeq;
- for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
+ for (Graphic3d_ViewStructureMap::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
{
const Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (aStructIter.Key()->Visual());
if (anAnswer == Graphic3d_TOA_COMPUTE)
anAnswer = Graphic3d_TOA_YES;
}
+ const Standard_Integer anOldExtent = myStructsDisplayed.Extent();
if (anAnswer == Graphic3d_TOA_YES)
{
- if (!myStructsDisplayed.Add (theStructure))
+ const Standard_Integer aPrsIndex = myStructsDisplayed.Add (theStructure, Handle(Graphic3d_Structure)());
+ if (aPrsIndex <= anOldExtent)
{
return;
}
if (anOldStruct->HLRValidation())
{
// Case COMPUTED valid, to be displayed
- if (!myStructsDisplayed.Add (theStructure))
+ const Standard_Integer aPrsIndex = myStructsDisplayed.Add (theStructure, Handle(Graphic3d_Structure)());
+ if (aPrsIndex <= anOldExtent)
{
return;
}
if (aNewIndex != 0)
{
// Case of COMPUTED invalid, WITH a valid of replacement; to be displayed
- if (!myStructsDisplayed.Add (theStructure))
+ const Standard_Integer aPrsIndex = myStructsDisplayed.Add (theStructure, Handle(Graphic3d_Structure)());
+ if (aPrsIndex <= anOldExtent)
{
return;
}
return;
}
- myStructsDisplayed.Add (theStructure);
+ const Standard_Integer aPrsIndex = myStructsDisplayed.Add (theStructure, Handle(Graphic3d_Structure)());
displayStructure (aStruct->CStructure(), theStructure->DisplayPriority());
Update (aStruct->GetZLayer());
myStructsToCompute.Remove (anIndex);
}
- myStructsDisplayed.Remove (theStructure);
+ myStructsDisplayed.RemoveKey (theStructure);
Update (theStructure->GetZLayer());
}
DEFINE_STANDARD_HANDLE (Graphic3d_CView, Graphic3d_DataStructureManager)
+/*struct Graphic3d_ViewStructure
+{
+ Handle(Graphic3d_Structure) Presentation;
+ Handle(Graphic3d_Structure) ViewPresentation;
+public:
+ //! Returns hash code for presentation.
+ static Standard_Integer HashCode (const Graphic3d_ViewStructure& thePrs,
+ const Standard_Integer theUpperBound)
+ {
+ return ::HashCode (thePrs.Presentation, theUpperBound);
+ }
+
+ //! Returns true if two objects are equal.
+ static Standard_Boolean IsEqual (const Graphic3d_ViewStructure& thePrs1,
+ const Graphic3d_ViewStructure& thePrs2)
+ {
+ return thePrs1.Presentation == thePrs2.Presentation;
+ }
+};*/
+
+typedef NCollection_IndexedDataMap<Handle(Graphic3d_Structure), Handle(Graphic3d_Structure)> Graphic3d_ViewStructureMap;
+
//! Base class of a graphical view that carries out rendering process for a concrete
//! implementation of graphical driver. Provides virtual interfaces for redrawing its
//! contents, management of displayed structures and render settings. The source code
Handle(Graphic3d_Camera) myCamera;
Graphic3d_SequenceOfStructure myStructsToCompute;
Graphic3d_SequenceOfStructure myStructsComputed;
- Graphic3d_MapOfStructure myStructsDisplayed;
+ //Graphic3d_MapOfStructure myStructsDisplayed;
+ Graphic3d_ViewStructureMap myStructsDisplayed;
Handle(Graphic3d_NMapOfTransient) myHiddenObjects;
Standard_Boolean myIsInComputedMode;
Standard_Boolean myIsActive;
}
//=============================================================================
-//function : Update
+//function : Redraw
//purpose :
//=============================================================================
-void V3d_View::Update() const
+void V3d_View::Redraw (bool theToCompute) const
{
if (!myView->IsDefined()
|| !myView->IsActive())
}
myIsInvalidatedImmediate = Standard_False;
- myView->Update();
- myView->Compute();
- AutoZFit();
- myView->Redraw();
-}
+ Handle(Graphic3d_StructureManager) aStructureMgr = MyViewer->StructureManager();
-//=============================================================================
-//function : Redraw
-//purpose :
-//=============================================================================
-void V3d_View::Redraw() const
-{
- if (!myView->IsDefined()
- || !myView->IsActive())
+ if (theToCompute)
{
- return;
+ //myView->Update();
+ myView->Compute();
}
- myIsInvalidatedImmediate = Standard_False;
- Handle(Graphic3d_StructureManager) aStructureMgr = MyViewer->StructureManager();
for (Standard_Integer aRetryIter = 0; aRetryIter < 2; ++aRetryIter)
{
if (aStructureMgr->IsDeviceLost())
Standard_EXPORT void Remove();
//! Deprecated, Redraw() should be used instead.
- Standard_EXPORT void Update() const;
+ void Update() const
+ {
+ Redraw (true);
+ }
- //! Redisplays the view even if there has not
- //! been any modification.
- //! Must be called if the view is shown.
- //! (Ex: DeIconification ) .
- Standard_EXPORT virtual void Redraw() const;
+ //! Redisplays the view even if there has not been any modification.
+ //! Must be called if the view is shown Ex: DeIconification).
+ Standard_EXPORT virtual void Redraw (bool theToCompute = false) const;
//! Updates layer of immediate presentations.
Standard_EXPORT virtual void RedrawImmediate() const;