X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FStdPrs%2FStdPrs_BndBox.hxx;h=802c01aa6d77a94c8b9dcfbfd42f355b3284073e;hb=7f24b768c30df045ec4a7c712724195643081dfb;hpb=787ff2408c680462f82753ae698239cf5587fa98 diff --git a/src/StdPrs/StdPrs_BndBox.hxx b/src/StdPrs/StdPrs_BndBox.hxx index 307b1b1b7d..802c01aa6d 100644 --- a/src/StdPrs/StdPrs_BndBox.hxx +++ b/src/StdPrs/StdPrs_BndBox.hxx @@ -1,6 +1,4 @@ -// Created on: 2014-10-14 -// Created by: Anton POLETAEV -// Copyright (c) 2013-2014 OPEN CASCADE SAS +// Copyright (c) 2020 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -16,133 +14,8 @@ #ifndef _StdPrs_BndBox_H__ #define _StdPrs_BndBox_H__ -#include -#include -#include -#include -#include -#include +#include -//! Tool for computing bounding box presentation. -class StdPrs_BndBox : public Prs3d_Root -{ -public: - - //! Computes presentation of a bounding box. - //! @param thePresentation [in] the presentation. - //! @param theBndBox [in] the bounding box. - //! @param theDrawer [in] the drawer. - Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, - const Bnd_Box& theBndBox, - const Handle(Prs3d_Drawer)& theDrawer); - - //! Computes presentation of a bounding box. - //! @param thePresentation [in] the presentation. - //! @param theBndBox [in] the bounding box. - //! @param theDrawer [in] the drawer. - Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation, - const Bnd_OBB& theBndBox, - const Handle(Prs3d_Drawer)& theDrawer); - -public: - - //! Create primitive array with line segments for displaying a box. - //! @param theBox [in] the box to add - static Handle(Graphic3d_ArrayOfSegments) FillSegments (const Bnd_OBB& theBox) - { - if (theBox.IsVoid()) - { - return Handle(Graphic3d_ArrayOfSegments)(); - } - - Handle(Graphic3d_ArrayOfSegments) aSegs = new Graphic3d_ArrayOfSegments (8, 12 * 2); - FillSegments (aSegs, theBox); - return aSegs; - } - - //! Create primitive array with line segments for displaying a box. - //! @param theBox [in] the box to add - static Handle(Graphic3d_ArrayOfSegments) FillSegments (const Bnd_Box& theBox) - { - if (theBox.IsVoid()) - { - return Handle(Graphic3d_ArrayOfSegments)(); - } - - Handle(Graphic3d_ArrayOfSegments) aSegs = new Graphic3d_ArrayOfSegments (8, 12 * 2); - FillSegments (aSegs, theBox); - return aSegs; - } - - //! Create primitive array with line segments for displaying a box. - //! @param theSegments [in] [out] primitive array to be filled; - //! should be at least 8 nodes and 24 edges in size - //! @param theBox [in] the box to add - static void FillSegments (const Handle(Graphic3d_ArrayOfSegments)& theSegments, const Bnd_OBB& theBox) - { - if (!theBox.IsVoid()) - { - gp_Pnt aXYZ[8]; - theBox.GetVertex (aXYZ); - fillSegments (theSegments, aXYZ); - } - } - - //! Create primitive array with line segments for displaying a box. - //! @param theSegments [in] [out] primitive array to be filled; - //! should be at least 8 nodes and 24 edges in size - //! @param theBox [in] the box to add - static void FillSegments (const Handle(Graphic3d_ArrayOfSegments)& theSegments, const Bnd_Box& theBox) - { - if (!theBox.IsVoid()) - { - const gp_Pnt aMin = theBox.CornerMin(); - const gp_Pnt aMax = theBox.CornerMax(); - const gp_Pnt aXYZ[8] = - { - gp_Pnt (aMin.X(), aMin.Y(), aMin.Z()), - gp_Pnt (aMax.X(), aMin.Y(), aMin.Z()), - gp_Pnt (aMin.X(), aMax.Y(), aMin.Z()), - gp_Pnt (aMax.X(), aMax.Y(), aMin.Z()), - gp_Pnt (aMin.X(), aMin.Y(), aMax.Z()), - gp_Pnt (aMax.X(), aMin.Y(), aMax.Z()), - gp_Pnt (aMin.X(), aMax.Y(), aMax.Z()), - gp_Pnt (aMax.X(), aMax.Y(), aMax.Z()), - }; - fillSegments (theSegments, aXYZ); - } - } - -public: - - //! Create primitive array with line segments for displaying a box. - //! @param theSegments [in] [out] primitive array to be filled; - //! should be at least 8 nodes and 24 edges in size - //! @param theBox [in] the box to add - static void fillSegments (const Handle(Graphic3d_ArrayOfSegments)& theSegments, const gp_Pnt* theBox) - { - const Standard_Integer aFrom = theSegments->VertexNumber(); - for (int aVertIter = 0; aVertIter < 8; ++aVertIter) - { - theSegments->AddVertex (theBox[aVertIter]); - } - - theSegments->AddEdges (aFrom + 1, aFrom + 2); - theSegments->AddEdges (aFrom + 3, aFrom + 4); - theSegments->AddEdges (aFrom + 5, aFrom + 6); - theSegments->AddEdges (aFrom + 7, aFrom + 8); - // - theSegments->AddEdges (aFrom + 1, aFrom + 3); - theSegments->AddEdges (aFrom + 2, aFrom + 4); - theSegments->AddEdges (aFrom + 5, aFrom + 7); - theSegments->AddEdges (aFrom + 6, aFrom + 8); - // - theSegments->AddEdges (aFrom + 1, aFrom + 5); - theSegments->AddEdges (aFrom + 2, aFrom + 6); - theSegments->AddEdges (aFrom + 3, aFrom + 7); - theSegments->AddEdges (aFrom + 4, aFrom + 8); - } - -}; +typedef Prs3d_BndBox StdPrs_BndBox; #endif // _StdPrs_BndBox_H__