0031431: Visualization, PrsMgr_PresentableObject - simplify HLR computing interface
[occt.git] / src / StdPrs / StdPrs_HLRToolShape.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
42cf5bc1 15
16#include <BRepAdaptor_Curve.hxx>
7fd59977 17#include <HLRAlgo_Projector.hxx>
18#include <HLRBRep_Algo.hxx>
19#include <HLRBRep_Data.hxx>
42cf5bc1 20#include <StdPrs_HLRToolShape.hxx>
21#include <TopoDS_Shape.hxx>
7fd59977 22
23StdPrs_HLRToolShape::StdPrs_HLRToolShape (
24 const TopoDS_Shape& TheShape,
25 const HLRAlgo_Projector& TheProjector)
26{
27 Handle(HLRBRep_Algo) Hider = new HLRBRep_Algo();
28 Standard_Integer nbIso = 0; // 5;
29 Hider->Add(TheShape, nbIso);
30 Hider->Projector(TheProjector);
31 Hider->Update();
32 Hider->Hide();
33 MyData = Hider->DataStructure();
34 MyCurrentEdgeNumber = 0;
35}
36
37Standard_Integer StdPrs_HLRToolShape::NbEdges() const {
38 return MyData->NbEdges();
39}
40void StdPrs_HLRToolShape::InitVisible(const Standard_Integer EdgeNumber) {
41 myEdgeIterator.InitVisible
42 (MyData->EDataArray().ChangeValue(EdgeNumber).Status());
43 MyCurrentEdgeNumber = EdgeNumber;
44}
45Standard_Boolean StdPrs_HLRToolShape::MoreVisible() const {
46 return myEdgeIterator.MoreVisible();
47}
48void StdPrs_HLRToolShape::NextVisible() {
49 myEdgeIterator.NextVisible();
50}
51void StdPrs_HLRToolShape::Visible(BRepAdaptor_Curve& TheEdge,
52 Standard_Real& U1,
53 Standard_Real& U2) {
54
55 TheEdge = MyData->EDataArray()
56 .ChangeValue(MyCurrentEdgeNumber)
57 .ChangeGeometry()
58 .Curve();
59 Standard_ShortReal t1,t2;
60 myEdgeIterator.Visible(U1,t1,U2,t2);
61}
62void StdPrs_HLRToolShape::InitHidden(const Standard_Integer EdgeNumber) {
63 myEdgeIterator.InitHidden
64 (MyData->EDataArray().ChangeValue(EdgeNumber).Status());
65 MyCurrentEdgeNumber = EdgeNumber;
66}
67Standard_Boolean StdPrs_HLRToolShape::MoreHidden() const {
68 return myEdgeIterator.MoreHidden();
69}
70void StdPrs_HLRToolShape::NextHidden() {
71 myEdgeIterator.NextHidden();
72}
73void StdPrs_HLRToolShape::Hidden (BRepAdaptor_Curve& TheEdge,
74 Standard_Real& U1,
75 Standard_Real& U2) {
76
77 TheEdge = MyData->EDataArray()
78 .ChangeValue(MyCurrentEdgeNumber)
79 .ChangeGeometry()
80 .Curve();
81 Standard_ShortReal t1,t2;
82 myEdgeIterator.Hidden(U1,t1,U2,t2);
83}