0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / Graphic3d / Graphic3d_CView.hxx
index 3856bf9..5691912 100644 (file)
 #include <Graphic3d_CStructure.hxx>
 #include <Graphic3d_DataStructureManager.hxx>
 #include <Graphic3d_DiagnosticInfo.hxx>
-#include <Graphic3d_ExportFormat.hxx>
 #include <Graphic3d_GraduatedTrihedron.hxx>
 #include <Graphic3d_MapOfStructure.hxx>
 #include <Graphic3d_NMapOfTransient.hxx>
 #include <Graphic3d_RenderingParams.hxx>
 #include <Graphic3d_SequenceOfHClipPlane.hxx>
 #include <Graphic3d_SequenceOfStructure.hxx>
-#include <Graphic3d_SortType.hxx>
 #include <Graphic3d_Structure.hxx>
 #include <Graphic3d_TextureEnv.hxx>
 #include <Graphic3d_TypeOfAnswer.hxx>
@@ -59,6 +57,8 @@ DEFINE_STANDARD_HANDLE (Graphic3d_CView, Graphic3d_DataStructureManager)
 //! computed (HLR or "view-dependent") structures.
 class Graphic3d_CView : public Graphic3d_DataStructureManager
 {
+  friend class Graphic3d_StructureManager;
+  DEFINE_STANDARD_RTTIEXT(Graphic3d_CView, Graphic3d_DataStructureManager)
 public:
 
   //! Constructor.
@@ -87,8 +87,21 @@ public:
   //! Returns true if the view was removed.
   Standard_Boolean IsRemoved() const { return myIsRemoved; }
 
+  //! Returns camera object of the view.
+  virtual const Handle(Graphic3d_Camera)& Camera() const { return myCamera; }
+
+  //! Sets camera used by the view.
+  virtual void SetCamera (const Handle(Graphic3d_Camera)& theCamera) { myCamera = theCamera; }
+
 public:
 
+  //! Returns default Shading Model of the view; Graphic3d_TOSM_FRAGMENT by default.
+  Graphic3d_TypeOfShadingModel ShadingModel() const { return myShadingModel; }
+
+  //! Sets default Shading Model of the view.
+  //! Will throw an exception on attempt to set Graphic3d_TOSM_DEFAULT.
+  Standard_EXPORT void SetShadingModel (Graphic3d_TypeOfShadingModel theModel);
+
   //! Returns visualization type of the view.
   Graphic3d_TypeOfVisualization VisualizationType() const { return myVisualization; }
 
@@ -152,21 +165,20 @@ public:
 
 private:
 
-  friend class Graphic3d_StructureManager;
-
   //! Is it possible to display the structure in the view?
   Standard_EXPORT Graphic3d_TypeOfAnswer acceptDisplay (const Graphic3d_TypeOfStructure theStructType) const;
 
   //! Clears the structure in this view.
-  Standard_EXPORT void Clear (const Handle(Graphic3d_Structure)& theStructure, const Standard_Boolean theWithDestruction);
+  Standard_EXPORT void Clear (Graphic3d_Structure* theStructure,
+                              const Standard_Boolean theWithDestruction);
 
   //! Connects the structures.
-  Standard_EXPORT void Connect (const Handle(Graphic3d_Structure)& theMother,
-                                const Handle(Graphic3d_Structure)& theDaughter);
+  Standard_EXPORT void Connect (const Graphic3d_Structure* theMother,
+                                const Graphic3d_Structure* theDaughter);
 
   //! Disconnects the structures.
-  Standard_EXPORT void Disconnect (const Handle(Graphic3d_Structure)& theMother,
-                                   const Handle(Graphic3d_Structure)& theDaughter);
+  Standard_EXPORT void Disconnect (const Graphic3d_Structure* theMother,
+                                   const Graphic3d_Structure* theDaughter);
 
   //! Displays the structure in the view.
   Standard_EXPORT void Display (const Handle(Graphic3d_Structure)& theStructure);
@@ -186,7 +198,9 @@ private:
   Standard_EXPORT void UnHighlight (const Handle(Graphic3d_Structure)& theStructure);
 
   //! Returns an index != 0 if the structure have another structure computed for the view <me>.
-  Standard_EXPORT Standard_Integer IsComputed (const Handle(Graphic3d_Structure)& theStructure) const;
+  Standard_EXPORT Standard_Integer IsComputed (const Graphic3d_Structure* theStructure) const;
+
+  Standard_Integer IsComputed (const Handle(Graphic3d_Structure)& theStructure) const { return IsComputed (theStructure.get()); }
 
   //! Returns true if the structure is displayed in the view.
   Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(Graphic3d_Structure)& theStructure) const;
@@ -247,33 +261,11 @@ public:
   //! Returns True if the window associated to the view is defined.
   virtual Standard_Boolean IsDefined() const = 0;
 
-  //! Returns data of a graduated trihedron
-  virtual const Graphic3d_GraduatedTrihedron& GetGraduatedTrihedron() = 0;
-
-  //! Displays Graduated Trihedron.
-  virtual void GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron& theTrihedronData) = 0;
-
-  //! Erases Graduated Trihedron.
-  virtual void GraduatedTrihedronErase() = 0;
-
-  //! Sets minimum and maximum points of scene bounding box for Graduated Trihedron stored in graphic view object.
-  //! @param theMin [in] the minimum point of scene.
-  //! @param theMax [in] the maximum point of scene.
-  virtual void GraduatedTrihedronMinMaxValues (const Graphic3d_Vec3 theMin, const Graphic3d_Vec3 theMax) = 0;
-
   //! Dump active rendering buffer into specified memory buffer.
   virtual Standard_Boolean BufferDump (Image_PixMap& theImage, const Graphic3d_BufferType& theBufferType) = 0;
 
-  //! Export scene into the one of the Vector graphics formats (SVG, PS, PDF...).
-  //! In contrast to Bitmaps, Vector graphics is scalable (so you may got quality benefits
-  //! on printing to laser printer). Notice however that results may differ a lot and
-  //! do not contain some elements.
-  virtual Standard_Boolean Export (const Standard_CString theFileName,
-                                   const Graphic3d_ExportFormat theFormat,
-                                   const Graphic3d_SortType theSortType = Graphic3d_ST_BSP_Tree) = 0;
-
   //! Marks BVH tree and the set of BVH primitives of correspondent priority list with id theLayerId as outdated.
-  virtual void InvalidateBVHData (const Standard_Integer theLayerId) = 0;
+  virtual void InvalidateBVHData (const Graphic3d_ZLayerId theLayerId) = 0;
 
   //! Add a new top-level z layer with ID <theLayerId> for
   //! the view. Z layers allow drawing structures in higher layers
@@ -355,10 +347,10 @@ public:
   Graphic3d_RenderingParams& ChangeRenderingParams() { return myRenderParams; }
 
   //! Returns background  fill color.
-  virtual Aspect_Background Background() const = 0;
+  virtual Aspect_Background Background() const { return Aspect_Background (myBgColor.GetRGB()); }
 
   //! Sets background fill color.
-  virtual void SetBackground (const Aspect_Background& theBackground) = 0;
+  virtual void SetBackground (const Aspect_Background& theBackground) { myBgColor.SetRGB (theBackground.Color()); }
 
   //! Returns gradient background fill colors.
   virtual Aspect_GradientBackground GradientBackground() const = 0;
@@ -384,35 +376,17 @@ public:
   //! Sets environment texture for the view.
   virtual void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTextureEnv) = 0;
 
-  //! Returns the state of frustum culling optimization.
-  virtual Standard_Boolean IsCullingEnabled() const = 0;
-
-  //! Enables or disables frustum culling optimization.
-  virtual void SetCullingEnabled (const Standard_Boolean theIsEnabled) = 0;
-
-  //! Returns shading model of the view.
-  virtual Graphic3d_TypeOfShadingModel ShadingModel() const = 0;
-
-  //! Sets shading model of the view.
-  virtual void SetShadingModel (const Graphic3d_TypeOfShadingModel theModel) = 0;
-
   //! Return backfacing model used for the view.
   virtual Graphic3d_TypeOfBackfacingModel BackfacingModel() const = 0;
 
   //! Sets backfacing model for the view.
   virtual void SetBackfacingModel (const Graphic3d_TypeOfBackfacingModel theModel) = 0;
 
-  //! Returns camera object of the view.
-  virtual const Handle(Graphic3d_Camera)& Camera() const = 0;
-
-  //! Sets camera used by the view.
-  virtual void SetCamera (const Handle(Graphic3d_Camera)& theCamera) = 0;
-
   //! Returns list of lights of the view.
-  virtual const Graphic3d_ListOfCLight& Lights() const = 0;
+  virtual const Handle(Graphic3d_LightSet)& Lights() const = 0;
 
   //! Sets list of lights for the view.
-  virtual void SetLights (const Graphic3d_ListOfCLight& theLights) = 0;
+  virtual void SetLights (const Handle(Graphic3d_LightSet)& theLights) = 0;
 
   //! Returns list of clip planes set for the view.
   virtual const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const = 0;
@@ -430,6 +404,32 @@ public:
   virtual void DiagnosticInformation (TColStd_IndexedDataMapOfStringString& theDict,
                                       Graphic3d_DiagnosticInfo theFlags) const = 0;
 
+  //! Returns string with statistic performance info.
+  virtual TCollection_AsciiString StatisticInformation() const = 0;
+
+  //! Fills in the dictionary with statistic performance info.
+  virtual void StatisticInformation (TColStd_IndexedDataMapOfStringString& theDict) const = 0;
+
+public: //! @name obsolete Graduated Trihedron functionality
+
+  //! Returns data of a graduated trihedron
+  virtual const Graphic3d_GraduatedTrihedron& GetGraduatedTrihedron() { return myGTrihedronData; }
+
+  //! Displays Graduated Trihedron.
+  virtual void GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron& theTrihedronData) { (void )theTrihedronData; }
+
+  //! Erases Graduated Trihedron.
+  virtual void GraduatedTrihedronErase() {}
+
+  //! Sets minimum and maximum points of scene bounding box for Graduated Trihedron stored in graphic view object.
+  //! @param theMin [in] the minimum point of scene.
+  //! @param theMax [in] the maximum point of scene.
+  virtual void GraduatedTrihedronMinMaxValues (const Graphic3d_Vec3 theMin, const Graphic3d_Vec3 theMax)
+  {
+    (void )theMin;
+    (void )theMax;
+  }
+
 private:
 
   //! Adds the structure to display lists of the view.
@@ -457,7 +457,9 @@ protected:
 
   Standard_Integer myId;
   Graphic3d_RenderingParams myRenderParams;
+  Quantity_ColorRGBA        myBgColor;
   Handle(Graphic3d_StructureManager) myStructureManager;
+  Handle(Graphic3d_Camera)  myCamera;
   Graphic3d_SequenceOfStructure myStructsToCompute;
   Graphic3d_SequenceOfStructure myStructsComputed;
   Graphic3d_MapOfStructure myStructsDisplayed;
@@ -465,11 +467,13 @@ protected:
   Standard_Boolean myIsInComputedMode;
   Standard_Boolean myIsActive;
   Standard_Boolean myIsRemoved;
+  Graphic3d_TypeOfShadingModel  myShadingModel;
   Graphic3d_TypeOfVisualization myVisualization;
 
-private:
+protected:
+
+  Graphic3d_GraduatedTrihedron myGTrihedronData;
 
-  DEFINE_STANDARD_RTTIEXT(Graphic3d_CView,Graphic3d_DataStructureManager)
 };
 
 #endif // _Graphic3d_CView_HeaderFile