Integration of OCCT 6.5.0 from SVN
[occt.git] / samples / java / src / ISession2D / ISession2D_ObjectOwner.cxx
1 #include <ISession2D_ObjectOwner.ixx>
2 #include <PrsMgr_PresentationManager2d.hxx>
3 #include <Graphic2d_Text.hxx>
4
5
6 ISession2D_ObjectOwner::ISession2D_ObjectOwner(const Standard_Integer aPriority)
7 :SelectMgr_EntityOwner(aPriority)
8 {
9 }
10
11 ISession2D_ObjectOwner::ISession2D_ObjectOwner(const Handle(SelectMgr_SelectableObject)& aSO,
12                                                const Standard_Integer aPriority)
13 :SelectMgr_EntityOwner(aSO,aPriority)
14 {
15 }
16
17 // Presentation Management
18  void ISession2D_ObjectOwner::Hilight(const Handle(PrsMgr_PresentationManager)& aPM,
19                                       const Standard_Integer ) 
20 {
21   if (aPM->IsKind(STANDARD_TYPE(PrsMgr_PresentationManager2d))) {
22     if (myGo.IsNull())
23       {
24         Handle(Graphic2d_View) aView = Handle(PrsMgr_PresentationManager2d)::DownCast(aPM)->StructureManager();
25         myGo = new Graphic2d_GraphicObject(aView); 
26       }
27
28     Handle(Graphic2d_Text) text;
29     text = new Graphic2d_Text(myGo, myDumpMessage, 0, 0, 0,Aspect_TOT_SOLID,1.5);
30     text->SetZoomable(Standard_False);
31     myGo->Display();
32   }
33 }
34
35  void ISession2D_ObjectOwner::Unhilight(const Handle(PrsMgr_PresentationManager)& ,
36                                         const Standard_Integer ) 
37 {
38   if (myGo.IsNull()) return;
39   myGo->RemovePrimitives();
40   myGo->Display();
41   myGo->Remove();
42 }
43