0028060: Samples - Objects in Geometry/Viewer2d have incorrect color
[occt.git] / samples / mfc / standard / 01_Geometry / src / ISession2D / ISession_Surface.cpp
1 // ISession_Surface.cpp: implementation of the ISession_Surface class.
2 //
3 //////////////////////////////////////////////////////////////////////
4
5 #include "stdafx.h"
6 #include "..\\GeometryApp.h"
7 #include "ISession_Surface.h"
8 #include <GeomAdaptor_HSurface.hxx>
9 #include <StdPrs_ShadedSurface.hxx>
10 #include <StdPrs_WFPoleSurface.hxx>
11 #include <StdPrs_WFSurface.hxx>
12
13 #ifdef _DEBUG
14 #undef THIS_FILE
15 static char THIS_FILE[]=__FILE__;
16 //#define new DEBUG_NEW
17 #endif
18
19 IMPLEMENT_STANDARD_RTTIEXT(ISession_Surface,AIS_InteractiveObject)
20
21 void ISession_Surface::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
22                                 const Handle(Prs3d_Presentation)& thePrs,
23                                 const Standard_Integer theMode)
24 {
25   GeomAdaptor_Surface anAdaptorSurface (mySurface);
26   Handle(GeomAdaptor_HSurface) anAdaptorHSurface = new GeomAdaptor_HSurface (mySurface);
27
28   Handle(Prs3d_Drawer) aPoleDrawer = new Prs3d_Drawer();
29   aPoleDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_YELLOW3, Aspect_TOL_SOLID, 1.0));
30   switch (theMode)
31   {
32     case 2:
33     {
34             StdPrs_ShadedSurface::Add (thePrs, anAdaptorSurface, myDrawer);
35       break;
36     }
37     case 1:
38     {
39       StdPrs_WFPoleSurface::Add (thePrs, anAdaptorSurface, aPoleDrawer);
40     }
41     case 0:
42     {
43       StdPrs_WFSurface::Add (thePrs, anAdaptorHSurface, myDrawer);
44       break;
45     }
46   }
47 }