mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presentation
Removed redundant proxy class Prs3d_Presentation - Graphic3d_Structure now should be used directly. Removed auxiliary class PrsMgr_ModedPresentation holding Structure and Display Mode index (field has been moved to Structure itself), so that PrsMgr_Presentations (AIS_InteractiveObject::Presentations()) now holds Structures directly. PrsMgr_Prs proxy class has been removed, and PrsMgr_Presentation now inherits Graphic3d_Structure. Graphic3d_Structure, maps declarations have been corrected to use class instead of void*, which allowed to avoid redundant casts. Several methods have been also modified to avoid creating Handle from this pointer. AIS package headers have been cleaned up from forward declaration of Prs3d_Presentation class. Fixed dereference of destroyed presentations within connected and HLR computed objects: - AIS_InteractiveContext::Disconnect() now erases connected presentation. - Graphic3d_CView::Clear() now removes destructed structures from Computed list. - fix inaccessibility of PrsMgr_Presentation methods
This commit is contained in:
@@ -32,7 +32,6 @@ Prs3d_PlaneAspect.hxx
|
||||
Prs3d_Point.hxx
|
||||
Prs3d_PointAspect.cxx
|
||||
Prs3d_PointAspect.hxx
|
||||
Prs3d_Presentation.cxx
|
||||
Prs3d_Presentation.hxx
|
||||
Prs3d_PresentationShadow.cxx
|
||||
Prs3d_PresentationShadow.hxx
|
||||
|
@@ -21,13 +21,11 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_NListOfSequenceOfPnt.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
|
||||
class TopoDS_Shape;
|
||||
class Prs3d_Presentation;
|
||||
|
||||
//! The Prs3d package provides the following services
|
||||
//! - a presentation object (the context for all
|
||||
|
@@ -1,146 +0,0 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-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 <Prs3d_Presentation.hxx>
|
||||
|
||||
#include <Geom_Transformation.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Graphic3d_DataStructureManager.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_NameOfMaterial.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Graphic3d_StructureManager.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Presentation,Graphic3d_Structure)
|
||||
|
||||
//=======================================================================
|
||||
//function : Prs3d_Presentation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Prs3d_Presentation::Prs3d_Presentation (const Handle(Graphic3d_StructureManager)& theViewer,
|
||||
const Standard_Boolean theToInit)
|
||||
: Graphic3d_Structure (theViewer)
|
||||
{
|
||||
if (!theToInit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Prs3d_Presentation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Prs3d_Presentation::Prs3d_Presentation (const Handle(Graphic3d_StructureManager)& theViewer,
|
||||
const Handle(Prs3d_Presentation)& thePrs)
|
||||
: Graphic3d_Structure (theViewer, thePrs)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Connect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_Presentation::Connect
|
||||
( const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
Graphic3d_Structure::Connect(aPresentation, Graphic3d_TOC_DESCENDANT);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Remove
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_Presentation::Remove (const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
Disconnect(aPresentation);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveAll
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_Presentation::RemoveAll ()
|
||||
{
|
||||
DisconnectAll(Graphic3d_TOC_DESCENDANT);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CurrentGroup
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Graphic3d_Group) Prs3d_Presentation::CurrentGroup () const
|
||||
{
|
||||
if (Groups().IsEmpty())
|
||||
{
|
||||
return const_cast<Prs3d_Presentation* >(this)->NewGroup();
|
||||
}
|
||||
return Groups().Last();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Graphic3d_Structure) Prs3d_Presentation::
|
||||
Compute(const Handle(Graphic3d_DataStructureManager)& /*aProjector*/)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_Presentation::Compute(const Handle(Graphic3d_DataStructureManager)& aDataStruct,
|
||||
Handle(Graphic3d_Structure)& aStruct)
|
||||
{
|
||||
Graphic3d_Structure::Compute(aDataStruct,aStruct );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Graphic3d_Structure) Prs3d_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theDataStruc,
|
||||
const Handle(Geom_Transformation)& theTrsf)
|
||||
{
|
||||
return Graphic3d_Structure::Compute (theDataStruc, theTrsf);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theDataStruc,
|
||||
const Handle(Geom_Transformation)& theTrsf,
|
||||
Handle(Graphic3d_Structure)& theStruc)
|
||||
{
|
||||
Graphic3d_Structure::Compute (theDataStruc, theTrsf, theStruc);
|
||||
}
|
@@ -17,71 +17,9 @@
|
||||
#ifndef _Prs3d_Presentation_HeaderFile
|
||||
#define _Prs3d_Presentation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
|
||||
class Prs3d_Root;
|
||||
class Graphic3d_StructureManager;
|
||||
class Graphic3d_Structure;
|
||||
class Graphic3d_DataStructureManager;
|
||||
class Geom_Transformation;
|
||||
class Graphic3d_Group;
|
||||
|
||||
class Prs3d_Presentation;
|
||||
DEFINE_STANDARD_HANDLE(Prs3d_Presentation, Graphic3d_Structure)
|
||||
|
||||
//! Defines a presentation object which can be displayed,
|
||||
//! highlighted or erased.
|
||||
//! The presentation object stores the results of the
|
||||
//! presentation algorithms as defined in the StdPrs
|
||||
//! classes and the Prs3d classes inheriting Prs3d_Root.
|
||||
//! This presentation object is used to give display
|
||||
//! attributes defined at this level to
|
||||
//! ApplicationInteractiveServices classes at the level above.
|
||||
//! A presentation object is attached to a given Viewer.
|
||||
class Prs3d_Presentation : public Graphic3d_Structure
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Constructs a presentation object
|
||||
//! if <Init> is false, no color initialization is done.
|
||||
Standard_EXPORT Prs3d_Presentation(const Handle(Graphic3d_StructureManager)& theStructManager, const Standard_Boolean theToInit = Standard_True);
|
||||
|
||||
//! Constructs a presentation object.
|
||||
Standard_EXPORT Prs3d_Presentation(const Handle(Graphic3d_StructureManager)& theStructManager, const Handle(Prs3d_Presentation)& thePrs);
|
||||
|
||||
Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the new Structure defined for the new visualization
|
||||
Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector,
|
||||
const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the new Structure defined for the new visualization
|
||||
Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, Handle(Graphic3d_Structure)& aStructure) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the new Structure defined for the new visualization
|
||||
Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& theProjector,
|
||||
const Handle(Geom_Transformation)& theTrsf,
|
||||
Handle(Graphic3d_Structure)& theStructure) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Connect (const Handle(Prs3d_Presentation)& aPresentation);
|
||||
|
||||
Standard_EXPORT void Remove (const Handle(Prs3d_Presentation)& aPresentation);
|
||||
|
||||
Standard_EXPORT void RemoveAll();
|
||||
|
||||
friend class Prs3d_Root;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Prs3d_Presentation,Graphic3d_Structure)
|
||||
|
||||
private:
|
||||
|
||||
Standard_EXPORT Handle(Graphic3d_Group) CurrentGroup() const;
|
||||
|
||||
};
|
||||
//! Alias for porting code.
|
||||
typedef Graphic3d_Structure Prs3d_Presentation;
|
||||
|
||||
#endif // _Prs3d_Presentation_HeaderFile
|
||||
|
@@ -15,18 +15,17 @@
|
||||
|
||||
#include <Prs3d_PresentationShadow.hxx>
|
||||
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_PresentationShadow,Prs3d_Presentation)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_PresentationShadow, Graphic3d_Structure)
|
||||
|
||||
//=======================================================================
|
||||
//function : Prs3d_PresentationShadow
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Prs3d_PresentationShadow::Prs3d_PresentationShadow (const Handle(Graphic3d_StructureManager)& theViewer,
|
||||
const Handle(Prs3d_Presentation)& thePrs)
|
||||
: Prs3d_Presentation (theViewer, thePrs),
|
||||
myParentStructId (thePrs->Identification()),
|
||||
myParentAffinity (thePrs->CStructure()->ViewAffinity)
|
||||
const Handle(Graphic3d_Structure)& thePrs)
|
||||
: Graphic3d_Structure (theViewer, thePrs),
|
||||
myParentAffinity (thePrs->CStructure()->ViewAffinity),
|
||||
myParentStructId (thePrs->Identification())
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@@ -19,14 +19,14 @@
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
|
||||
//! Defines a "shadow" of existing presentation object with custom aspects.
|
||||
class Prs3d_PresentationShadow : public Prs3d_Presentation
|
||||
class Prs3d_PresentationShadow : public Graphic3d_Structure
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Prs3d_PresentationShadow, Graphic3d_Structure)
|
||||
public:
|
||||
|
||||
//! Constructs a shadow of existing presentation object.
|
||||
Standard_EXPORT Prs3d_PresentationShadow (const Handle(Graphic3d_StructureManager)& theViewer,
|
||||
const Handle(Prs3d_Presentation)& thePrs);
|
||||
const Handle(Graphic3d_Structure)& thePrs);
|
||||
|
||||
//! Returns the id of the parent presentation
|
||||
inline Standard_Integer ParentId() const { return myParentStructId; }
|
||||
@@ -37,16 +37,13 @@ public:
|
||||
//! Do nothing - axis-aligned bounding box should be initialized from parent structure.
|
||||
Standard_EXPORT virtual void CalculateBoundBox() Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Prs3d_PresentationShadow,Prs3d_Presentation)
|
||||
|
||||
private:
|
||||
Standard_Integer myParentStructId;
|
||||
|
||||
Handle(Graphic3d_ViewAffinity) myParentAffinity;
|
||||
Standard_Integer myParentStructId;
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Prs3d_PresentationShadow, Prs3d_Presentation)
|
||||
DEFINE_STANDARD_HANDLE(Prs3d_PresentationShadow, Graphic3d_Structure)
|
||||
|
||||
#endif // _Prs3d_PresentationShadow_HeaderFile
|
||||
|
Reference in New Issue
Block a user