1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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
23 #include "HYDROGUI_PrsZone.h"
28 //=======================================================================
29 // name : HYDROGUI_PrsZone
30 // Purpose : Constructor
31 //=======================================================================
32 HYDROGUI_PrsZone::HYDROGUI_PrsZone( const Handle(HYDROData_Object)& theObject )
33 : HYDROGUI_Prs( theObject ),
35 myFillingColor( Qt::transparent ),
36 myBorderColor( Qt::transparent )
40 //=======================================================================
41 // name : HYDROGUI_PrsZone
42 // Purpose : Destructor
43 //=======================================================================
44 HYDROGUI_PrsZone::~HYDROGUI_PrsZone()
48 //================================================================
51 //================================================================
52 void HYDROGUI_PrsZone::setPath( const QPainterPath& thePath )
57 //================================================================
60 //================================================================
61 QPainterPath HYDROGUI_PrsZone::getPath() const
66 //================================================================
67 // Function : setFillingColor
69 //================================================================
70 void HYDROGUI_PrsZone::setFillingColor( const QColor& theColor )
72 myFillingColor = theColor;
75 //================================================================
76 // Function : getFillingColor
78 //================================================================
79 QColor HYDROGUI_PrsZone::getFillingColor() const
81 return myFillingColor;
84 //================================================================
85 // Function : setBorderColor
87 //================================================================
88 void HYDROGUI_PrsZone::setBorderColor( const QColor& theColor )
90 myBorderColor = theColor;
93 //================================================================
94 // Function : getBorderColor
96 //================================================================
97 QColor HYDROGUI_PrsZone::getBorderColor() const
102 //================================================================
103 // Function : boundingRect
105 //================================================================
106 QRectF HYDROGUI_PrsZone::boundingRect() const
108 return myZoneItem->boundingRect();
111 //================================================================
112 // Function : compute
114 //================================================================
115 void HYDROGUI_PrsZone::compute()
119 myZoneItem = new QGraphicsPathItem( this );
120 addToGroup( myZoneItem );
123 QPainterPath aPath( myPath );
124 aPath.setFillRule( Qt::WindingFill );
126 myZoneItem->setPath( aPath );
127 myZoneItem->setBrush( QBrush( myFillingColor ) );
128 myZoneItem->setPen( QPen( myBorderColor ) );
131 //================================================================
132 // Function : checkHighlight
134 //================================================================
135 bool HYDROGUI_PrsZone::checkHighlight( double theX, double theY, QCursor& theCursor ) const
141 //================================================================
144 //================================================================
145 bool HYDROGUI_PrsZone::select( double theX, double theY, const QRectF& theRect )
147 return GraphicsView_Object::select( theX, theY, theRect );
150 //================================================================
151 // Function : unselect
153 //================================================================
154 void HYDROGUI_PrsZone::unselect()
156 GraphicsView_Object::unselect();
159 //================================================================
160 // Function : setSelected
162 //================================================================
163 void HYDROGUI_PrsZone::setSelected( bool theState )
165 GraphicsView_Object::setSelected( theState );