0023821: Improve qmake project files for Qt samples
[occt.git] / samples / mfc / standard / Common / Primitive / Sample2D_Line.cpp
1 #include "stdafx.h"
2
3 #include "Sample2D_Line.h"
4
5 IMPLEMENT_STANDARD_HANDLE(Sample2D_Line,AIS2D_InteractiveObject)
6 IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Line,AIS2D_InteractiveObject)
7
8 Sample2D_Line::Sample2D_Line ()
9     :AIS2D_InteractiveObject()
10 {
11 }
12
13 void Sample2D_Line::SetContext(const Handle(AIS2D_InteractiveContext)& theContext)
14 {
15   AIS2D_InteractiveObject::SetContext(theContext);
16
17   Handle(Prs2d_AspectLine) aLineAspect = new Prs2d_AspectLine;  
18   aLineAspect->SetTypeOfFill(Graphic2d_TOPF_FILLED);
19   aLineAspect->SetWidthIndex(0);
20
21   for (int i=0;i<=13;i++)
22    for (int j=0;j<=5;j++)
23    {
24                 Graphic2d_Array1OfVertex anArrayVertex(1,5);
25                 anArrayVertex(1)=Graphic2d_Vertex(20.*i,10.*j+0);
26                 anArrayVertex(2)=Graphic2d_Vertex(20.*i+10,10.*j+0);
27                 anArrayVertex(3)=Graphic2d_Vertex(20.*i+10,10.*j+5);
28                 anArrayVertex(4)=Graphic2d_Vertex(20.*i,10.*j+5);
29                 anArrayVertex(5)=Graphic2d_Vertex(20.*i,10.*j+0);
30                 Handle(Graphic2d_Polyline) aPolyline = new Graphic2d_Polyline(this,anArrayVertex);
31                 
32                 SetAspect(aLineAspect, aPolyline);
33
34                 aPolyline->SetInteriorColorIndex(i); // to use with Graphic2d_TOPF_FILLED
35                 aPolyline->SetTypeIndex(j);          // type of the polyline            
36         }
37 }
38
39
40
41