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