summaryrefslogtreecommitdiff
path: root/src/V2d/V2d_CircularGrid.cxx
blob: 6935e77c439f62e4ef5762776eaa43a1f8411207 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#define PRO9581 //GG_270298
//              Creer la grille dans un objet graphique a l'altitude 0
//              de facon a etre tracee en premier.

// Update 14/07/98 : DCB : PRO10988 SetColorIndices() method

#include <V2d_CircularGrid.ixx>
#ifdef PRO9581
#include <V2d_BackgroundGraphicObject.hxx>
#else
#include <Graphic2d_GraphicObject.hxx>
#endif
#include <V2d_Viewer.hxx>

V2d_CircularGrid::V2d_CircularGrid(const V2d_ViewerPointer& aViewer,
                                   const Standard_Integer aColorIndex1,
                                   const Standard_Integer aColorIndex2)
                                   : Aspect_CircularGrid(1.,8),
                                     myViewer(aViewer),
#ifdef PRO9581
    myGraphicObject(new V2d_BackgroundGraphicObject(aViewer->View())), 
#else
    myGraphicObject(new Graphic2d_GraphicObject(aViewer->View())),
#endif
                                     myColorIndex1(aColorIndex1),
                                     myColorIndex2(aColorIndex2)
{
  Standard_Real l=100.;
  Standard_Integer n = (Standard_Integer)log10(l);
  Standard_Real step = Pow(10.,Standard_Real(n))/10.;
  SetRadiusStep(step);
  Init();
}

void V2d_CircularGrid::SetColorIndices (const Standard_Integer aColorIndex1,
                                        const Standard_Integer aColorIndex2)
{
  myColorIndex1 = aColorIndex1;
  myColorIndex2 = aColorIndex2;
}

void V2d_CircularGrid::Display()
{
  myGraphicObject->Display();
}

void V2d_CircularGrid::Erase() const
{
  myGraphicObject->Erase();
}

void V2d_CircularGrid::UpdateDisplay()
{
  myGraphicObject->RemovePrimitives();
  myGrid = new V2d_CircularGraphicGrid
    (myGraphicObject,
     XOrigin(),YOrigin(),RotationAngle(),RadiusStep(),DivisionNumber(),myColorIndex2);
  myGrid->SetColorIndex(myColorIndex1);
  myGrid->SetDrawMode(DrawMode());
}

Standard_Boolean V2d_CircularGrid::IsDisplayed () const
{
  return myGraphicObject->IsDisplayed();
}