0028316: Coding Rules - Elimilate confusing aliases of Standard_Real type in V3d_View
[occt.git] / samples / mfc / standard / 10_Convert / 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
13#define WAIT_A_LITTLE WaitForInput(500)
14#define WAIT_A_SECOND WaitForInput(1000)
15
16#include <OCCDemoDoc.h>
17#include <OCCDemo.h>
9e3ca93a 18#include <AIS_InteractiveObject.hxx>
19#include <AIS_Point.hxx>
20#include <Geom_Surface.hxx>
21#include <Geom_Curve.hxx>
22#include <Geom2d_Curve.hxx>
7fd59977 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 (COCCDemoDoc* 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;
ee2be2a8 53 static void GetViewAt (Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ);
54 static void SetViewAt (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ);
55 static void GetViewEye (Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
56 static void SetViewEye (Standard_Real X, Standard_Real Y, Standard_Real Z);
57 static Standard_Real GetViewScale();
58 static void SetViewScale(Standard_Real Coef);
7fd59977 59 static void ResetView();
ee2be2a8 60 static void TranslateView (const Standard_Real theX, const Standard_Real theY);
7fd59977 61
62 // place one-time initialization code in this function
63 virtual void Init() {}
64
65protected:
66 // Methods to call from a derivable class
67 void setName (const char* theName) {myName = CString(theName);}
92efcf78 68 Handle(AIS_InteractiveContext) getAISContext() const {return myDoc->GetAISContext();}
69 Handle(V3d_Viewer) getViewer() const {return myDoc->GetViewer();}
7fd59977 70 void setResultTitle (const char* theTitle) {myDoc->GetResultDialog()->SetTitle(theTitle);}
71 void setResultText (const char* theText) {myDoc->GetResultDialog()->SetText(theText);}
72 Standard_CString GetDataDir() {return myDoc->GetDataDir();}
73
74 Standard_Boolean WaitForInput (unsigned long aMilliSeconds);
75 // Waits for a user input or a period of time has been elapsed
76
92efcf78 77 Handle(AIS_InteractiveObject) drawSurface (const Handle(Geom_Surface)& theSurface,
7fd59977 78 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_LEMONCHIFFON3),
79 const Standard_Boolean toDisplay = Standard_True);
80 // creates a finite face based on the given geometric surface
81 // and displays it in the viewer if toDisplay = Standard_True
82
92efcf78 83 Handle(AIS_InteractiveObject) drawCurve (const Handle(Geom_Curve)& theCurve,
7fd59977 84 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_RED),
85 const Standard_Boolean toDisplay = Standard_True);
86 // creates an ISession_Curve based on the given geometric curve
87 // and displays it in the viewer if toDisplay = Standard_True
88
92efcf78 89 Handle(AIS_InteractiveObject) drawCurve (const Handle(Geom2d_Curve)& theCurve,
7fd59977 90 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_RED),
91 const Standard_Boolean toDisplay = Standard_True,
92 const gp_Ax2& aPosition = gp::XOY());
93 // converts a given curve to 3d using aPosition and calls the previous method
94
92efcf78 95 Handle(AIS_Point) drawPoint (const gp_Pnt& thePnt,
7fd59977 96 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_GREEN),
97 const Standard_Boolean toDisplay = Standard_True);
98 // creates a presentation of the given point
99 // and displays it in the viewer if toDisplay = Standard_True
100
92efcf78 101 Handle(AIS_InteractiveObject) drawVector (const gp_Pnt& thePnt,
7fd59977 102 const gp_Vec& theVec,
103 const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_YELLOW),
104 const Standard_Boolean toDisplay = Standard_True);
105 // creates a presentation of the given vector
106 // and displays it in the viewer if toDisplay = Standard_True
107
92efcf78 108 Handle(AIS_Shape) drawShape (const TopoDS_Shape& theShape,
7fd59977 109 const Quantity_Color& theColor,
110 const Standard_Boolean toDisplay = Standard_True);
111 // creates a presentation of the given shape
112 // with material PLASTIC and a given color
113 // and displays it in the viewer if toDisplay = Standard_True
114
92efcf78 115 Handle(AIS_Shape) drawShape (const TopoDS_Shape& theShape,
7fd59977 116 const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_BRASS,
117 const Standard_Boolean toDisplay = Standard_True);
118 // creates a presentation of the given shape with the given material
119 // (color is default for a given material)
120 // and displays it in the viewer if toDisplay = Standard_True
121
122protected:
123 // Fields to use in a derivable class
124 BOOL FitMode;
125 int myIndex;
126 int myNbSamples;
127
128private:
129 COCCDemoDoc* myDoc;
130 CString myName;
131
132};
133
134#endif // !defined(AFX_OCCDEMO_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)