0028726: Quantity_NameOfColor should be replaced by Quantity_Color in function input...
[occt.git] / src / V3d / V3d_View.hxx
index 52bc122..778fb12 100644 (file)
 #include <Aspect_GradientBackground.hxx>
 #include <Aspect_GradientFillMethod.hxx>
 #include <Aspect_Handle.hxx>
-#include <Aspect_PrintAlgo.hxx>
 #include <Aspect_RenderingContext.hxx>
 #include <Aspect_TypeOfTriedronPosition.hxx>
-#include <Aspect_TypeOfTriedronEcho.hxx>
 
 #include <Bnd_Box.hxx>
 
@@ -50,7 +48,6 @@
 #include <Quantity_Coefficient.hxx>
 #include <Quantity_Factor.hxx>
 #include <Quantity_Length.hxx>
-#include <Quantity_NameOfColor.hxx>
 #include <Quantity_Parameter.hxx>
 #include <Quantity_PlaneAngle.hxx>
 #include <Quantity_Ratio.hxx>
@@ -68,8 +65,8 @@
 #include <TColStd_ListIteratorOfListOfTransient.hxx>
 
 #include <V3d_Coordinate.hxx>
-#include <V3d_ListOfTransient.hxx>
-#include <V3d_StereoDumpOptions.hxx>
+#include <V3d_ImageDumpOptions.hxx>
+#include <V3d_Trihedron.hxx>
 #include <V3d_TypeOfAxe.hxx>
 
 #include <V3d_TypeOfBackfacingModel.hxx>
@@ -77,7 +74,6 @@
 #include <V3d_TypeOfShadingModel.hxx>
 #include <V3d_TypeOfView.hxx>
 #include <V3d_TypeOfVisualization.hxx>
-#include <V3d_TypeOfZclipping.hxx>
 #include <V3d_Viewer.hxx>
 #include <V3d_ViewerPointer.hxx>
 
@@ -217,9 +213,6 @@ public:
   //! Defines the background color of the view.
   Standard_EXPORT void SetBackgroundColor (const Quantity_Color& theColor);
 
-  //! Defines the background color of the view by supplying the color name in the form Quantity_NOC_xxxx.
-  Standard_EXPORT void SetBackgroundColor (const Quantity_NameOfColor theName);
-
   //! Defines the gradient background colors of the view by supplying the colors
   //! and the fill method (horizontal by default).
   Standard_EXPORT void SetBgGradientColors (const Quantity_Color& theColor1,
@@ -227,13 +220,6 @@ public:
                                             const Aspect_GradientFillMethod theFillStyle = Aspect_GFM_HOR,
                                             const Standard_Boolean theToUpdate = Standard_False);
 
-  //! Defines the gradient background colors of the view by supplying  the color names
-  //! and the fill method (horizontal by default).
-  Standard_EXPORT void SetBgGradientColors (const Quantity_NameOfColor theColor1,
-                                            const Quantity_NameOfColor theColor2,
-                                            const Aspect_GradientFillMethod theFillStyle = Aspect_GFM_HOR,
-                                            const Standard_Boolean theToUpdate = Standard_False);
-
   //! Defines the gradient background fill method of the view.
   Standard_EXPORT void SetBgGradientStyle (const Aspect_GradientFillMethod theMethod = Aspect_GFM_HOR,
                                            const Standard_Boolean theToUpdate = Standard_False);
@@ -263,27 +249,6 @@ public:
   //! Defines the visualization type in the view.
   Standard_EXPORT void SetVisualization (const V3d_TypeOfVisualization theType);
 
-  //! Defines the depth of the medium clipping plane.
-  Standard_EXPORT void SetZClippingDepth (const Quantity_Length theDepth);
-
-  //! Defines the thickness around the medium clipping plane.
-  Standard_EXPORT void SetZClippingWidth (const Quantity_Length theWidth);
-
-  //! Defines the type of ZClipping.
-  Standard_EXPORT void SetZClippingType (const V3d_TypeOfZclipping theType);
-
-  //! Defines the depth of the medium plane.
-  Standard_EXPORT void SetZCueingDepth (const Quantity_Length theDepth);
-
-  //! Defines the thickness around the medium plane.
-  Standard_EXPORT void SetZCueingWidth (const Quantity_Length theWidth);
-
-  //! Activates ZCueing in the view.
-  Standard_EXPORT void SetZCueingOn();
-
-  //! Deactivates ZCueing in the view.
-  Standard_EXPORT void SetZCueingOff();
-
   //! Activates theLight in the view.
   Standard_EXPORT void SetLightOn (const Handle(V3d_Light)& theLight);
 
@@ -308,9 +273,9 @@ public:
   //! position comes out of the view
   //! AxisDiametr - diameter relatively to axis length
   //! NbFacettes - number of facets of cylinders and cones
-  Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor theXColor = Quantity_NOC_RED,
-                                             const Quantity_NameOfColor theYColor = Quantity_NOC_GREEN,
-                                             const Quantity_NameOfColor theZColor = Quantity_NOC_BLUE1,
+  Standard_EXPORT void ZBufferTriedronSetup (const Quantity_Color& theXColor = Quantity_NOC_RED,
+                                             const Quantity_Color& theYColor = Quantity_NOC_GREEN,
+                                             const Quantity_Color& theZColor = Quantity_NOC_BLUE1,
                                              const Standard_Real theSizeRatio = 0.8,
                                              const Standard_Real theAxisDiametr = 0.05,
                                              const Standard_Integer theNbFacettes = 12);
@@ -319,16 +284,13 @@ public:
   //! Initialize position, color and length of Triedron axes.
   //! The scale is a percent of the window width.
   Standard_EXPORT void TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition = Aspect_TOTP_CENTER,
-                                        const Quantity_NameOfColor theColor = Quantity_NOC_WHITE,
+                                        const Quantity_Color& theColor = Quantity_NOC_WHITE,
                                         const Standard_Real theScale = 0.02,
                                         const V3d_TypeOfVisualization theMode = V3d_WIREFRAME);
 
   //! Erases the Triedron.
   Standard_EXPORT void TriedronErase();
 
-  //! Highlights the echo zone of the Triedron.
-  Standard_EXPORT void TriedronEcho (const Aspect_TypeOfTriedronEcho theType = Aspect_TOTE_NONE);
-
   //! Returns data of a graduated trihedron.
   Standard_EXPORT const Graphic3d_GraduatedTrihedron& GetGraduatedTrihedron() const;
 
@@ -714,35 +676,23 @@ public:
   //! Returns the current visualisation mode.
   Standard_EXPORT V3d_TypeOfVisualization Visualization() const;
 
-  //! Returns activity and information on the Zcueing.
-  //! <Depth> : Depth of plane.
-  //! <Width> : Thickness around the plane.
-  Standard_EXPORT Standard_Boolean ZCueing (Quantity_Length& theDepth, Quantity_Length& theWidth) const;
-
-  //! Returns current information on the ZClipping.
-  //! <Depth> : Depth of plane.
-  //! <Width> : Thickness around the plane.
-  //! <TypeOfZclipping>  :        "BACK"
-  //! "FRONT"
-  //! "SLICE"
-  //! "OFF"
-  Standard_EXPORT V3d_TypeOfZclipping ZClipping (Quantity_Length& theDepth, Quantity_Length& theWidth) const;
-
   //! Returns True if One light more can be
   //! activated in this View.
   Standard_EXPORT Standard_Boolean IfMoreLights() const;
 
+  //! Return iterator for defined lights.
+  V3d_ListOfLightIterator ActiveLightIterator() const { return V3d_ListOfLightIterator (myActiveLights); }
+
   //! initializes an iteration on the active Lights.
-  Standard_EXPORT void InitActiveLights();
+  void InitActiveLights() { myActiveLightsIterator.Initialize (myActiveLights); }
 
   //! returns true if there are more active Light(s) to return.
-  Standard_EXPORT Standard_Boolean MoreActiveLights() const;
+  Standard_Boolean MoreActiveLights() const { return myActiveLightsIterator.More(); }
 
-  //! Go to the next active Light
-  //! (if there is not, ActiveLight will raise an exception)
-  Standard_EXPORT void NextActiveLights();
+  //! Go to the next active Light (if there is not, ActiveLight will raise an exception)
+  void NextActiveLights() { myActiveLightsIterator.Next(); }
 
-  Standard_EXPORT Handle(V3d_Light) ActiveLight() const;
+  const Handle(V3d_Light)& ActiveLight() const { return myActiveLightsIterator.Value(); }
 
   //! Returns the MAX number of light associated to the view.
   Standard_EXPORT Standard_Integer LightLimit() const;
@@ -842,55 +792,41 @@ public:
   //! Returns FALSE when the dump has failed
   Standard_EXPORT Standard_Boolean Dump (const Standard_CString theFile, const Graphic3d_BufferType& theBufferType = Graphic3d_BT_RGB);
 
-  //! print the contents of the view to printer with preview.
-  //! <thePrintDC> : If you have already an PrinterDeviceContext (HDC),
-  //! then you can pass it to the print routines.
-  //! If you don't have an PrinterDeviceContext, then this parameter should
-  //! be NULL.
-  //! <theShowDialog> : If thePrintDC == NULL, then you can force the print routines to
-  //! open a Print Dialog box.
-  //! If you want to do this, then set showDialog to TRUE
-  //! If you don't want to see a dialog (only possible, if you have a hPrnDC
-  //! or the dialog box was opened once before) then set <theShowDialog> to FALSE.
-  //! <theShowBackground> : When set to FALSE then print the view without background color
-  //! (background is white)
-  //! else set to TRUE for printing with current background color.
-  //! <theFilename>: If != NULL, then the view will be printed to a file.
-  //! <thePrintAlgorithm>: If you want to select the print algorithm, then you can
-  //! specify one of existing algorithms: Aspect_PA_STRETCH, Aspect_PA_TILE.
-  //! Returns Standard_True if the data is passed to the printer, otherwise
-  //! Standard_False if the print operation failed. 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 on level of OpenGl_GraphicDriver; Please take it into account if
-  //! you use it for your purposes;
-  //! Warning: Works only under Windows.
-  Standard_EXPORT Standard_Boolean Print (const Aspect_Handle    thePrintDC = 0,
-                                          const Standard_Boolean theShowDialog = Standard_True,
-                                          const Standard_Boolean theShowBackground = Standard_True,
-                                          const Standard_CString theFilename = NULL,
-                                          const Aspect_PrintAlgo thePrintAlgorithm = Aspect_PA_STRETCH) const;
-
   //! 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.
+  Standard_DEPRECATED("Export to Vector graphic is incompatible with Programmable Pipeline and should not be used")
   Standard_EXPORT Standard_Boolean Export (const Standard_CString theFileName,
                                            const Graphic3d_ExportFormat theFormat,
                                            const Graphic3d_SortType theSortType = Graphic3d_ST_BSP_Tree);
 
-  //! Dumps the full contents of the view
-  //! to a pixmap of pixel size <theWidth> * <theHeight> and
-  //! buffer type <theBufferType>. If <theToKeepAspect> is true
-  //! the aspect ratio of view will be kept if <theWidth> and <theHeight>
-  //! define another ratio.
-  //! Pixmap will be automatically (re)allocated when needed.
-  //! When dumping stereographic camera - the corresponding
-  //! middle-point monographic projection will be used for dumping by default.
-  //! <theStereoOptions> flags are to be used for dumping then left or
-  //! right eye projections.
-  Standard_EXPORT Standard_Boolean ToPixMap (Image_PixMap& theImage, const Standard_Integer theWidth, const Standard_Integer theHeight, const Graphic3d_BufferType& theBufferType = Graphic3d_BT_RGB, const Standard_Boolean theToKeepAspect = Standard_True, const V3d_StereoDumpOptions theStereoOptions = V3d_SDO_MONO);
+  //! Dumps the full contents of the view to a pixmap with specified parameters.
+  Standard_EXPORT Standard_Boolean ToPixMap (Image_PixMap&               theImage,
+                                             const V3d_ImageDumpOptions& theParams);
+
+  //! Dumps the full contents of the view to a pixmap.
+  //! @param theImage          target image, will be re-allocated to match theWidth x theHeight
+  //! @param theWidth          target image width
+  //! @param theHeight         target image height
+  //! @param theBufferType     type of the view buffer to dump (color / depth)
+  //! @param theToAdjustAspect when true, active view aspect ratio will be overridden by (theWidth / theHeight)
+  //! @param theStereoOptions  how to dump stereographic camera
+  Standard_Boolean ToPixMap (Image_PixMap& theImage,
+                             const Standard_Integer theWidth,
+                             const Standard_Integer theHeight,
+                             const Graphic3d_BufferType& theBufferType     = Graphic3d_BT_RGB,
+                             const Standard_Boolean      theToAdjustAspect = Standard_True,
+                             const V3d_StereoDumpOptions theStereoOptions  = V3d_SDO_MONO)
+  {
+    V3d_ImageDumpOptions aParams;
+    aParams.Width  = theWidth;
+    aParams.Height = theHeight;
+    aParams.BufferType = theBufferType;
+    aParams.StereoOptions  = theStereoOptions;
+    aParams.ToAdjustAspect = theToAdjustAspect;
+    return ToPixMap (theImage, aParams);
+  }
 
   //! Manages display of the back faces
   //! When <aModel> is TOBM_AUTOMATIC the object backfaces
@@ -906,13 +842,6 @@ public:
   //! Returns current state of the back faces display
   Standard_EXPORT V3d_TypeOfBackfacingModel BackFacingModel() const;
 
-  //! turns on/off opengl lighting, currently used in triedron displaying
-  Standard_EXPORT void EnableGLLight (const Standard_Boolean theIsEnabled = Standard_True) const;
-
-  //! returns the current state of the gl lighting
-  //! currently used in triedron displaying
-  Standard_EXPORT Standard_Boolean IsGLLightEnabled() const;
-
   //! Adds clip plane to the view. The composition of clip planes truncates the
   //! rendering space to convex volume. Number of supported clip planes can be consulted
   //! by PlaneLimit method of associated Graphic3d_GraphicDriver.
@@ -931,11 +860,18 @@ public:
   //! Graphic3d_GraphicDriver. Please be aware that the planes that
   //! exceed the limit are ignored during rendering.
   //! @param thePlanes [in] the clip planes to set.
-  Standard_EXPORT void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes);
+  Standard_EXPORT void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes);
+
+  Standard_DEPRECATED("This method is deprecated - overload taking Handle should be used instead")
+  void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes)
+  {
+    Handle(Graphic3d_SequenceOfHClipPlane) aPlanes = new Graphic3d_SequenceOfHClipPlane (thePlanes);
+    SetClipPlanes (aPlanes);
+  }
 
   //! Get clip planes.
   //! @return sequence clip planes that have been set for the view
-  Standard_EXPORT const Graphic3d_SequenceOfHClipPlane& GetClipPlanes() const;
+  Standard_EXPORT const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const;
 
   //! Returns the MAX number of clipping planes associated to the view.
   Standard_EXPORT Standard_Integer PlaneLimit() const;
@@ -948,6 +884,9 @@ public:
   //! the camera approach.
   Standard_EXPORT const Handle(Graphic3d_Camera)& Camera() const;
 
+  //! Return default camera.
+  const Handle(Graphic3d_Camera)& DefaultCamera() const { return myDefaultCamera; }
+
   //! Returns current rendering parameters and effect settings.
   //! By default it returns default parameters of current viewer.
   //! To define view-specific settings use method V3d_View::ChangeRenderingParams().
@@ -982,6 +921,17 @@ friend
   //! has been Iconified .
   Standard_EXPORT void V3d_Viewer::SetViewOff (const Handle(V3d_View)& View);
 
+  //! 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.
+  //! @param theDict  destination map for information
+  //! @param theFlags defines the information to be retrieved
+  Standard_EXPORT void DiagnosticInformation (TColStd_IndexedDataMapOfStringString& theDict,
+                                              Graphic3d_DiagnosticInfo theFlags) const;
 
   DEFINE_STANDARD_RTTIEXT(V3d_View,MMgt_TShared)
 
@@ -1021,11 +971,6 @@ private:
   //! the associated window is defined or resized.
   Standard_EXPORT void SetRatio();
 
-  //! Change the scale factor and position of the view
-  //! such as the bounding box <Umin, Vmin, Umax, Vmax> is contains
-  //! in the view.
-  Standard_EXPORT void FitAll (const Handle(Aspect_Window)& aWindow, const V3d_Coordinate Umin, const V3d_Coordinate Vmin, const V3d_Coordinate Umax, const V3d_Coordinate Vmax);
-  
   //! Determines the screen axes in the reference
   //! framework of the view.
   Standard_EXPORT static Standard_Boolean ScreenAxis (const gp_Dir& Vpn, const gp_Dir& Vup, Graphic3d_Vector& Xaxe, Graphic3d_Vector& Yaxe, Graphic3d_Vector& Zaxe);
@@ -1065,11 +1010,11 @@ protected:
 private:
 
   V3d_ViewerPointer MyViewer;
-  V3d_ListOfTransient MyActiveLights;
+  V3d_ListOfLight myActiveLights;
   Graphic3d_Vector MyDefaultViewAxis;
   Graphic3d_Vertex MyDefaultViewPoint;
   Handle(Aspect_Window) MyWindow;
-  TColStd_ListIteratorOfListOfTransient myActiveLightsIterator;
+  V3d_ListOfLight::Iterator myActiveLightsIterator;
   Standard_Integer sx;
   Standard_Integer sy;
   Standard_Real rx;
@@ -1082,6 +1027,7 @@ private:
   Standard_Boolean myZRotation;
   Standard_Integer MyZoomAtPointX;
   Standard_Integer MyZoomAtPointY;
+  Handle(V3d_Trihedron) myTrihedron;
   Handle(Aspect_Grid) MyGrid;
   gp_Ax3 MyPlane;
   TColStd_Array2OfReal MyTrsf;
@@ -1094,6 +1040,7 @@ private:
   Graphic3d_Vertex myGravityReferencePoint;
   Standard_Boolean myAutoZFitIsOn;
   Standard_Real myAutoZFitScaleFactor;
+
 };
 
 #endif // _V3d_View_HeaderFile