Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:54

0001 // Created on: 2018-12-12
0002 // Created by: Olga SURYANINOVA
0003 // Copyright (c) 2018 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 _AIS_CameraFrustum_HeaderFile
0017 #define _AIS_CameraFrustum_HeaderFile
0018 
0019 #include <AIS_InteractiveObject.hxx>
0020 
0021 class Graphic3d_ArrayOfSegments;
0022 class Graphic3d_ArrayOfTriangles;
0023 
0024 //! Presentation for drawing camera frustum.
0025 //! Default configuration is built with filling and some transparency.
0026 class AIS_CameraFrustum : public AIS_InteractiveObject
0027 {
0028   DEFINE_STANDARD_RTTIEXT(AIS_CameraFrustum, AIS_InteractiveObject)
0029 public:
0030 
0031   //! Selection modes supported by this object
0032   enum SelectionMode
0033   {
0034     SelectionMode_Edges  = 0, //!< detect by edges (default)
0035     SelectionMode_Volume = 1, //!< detect by volume
0036   };
0037 
0038 public:
0039 
0040   //! Constructs camera frustum with default configuration.
0041   Standard_EXPORT AIS_CameraFrustum();
0042 
0043   //! Sets camera frustum.
0044   Standard_EXPORT void SetCameraFrustum (const Handle(Graphic3d_Camera)& theCamera);
0045 
0046   //! Setup custom color.
0047   Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
0048 
0049   //! Restore default color.
0050   Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
0051 
0052   //! Restore transparency setting.
0053   Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE;
0054 
0055   //! Return true if specified display mode is supported.
0056   Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE;
0057 
0058 protected:
0059 
0060   //! Computes presentation of camera frustum.
0061   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
0062                                         const Handle(Prs3d_Presentation)& thePrs,
0063                                         const Standard_Integer theMode) Standard_OVERRIDE;
0064 
0065   //! Compute selection.
0066   Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
0067                                                  const Standard_Integer             theMode) Standard_OVERRIDE;
0068 
0069 private:
0070 
0071   //! Fills triangles primitive array for camera frustum filling.
0072   void fillTriangles();
0073 
0074   //! Fills polylines primitive array for camera frustum borders.
0075   void fillBorders();
0076 
0077 protected:
0078 
0079   NCollection_Array1<Graphic3d_Vec3d> myPoints;    //!< Array of points
0080   Handle(Graphic3d_ArrayOfTriangles)  myTriangles; //!< Triangles for camera frustum filling
0081   Handle(Graphic3d_ArrayOfSegments)   myBorders;   //!< Segments for camera frustum borders
0082 
0083 };
0084 
0085 #endif // _AIS_CameraFrustum_HeaderFile