1 // LIGHT : sample (no-corba-engine) SALOME module
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // Author : Natalia DONIS
26 #include <LIGHTGUI_TextPrs.hxx>
28 #include <Prs3d_Root.hxx>
29 #include <Graphic3d_Group.hxx>
30 #include <Graphic3d_Vertex.hxx>
31 #include <SelectMgr_Selection.hxx>
32 #include <SelectMgr_EntityOwner.hxx>
33 #include <Select3D_SensitivePoint.hxx>
34 //#include <Select3D_SensitiveSegment.hxx>
36 IMPLEMENT_STANDARD_HANDLE( LIGHTGUI_TextPrs, AIS_InteractiveObject )
37 IMPLEMENT_STANDARD_RTTIEXT( LIGHTGUI_TextPrs, AIS_InteractiveObject )
39 Standard_Integer aCharSize = 16;
41 LIGHTGUI_TextPrs::LIGHTGUI_TextPrs( const char* theString, const gp_Pnt& thePos)
44 myString = new char[strlen( theString ) + 1];
45 strcpy( myString, theString );
48 LIGHTGUI_TextPrs::~LIGHTGUI_TextPrs()
53 void LIGHTGUI_TextPrs::Compute( const Handle(PrsMgr_PresentationManager3d)&,
54 const Handle(Prs3d_Presentation)& thePrs,
55 const Standard_Integer )
57 Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( thePrs );
58 aGroup->BeginPrimitives();
59 Graphic3d_Vertex aTextPos;
60 // aTextPos.SetCoord( myPos.X(), aPos.Y(), aPos.Z() );
61 aTextPos.SetCoord( myPos.X(), myPos.Y(), myPos.Z() );
62 aGroup->Marker( aTextPos );
63 // aGroup->Text( aNodeIter.Value().ToCString(), aTextPos, aCharSize );
64 aGroup->Text( myString, aTextPos, aCharSize );
65 aGroup->EndPrimitives();
68 void LIGHTGUI_TextPrs::ComputeSelection( const Handle(SelectMgr_Selection)& theSelection,
69 const Standard_Integer )
71 Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
72 eown -> SelectBasics_EntityOwner::Set( aCharSize );
73 Handle(Select3D_SensitivePoint) seg = new Select3D_SensitivePoint(eown, myPos);
74 // Handle(Select3D_SensitiveSegment) seg = new Select3D_SensitiveSegment(eown, myPos,
75 // myPos.Translated( gp_Vec( strlen( myString ) * aCharSize, 0, 0 ) ) );
76 theSelection->Add(seg);