0024355: Compiler Warning level 4 for MFC samples
[occt.git] / samples / mfc / standard / Common / Primitive / Sample2D_Markers.cpp
1 #include "stdafx.h"
2
3 #include "Sample2D_Markers.h"
4
5 IMPLEMENT_STANDARD_HANDLE(Sample2D_Markers,AIS_InteractiveObject)
6 IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Markers,AIS_InteractiveObject)
7
8 // generic marker
9 Sample2D_Markers::Sample2D_Markers (const Quantity_Length theXPosition , 
10                    const Quantity_Length theYPosition ,
11                    const Aspect_TypeOfMarker theMarkerType,
12                    const Quantity_Color theColor,
13                    const Standard_Real theScaleOrId)
14                    :AIS_InteractiveObject(),myArrayOfPoints (new Graphic3d_ArrayOfPoints (1))
15 {
16   myXPosition = theXPosition;
17   myYPosition = theYPosition;
18   myMarkerType = theMarkerType;
19   myColor = theColor;
20   myIndex = theScaleOrId;
21 }
22
23 Sample2D_Markers::Sample2D_Markers (const Quantity_Length theXPosition , 
24                    const Quantity_Length theYPosition ,
25                    const Handle(Graphic3d_ArrayOfPoints)& theArrayOfPoints,
26                    const Aspect_TypeOfMarker theMarkerType,
27                    const Quantity_Color theColor,
28                    const Standard_Real theScaleOrId)
29                    :AIS_InteractiveObject(),myArrayOfPoints (new Graphic3d_ArrayOfPoints (6))
30 {
31   myXPosition = theXPosition;
32   myYPosition = theYPosition;
33   myMarkerType = theMarkerType;
34   myColor = theColor;
35   myIndex = theScaleOrId;
36   myArrayOfPoints = theArrayOfPoints;
37 }
38
39
40 void Sample2D_Markers::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
41                                 const Handle(Prs3d_Presentation)& aPresentation,
42                                 const Standard_Integer /*aMode*/)
43 {
44   if(myMarkerType == Aspect_TOM_USERDEFINED)
45   {
46     Handle(Graphic3d_AspectMarker3d) aMarker = new Graphic3d_AspectMarker3d(Aspect_TOM_POINT,myColor,myIndex);
47     Prs3d_Root::CurrentGroup(aPresentation)->SetGroupPrimitivesAspect(aMarker);
48     Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (myArrayOfPoints);
49   }
50   else
51   {
52     Handle(Graphic3d_AspectMarker3d) aMarker = new Graphic3d_AspectMarker3d(myMarkerType,myColor,myIndex);
53     Prs3d_Root::CurrentGroup (aPresentation)->SetPrimitivesAspect(aMarker);
54     Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
55     anArrayOfPoints->AddVertex (myXPosition, myYPosition, 0);
56     Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
57   }
58 }