1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include "HYDROGUI_PrsPolyline.h"
23 //=======================================================================
24 // name : HYDROGUI_PrsPolyline
25 // Purpose : Constructor
26 //=======================================================================
27 HYDROGUI_PrsPolyline::HYDROGUI_PrsPolyline( const Handle(HYDROData_Entity)& theObject )
28 : HYDROGUI_Prs( theObject ),
33 //=======================================================================
34 // name : HYDROGUI_PrsPolyline
35 // Purpose : Destructor
36 //=======================================================================
37 HYDROGUI_PrsPolyline::~HYDROGUI_PrsPolyline()
41 //================================================================
44 //================================================================
45 void HYDROGUI_PrsPolyline::setPath( const QPainterPath& thePath )
50 //================================================================
53 //================================================================
54 QPainterPath HYDROGUI_PrsPolyline::getPath() const
59 //================================================================
60 // Function : boundingRect
62 //================================================================
63 QRectF HYDROGUI_PrsPolyline::boundingRect() const
65 return myPolylineItem->boundingRect();
68 //================================================================
71 //================================================================
72 void HYDROGUI_PrsPolyline::compute()
76 myPolylineItem = new QGraphicsPathItem( this );
77 addToGroup( myPolylineItem );
79 myPolylineItem->setPath( myPath );
82 //================================================================
83 // Function : checkHighlight
85 //================================================================
86 bool HYDROGUI_PrsPolyline::checkHighlight( double theX, double theY, QCursor& theCursor ) const
92 //================================================================
95 //================================================================
96 bool HYDROGUI_PrsPolyline::select( double theX, double theY, const QRectF& theRect )
98 return GraphicsView_Object::select( theX, theY, theRect );
101 //================================================================
102 // Function : unselect
104 //================================================================
105 void HYDROGUI_PrsPolyline::unselect()
107 GraphicsView_Object::unselect();
110 QPen aPen = myPolylineItem->pen();
111 aPen.setColor( Qt::black );
113 myPolylineItem->setPen( aPen );
116 //================================================================
117 // Function : setSelected
119 //================================================================
120 void HYDROGUI_PrsPolyline::setSelected( bool theState )
122 GraphicsView_Object::setSelected( theState );
125 QPen aPen = myPolylineItem->pen();
126 aPen.setColor( theState ? Qt::red : Qt::black );
127 aPen.setWidth( theState ? 2 : 1 );
128 myPolylineItem->setPen( aPen );