mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-07-25 12:55:50 +03:00
Move OpenGl_Structure::myZLayer to base class Graphic3d_CStructure. Graphic3d_ZLayerId - introduce new pre-defined ZLayers. Do not clear Depth buffer twice for default ZLayer. AIS_InteractiveContext::Display() - add new argument AIS_DisplayStatus to specify displaying status. Drop unused Graphic3d_CPick and related methods. Drop OpenGl_Structure::myNamedStatus - use flags from parent class Graphic3d_CStructure directly. OpenGl_LayerList ::ChangeLayer(), ::ChangePriority - fix structure remove from unexpected layer. Merge class OpenGl_PriorityList into OpenGl_Layer. PrsMgr_PresentationManager::mySelectionColor - store selection color as field of Presentation Manager. PrsMgr_Presentation class - do not declare private methods as virtual. PrsMgr_Presentation::Highlight() - extend method syntax and drop methods ::Color() and ::BoundBox(). PrsMgr_PresentableObject - store ZLayer in presentable object to display object presentations in required layer directly (without displaying it in wrong layer first). test/mesh/end - force re-displaying the shape to compute mesh anew Test-case for issue
115 lines
4.2 KiB
C++
115 lines
4.2 KiB
C++
// Created on: 2011-10-20
|
|
// Created by: Sergey ZERCHANINOV
|
|
// Copyright (c) 2011-2014 OPEN CASCADE SAS
|
|
//
|
|
// This file is part of Open CASCADE Technology software library.
|
|
//
|
|
// This library is free software; you can redistribute it and/or modify it under
|
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
// by the Free Software Foundation, with special exception defined in the file
|
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
// distribution for complete text of the license and disclaimer of any warranty.
|
|
//
|
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
// commercial license or contractual agreement.
|
|
|
|
#include <OpenGl_GraphicDriver.hxx>
|
|
|
|
#include <NCollection_DataMap.hxx>
|
|
#include <OpenGl_Structure.hxx>
|
|
#include <OpenGl_CView.hxx>
|
|
|
|
void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCView,
|
|
const Handle(Graphic3d_Structure)& theStructure,
|
|
const Standard_Integer thePriority)
|
|
{
|
|
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
|
|
if (aCView == NULL)
|
|
return;
|
|
|
|
aCView->View->DisplayStructure (theStructure, thePriority);
|
|
}
|
|
|
|
void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView,
|
|
const Handle(Graphic3d_Structure)& theStructure)
|
|
{
|
|
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
|
|
if (aCView == NULL)
|
|
return;
|
|
|
|
aCView->View->EraseStructure (theStructure);
|
|
}
|
|
|
|
void OpenGl_GraphicDriver::RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure)
|
|
{
|
|
OpenGl_Structure* aStructure = NULL;
|
|
if (!myMapOfStructure.Find (theCStructure->Id, aStructure))
|
|
{
|
|
return;
|
|
}
|
|
|
|
myMapOfStructure.UnBind (theCStructure->Id);
|
|
aStructure->Release (GetSharedContext());
|
|
theCStructure.Nullify();
|
|
}
|
|
|
|
Handle(Graphic3d_CStructure) OpenGl_GraphicDriver::Structure (const Handle(Graphic3d_StructureManager)& theManager)
|
|
{
|
|
Handle(OpenGl_Structure) aStructure = new OpenGl_Structure (theManager);
|
|
myMapOfStructure.Bind (aStructure->Id, aStructure.operator->());
|
|
return aStructure;
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : ChangeZLayer
|
|
//purpose :
|
|
//=======================================================================
|
|
|
|
void OpenGl_GraphicDriver::ChangeZLayer (const Graphic3d_CStructure& theCStructure,
|
|
const Graphic3d_CView& theCView,
|
|
const Graphic3d_ZLayerId theNewLayerId)
|
|
{
|
|
const OpenGl_CView *aCView = (const OpenGl_CView *)theCView.ptrView;
|
|
|
|
if (!myMapOfStructure.IsBound (theCStructure.Id) || !aCView)
|
|
return;
|
|
|
|
OpenGl_Structure* aStructure = myMapOfStructure.Find (theCStructure.Id);
|
|
|
|
aCView->View->ChangeZLayer (aStructure, theNewLayerId);
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : UnsetZLayer
|
|
//purpose :
|
|
//=======================================================================
|
|
|
|
void OpenGl_GraphicDriver::UnsetZLayer (const Graphic3d_ZLayerId theLayerId)
|
|
{
|
|
NCollection_DataMap<Standard_Integer, OpenGl_Structure*>::Iterator aStructIt (myMapOfStructure);
|
|
for( ; aStructIt.More (); aStructIt.Next ())
|
|
{
|
|
OpenGl_Structure* aStruct = aStructIt.ChangeValue ();
|
|
if (aStruct->ZLayer() == theLayerId)
|
|
aStruct->SetZLayer (Graphic3d_ZLayerId_Default);
|
|
}
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : ChangePriority
|
|
//purpose :
|
|
//=======================================================================
|
|
void OpenGl_GraphicDriver::ChangePriority (const Graphic3d_CStructure& theCStructure,
|
|
const Graphic3d_CView& theCView,
|
|
const Standard_Integer theNewPriority)
|
|
{
|
|
const OpenGl_CView *aCView = (const OpenGl_CView *)theCView.ptrView;
|
|
|
|
if (!myMapOfStructure.IsBound (theCStructure.Id) || !aCView)
|
|
return;
|
|
|
|
OpenGl_Structure* aStructure = myMapOfStructure.Find (theCStructure.Id);
|
|
|
|
aCView->View->ChangePriority (aStructure, theNewPriority);
|
|
}
|