Salome HOME
refs #568: use ordered list view with selection synchronized with object browser...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Prs.cxx
index f0a9f554418737cfbf01046029f6790055cbd70c..a413f1d0a824a47a6d99470a27ee8e14bd213e3d 100644 (file)
@@ -1,12 +1,8 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+// Copyright (C) 2014-2015  EDF-R&D
 // 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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 #include "HYDROGUI_Prs.h"
 
+#include <GraphicsView_ViewPort.h>
+
+#include <QCursor>
+
 //=======================================================================
 // name    : HYDROGUI_Prs
 // Purpose : Constructor
 //=======================================================================
-HYDROGUI_Prs::HYDROGUI_Prs( const Handle(HYDROData_Object)& theObject )
+HYDROGUI_Prs::HYDROGUI_Prs( const Handle(HYDROData_Entity)& theObject )
 : GraphicsView_Object(),
   myObject( theObject ),
   myIsToUpdate( false )
 {
+  myHighlightCursor = new QCursor( Qt::PointingHandCursor );
 }
 
 //=======================================================================
@@ -39,4 +40,30 @@ HYDROGUI_Prs::HYDROGUI_Prs( const Handle(HYDROData_Object)& theObject )
 //=======================================================================
 HYDROGUI_Prs::~HYDROGUI_Prs()
 {
+  if( myHighlightCursor )
+  {
+    delete myHighlightCursor;
+    myHighlightCursor = 0;
+  }
+}
+
+//================================================================
+// Function : addTo
+// Purpose  : 
+//================================================================
+void HYDROGUI_Prs::addTo( GraphicsView_ViewPort* theViewPort )
+{
+  GraphicsView_Object::addTo( theViewPort );
+
+  double aZValue = 0;
+  GraphicsView_ObjectListIterator anIter( theViewPort->getObjects() );
+  while( anIter.hasNext() )
+  {
+    if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
+    {
+      double aZValueRef = aPrs->zValue();
+      aZValue = qMax( aZValue, aZValueRef );
+    }
+  }
+  setZValue( aZValue + 1 );
 }