0027816: Visualization - provide an API for overriding clipping planes list
[occt.git] / src / Graphic3d / Graphic3d_CView.hxx
index 451b9c3..01f9a7a 100644 (file)
@@ -15,7 +15,6 @@
 #define _Graphic3d_CView_HeaderFile
 
 #include <Aspect_Handle.hxx>
-#include <Aspect_PrintAlgo.hxx>
 #include <Aspect_RenderingContext.hxx>
 #include <Aspect_TypeOfTriedronEcho.hxx>
 #include <Aspect_TypeOfTriedronPosition.hxx>
@@ -26,6 +25,7 @@
 #include <Graphic3d_CLight.hxx>
 #include <Graphic3d_CStructure.hxx>
 #include <Graphic3d_DataStructureManager.hxx>
+#include <Graphic3d_DiagnosticInfo.hxx>
 #include <Graphic3d_ExportFormat.hxx>
 #include <Graphic3d_GraduatedTrihedron.hxx>
 #include <Graphic3d_MapOfStructure.hxx>
@@ -35,7 +35,6 @@
 #include <Graphic3d_SequenceOfStructure.hxx>
 #include <Graphic3d_SortType.hxx>
 #include <Graphic3d_Structure.hxx>
-#include <Graphic3d_StructureManagerPtr.hxx>
 #include <Graphic3d_TextureEnv.hxx>
 #include <Graphic3d_TypeOfAnswer.hxx>
 #include <Graphic3d_TypeOfBackfacingModel.hxx>
@@ -48,6 +47,7 @@
 #include <Quantity_NameOfColor.hxx>
 #include <Standard_Address.hxx>
 #include <Standard_Transient.hxx>
+#include <TColStd_IndexedDataMapOfStringString.hxx>
 
 class Graphic3d_CView;
 class Graphic3d_GraphicDriver;
@@ -108,8 +108,10 @@ public:
   //! Computes the new presentation of the structure  displayed in this view with the type Graphic3d_TOS_COMPUTED.
   Standard_EXPORT void ReCompute (const Handle(Graphic3d_Structure)& theStructure);
 
-  //! Updates screen in function of modifications of the structures.
-  Standard_EXPORT void Update (const Aspect_TypeOfUpdate theUpdateMode);
+  //! Updates screen in function of modifications of the structures
+  //! and invalidates bounding box of specified ZLayerId.
+  Standard_EXPORT void Update (const Aspect_TypeOfUpdate theUpdateMode,
+                               const Graphic3d_ZLayerId  theLayerId = Graphic3d_ZLayerId_UNKNOWN);
 
   //! Returns Standard_True if one of the structures displayed in the view contains Polygons, Triangles or Quadrangles.
   Standard_EXPORT Standard_Boolean ContainsFacet() const;
@@ -134,19 +136,19 @@ public:
   Standard_EXPORT Standard_Boolean IsComputed (const Standard_Integer theStructId,
                                                Handle(Graphic3d_Structure)& theComputedStruct) const;
 
-  //! Returns the coordinates of the boundary box of all
-  //! structures displayed in the view.
-  //! If <theToIgnoreInfiniteFlag> is TRUE, then the boundary box
-  //! also includes minimum and maximum limits of graphical elements
-  //! forming parts of infinite structures.
-  Standard_EXPORT Bnd_Box MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
+  //! Returns the bounding box of all structures displayed in the view.
+  //! If theToIncludeAuxiliary is TRUE, then the boundary box also includes minimum and maximum limits
+  //! of graphical elements forming parts of infinite and other auxiliary structures.
+  //! @param theToIncludeAuxiliary consider also auxiliary presentations (with infinite flag or with trihedron transformation persistence)
+  //! @return computed bounding box
+  Standard_EXPORT Bnd_Box MinMaxValues (const Standard_Boolean theToIncludeAuxiliary = Standard_False) const;
 
   //! Returns the coordinates of the boundary box of all structures in the set <theSet>.
   //! If <theToIgnoreInfiniteFlag> is TRUE, then the boundary box
   //! also includes minimum and maximum limits of graphical elements
   //! forming parts of infinite structures.
   Standard_EXPORT Bnd_Box MinMaxValues (const Graphic3d_MapOfStructure& theSet,
-                                        const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
+                                        const Standard_Boolean theToIncludeAuxiliary = Standard_False) const;
 
   //! Returns the structure manager handle which manage structures associated with this view.
   const Handle(Graphic3d_StructureManager)& StructureManager() const { return myStructureManager; }
@@ -297,27 +299,6 @@ public:
   //! Dump active rendering buffer into specified memory buffer.
   virtual Standard_Boolean BufferDump (Image_PixMap& theImage, const Graphic3d_BufferType& theBufferType) = 0;
 
-  //! Print the contents of the view to the printer.
-  //! @param thePrinterDC        pass the PrinterDeviceContext (HDC)
-  //! @param theToShowBackground when set to FALSE then print the view without background
-  //!                            color (background is white) else set to TRUE for printing
-  //!                            with current background color
-  //! @param theFileName         if != NULL, then the view will be printed to a file
-  //! @param thePrintAlgorithm   select print algorithm: stretch, tile
-  //! @param theScaleFactor      scaling coefficient, used internally to scale the printings
-  //!                            accordingly to the scale factor selected in the printer properties dialog
-  //! @return Standard_True if the data is passed to the printer, otherwise Standard_False if
-  //! the print operation failed due to the printer errors, or lack of system memory. This might be related
-  //! to insufficient memory or some internal errors.
-  //! All this errors are indicated by the message boxes (on level of OpenGl_GraphicDriver).
-  //! Warning: This function can reuse FBO assigned to the view, please take it into account
-  //! if you use it for your purposes.
-  virtual Standard_Boolean Print (const Aspect_Handle    thePrinterDC,
-                                  const Standard_Boolean theToShowBackground,
-                                  const Standard_CString theFileName,
-                                  const Aspect_PrintAlgo thePrintAlgorithm = Aspect_PA_STRETCH,
-                                  const Standard_Real    theScaleFactor = 1.0) = 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
@@ -336,6 +317,26 @@ public:
   //! ID for the structure.
   virtual void AddZLayer (const Graphic3d_ZLayerId theLayerId) = 0;
 
+  //! Returns the maximum Z layer ID.
+  //! First layer ID is Graphic3d_ZLayerId_Default, last ID is ZLayerMax().
+  virtual Standard_Integer ZLayerMax() const = 0;
+
+  //! Returns the bounding box of all structures displayed in the Z layer.
+  virtual void InvalidateZLayerBoundingBox (const Graphic3d_ZLayerId theLayerId) const = 0;
+
+  //! Returns the bounding box of all structures displayed in the Z layer.
+  //! @param theLayerId            layer identifier
+  //! @param theCamera             camera definition
+  //! @param theWindowWidth        viewport width  (for applying transformation-persistence)
+  //! @param theWindowHeight       viewport height (for applying transformation-persistence)
+  //! @param theToIncludeAuxiliary consider also auxiliary presentations (with infinite flag or with trihedron transformation persistence)
+  //! @return computed bounding box
+  virtual Graphic3d_BndBox4f ZLayerBoundingBox (const Graphic3d_ZLayerId        theLayerId,
+                                                const Handle(Graphic3d_Camera)& theCamera,
+                                                const Standard_Integer          theWindowWidth,
+                                                const Standard_Integer          theWindowHeight,
+                                                const Standard_Boolean          theToIncludeAuxiliary) const = 0;
+
   //! Remove Z layer from the specified view. All structures
   //! displayed at the moment in layer will be displayed in default layer
   //! ( the bottom-level z layer ). To unset layer ID from associated
@@ -346,6 +347,9 @@ public:
   virtual void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId,
                                   const Graphic3d_ZLayerSettings& theSettings) = 0;
 
+  //! Returns zoom-scale factor.
+  Standard_EXPORT Standard_Real ConsiderZoomPersistenceObjects();
+
   //! Returns pointer to an assigned framebuffer object.
   virtual Handle(Standard_Transient) FBO() const = 0;
 
@@ -385,12 +389,6 @@ public:
   //! Returns reference to current rendering parameters and effect settings.
   Graphic3d_RenderingParams& ChangeRenderingParams() { return myRenderParams; }
 
-  //! Returns true if anti-aliasing is enabled for the view.
-  virtual Standard_Boolean IsAntialiasingEnabled() const = 0;
-
-  //! Enable or disable anti-aliasing in the view.
-  virtual void SetAntialiasingEnabled (const Standard_Boolean theIsEnabled) = 0;
-
   //! Returns background  fill color.
   virtual Aspect_Background Background() const = 0;
 
@@ -445,48 +443,6 @@ public:
   //! Sets camera used by the view.
   virtual void SetCamera (const Handle(Graphic3d_Camera)& theCamera) = 0;
 
-  //! Returns the activity of back z-clipping plane.
-  virtual Standard_Boolean BackZClippingIsOn() const = 0;
-
-  //! Activates the back Z-clipping plane.
-  virtual void SetBackZClippingOn (const Standard_Boolean theIsOn) = 0;
-
-  //! Returns the definition of the back Z-clipping plane.
-  virtual Standard_Real ZClippingBackPlane() const = 0;
-
-  //! Sets the definition of the back Z-clipping plane.
-  virtual void SetZClippingBackPlane (const Standard_Real theValue) = 0;
-
-  //! Returns the activity of front z-clipping plane.
-  virtual Standard_Boolean FrontZClippingIsOn() const = 0;
-
-  //! Activates the front Z-clipping plane.
-  virtual void SetFrontZClippingOn (const Standard_Boolean theIsOn) = 0;
-
-  //! Returns the definition of the front Z-clipping plane.
-  virtual Standard_Real ZClippingFrontPlane() const = 0;
-
-  //! Sets the definition of the front Z-clipping plane.
-  virtual void SetZClippingFrontPlane (const Standard_Real theValue) = 0;
-
-  //! Returns the activity of depth cueing.
-  virtual Standard_Boolean DepthCueingIsOn() const = 0;
-
-  //! Sets the activity of depth cueing.
-  virtual void SetDepthCueingOn (const Standard_Boolean theIsOn) = 0;
-
-  //! Returns the back depth cueing plane.
-  virtual Standard_Real DepthCueingBackPlane() const = 0;
-
-  //! Set the back depth cueing plane.
-  virtual void SetDepthCueingBackPlane (const Standard_Real theValue) = 0;
-
-  //! Returns the front depth cueing plane.
-  virtual Standard_Real DepthCueingFrontPlane() const = 0;
-
-  //! Set the front depth cueing plane.
-  virtual void SetDepthCueingFrontPlane (const Standard_Real theValue) = 0;
-
   //! Returns true if GL lighting is enabled.
   virtual Standard_Boolean IsGLLightEnabled() const = 0;
 
@@ -500,10 +456,20 @@ public:
   virtual void SetLights (const Graphic3d_ListOfCLight& theLights) = 0;
 
   //! Returns list of clip planes set for the view.
-  virtual const Graphic3d_SequenceOfHClipPlane& ClipPlanes() const = 0;
+  virtual const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const = 0;
 
   //! Sets list of clip planes for the view.
-  virtual void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) = 0;
+  virtual void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) = 0;
+
+  //! Fill in the dictionary with diagnostic info.
+  //! Should be called within rendering thread.
+  //!
+  //! This API should be used only for user output or for creating automated reports.
+  //! The format of returned information (e.g. key-value layout)
+  //! is NOT part of this API and can be changed at any time.
+  //! Thus application should not parse returned information to weed out specific parameters.
+  virtual void DiagnosticInformation (TColStd_IndexedDataMapOfStringString& theDict,
+                                      Graphic3d_DiagnosticInfo theFlags) const = 0;
 
 private:
 
@@ -522,29 +488,11 @@ private:
   virtual void changePriority (const Handle(Graphic3d_CStructure)& theCStructure,
                                const Standard_Integer theNewPriority) = 0;
 
-protected:
-
-  struct CachedMinMax
-  {
-    CachedMinMax() { Invalidate(); }
-
-    Bnd_Box& BoundingBox (const Standard_Boolean theToIgnoreInfiniteFlag)
-    {
-      return !theToIgnoreInfiniteFlag ? myBoundingBox[0] : myBoundingBox[1];
-    }
-    Standard_Boolean& IsOutdated (const Standard_Boolean theToIgnoreInfiniteFlag)
-    {
-      return !theToIgnoreInfiniteFlag ? myIsOutdated[0] : myIsOutdated[1];
-    }
-    void Invalidate()
-    {
-      myIsOutdated[0] = Standard_True;
-      myIsOutdated[1] = Standard_True;
-    }
-
-    Standard_Boolean myIsOutdated [2];
-    Bnd_Box          myBoundingBox[2];
-  };
+  //! Returns zoom-scale factor.
+  virtual Standard_Real considerZoomPersistenceObjects (const Graphic3d_ZLayerId        theLayerId,
+                                                        const Handle(Graphic3d_Camera)& theCamera,
+                                                        const Standard_Integer          theWindowWidth,
+                                                        const Standard_Integer          theWindowHeight) const = 0;
 
 protected:
 
@@ -559,7 +507,6 @@ protected:
   Standard_Boolean myIsActive;
   Standard_Boolean myIsRemoved;
   Graphic3d_TypeOfVisualization myVisualization;
-  mutable CachedMinMax myMinMax;
 
 private: