0023821: Improve qmake project files for Qt samples
[occt.git] / samples / mfc / standard / Common / Primitive / Sample2D_Curve.cpp
1 #include "stdafx.h"
2
3 #include "Sample2D_Curve.h"
4
5
6 IMPLEMENT_STANDARD_HANDLE(Sample2D_Curve,AIS2D_InteractiveObject)
7 IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Curve,AIS2D_InteractiveObject)
8
9 #include <Graphic2d_SetOfCurves.hxx>
10 #include <Geom2dAdaptor_Curve.hxx>
11 #include <Bnd_Box2d.hxx>
12 #include <BndLib_Add2dCurve.hxx>
13 #include <Precision.hxx>
14 #include <Select2D_SensitiveBox.hxx>
15 #include <Select2D_SensitiveSegment.hxx>
16 #include <gp_Circ2d.hxx>
17 #include <gp_Dir2d.hxx>
18 #include <gp_Ax2d.hxx>
19
20 #include <Select2D_SensitiveArc.hxx>
21 #include <Geom2d_Curve.hxx>
22 #include <GeomTools_Curve2dSet.hxx>
23 #include <Geom2d_TrimmedCurve.hxx>
24 #include <gp_Pnt2d.hxx>
25 #include <GCE2d_MakeSegment.hxx>
26 #include <gp_Vec2d.hxx>
27 #include <OSD_Environment.hxx>
28 #include <Graphic2d_Array1OfVertex.hxx>
29 #include <Graphic2d_PolyLine.hxx>
30 #include "SelectMgr_Selection.hxx"
31 #include "Prs2d_AspectLine.hxx"
32 #include "Graphic2d_TypeOfPolygonFilling.hxx"
33
34 Sample2D_Curve::Sample2D_Curve(const Handle_Geom2d_Curve aGeom2dCurve,
35                                const Standard_Integer aTypeOfLineIndex,
36                                const Standard_Integer aWidthOfLineIndex,
37                                const Standard_Integer aColorIndex)
38     :AIS2D_InteractiveObject()
39 {
40   myGeom2dCurve = aGeom2dCurve;
41   myTypeOfLineIndex  = aTypeOfLineIndex ;
42   myWidthOfLineIndex = aWidthOfLineIndex;
43   myColorIndex  = aColorIndex ;
44 }
45
46
47 void Sample2D_Curve::SetContext(const Handle(AIS2D_InteractiveContext)& theContext) 
48 {
49   AIS2D_InteractiveObject::SetContext(theContext);
50
51   Handle(Prs2d_AspectLine) aLineAspect = new Prs2d_AspectLine;  
52   aLineAspect->SetTypeOfFill(Graphic2d_TOPF_EMPTY);
53   
54   Handle(Graphic2d_SetOfCurves) segment;
55   segment = new Graphic2d_SetOfCurves(this);
56
57   segment->Add(myGeom2dCurve);
58
59   aLineAspect->SetTypeIndex(myTypeOfLineIndex);
60   aLineAspect->SetColorIndex(myColorIndex);
61   aLineAspect->SetWidthIndex(myWidthOfLineIndex);
62
63   SetAspect(aLineAspect, segment);
64
65 }
66