a13d5dcf815fbe53c7d92c04e01057466225db5e
[occt.git] / src / StdSelect / StdSelect.cxx
1 // Copyright:   Matra-Datavision 1995
2 // File:        StdSelect.cxx
3 // Created:     Mon Mar 27 17:07:10 1995
4 // Author:      Robert COUBLANC
5 //              <rob>
6
7
8
9 #include <StdSelect.ixx>
10 #include <SelectMgr_Selection.hxx>
11 #include <Graphic3d_StructureManager.hxx>
12 #include <Graphic3d_Group.hxx>
13 #include <Select3D_SensitiveSegment.hxx>
14 #include <Select3D_SensitiveCurve.hxx>
15 #include <Select3D_SensitiveFace.hxx>
16 #include <Graphic3d_AspectLine3d.hxx>
17 #include <Graphic3d_Structure.hxx>
18 #include <Graphic3d_Array1OfVertex.hxx>
19 #include <Quantity_NameOfColor.hxx>
20 #include <Aspect_TypeOfLine.hxx>
21 #include <TColgp_HArray1OfPnt.hxx>
22 #include <gp_Pnt.hxx>
23 #include <gp_Dir.hxx>
24 #include <gp_Ax3.hxx>
25 #include <V3d_PerspectiveView.hxx>
26 #include <StdSelect_BRepOwner.hxx>
27 //#include <.hxx>
28
29
30
31
32 Select3D_Projector  StdSelect::GetProjector(const Handle(V3d_View)& aViou)
33 {
34   Standard_Real Focale=0.,Xat,Yat,Zat,XUp,YUp,ZUp,DX,DY,DZ;
35   Standard_Boolean Pers=Standard_False;
36   // NKV - 31/07/07 - Fix for perspective view
37   if ( aViou->Type() == V3d_PERSPECTIVE ) {
38     Pers = Standard_True;
39     Focale = aViou->Focale();} // must be replaced by the method Focale 
40   
41   aViou->At(Xat,Yat,Zat);
42   aViou->Up(XUp,YUp,ZUp);
43   aViou->Proj(DX,DY,DZ);
44   gp_Pnt At (Xat,Yat,Zat); 
45   gp_Dir Zpers (DX,DY,DZ);
46   gp_Dir Ypers (XUp,YUp,ZUp);
47   gp_Dir Xpers = Ypers.Crossed(Zpers);
48   gp_Ax3 Axe (At, Zpers, Xpers);
49   gp_Trsf T;
50   T.SetTransformation(Axe);
51   return Select3D_Projector(T,Pers,Focale);
52   
53 }
54
55 //=======================================================================
56 //function : SetDrawerForBRepOwner
57 //purpose  : 
58 //=======================================================================
59
60 void StdSelect::SetDrawerForBRepOwner(const Handle(SelectMgr_Selection)& Sel,
61                                      const Handle(Prs3d_Drawer)& Drwr)
62 {
63 //  Handle(StdSelect_BRepOwner) BROWN;
64
65 //   for(Sel->Init();Sel->More();Sel->Next()){
66 //     BROWN = Handle(StdSelect_BRepOwner)::DownCast(Sel->Sensitive()->OwnerId());
67 //     if(!BROWN.IsNull())
68 //       BROWN->SetDrawer(Drwr);
69 //   }
70 }