mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
0031431: Visualization, PrsMgr_PresentableObject - simplify HLR computing interface
Multiple PrsMgr_PresentableObject::Compute() methods have been replaced by single one PrsMgr_PresentableObject::computeHLR(). Dummy implementations of previously declared methods have been removed from AIS classes not implementng HLR presentation. Class Prs3d_Projector has been removed and Graphic3d_Camera is now passed directly, so that redundant dependency from HLRAlgo_Projector in Prs3d interfaces has been eliminated. StdPrs_HLRShape and StdPrs_HLRPolyShape now implement common interface StdPrs_HLRShapeI.
This commit is contained in:
@@ -8,6 +8,8 @@ StdPrs_HLRPolyShape.cxx
|
||||
StdPrs_HLRPolyShape.hxx
|
||||
StdPrs_HLRShape.cxx
|
||||
StdPrs_HLRShape.hxx
|
||||
StdPrs_HLRShapeI.cxx
|
||||
StdPrs_HLRShapeI.hxx
|
||||
StdPrs_HLRToolShape.cxx
|
||||
StdPrs_HLRToolShape.hxx
|
||||
StdPrs_Isolines.cxx
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include <HLRBRep_PolyAlgo.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <StdPrs_ToolTriangulatedShape.hxx>
|
||||
#include <StdPrs_WFShape.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
@@ -41,16 +41,24 @@
|
||||
#define PntY2 ((Standard_Real*)Coordinates)[4]
|
||||
#define PntZ2 ((Standard_Real*)Coordinates)[5]
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StdPrs_HLRPolyShape, StdPrs_HLRShapeI)
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void StdPrs_HLRPolyShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
|
||||
const TopoDS_Shape& aShape,
|
||||
const Handle (Prs3d_Drawer)& aDrawer,
|
||||
const Handle (Prs3d_Projector)& aProjector)
|
||||
void StdPrs_HLRPolyShape::ComputeHLR (const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const TopoDS_Shape& aShape,
|
||||
const Handle(Prs3d_Drawer)& aDrawer,
|
||||
const Handle(Graphic3d_Camera)& theProjector) const
|
||||
{
|
||||
gp_Dir aBackDir = -theProjector->Direction();
|
||||
gp_Dir aXpers = theProjector->Up().Crossed (aBackDir);
|
||||
gp_Ax3 anAx3 (theProjector->Center(), aBackDir, aXpers);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (anAx3);
|
||||
const HLRAlgo_Projector aProj (aTrsf, !theProjector->IsOrthographic(), theProjector->Scale());
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
|
||||
|
||||
TopExp_Explorer ex;
|
||||
@@ -76,8 +84,7 @@ void StdPrs_HLRPolyShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
|
||||
}
|
||||
|
||||
Handle(HLRBRep_PolyAlgo) hider = new HLRBRep_PolyAlgo(aShape);
|
||||
|
||||
hider->Projector(aProjector->Projector());
|
||||
hider->Projector (aProj);
|
||||
hider->Angle(aDrawer->HLRAngle());
|
||||
hider->Update();
|
||||
Standard_Real sta,end,dx,dy,dz;
|
||||
|
@@ -17,59 +17,26 @@
|
||||
#ifndef _StdPrs_HLRPolyShape_HeaderFile
|
||||
#define _StdPrs_HLRPolyShape_HeaderFile
|
||||
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <StdPrs_HLRShapeI.hxx>
|
||||
|
||||
class TopoDS_Shape;
|
||||
class Prs3d_Projector;
|
||||
|
||||
//! Instantiates Prs3d_PolyHLRShape to define a
|
||||
//! display of a shape where hidden and visible lines are
|
||||
//! identified with respect to a given projection.
|
||||
//! StdPrs_HLRPolyShape works with a polyhedral
|
||||
//! simplification of the shape whereas
|
||||
//! StdPrs_HLRShape takes the shape itself into
|
||||
//! account. When you use StdPrs_HLRShape, you
|
||||
//! obtain an exact result, whereas, when you use
|
||||
//! StdPrs_HLRPolyShape, you reduce computation
|
||||
//! time but obtain polygonal segments.
|
||||
//! Instantiates Prs3d_PolyHLRShape to define a display of a shape where hidden
|
||||
//! and visible lines are identified with respect to a given projection.
|
||||
//! StdPrs_HLRPolyShape works with a polyhedral simplification of the shape whereas
|
||||
//! StdPrs_HLRShape takes the shape itself into account.
|
||||
//! When you use StdPrs_HLRShape, you obtain an exact result, whereas, when you use StdPrs_HLRPolyShape,
|
||||
//! you reduce computation time but obtain polygonal segments.
|
||||
//! The polygonal algorithm is used.
|
||||
class StdPrs_HLRPolyShape : public Prs3d_Root
|
||||
class StdPrs_HLRPolyShape : public StdPrs_HLRShapeI
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(StdPrs_HLRPolyShape, StdPrs_HLRShapeI)
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Defines the hidden line removal display of the
|
||||
//! topology aShape in the projection defined by
|
||||
//! aProjector. The shape and the projection are added
|
||||
//! to the display aPresentation, and the attributes of the
|
||||
//! elements present in the aPresentation are defined by
|
||||
//! the attribute manager aDrawer.
|
||||
Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& aPresentation, const TopoDS_Shape& aShape, const Handle(Prs3d_Drawer)& aDrawer, const Handle(Prs3d_Projector)& aProjector);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
//! Compute presentation for specified shape.
|
||||
Standard_EXPORT virtual void ComputeHLR (const Handle(Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Handle(Graphic3d_Camera)& theProjector) const Standard_OVERRIDE;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _StdPrs_HLRPolyShape_HeaderFile
|
||||
|
@@ -11,29 +11,38 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <StdPrs_HLRShape.hxx>
|
||||
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <StdPrs_HLRShape.hxx>
|
||||
#include <StdPrs_HLRToolShape.hxx>
|
||||
#include <StdPrs_DeflectionCurve.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <HLRAlgo_Projector.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StdPrs_HLRShape, StdPrs_HLRShapeI)
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//function : ComputeHLR
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void StdPrs_HLRShape::Add (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Handle(Prs3d_Projector)& theProjector)
|
||||
void StdPrs_HLRShape::ComputeHLR (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Handle(Graphic3d_Camera)& theProjector) const
|
||||
{
|
||||
StdPrs_HLRToolShape aTool(theShape, theProjector->Projector());
|
||||
gp_Dir aBackDir = -theProjector->Direction();
|
||||
gp_Dir aXpers = theProjector->Up().Crossed (aBackDir);
|
||||
gp_Ax3 anAx3 (theProjector->Center(), aBackDir, aXpers);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (anAx3);
|
||||
const HLRAlgo_Projector aProj (aTrsf, !theProjector->IsOrthographic(), theProjector->Scale());
|
||||
|
||||
StdPrs_HLRToolShape aTool(theShape, aProj);
|
||||
Standard_Integer aNbEdges = aTool.NbEdges();
|
||||
Standard_Integer anI;
|
||||
Standard_Real anU1, anU2;
|
||||
|
@@ -14,26 +14,20 @@
|
||||
#ifndef _StdPrs_HLRFace_H__
|
||||
#define _StdPrs_HLRFace_H__
|
||||
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <StdPrs_HLRShapeI.hxx>
|
||||
|
||||
// Computes the presentation of objects with
|
||||
// removal of their hidden lines for a specific
|
||||
// projector. The exact algorithm is used.
|
||||
|
||||
class StdPrs_HLRShape: public Prs3d_Root
|
||||
//! Computes the presentation of objects with removal of their hidden lines for a specific projector.
|
||||
//! The exact algorithm is used.
|
||||
class StdPrs_HLRShape : public StdPrs_HLRShapeI
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(StdPrs_HLRShape, StdPrs_HLRShapeI)
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
Standard_EXPORT static void Add
|
||||
(const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Handle(Prs3d_Projector)& theProjector);
|
||||
//! Compute presentation for specified shape.
|
||||
Standard_EXPORT virtual void ComputeHLR (const Handle(Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Handle(Graphic3d_Camera)& theProjector) const Standard_OVERRIDE;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
16
src/StdPrs/StdPrs_HLRShapeI.cxx
Normal file
16
src/StdPrs/StdPrs_HLRShapeI.cxx
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) 2020 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 <StdPrs_HLRShapeI.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StdPrs_HLRShapeI, Standard_Transient)
|
39
src/StdPrs/StdPrs_HLRShapeI.hxx
Normal file
39
src/StdPrs/StdPrs_HLRShapeI.hxx
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2020 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.
|
||||
|
||||
#ifndef _StdPrs_HLRShapeI_HeaderFile
|
||||
#define _StdPrs_HLRShapeI_HeaderFile
|
||||
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
class TopoDS_Shape;
|
||||
class Prs3d_Drawer;
|
||||
class Graphic3d_Camera;
|
||||
|
||||
//! Computes the presentation of objects with removal of their hidden lines for a specific projector.
|
||||
class StdPrs_HLRShapeI : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(StdPrs_HLRShapeI, Standard_Transient)
|
||||
public:
|
||||
|
||||
//! Compute presentation for specified shape.
|
||||
virtual void ComputeHLR (const Handle(Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Handle(Graphic3d_Camera)& theProjector) const = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // _StdPrs_HLRShapeI_HeaderFile
|
Reference in New Issue
Block a user