0028316: Coding Rules - Elimilate confusing aliases of Standard_Real type in V3d_View
[occt.git] / samples / mfc / occtdemo / Common / 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
13#define WAIT_A_LITTLE WaitForInput(500)
14#define WAIT_A_SECOND WaitForInput(1000)
15
16#include <OCCDemoDoc.h>
92efcf78 17class AIS_InteractiveObject;
18class Geom_Surface;
19class Geom_Curve;
20class Geom2d_Curve;
7fd59977 21class Quantity_Color;
22
23class OCCDemo_Presentation
24{
25public:
26 // Construction
27 OCCDemo_Presentation() : myIndex(0), myNbSamples(0), FitMode(false){}
28 virtual ~OCCDemo_Presentation() {}
29
30public:
31 static OCCDemo_Presentation* Current;
32 // this pointer must be initialized when realize a derivable class;
33 // it is used by application to access to a presentation class instance
34
35 void SetDocument (COCCDemoDoc* theDoc) {myDoc = theDoc;}
36 // document must be set by the user of this class before first use of iterations
37
38public:
39 // Titling
40 const CString& GetName() const {return myName;}
41
42public:
43 // Iteration on samples
44 void FirstSample() {myIndex=0;}
45 void LastSample() {myIndex=myNbSamples-1;}
46 Standard_Boolean AtFirstSample() const {return myIndex <= 0;}
47 Standard_Boolean AtLastSample() const {return myIndex >= myNbSamples-1;}
48 void NextSample() {myIndex++;}
49 void PrevSample() {myIndex--;}
50 virtual void DoSample() = 0;
ee2be2a8 51 static void GetViewCenter(Standard_Real& Xc, Standard_Real& Yc);
52 static void SetViewCenter(const Standard_Real Xc, const Standard_Real Yc);
53 static void GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
54 static void SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z);
55 static Standard_Real GetViewScale();
56 static void SetViewScale(Standard_Real Coef);
7fd59977 57 static void ResetView();
58
59
60 // place one-time initialization code in this function
61 virtual void Init() {}
62
63protected:
64 // Methods to call from a derivable class
65 void setName (const char* theName) {myName = CString(theName);}
92efcf78 66 Handle(AIS_InteractiveContext) getAISContext() const {return myDoc->GetAISContext();}
67 Handle(V3d_Viewer) getViewer() const {return myDoc->GetViewer();}
7fd59977 68 void setResultTitle (const char* theTitle) {myDoc->GetResultDialog()->SetTitle(theTitle);}
69 void setResultText (const char* theText) {myDoc->GetResultDialog()->SetText(theText);}
70 Standard_CString GetDataDir() {return myDoc->GetDataDir();}
71
72 Standard_Boolean WaitForInput (unsigned long aMilliSeconds);
73 // Waits for a user input or a period of time has been elapsed
74
92efcf78 75 Handle(AIS_InteractiveObject) drawSurface (const Handle(Geom_Surface)& theSurface,
7fd59977 76 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_LEMONCHIFFON3),
77 const Standard_Boolean toDisplay = Standard_True);
78 // creates a finite face based on the given geometric surface
79 // and displays it in the viewer if toDisplay = Standard_True
80
92efcf78 81 Handle(AIS_InteractiveObject) drawCurve (const Handle(Geom_Curve)& theCurve,
7fd59977 82 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_RED),
83 const Standard_Boolean toDisplay = Standard_True);
84 // creates an ISession_Curve based on the given geometric curve
85 // and displays it in the viewer if toDisplay = Standard_True
86
92efcf78 87 Handle(AIS_InteractiveObject) drawCurve (const Handle(Geom2d_Curve)& theCurve,
7fd59977 88 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_RED),
89 const Standard_Boolean toDisplay = Standard_True,
90 const gp_Ax2& aPosition = gp::XOY());
91 // converts a given curve to 3d using aPosition and calls the previous method
92
92efcf78 93 Handle(AIS_Point) drawPoint (const gp_Pnt& thePnt,
7fd59977 94 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_GREEN),
95 const Standard_Boolean toDisplay = Standard_True);
96 // creates a presentation of the given point
97 // and displays it in the viewer if toDisplay = Standard_True
98
92efcf78 99 Handle(AIS_InteractiveObject) drawVector (const gp_Pnt& thePnt,
7fd59977 100 const gp_Vec& theVec,
101 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_YELLOW),
102 const Standard_Boolean toDisplay = Standard_True);
103 // creates a presentation of the given vector
104 // and displays it in the viewer if toDisplay = Standard_True
105
92efcf78 106 Handle(AIS_Shape) drawShape (const TopoDS_Shape& theShape,
7fd59977 107 const Quantity_Color& theColor,
108 const Standard_Boolean toDisplay = Standard_True);
109 // creates a presentation of the given shape
110 // with material PLASTIC and a given color
111 // and displays it in the viewer if toDisplay = Standard_True
112
92efcf78 113 Handle(AIS_Shape) drawShape (const TopoDS_Shape& theShape,
7fd59977 114 const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_BRASS,
115 const Standard_Boolean toDisplay = Standard_True);
116 // creates a presentation of the given shape with the given material
117 // (color is default for a given material)
118 // and displays it in the viewer if toDisplay = Standard_True
119
120protected:
121 // Fields to use in a derivable class
122 BOOL FitMode;
123 int myIndex;
124 int myNbSamples;
125
126private:
127 COCCDemoDoc* myDoc;
128 CString myName;
129
130};
131
132#endif // !defined(AFX_OCCDEMO_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)