0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[occt.git] / samples / mfc / standard / Common / Primitive / Sample2D_Markers.cpp
CommitLineData
7fd59977 1#include "stdafx.h"
2
3#include "Sample2D_Markers.h"
4
5c1f974e 5IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Markers,AIS_InteractiveObject)
7fd59977 6
7// generic marker
5c1f974e 8Sample2D_Markers::Sample2D_Markers (const Quantity_Length theXPosition ,
9 const Quantity_Length theYPosition ,
10 const Aspect_TypeOfMarker theMarkerType,
11 const Quantity_Color theColor,
12 const Standard_Real theScaleOrId)
a577aaab 13 :AIS_InteractiveObject(),myArrayOfPoints (new Graphic3d_ArrayOfPoints (1))
7fd59977 14{
5c1f974e 15 myXPosition = theXPosition;
16 myYPosition = theYPosition;
17 myMarkerType = theMarkerType;
18 myColor = theColor;
19 myIndex = theScaleOrId;
7fd59977 20}
21
5c1f974e 22Sample2D_Markers::Sample2D_Markers (const Quantity_Length theXPosition ,
23 const Quantity_Length theYPosition ,
a577aaab 24 const Handle(Graphic3d_ArrayOfPoints)& theArrayOfPoints,
5c1f974e 25 const Aspect_TypeOfMarker theMarkerType,
26 const Quantity_Color theColor,
27 const Standard_Real theScaleOrId)
a577aaab 28 :AIS_InteractiveObject(),myArrayOfPoints (new Graphic3d_ArrayOfPoints (6))
7fd59977 29{
5c1f974e 30 myXPosition = theXPosition;
31 myYPosition = theYPosition;
32 myMarkerType = theMarkerType;
33 myColor = theColor;
34 myIndex = theScaleOrId;
a577aaab 35 myArrayOfPoints = theArrayOfPoints;
7fd59977 36}
37
7fd59977 38
5c573e69 39void Sample2D_Markers::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
40 const Handle(Prs3d_Presentation)& aPresentation,
41 const Standard_Integer /*aMode*/)
7fd59977 42{
5c1f974e 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);
a577aaab 47 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (myArrayOfPoints);
5c1f974e 48 }
49 else
50 {
51 Handle(Graphic3d_AspectMarker3d) aMarker = new Graphic3d_AspectMarker3d(myMarkerType,myColor,myIndex);
eb4320f2 52 Prs3d_Root::CurrentGroup (aPresentation)->SetPrimitivesAspect(aMarker);
a577aaab 53 Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
54 anArrayOfPoints->AddVertex (myXPosition, myYPosition, 0);
55 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
5c1f974e 56 }
7fd59977 57}