X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FLIGHTGUI%2FLIGHTGUI_TextPrs.cxx;h=444e823a75ef73014de0b84915631260570b73d9;hb=becc0dc93a016e0aa36fad8671ea396cb667d436;hp=0d24f1fb4d227ea60ce1f7389693be7ece83e29a;hpb=decd43d9bcd6b3b1ac3ca86640ca2e2d1a137316;p=samples%2Flight.git diff --git a/src/LIGHTGUI/LIGHTGUI_TextPrs.cxx b/src/LIGHTGUI/LIGHTGUI_TextPrs.cxx index 0d24f1f..444e823 100644 --- a/src/LIGHTGUI/LIGHTGUI_TextPrs.cxx +++ b/src/LIGHTGUI/LIGHTGUI_TextPrs.cxx @@ -1,29 +1,27 @@ -// LIGHT : sample (no-corba-engine) SALOME module +// Copyright (C) 2005-2014 OPEN CASCADE // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// Author : Natalia DONIS -// Date : 01/09/2005 -// $Header$ -#include +// LIGHT : sample (no-corba-engine) SALOME module +// File : LIGHTGUI_TextPrs.cxx +// Author : Natalia DONIS +// +#include "LIGHTGUI_TextPrs.hxx" #include #include @@ -31,42 +29,89 @@ #include #include #include -//#include + +#include + +#if OCC_VERSION_LARGE > 0x060505 +#include +#endif + +/*! + \class LIGHTGUI_TextPrs + \brief Presentation object for the string line. +*/ IMPLEMENT_STANDARD_HANDLE( LIGHTGUI_TextPrs, AIS_InteractiveObject ) IMPLEMENT_STANDARD_RTTIEXT( LIGHTGUI_TextPrs, AIS_InteractiveObject ) -Standard_Integer aCharSize = 16; +const Standard_Integer aCharSize = 16; -LIGHTGUI_TextPrs::LIGHTGUI_TextPrs( const char* theString, const gp_Pnt& thePos) +/*! + \brief Contructor. + \param theString text string + \param thePos text position in the viewer +*/ +LIGHTGUI_TextPrs::LIGHTGUI_TextPrs( const char* theString, const gp_Pnt& thePos ) : myPos( thePos ) { - myString = new char[strlen( theString ) + 1]; - strcpy( myString, theString ); + myString = new char[strlen( theString ) + 1]; + strcpy( myString, theString ); } +/*! + \brief Destructor. +*/ LIGHTGUI_TextPrs::~LIGHTGUI_TextPrs() { - delete myString; + delete myString; +} + +/*! + \brief Get presentation text size. +*/ +int LIGHTGUI_TextPrs::TextSize() +{ + return aCharSize; } -void LIGHTGUI_TextPrs::Compute( const Handle(PrsMgr_PresentationManager3d)&, +/*! + \brief Compute the presentation. + \param prsMgr presentation manager (not used) + \param thePrs presentation + \param mode display mode +*/ +void LIGHTGUI_TextPrs::Compute( const Handle(PrsMgr_PresentationManager3d)& /*prsMgr*/, const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer ) + const Standard_Integer /*mode*/ ) { Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( thePrs ); +#if OCC_VERSION_LARGE <= 0x060504 aGroup->BeginPrimitives(); +#endif Graphic3d_Vertex aTextPos; // aTextPos.SetCoord( myPos.X(), aPos.Y(), aPos.Z() ); aTextPos.SetCoord( myPos.X(), myPos.Y(), myPos.Z() ); +#if OCC_VERSION_LARGE <= 0x060505 aGroup->Marker( aTextPos ); +#else + Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); + anArrayOfPoints->AddVertex(myPos.X(), myPos.Y(), myPos.Z()); + aGroup->AddPrimitiveArray(anArrayOfPoints); +#endif // aGroup->Text( aNodeIter.Value().ToCString(), aTextPos, aCharSize ); aGroup->Text( myString, aTextPos, aCharSize ); +#if OCC_VERSION_LARGE <= 0x060504 aGroup->EndPrimitives(); +#endif } +/*! + \brief Compute selection of the presentation. + \param theSelection current selection object + \param mode display mode +*/ void LIGHTGUI_TextPrs::ComputeSelection( const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer ) + const Standard_Integer /*mode*/ ) { Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this); eown -> SelectBasics_EntityOwner::Set( aCharSize );