File indexing completed on 2026-09-13 09:16:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
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_Drawable3D.hxx>
0023 #include <NCollection_Sequence.hxx>
0024 #include <Draw_Color.hxx>
0025
0026 #ifdef _WIN32
0027 #include <windows.h>
0028 #endif
0029
0030 const int MAXVIEW = 30;
0031
0032 class Draw_View;
0033
0034 class Draw_Viewer
0035 {
0036
0037 public:
0038 Standard_EXPORT Draw_Viewer();
0039 Standard_EXPORT bool DefineColor(const int i, const char* colname);
0040 Standard_EXPORT void MakeView(const int id,
0041 const char* typ,
0042 const int X,
0043 const int Y,
0044 const int W,
0045 const int H);
0046
0047 #ifdef _WIN32
0048 Standard_EXPORT void MakeView(const int id,
0049 const char* typ,
0050 const int X,
0051 const int Y,
0052 const int W,
0053 const int H,
0054 HWND win,
0055 const bool useBuffer = false);
0056 #endif
0057 Standard_EXPORT void MakeView(const int id, const char* typ, const char* window);
0058 Standard_EXPORT void SetTitle(const int id, const char* name);
0059 Standard_EXPORT void ResetView(const int id);
0060 Standard_EXPORT void SetZoom(const int id, const double z);
0061 Standard_EXPORT void RotateView(const int id, const gp_Dir2d&, const double);
0062 Standard_EXPORT void RotateView(const int id, const gp_Pnt&, const gp_Dir&, const double);
0063 Standard_EXPORT void SetFocal(const int id, const double FocalDist);
0064 Standard_EXPORT char* GetType(const int id) const;
0065 Standard_EXPORT double Zoom(const int id) const;
0066 Standard_EXPORT double Focal(const int id) const;
0067 Standard_EXPORT void SetTrsf(const int id, gp_Trsf& T);
0068 Standard_EXPORT void GetTrsf(const int id, gp_Trsf& T) const;
0069 Standard_EXPORT void GetPosSize(const int id, int& X, int& Y, int& W, int& H);
0070 Standard_EXPORT bool Is3D(const int id) const;
0071 Standard_EXPORT void GetFrame(const int id, int& xmin, int& ymin, int& xmax, int& ymax);
0072 Standard_EXPORT void FitView(const int id, const int frame);
0073 Standard_EXPORT void PanView(const int id, const int DX, const int DY);
0074 Standard_EXPORT void SetPan(const int id, const int DX, const int DY);
0075 Standard_EXPORT void GetPan(const int id, int& DX, int& DY);
0076 Standard_EXPORT bool HasView(const int id) const;
0077 Standard_EXPORT void DisplayView(const int id) const;
0078 Standard_EXPORT void HideView(const int id) const;
0079 Standard_EXPORT void ClearView(const int id) const;
0080 Standard_EXPORT void RemoveView(const int id);
0081 Standard_EXPORT void RepaintView(const int id) const;
0082 #ifdef _WIN32
0083 Standard_EXPORT void ResizeView(const int id) const;
0084 Standard_EXPORT void UpdateView(const int id, const bool forced = false) const;
0085 #endif
0086 Standard_EXPORT void ConfigView(const int id) const;
0087 Standard_EXPORT void PostScriptView(const int id,
0088 const int VXmin,
0089 const int VYmin,
0090 const int VXmax,
0091 const int VYmax,
0092 const int PXmin,
0093 const int PYmin,
0094 const int PXmax,
0095 const int PYmax,
0096 std::ostream& sortie) const;
0097 Standard_EXPORT void PostColor(const int icol, const int width, const double gray);
0098 Standard_EXPORT bool SaveView(const int id, const char* filename);
0099 Standard_EXPORT void RepaintAll() const;
0100 Standard_EXPORT void Repaint2D() const;
0101 Standard_EXPORT void Repaint3D() const;
0102 Standard_EXPORT void DeleteView(const int id);
0103 Standard_EXPORT void Clear();
0104 Standard_EXPORT void Clear2D();
0105 Standard_EXPORT void Clear3D();
0106 Standard_EXPORT void Flush();
0107
0108 Standard_EXPORT void DrawOnView(const int id, const occ::handle<Draw_Drawable3D>& D) const;
0109 Standard_EXPORT void HighlightOnView(const int id,
0110 const occ::handle<Draw_Drawable3D>& D,
0111 const Draw_ColorKind C = Draw_blanc) const;
0112 Standard_EXPORT void AddDrawable(const occ::handle<Draw_Drawable3D>& D);
0113 Standard_EXPORT void RemoveDrawable(const occ::handle<Draw_Drawable3D>& D);
0114 Standard_EXPORT Draw_Display MakeDisplay(const int id) const;
0115
0116 Standard_EXPORT void Select(int& id,
0117 int& X,
0118 int& Y,
0119 int& Button,
0120 bool waitclick = true);
0121
0122 Standard_EXPORT int Pick(const int id,
0123 const int X,
0124 const int Y,
0125 const int Prec,
0126 occ::handle<Draw_Drawable3D>& D,
0127 const int First = 0) const;
0128
0129 Standard_EXPORT void LastPick(gp_Pnt& P1, gp_Pnt& P2, double& Param);
0130
0131
0132 Standard_EXPORT ~Draw_Viewer();
0133 Standard_EXPORT Draw_Viewer& operator<<(const occ::handle<Draw_Drawable3D>&);
0134 Standard_EXPORT const NCollection_Sequence<occ::handle<Draw_Drawable3D>>& GetDrawables();
0135
0136 private:
0137 Draw_View* myViews[MAXVIEW];
0138 NCollection_Sequence<occ::handle<Draw_Drawable3D>> myDrawables;
0139 };
0140
0141 #endif