0024720: Some standard samples are not compiled after latest integration to visualisation
[occt.git] / samples / mfc / standard / 04_Viewer3d / src / OCCDemo_Presentation.h
CommitLineData
7fd59977 1// OCCDemo_Presentation.h: interface for the OCCDemo_Presentation class.
2// This is a base class for all presentations
3//////////////////////////////////////////////////////////////////////
4
5#if !defined(AFX_OCCDEMO_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)
6#define AFX_OCCDEMO_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_
7
8#if _MSC_VER > 1000
9#pragma once
10#endif // _MSC_VER > 1000
11
12#include "Viewer3dDoc.h"
13
14#define WAIT_A_LITTLE WaitForInput(500)
15#define WAIT_A_SECOND WaitForInput(1000)
16
17class CViewer3dDoc;
18class Handle_AIS_InteractiveObject;
19class Handle_AIS_Point;
20class Handle_Geom_Surface;
21class Handle_Geom_Curve;
22class Handle_Geom2d_Curve;
23class Quantity_Color;
24
25class OCCDemo_Presentation
26{
27public:
28 // Construction
29 OCCDemo_Presentation() : myIndex(0), myNbSamples(0), FitMode(false){}
30 virtual ~OCCDemo_Presentation() {}
31
32public:
33 static OCCDemo_Presentation* Current;
34 // this pointer must be initialized when realize a derivable class;
35 // it is used by application to access to a presentation class instance
36
37 void SetDocument (CViewer3dDoc* theDoc) {myDoc = theDoc;}
38 // document must be set by the user of this class before first use of iterations
39
40public:
41 // Titling
42 const CString& GetName() const {return myName;}
43
44public:
45 // Iteration on samples
46 void FirstSample() {myIndex=0;}
47 void LastSample() {myIndex=myNbSamples-1;}
48 Standard_Boolean AtFirstSample() const {return myIndex <= 0;}
49 Standard_Boolean AtLastSample() const {return myIndex >= myNbSamples-1;}
50 void NextSample() {myIndex++;}
51 void PrevSample() {myIndex--;}
52 virtual void DoSample() = 0;
9764ccbb 53 static void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ);
54 static void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
55 static void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
56 static void SetViewEye (V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
7fd59977 57 static Quantity_Factor GetViewScale();
58 static void SetViewScale(Quantity_Factor Coef);
59 static void ResetView();
60 CViewer3dDoc* getDocument() { return myDoc; }
61
62
63 // place one-time initialization code in this function
64 virtual void Init() {}
65
66protected:
67 // Methods to call from a derivable class
68 void setName (const char* theName) {myName = CString(theName);}
69 Handle_AIS_InteractiveContext getAISContext() const;
70 Handle_V3d_Viewer getViewer() const;
71// void setResultTitle (const char* theTitle) {myDoc->GetResultDialog()->SetTitle(theTitle);}
72// void setResultText (const char* theText) {myDoc->GetResultDialog()->SetText(theText);}
73 Standard_CString GetDataDir();
74
75 Standard_Boolean WaitForInput (unsigned long aMilliSeconds);
76 // Waits for a user input or a period of time has been elapsed
77
78 Handle_AIS_InteractiveObject drawSurface (const Handle_Geom_Surface& theSurface,
79 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_LEMONCHIFFON3),
80 const Standard_Boolean toDisplay = Standard_True);
81 // creates a finite face based on the given geometric surface
82 // and displays it in the viewer if toDisplay = Standard_True
83
84 Handle_AIS_InteractiveObject drawCurve (const Handle_Geom_Curve& theCurve,
85 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_RED),
86 const Standard_Boolean toDisplay = Standard_True);
87 // creates an ISession_Curve based on the given geometric curve
88 // and displays it in the viewer if toDisplay = Standard_True
89
90 Handle_AIS_InteractiveObject drawCurve (const Handle_Geom2d_Curve& theCurve,
91 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_RED),
92 const Standard_Boolean toDisplay = Standard_True,
93 const gp_Ax2& aPosition = gp::XOY());
94 // converts a given curve to 3d using aPosition and calls the previous method
95
96 Handle_AIS_Point drawPoint (const gp_Pnt& thePnt,
97 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_GREEN),
98 const Standard_Boolean toDisplay = Standard_True);
99 // creates a presentation of the given point
100 // and displays it in the viewer if toDisplay = Standard_True
101
102 Handle_AIS_InteractiveObject drawVector (const gp_Pnt& thePnt,
103 const gp_Vec& theVec,
104 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_YELLOW),
105 const Standard_Boolean toDisplay = Standard_True);
106 // creates a presentation of the given vector
107 // and displays it in the viewer if toDisplay = Standard_True
108
109 Handle_AIS_Shape drawShape (const TopoDS_Shape& theShape,
110 const Quantity_Color& theColor,
111 const Standard_Boolean toDisplay = Standard_True);
112 // creates a presentation of the given shape
113 // with material PLASTIC and a given color
114 // and displays it in the viewer if toDisplay = Standard_True
115
116 Handle_AIS_Shape drawShape (const TopoDS_Shape& theShape,
117 const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_BRASS,
118 const Standard_Boolean toDisplay = Standard_True);
119 // creates a presentation of the given shape with the given material
120 // (color is default for a given material)
121 // and displays it in the viewer if toDisplay = Standard_True
122
123protected:
124 // Fields to use in a derivable class
125 BOOL FitMode;
126 int myIndex;
127 int myNbSamples;
128
129private:
130 CViewer3dDoc* myDoc;
131 CString myName;
132
133};
134
135#endif // !defined(AFX_OCCDEMO_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)