mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-13 14:27:08 +03:00
0025300: Visualization - Build wireframe representation consistent with the shape's triangulation
1) Remove duplicating presentation algorithms for shapes StdPrs_WFShape, StdPrs_WFDeflectionShape. 2) Rewrite Prs3d_WFShape to use deflection for non-triangulated shapes and rename it to StdPrs_WFShape. 3) Revise and correct references in code. 4) Rename StdPrs_ToolShadedShape to StdPrs_ToolTriangulatedShape (reused in StdPrs_WFShape, StdPrs_ShadedShape). 5) Add StdPrs_BndBox for drawing bounding box presentation. 6) Implemented on-triangulation isoline builder. 7) Add option -isoontriangulation to vaspects command to enable on-triangulation isoline builder for shape. 8) Drawer's maximum UV parameter value is taken into account in isolines calculation correctly. 9) Add option -setMaxParamValue to vaspects command to change drawer's maximum UV parameter value.
This commit is contained in:
@@ -15,113 +15,57 @@
|
||||
#define _StdPrs_WFShape_H__
|
||||
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <TopTools_HSequenceOfShape.hxx>
|
||||
#include <Quantity_Length.hxx>
|
||||
#include <Prs3d_WFShape.hxx>
|
||||
#include <StdPrs_WFRestrictedFace.hxx>
|
||||
#include <StdPrs_Curve.hxx>
|
||||
#include <StdPrs_Vertex.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
//! Tool for computing wireframe presentation of a TopoDS_Shape.
|
||||
class StdPrs_WFShape : public Prs3d_Root
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Add shape to presentation
|
||||
static inline void Add (const Handle (Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle (Prs3d_Drawer)& theDrawer)
|
||||
{
|
||||
Face aFaceAlgo;
|
||||
Curve aCurveAlgo;
|
||||
Prs3d_WFShape anAlgo (aFaceAlgo, aCurveAlgo);
|
||||
anAlgo.Add (thePrs, theShape, theDrawer);
|
||||
}
|
||||
|
||||
static inline Handle(TopTools_HSequenceOfShape) PickCurve
|
||||
(const Quantity_Length theX,
|
||||
const Quantity_Length theY,
|
||||
const Quantity_Length theZ,
|
||||
const Quantity_Length theDistance,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle (Prs3d_Drawer)& theDrawer)
|
||||
{
|
||||
Face aFaceAlgo;
|
||||
Curve aCurveAlgo;
|
||||
Prs3d_WFShape anAlgo (aFaceAlgo, aCurveAlgo);
|
||||
return anAlgo.PickCurve (theX, theY, theZ, theDistance, theShape, theDrawer);
|
||||
}
|
||||
|
||||
static inline Handle(TopTools_HSequenceOfShape) PickPatch
|
||||
(const Quantity_Length theX,
|
||||
const Quantity_Length theY,
|
||||
const Quantity_Length theZ,
|
||||
const Quantity_Length theDistance,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer)
|
||||
{
|
||||
Face aFaceAlgo;
|
||||
Curve aCurveAlgo;
|
||||
Prs3d_WFShape anAlgo (aFaceAlgo, aCurveAlgo);
|
||||
return anAlgo.PickPatch (theX, theY, theZ, theDistance, theShape, theDrawer);
|
||||
}
|
||||
//! Computes wireframe presentation of a shape.
|
||||
//! @param thePresentation [in] the presentation.
|
||||
//! @param theShape [in] the shape.
|
||||
//! @param theDrawer [in] the draw settings.
|
||||
Standard_EXPORT static void Add (const Handle (Prs3d_Presentation)& thePresentation,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle (Prs3d_Drawer)& theDrawer);
|
||||
|
||||
private:
|
||||
|
||||
class Face : public Prs3d_WFShape::Face
|
||||
{
|
||||
public:
|
||||
virtual void Add (const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Handle(BRepAdaptor_HSurface)& theFace,
|
||||
const Standard_Boolean theToDrawUIso,
|
||||
const Standard_Boolean theToDrawVIso,
|
||||
const Quantity_Length theDeflection,
|
||||
const Standard_Integer theNBUiso,
|
||||
const Standard_Integer theNBViso,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
Prs3d_NListOfSequenceOfPnt& theCurves) const
|
||||
{
|
||||
StdPrs_WFRestrictedFace::Add (thePrs, theFace, theToDrawUIso, theToDrawVIso, theDeflection,
|
||||
theNBUiso, theNBViso, theDrawer, theCurves);
|
||||
}
|
||||
//! Compute edge presentations for a shape.
|
||||
//! @param thePresentation [in] the presentation.
|
||||
//! @param theEdges [in] the list of edges.
|
||||
//! @param theAspect [in] the edge drawing aspect.
|
||||
//! @param theDrawer [in] the drawer settings.
|
||||
//! @param theShapeDeflection [in] the deflection for the wireframe shape.
|
||||
static void addEdges (const Handle (Prs3d_Presentation)& thePresentation,
|
||||
const TopTools_ListOfShape& theEdges,
|
||||
const Handle (Prs3d_LineAspect)& theAspect,
|
||||
const Handle (Prs3d_Drawer)& theDrawer,
|
||||
const Standard_Real theShapeDeflection);
|
||||
|
||||
virtual Standard_Boolean Match (const Quantity_Length theX,
|
||||
const Quantity_Length theY,
|
||||
const Quantity_Length theZ,
|
||||
const Quantity_Length theDistance,
|
||||
const Handle(BRepAdaptor_HSurface)& theFace,
|
||||
const Handle(Prs3d_Drawer)& theDrawer) const
|
||||
{
|
||||
return StdPrs_WFRestrictedFace::Match (theX, theY, theZ, theDistance, theFace, theDrawer);
|
||||
}
|
||||
};
|
||||
|
||||
class Curve : public Prs3d_WFShape::Curve
|
||||
{
|
||||
public:
|
||||
virtual void Add (const Handle(Prs3d_Presentation)& thePrs,
|
||||
Adaptor3d_Curve& theCurve,
|
||||
const Quantity_Length theDeflection,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
TColgp_SequenceOfPnt& thePoints,
|
||||
const Standard_Boolean theToDrawCurve) const
|
||||
{
|
||||
StdPrs_Curve::Add (thePrs, theCurve, theDeflection, theDrawer, thePoints, theToDrawCurve);
|
||||
}
|
||||
|
||||
virtual Standard_Boolean Match (const Quantity_Length theX,
|
||||
const Quantity_Length theY,
|
||||
const Quantity_Length theZ,
|
||||
const Quantity_Length theDistance,
|
||||
const Adaptor3d_Curve& theCurve,
|
||||
const Handle(Prs3d_Drawer)& theDrawer) const
|
||||
{
|
||||
return StdPrs_Curve::Match (theX, theY, theZ, theDistance, theCurve, theDrawer);
|
||||
}
|
||||
};
|
||||
//! Compute free and boundary edges on a triangulation of a face.
|
||||
//! @param thePresentation [in] the presentation.
|
||||
//! @param theFaces [in] the list of triangulated faces.
|
||||
//! @param theAspect [in] the edge drawing aspect.
|
||||
//! @param theDrawer [in] the drawer settings.
|
||||
static void addEdgesOnTriangulation (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const TopTools_ListOfShape& theFaces,
|
||||
const Handle (Prs3d_LineAspect)& theAspect);
|
||||
|
||||
//! Compute vertex presentation for a shape.
|
||||
//! @param thePresentation [in] the presentation.
|
||||
//! @param theVertices [in] the list of points.
|
||||
//! @param theAspect [in] the point drawing aspect.
|
||||
static void addVertices (const Handle (Prs3d_Presentation)& thePresentation,
|
||||
const TColgp_SequenceOfPnt& theVertices,
|
||||
const Handle (Prs3d_PointAspect)& theAspect);
|
||||
};
|
||||
|
||||
#endif // _StdPrs_WFShape_H__
|
||||
|
Reference in New Issue
Block a user