bda83605 |
1 | // File: HLRAppli_ReflectLines.cxx |
2 | // Created: 05.12.12 12:55:50 |
3 | // Created by: Julia GERASIMOVA |
4 | // Copyright (c) 2001-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
21 | #include <HLRAppli_ReflectLines.hxx> |
22 | #include <HLRBRep_Algo.hxx> |
23 | #include <HLRBRep_HLRToShape.hxx> |
24 | #include <BRep_Builder.hxx> |
25 | #include <gp_Ax3.hxx> |
26 | |
27 | //======================================================================= |
28 | //function : HLRAppli_ReflectLines |
29 | //purpose : Constructor |
30 | //======================================================================= |
31 | |
32 | HLRAppli_ReflectLines::HLRAppli_ReflectLines(const TopoDS_Shape& aShape) |
33 | { |
34 | myShape = aShape; |
35 | } |
36 | |
37 | //======================================================================= |
38 | //function : SetAxes |
39 | //purpose : |
40 | //======================================================================= |
41 | |
42 | void HLRAppli_ReflectLines::SetAxes(const Standard_Real Nx, |
43 | const Standard_Real Ny, |
44 | const Standard_Real Nz, |
45 | const Standard_Real XAt, |
46 | const Standard_Real YAt, |
47 | const Standard_Real ZAt, |
48 | const Standard_Real XUp, |
49 | const Standard_Real YUp, |
50 | const Standard_Real ZUp) |
51 | { |
52 | Standard_Boolean IsPerspective = Standard_False; |
53 | Standard_Real aFocus = 1; |
54 | //Prs3d_Projector aPrs3dProjector(IsPerspective, aFocus, Nx, Ny, Nz, XAt, YAt, ZAt, XUp, YUp, ZUp); |
55 | |
56 | gp_Pnt At (XAt,YAt,ZAt); |
57 | gp_Dir Zpers (Nx,Ny,Nz); |
58 | gp_Dir Ypers (XUp,YUp,ZUp); |
59 | gp_Dir Xpers = Ypers.Crossed(Zpers); |
60 | gp_Ax3 Axe (At, Zpers, Xpers); |
61 | gp_Trsf T; |
62 | T.SetTransformation(Axe); |
63 | |
64 | //myProjector = aPrs3dProjector.Projector(); |
65 | myProjector = HLRAlgo_Projector(T,IsPerspective,aFocus); |
66 | } |
67 | |
68 | //======================================================================= |
69 | //function : Perform |
70 | //purpose : |
71 | //======================================================================= |
72 | |
73 | void HLRAppli_ReflectLines::Perform() |
74 | { |
75 | Handle(HLRBRep_Algo) aHLRAlgo = new HLRBRep_Algo(); |
76 | aHLRAlgo->Add( myShape, 0 ); |
77 | aHLRAlgo->Projector( myProjector ); |
78 | aHLRAlgo->Update(); |
79 | aHLRAlgo->Hide(); |
80 | HLRBRep_HLRToShape aHLRToShape( aHLRAlgo ); |
81 | |
82 | myCompound = aHLRToShape.OutLineVCompound3d(); |
83 | } |
84 | |
85 | //======================================================================= |
86 | //function : GetResult |
87 | //purpose : |
88 | //======================================================================= |
89 | |
90 | TopoDS_Shape HLRAppli_ReflectLines::GetResult() const |
91 | { |
92 | return myCompound; |
93 | } |