return -1;
if (myObjects.IsBound (theIObj))
+ {
return theIObj->GetZLayer (myMainPM);
+ }
+ else if (HasOpenedContext ())
+ {
+ return myLocalContexts (myCurLocalIndex)->GetZLayer (theIObj);
+ }
- return myLocalContexts (myCurLocalIndex)->GetZLayer (theIObj);
+ return -1;
}
MyGraphicDriver->ClipLimit (MyCView, AWait);
MyGraphicDriver->Environment(MyCView);
+ // Make view manager z layer list consistent with the view's list.
+ MyViewManager->InstallZLayers (this);
+
// Update planses of model clipping
UpdatePlanes ();
-- from lowest layer to highest ( foreground ). The first layer ID
-- in sequence is the default layer that can't be removed.
+ InstallZLayers ( me;
+ theView : View from Visual3d )
+ is private;
+ ---Purpose: Install z layers managed by the view manager into the
+ -- controlled view. This method used on the view initialization to
+ -- make the layer lists consistent.
+
getZLayerGenId ( myclass )
---Purpose: Returns global instance of z layer ids generator.
---C++: return &
static Aspect_GenId aGenId (1, IntegerLast());
return aGenId;
}
+
+//=======================================================================
+//function : InstallZLayers
+//purpose :
+//=======================================================================
+
+void Visual3d_ViewManager::InstallZLayers(const Handle(Visual3d_View)& theView) const
+{
+ if (!MyDefinedView.Contains (theView))
+ return;
+
+ // erase and insert layers iteratively to provide the same layer order as
+ // in the view manager's sequence. This approach bases on the layer insertion
+ // order: the new layers are always appended to the end of the list
+ // inside of view, while layer remove operation doesn't affect the order.
+ // Starting from second layer : no need to change the default z layer.
+ for (Standard_Integer aSeqIdx = 2; aSeqIdx <= myLayerSeq.Length (); aSeqIdx++)
+ {
+ Standard_Integer aLayerID = myLayerSeq.Value (aSeqIdx);
+ theView->RemoveZLayer (aLayerID);
+ theView->AddZLayer (aLayerID);
+ }
+}