1 // Created on: 2016-10-20
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2016 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15 
16 
17 #ifndef _XCAFView_Object_HeaderFile
18 #define _XCAFView_Object_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22 
23 #include <gp_Dir.hxx>
24 #include <gp_Pln.hxx>
25 #include <gp_Pnt.hxx>
26 #include <TColgp_HArray1OfPnt.hxx>
27 #include <TCollection_HAsciiString.hxx>
28 #include <XCAFView_ProjectionType.hxx>
29 
30 class XCAFView_Object;
31 DEFINE_STANDARD_HANDLE(XCAFView_Object, Standard_Transient)
32 
33 //! Access object for saved view
34 class XCAFView_Object : public Standard_Transient
35 {
36 
37 public:
38 
39   Standard_EXPORT XCAFView_Object();
40 
41   Standard_EXPORT XCAFView_Object(const Handle(XCAFView_Object)& theObj);
42 
SetName(Handle (TCollection_HAsciiString)theName)43   void SetName(Handle(TCollection_HAsciiString) theName)
44   {
45     myName = theName;
46   }
47 
Name()48   Handle(TCollection_HAsciiString) Name()
49   {
50     return myName;
51   }
52 
SetType(XCAFView_ProjectionType theType)53   void SetType(XCAFView_ProjectionType theType)
54   {
55     myType = theType;
56   }
57 
Type()58   XCAFView_ProjectionType Type()
59   {
60     return myType;
61   }
62 
SetProjectionPoint(gp_Pnt thePoint)63   void SetProjectionPoint(gp_Pnt thePoint)
64   {
65     myProjectionPoint = thePoint;
66   }
67 
ProjectionPoint()68   gp_Pnt ProjectionPoint()
69   {
70     return myProjectionPoint;
71   }
72 
SetViewDirection(gp_Dir theDirection)73   void SetViewDirection(gp_Dir theDirection)
74   {
75     myViewDirection = theDirection;
76   }
77 
ViewDirection()78   gp_Dir ViewDirection()
79   {
80     return myViewDirection;
81   }
82 
SetUpDirection(gp_Dir theDirection)83   void SetUpDirection(gp_Dir theDirection)
84   {
85     myUpDirection = theDirection;
86   }
87 
UpDirection()88   gp_Dir UpDirection()
89   {
90     return myUpDirection;
91   }
92 
SetZoomFactor(Standard_Real theZoomFactor)93   void SetZoomFactor(Standard_Real theZoomFactor)
94   {
95     myZoomFactor = theZoomFactor;
96   }
97 
ZoomFactor()98   Standard_Real ZoomFactor()
99   {
100     return myZoomFactor;
101   }
102 
SetWindowHorizontalSize(Standard_Real theSize)103   void SetWindowHorizontalSize(Standard_Real theSize)
104   {
105     myWindowHorizontalSize = theSize;
106   }
107 
WindowHorizontalSize()108   Standard_Real WindowHorizontalSize()
109   {
110     return myWindowHorizontalSize;
111   }
112 
SetWindowVerticalSize(Standard_Real theSize)113   void SetWindowVerticalSize(Standard_Real theSize)
114   {
115     myWindowVerticalSize = theSize;
116   }
117 
WindowVerticalSize()118   Standard_Real WindowVerticalSize()
119   {
120     return myWindowVerticalSize;
121   }
122 
SetClippingExpression(Handle (TCollection_HAsciiString)theExpression)123   void SetClippingExpression(Handle(TCollection_HAsciiString) theExpression)
124   {
125     myClippingExpression = theExpression;
126   }
127 
ClippingExpression()128   Handle(TCollection_HAsciiString) ClippingExpression()
129   {
130     return myClippingExpression;
131   }
132 
UnsetFrontPlaneClipping()133   void UnsetFrontPlaneClipping()
134   {
135     myFrontPlaneClipping = Standard_False;
136   }
137 
HasFrontPlaneClipping()138   Standard_Boolean HasFrontPlaneClipping()
139   {
140     return myFrontPlaneClipping;
141   }
142 
SetFrontPlaneDistance(Standard_Real theDistance)143   void SetFrontPlaneDistance(Standard_Real theDistance)
144   {
145     myFrontPlaneDistance = theDistance;
146     myFrontPlaneClipping = Standard_True;
147   }
148 
FrontPlaneDistance()149   Standard_Real FrontPlaneDistance()
150   {
151     return myFrontPlaneDistance;
152   }
153 
UnsetBackPlaneClipping()154   void UnsetBackPlaneClipping()
155   {
156     myBackPlaneClipping = Standard_False;
157   }
158 
HasBackPlaneClipping()159   Standard_Boolean HasBackPlaneClipping()
160   {
161     return myBackPlaneClipping;
162   }
163 
SetBackPlaneDistance(Standard_Real theDistance)164   void SetBackPlaneDistance(Standard_Real theDistance)
165   {
166     myBackPlaneDistance = theDistance;
167     myBackPlaneClipping = Standard_True;
168   }
169 
BackPlaneDistance()170   Standard_Real BackPlaneDistance()
171   {
172     return myBackPlaneDistance;
173   }
174 
SetViewVolumeSidesClipping(Standard_Boolean theViewVolumeSidesClipping)175   void SetViewVolumeSidesClipping(Standard_Boolean theViewVolumeSidesClipping)
176   {
177     myViewVolumeSidesClipping = theViewVolumeSidesClipping;
178   }
179 
HasViewVolumeSidesClipping()180   Standard_Boolean HasViewVolumeSidesClipping()
181   {
182     return myViewVolumeSidesClipping;
183   }
184 
CreateGDTPoints(const Standard_Integer theLenght)185   void CreateGDTPoints(const Standard_Integer theLenght)
186   {
187     if (theLenght > 0)
188       myGDTPoints = new TColgp_HArray1OfPnt(1, theLenght);
189   }
190 
HasGDTPoints()191   Standard_Boolean HasGDTPoints()
192   {
193     return (!myGDTPoints.IsNull());
194   }
195 
NbGDTPoints()196   Standard_Integer NbGDTPoints()
197   {
198     if (myGDTPoints.IsNull())
199       return 0;
200     return myGDTPoints->Length();
201   }
202 
SetGDTPoint(const Standard_Integer theIndex,const gp_Pnt thePoint)203   void SetGDTPoint(const Standard_Integer theIndex, const gp_Pnt thePoint)
204   {
205     if (myGDTPoints.IsNull())
206       return;
207     if (theIndex > 0 && theIndex <= myGDTPoints->Length())
208       myGDTPoints->SetValue(theIndex, thePoint);
209   }
210 
GDTPoint(const Standard_Integer theIndex)211   gp_Pnt GDTPoint(const Standard_Integer theIndex)
212   {
213     if (myGDTPoints.IsNull())
214       return gp_Pnt();
215     if (theIndex > 0 && theIndex <= myGDTPoints->Length())
216       return myGDTPoints->Value(theIndex);
217     else
218       return gp_Pnt();
219   }
220 
221   DEFINE_STANDARD_RTTIEXT(XCAFView_Object,Standard_Transient)
222 
223 private:
224 
225   Handle(TCollection_HAsciiString) myName;
226   XCAFView_ProjectionType myType;
227   gp_Pnt myProjectionPoint;
228   gp_Dir myViewDirection;
229   gp_Dir myUpDirection;
230   Standard_Real myZoomFactor;
231   Standard_Real myWindowHorizontalSize;
232   Standard_Real myWindowVerticalSize;
233   Handle(TCollection_HAsciiString) myClippingExpression;
234   Standard_Boolean myFrontPlaneClipping;
235   Standard_Real myFrontPlaneDistance;
236   Standard_Boolean myBackPlaneClipping;
237   Standard_Real myBackPlaneDistance;
238   Standard_Boolean myViewVolumeSidesClipping;
239   Handle(TColgp_HArray1OfPnt) myGDTPoints; // Point for each GDT to describe position of GDT frame in View.
240 };
241 
242 #endif // _XCAFView_Object_HeaderFile
243