1 // Created on: 1992-04-06
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 #ifndef Draw_Viewer_HeaderFile
24 #define Draw_Viewer_HeaderFile
29 #include <gp_Pnt2d.hxx>
30 #include <gp_Vec2d.hxx>
31 #include <gp_Dir2d.hxx>
32 #include <gp_Trsf.hxx>
34 #include <Draw_Drawable3D.hxx>
35 #include <Draw_SequenceOfDrawable3D.hxx>
36 #include <Draw_Color.hxx>
40 #if !defined(__Draw_API) && !defined(HAVE_NO_DLL)
42 # define __Draw_API __declspec( dllexport )
44 # define __Draw_API /*__declspec( dllimport )*/
50 const Standard_Integer MAXVIEW = 30;
57 __Draw_API Draw_Viewer ();
58 __Draw_API Standard_Boolean DefineColor (const Standard_Integer i,
60 __Draw_API void MakeView (const Standard_Integer id,
62 const Standard_Integer X, const Standard_Integer Y,
63 const Standard_Integer W, const Standard_Integer H);
64 // build a view on a given window
66 __Draw_API void MakeView (const Standard_Integer id,
68 const Standard_Integer X, const Standard_Integer Y,
69 const Standard_Integer W, const Standard_Integer H,
71 const Standard_Boolean useBuffer = Standard_False);
73 __Draw_API void MakeView (const Standard_Integer id,
76 __Draw_API void SetTitle (const Standard_Integer id,
78 __Draw_API void ResetView (const Standard_Integer id);
79 __Draw_API void SetZoom (const Standard_Integer id,
80 const Standard_Real z);
81 __Draw_API void RotateView (const Standard_Integer id,
84 __Draw_API void RotateView (const Standard_Integer id,
88 __Draw_API void SetFocal (const Standard_Integer id,
89 const Standard_Real FocalDist);
90 __Draw_API char* GetType (const Standard_Integer id) const;
91 __Draw_API Standard_Real Zoom (const Standard_Integer id) const;
92 __Draw_API Standard_Real Focal (const Standard_Integer id) const;
93 __Draw_API void SetTrsf (const Standard_Integer id,
95 __Draw_API void GetTrsf (const Standard_Integer id,
97 __Draw_API void GetPosSize (const Standard_Integer id,
98 Standard_Integer& X, Standard_Integer& Y,
99 Standard_Integer& W, Standard_Integer& H);
100 __Draw_API Standard_Boolean Is3D (const Standard_Integer id) const;
101 __Draw_API void GetFrame (const Standard_Integer id,
102 Standard_Integer& xmin, Standard_Integer& ymin,
103 Standard_Integer& xmax, Standard_Integer& ymax);
104 __Draw_API void FitView (const Standard_Integer id, const Standard_Integer frame);
105 __Draw_API void PanView (const Standard_Integer id,
106 const Standard_Integer DX, const Standard_Integer DY);
107 __Draw_API void SetPan (const Standard_Integer id,
108 const Standard_Integer DX, const Standard_Integer DY);
109 __Draw_API void GetPan (const Standard_Integer id,
110 Standard_Integer& DX, Standard_Integer& DY);
111 __Draw_API Standard_Boolean HasView (const Standard_Integer id) const;
112 __Draw_API void DisplayView (const Standard_Integer id) const;
113 __Draw_API void HideView (const Standard_Integer id) const;
114 __Draw_API void ClearView (const Standard_Integer id) const;
115 __Draw_API void RemoveView (const Standard_Integer id) ;
116 __Draw_API void RepaintView (const Standard_Integer id) const;
118 __Draw_API void ResizeView (const Standard_Integer id) const;
119 __Draw_API void UpdateView (const Standard_Integer id, const Standard_Boolean forced = Standard_False) const;
121 __Draw_API void ConfigView (const Standard_Integer id) const;
122 __Draw_API void PostScriptView (const Standard_Integer id,
123 const Standard_Integer VXmin,
124 const Standard_Integer VYmin,
125 const Standard_Integer VXmax,
126 const Standard_Integer VYmax,
127 const Standard_Integer PXmin,
128 const Standard_Integer PYmin,
129 const Standard_Integer PXmax,
130 const Standard_Integer PYmax,
131 ostream& sortie) const;
132 __Draw_API void PostColor(const Standard_Integer icol,
133 const Standard_Integer width,
134 const Standard_Real gray);
135 __Draw_API Standard_Boolean SaveView(const Standard_Integer id, const char* filename);
136 __Draw_API void RepaintAll () const;
137 __Draw_API void Repaint2D () const;
138 __Draw_API void Repaint3D () const;
139 __Draw_API unsigned long GetWindow (const Standard_Integer id) const;
140 __Draw_API void DeleteView (const Standard_Integer id);
141 __Draw_API void Clear ();
142 __Draw_API void Clear2D ();
143 __Draw_API void Clear3D ();
144 __Draw_API void Flush ();
146 __Draw_API void DrawOnView (const Standard_Integer id,
147 const Handle(Draw_Drawable3D)& D) const;
148 __Draw_API void HighlightOnView (const Standard_Integer id,
149 const Handle(Draw_Drawable3D)& D,
150 const Draw_ColorKind C = Draw_blanc) const;
151 __Draw_API void AddDrawable (const Handle(Draw_Drawable3D)& D);
152 __Draw_API void RemoveDrawable (const Handle(Draw_Drawable3D)& D);
153 __Draw_API Draw_Display MakeDisplay (const Standard_Integer id) const;
155 __Draw_API void Select (Standard_Integer& id, // View, -1 if none
156 Standard_Integer& X, // Pick coordinates
158 Standard_Integer& Button, // Button pressed, 0 if none
159 Standard_Boolean waitclick = Standard_True
162 __Draw_API Standard_Integer Pick(const Standard_Integer id, // returns the index (or 0)
163 const Standard_Integer X,
164 const Standard_Integer Y,
165 const Standard_Integer Prec,
166 Handle(Draw_Drawable3D)& D,
167 const Standard_Integer First = 0) const; // search after this drawable
169 __Draw_API void LastPick(gp_Pnt& P1, gp_Pnt& P2, Standard_Real& Param);
170 // returns the extremities and parameter of the last picked segment
172 __Draw_API ~Draw_Viewer();
173 __Draw_API Draw_Viewer& operator<<(const Handle(Draw_Drawable3D)&);
174 __Draw_API const Draw_SequenceOfDrawable3D& GetDrawables();
178 Draw_View* myViews[MAXVIEW];
179 Draw_SequenceOfDrawable3D myDrawables;