Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:24

0001 // Created on: 1992-04-06
0002 // Created by: Remi LEQUETTE
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef Draw_Viewer_HeaderFile
0018 #define Draw_Viewer_HeaderFile
0019 
0020 #include <gp_Trsf.hxx>
0021 #include <gp_Ax1.hxx>
0022 #include <Draw_SequenceOfDrawable3D.hxx>
0023 #include <Draw_Color.hxx>
0024 
0025 #ifdef _WIN32
0026 #include <windows.h>
0027 #endif
0028 
0029 const Standard_Integer MAXVIEW  = 30;
0030 
0031 class Draw_View;
0032 
0033 class Draw_Viewer {
0034 
0035   public :
0036   Standard_EXPORT Draw_Viewer      ();
0037   Standard_EXPORT Standard_Boolean DefineColor (const Standard_Integer i,
0038                        const char* colname);
0039   Standard_EXPORT void   MakeView    (const Standard_Integer id,
0040                  const char*   typ,
0041                  const Standard_Integer X, const Standard_Integer Y, 
0042                  const Standard_Integer W, const Standard_Integer H);
0043   // build a view on a given window
0044 #ifdef _WIN32
0045   Standard_EXPORT void MakeView    (const Standard_Integer id,
0046                    const char*   typ,
0047                    const Standard_Integer X, const Standard_Integer Y,
0048                    const Standard_Integer W, const Standard_Integer H,
0049                    HWND win,
0050                    const Standard_Boolean useBuffer = Standard_False);
0051 #endif
0052   Standard_EXPORT void   MakeView    (const Standard_Integer id,
0053                  const char*  typ,
0054                  const char*  window);
0055   Standard_EXPORT void   SetTitle    (const Standard_Integer id,
0056                  const char* name);
0057   Standard_EXPORT void   ResetView   (const Standard_Integer id);
0058   Standard_EXPORT void   SetZoom     (const Standard_Integer id,
0059                  const Standard_Real z);
0060   Standard_EXPORT void   RotateView  (const Standard_Integer id,
0061                  const gp_Dir2d&,
0062                  const Standard_Real);
0063   Standard_EXPORT void   RotateView  (const Standard_Integer id,
0064                  const gp_Pnt&,
0065                  const gp_Dir&,
0066                  const Standard_Real);
0067   Standard_EXPORT void   SetFocal    (const Standard_Integer id,
0068                  const Standard_Real FocalDist);
0069   Standard_EXPORT char*  GetType     (const Standard_Integer id) const;
0070   Standard_EXPORT Standard_Real   Zoom        (const Standard_Integer id) const;
0071   Standard_EXPORT Standard_Real   Focal       (const Standard_Integer id) const;
0072   Standard_EXPORT void   SetTrsf     (const Standard_Integer id,
0073                  gp_Trsf& T);
0074   Standard_EXPORT void   GetTrsf     (const Standard_Integer id,
0075                  gp_Trsf& T) const;
0076   Standard_EXPORT void   GetPosSize  (const Standard_Integer id,
0077                  Standard_Integer& X, Standard_Integer& Y,
0078                  Standard_Integer& W, Standard_Integer& H);
0079   Standard_EXPORT Standard_Boolean    Is3D        (const Standard_Integer id) const; 
0080   Standard_EXPORT void   GetFrame    (const Standard_Integer id,
0081                  Standard_Integer& xmin, Standard_Integer& ymin,
0082                  Standard_Integer& xmax, Standard_Integer& ymax);
0083   Standard_EXPORT void   FitView     (const Standard_Integer id, const Standard_Integer frame);
0084   Standard_EXPORT void   PanView     (const Standard_Integer id,
0085                  const Standard_Integer DX, const Standard_Integer DY);
0086   Standard_EXPORT void   SetPan      (const Standard_Integer id,
0087                  const Standard_Integer DX, const Standard_Integer DY);
0088   Standard_EXPORT void   GetPan      (const Standard_Integer id,
0089                  Standard_Integer& DX, Standard_Integer& DY);
0090   Standard_EXPORT Standard_Boolean HasView    (const Standard_Integer id) const;
0091   Standard_EXPORT void   DisplayView (const Standard_Integer id) const;
0092   Standard_EXPORT void   HideView    (const Standard_Integer id) const;
0093   Standard_EXPORT void   ClearView   (const Standard_Integer id) const;
0094   Standard_EXPORT void   RemoveView  (const Standard_Integer id) ;
0095   Standard_EXPORT void   RepaintView (const Standard_Integer id) const;
0096 #ifdef _WIN32
0097   Standard_EXPORT void   ResizeView  (const Standard_Integer id) const;
0098   Standard_EXPORT void   UpdateView  (const Standard_Integer id, const Standard_Boolean forced = Standard_False) const;
0099 #endif  
0100   Standard_EXPORT void   ConfigView  (const Standard_Integer id) const;
0101   Standard_EXPORT void   PostScriptView (const Standard_Integer id,
0102                     const Standard_Integer VXmin,
0103                     const Standard_Integer VYmin,
0104                     const Standard_Integer VXmax,
0105                     const Standard_Integer VYmax,
0106                     const Standard_Integer PXmin,
0107                     const Standard_Integer PYmin,
0108                     const Standard_Integer PXmax,
0109                     const Standard_Integer PYmax,
0110                     std::ostream& sortie) const;
0111   Standard_EXPORT void   PostColor(const Standard_Integer icol,
0112                   const Standard_Integer width,
0113                   const Standard_Real    gray);
0114   Standard_EXPORT Standard_Boolean SaveView(const Standard_Integer id, const char* filename);
0115   Standard_EXPORT void   RepaintAll  () const;
0116   Standard_EXPORT void   Repaint2D  () const;
0117   Standard_EXPORT void   Repaint3D  () const;
0118   Standard_EXPORT void   DeleteView  (const Standard_Integer id);
0119   Standard_EXPORT void   Clear       ();
0120   Standard_EXPORT void   Clear2D     ();
0121   Standard_EXPORT void   Clear3D     ();
0122   Standard_EXPORT void   Flush       ();
0123   
0124   Standard_EXPORT void DrawOnView     (const Standard_Integer id,
0125                   const Handle(Draw_Drawable3D)& D) const; 
0126   Standard_EXPORT void HighlightOnView (const Standard_Integer id,
0127                    const Handle(Draw_Drawable3D)& D,
0128                    const Draw_ColorKind C = Draw_blanc) const; 
0129   Standard_EXPORT void AddDrawable    (const Handle(Draw_Drawable3D)& D);
0130   Standard_EXPORT void RemoveDrawable (const Handle(Draw_Drawable3D)& D);
0131   Standard_EXPORT Draw_Display MakeDisplay (const Standard_Integer id) const;
0132   
0133   Standard_EXPORT void Select (Standard_Integer& id,         // View, -1 if none
0134               Standard_Integer& X,          // Pick coordinates
0135               Standard_Integer& Y,
0136               Standard_Integer& Button,     // Button pressed, 0 if none
0137               Standard_Boolean  waitclick = Standard_True
0138               );
0139 
0140   Standard_EXPORT Standard_Integer Pick(const Standard_Integer id,   // returns the index (or 0)
0141                    const Standard_Integer X,
0142                    const Standard_Integer Y,
0143                    const Standard_Integer Prec,
0144                    Handle(Draw_Drawable3D)& D,
0145                    const Standard_Integer First = 0) const; // search after this drawable
0146   
0147   Standard_EXPORT void LastPick(gp_Pnt& P1, gp_Pnt& P2, Standard_Real& Param);
0148   // returns the extremities and parameter of the last picked segment
0149   
0150   Standard_EXPORT ~Draw_Viewer();
0151   Standard_EXPORT Draw_Viewer& operator<<(const Handle(Draw_Drawable3D)&);
0152   Standard_EXPORT const Draw_SequenceOfDrawable3D& GetDrawables();
0153 
0154   private :
0155 
0156     Draw_View*                myViews[MAXVIEW];
0157     Draw_SequenceOfDrawable3D myDrawables;
0158 };
0159 
0160 
0161 #endif