Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-04 09:16:43

0001 // Created on: 2016-10-20
0002 // Created by: Irina KRYLOVA
0003 // Copyright (c) 2016 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _XCAFView_Object_HeaderFile
0017 #define _XCAFView_Object_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <gp_Pln.hxx>
0023 #include <gp_Pnt.hxx>
0024 #include <NCollection_Array1.hxx>
0025 #include <NCollection_HArray1.hxx>
0026 #include <TCollection_HAsciiString.hxx>
0027 #include <XCAFView_ProjectionType.hxx>
0028 
0029 //! Access object for saved view
0030 class XCAFView_Object : public Standard_Transient
0031 {
0032 
0033 public:
0034   Standard_EXPORT XCAFView_Object();
0035 
0036   Standard_EXPORT XCAFView_Object(const occ::handle<XCAFView_Object>& theObj);
0037 
0038   void SetName(occ::handle<TCollection_HAsciiString> theName) { myName = theName; }
0039 
0040   occ::handle<TCollection_HAsciiString> Name() { return myName; }
0041 
0042   void SetType(XCAFView_ProjectionType theType) { myType = theType; }
0043 
0044   XCAFView_ProjectionType Type() { return myType; }
0045 
0046   void SetProjectionPoint(const gp_Pnt& thePoint) { myProjectionPoint = thePoint; }
0047 
0048   gp_Pnt ProjectionPoint() { return myProjectionPoint; }
0049 
0050   void SetViewDirection(const gp_Dir& theDirection) { myViewDirection = theDirection; }
0051 
0052   gp_Dir ViewDirection() { return myViewDirection; }
0053 
0054   void SetUpDirection(const gp_Dir& theDirection) { myUpDirection = theDirection; }
0055 
0056   gp_Dir UpDirection() { return myUpDirection; }
0057 
0058   void SetZoomFactor(double theZoomFactor) { myZoomFactor = theZoomFactor; }
0059 
0060   double ZoomFactor() { return myZoomFactor; }
0061 
0062   void SetWindowHorizontalSize(double theSize) { myWindowHorizontalSize = theSize; }
0063 
0064   double WindowHorizontalSize() { return myWindowHorizontalSize; }
0065 
0066   void SetWindowVerticalSize(double theSize) { myWindowVerticalSize = theSize; }
0067 
0068   double WindowVerticalSize() { return myWindowVerticalSize; }
0069 
0070   void SetClippingExpression(occ::handle<TCollection_HAsciiString> theExpression)
0071   {
0072     myClippingExpression = theExpression;
0073   }
0074 
0075   occ::handle<TCollection_HAsciiString> ClippingExpression() { return myClippingExpression; }
0076 
0077   void UnsetFrontPlaneClipping() { myFrontPlaneClipping = false; }
0078 
0079   bool HasFrontPlaneClipping() { return myFrontPlaneClipping; }
0080 
0081   void SetFrontPlaneDistance(double theDistance)
0082   {
0083     myFrontPlaneDistance = theDistance;
0084     myFrontPlaneClipping = true;
0085   }
0086 
0087   double FrontPlaneDistance() { return myFrontPlaneDistance; }
0088 
0089   void UnsetBackPlaneClipping() { myBackPlaneClipping = false; }
0090 
0091   bool HasBackPlaneClipping() { return myBackPlaneClipping; }
0092 
0093   void SetBackPlaneDistance(double theDistance)
0094   {
0095     myBackPlaneDistance = theDistance;
0096     myBackPlaneClipping = true;
0097   }
0098 
0099   double BackPlaneDistance() { return myBackPlaneDistance; }
0100 
0101   void SetViewVolumeSidesClipping(bool theViewVolumeSidesClipping)
0102   {
0103     myViewVolumeSidesClipping = theViewVolumeSidesClipping;
0104   }
0105 
0106   bool HasViewVolumeSidesClipping() { return myViewVolumeSidesClipping; }
0107 
0108   void CreateGDTPoints(const int theLenght)
0109   {
0110     if (theLenght > 0)
0111       myGDTPoints = new NCollection_HArray1<gp_Pnt>(1, theLenght);
0112   }
0113 
0114   bool HasGDTPoints() { return (!myGDTPoints.IsNull()); }
0115 
0116   int NbGDTPoints()
0117   {
0118     if (myGDTPoints.IsNull())
0119       return 0;
0120     return myGDTPoints->Length();
0121   }
0122 
0123   void SetGDTPoint(const int theIndex, const gp_Pnt& thePoint)
0124   {
0125     if (myGDTPoints.IsNull())
0126       return;
0127     if (theIndex > 0 && theIndex <= myGDTPoints->Length())
0128       myGDTPoints->SetValue(theIndex, thePoint);
0129   }
0130 
0131   gp_Pnt GDTPoint(const int theIndex)
0132   {
0133     if (myGDTPoints.IsNull())
0134       return gp_Pnt();
0135     if (theIndex > 0 && theIndex <= myGDTPoints->Length())
0136       return myGDTPoints->Value(theIndex);
0137     else
0138       return gp_Pnt();
0139   }
0140 
0141   DEFINE_STANDARD_RTTIEXT(XCAFView_Object, Standard_Transient)
0142 
0143 private:
0144   occ::handle<TCollection_HAsciiString> myName;
0145   XCAFView_ProjectionType               myType;
0146   gp_Pnt                                myProjectionPoint;
0147   gp_Dir                                myViewDirection;
0148   gp_Dir                                myUpDirection;
0149   double                                myZoomFactor;
0150   double                                myWindowHorizontalSize;
0151   double                                myWindowVerticalSize;
0152   occ::handle<TCollection_HAsciiString> myClippingExpression;
0153   bool                                  myFrontPlaneClipping;
0154   double                                myFrontPlaneDistance;
0155   bool                                  myBackPlaneClipping;
0156   double                                myBackPlaneDistance;
0157   bool                                  myViewVolumeSidesClipping;
0158   // clang-format off
0159   occ::handle<NCollection_HArray1<gp_Pnt>> myGDTPoints; // Point for each GDT to describe position of GDT frame in View.
0160   // clang-format on
0161 };
0162 
0163 #endif // _XCAFView_Object_HeaderFile