1 // Copyright (c) 2013-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <BRepAdaptor_Curve.hxx>
15 #include <Graphic3d_Group.hxx>
16 #include <Prs3d_Drawer.hxx>
17 #include <Prs3d_LineAspect.hxx>
18 #include <Prs3d_Presentation.hxx>
19 #include <Prs3d_Projector.hxx>
20 #include <StdPrs_HLRShape.hxx>
21 #include <StdPrs_HLRToolShape.hxx>
22 #include <StdPrs_DeflectionCurve.hxx>
23 #include <TopoDS_Shape.hxx>
24 #include <TColgp_SequenceOfPnt.hxx>
26 //=======================================================================
29 //=======================================================================
31 void StdPrs_HLRShape::Add (const Handle(Prs3d_Presentation)& thePresentation,
32 const TopoDS_Shape& theShape,
33 const Handle(Prs3d_Drawer)& theDrawer,
34 const Handle(Prs3d_Projector)& theProjector)
36 StdPrs_HLRToolShape aTool(theShape, theProjector->Projector());
37 Standard_Integer aNbEdges = aTool.NbEdges();
39 Standard_Real anU1, anU2;
40 BRepAdaptor_Curve aCurve;
41 Standard_Real aDeviation = theDrawer->MaximalChordialDeviation();
42 Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation);
44 aGroup->SetPrimitivesAspect(theDrawer->SeenLineAspect()->Aspect());
46 Standard_Real anAngle = theDrawer->DeviationAngle();
47 TColgp_SequenceOfPnt aPoints;
48 for (anI = 1; anI <= aNbEdges; ++anI)
50 for(aTool.InitVisible(anI); aTool.MoreVisible(); aTool.NextVisible())
52 aTool.Visible(aCurve, anU1, anU2);
53 StdPrs_DeflectionCurve::Add(thePresentation, aCurve,
54 anU1, anU2, aDeviation, aPoints, anAngle);
58 if(theDrawer->DrawHiddenLine())
60 aGroup->SetPrimitivesAspect(theDrawer->HiddenLineAspect()->Aspect());
62 for (anI = 1; anI <= aNbEdges; ++anI)
64 for (aTool.InitHidden(anI); aTool.MoreHidden(); aTool.NextHidden())
66 aTool.Hidden(aCurve, anU1, anU2);
67 StdPrs_DeflectionCurve::Add(thePresentation, aCurve,
68 anU1, anU2, aDeviation, aPoints, anAngle);