0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / HLRAppli / HLRAppli_ReflectLines.cxx
CommitLineData
bda83605 1// File: HLRAppli_ReflectLines.cxx
2// Created: 05.12.12 12:55:50
3// Created by: Julia GERASIMOVA
973c2be1 4// Copyright (c) 2001-2014 OPEN CASCADE SAS
bda83605 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
bda83605 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
bda83605 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
bda83605 16
17#include <HLRAppli_ReflectLines.hxx>
18#include <HLRBRep_Algo.hxx>
19#include <HLRBRep_HLRToShape.hxx>
20#include <BRep_Builder.hxx>
21#include <gp_Ax3.hxx>
59495dbe 22#include <BRepLib.hxx>
23
bda83605 24
25//=======================================================================
26//function : HLRAppli_ReflectLines
27//purpose : Constructor
28//=======================================================================
29
30HLRAppli_ReflectLines::HLRAppli_ReflectLines(const TopoDS_Shape& aShape)
31{
32 myShape = aShape;
33}
34
35//=======================================================================
36//function : SetAxes
37//purpose :
38//=======================================================================
39
40void HLRAppli_ReflectLines::SetAxes(const Standard_Real Nx,
41 const Standard_Real Ny,
42 const Standard_Real Nz,
43 const Standard_Real XAt,
44 const Standard_Real YAt,
45 const Standard_Real ZAt,
46 const Standard_Real XUp,
47 const Standard_Real YUp,
48 const Standard_Real ZUp)
49{
50 Standard_Boolean IsPerspective = Standard_False;
51 Standard_Real aFocus = 1;
52 //Prs3d_Projector aPrs3dProjector(IsPerspective, aFocus, Nx, Ny, Nz, XAt, YAt, ZAt, XUp, YUp, ZUp);
53
54 gp_Pnt At (XAt,YAt,ZAt);
55 gp_Dir Zpers (Nx,Ny,Nz);
56 gp_Dir Ypers (XUp,YUp,ZUp);
57 gp_Dir Xpers = Ypers.Crossed(Zpers);
58 gp_Ax3 Axe (At, Zpers, Xpers);
59 gp_Trsf T;
60 T.SetTransformation(Axe);
61
62 //myProjector = aPrs3dProjector.Projector();
63 myProjector = HLRAlgo_Projector(T,IsPerspective,aFocus);
64}
65
66//=======================================================================
67//function : Perform
68//purpose :
69//=======================================================================
70
71void HLRAppli_ReflectLines::Perform()
72{
601b1c8d 73 myHLRAlgo = new HLRBRep_Algo();
74 myHLRAlgo->Add( myShape, 0 );
75 myHLRAlgo->Projector( myProjector );
76 myHLRAlgo->Update();
77 myHLRAlgo->Hide();
78
79 /*
bda83605 80 HLRBRep_HLRToShape aHLRToShape( aHLRAlgo );
81
82 myCompound = aHLRToShape.OutLineVCompound3d();
59495dbe 83
84 BRepLib::SameParameter(myCompound,Precision::PConfusion(),Standard_False);
601b1c8d 85 */
86}
87
88//=======================================================================
89//function : GetCompoundOf3dEdges
90//purpose :
91//=======================================================================
92
93TopoDS_Shape HLRAppli_ReflectLines::GetCompoundOf3dEdges(const HLRBRep_TypeOfResultingEdge type,
5ae6e53d 94 const Standard_Boolean visible,
e7b01db7 95 const Standard_Boolean In3d) const
601b1c8d 96{
97 HLRBRep_HLRToShape aHLRToShape( myHLRAlgo );
98
5ae6e53d 99 TopoDS_Shape theCompound = aHLRToShape.CompoundOfEdges(type, visible, In3d);
601b1c8d 100
101 BRepLib::SameParameter(theCompound,Precision::PConfusion(),Standard_False);
102
103 return theCompound;
bda83605 104}
105
106//=======================================================================
107//function : GetResult
108//purpose :
109//=======================================================================
110
e7b01db7 111TopoDS_Shape HLRAppli_ReflectLines::GetResult() const
bda83605 112{
5ae6e53d 113 return GetCompoundOf3dEdges(HLRBRep_OutLine, Standard_True, Standard_True);
bda83605 114}