]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
dtm intersections >= 2 is colored in listview
authorisn <isn@opencascade.com>
Wed, 12 Oct 2016 12:04:35 +0000 (15:04 +0300)
committerisn <isn@opencascade.com>
Wed, 12 Oct 2016 12:05:35 +0000 (15:05 +0300)
src/HYDROData/HYDROData_DTM.cxx
src/HYDROData/HYDROData_DTM.h
src/HYDROGUI/HYDROGUI_ListModel.cxx
src/HYDROGUI/HYDROGUI_ListModel.h
src/HYDROGUI/HYDROGUI_OrderedListWidget.cxx
src/HYDROGUI/HYDROGUI_OrderedListWidget.h
src/HYDROGUI/HYDROGUI_StreamDlg.cxx
src/HYDROGUI/HYDROGUI_StreamDlg.h
src/HYDROGUI/HYDROGUI_StreamOp.cxx

index 736c43b5bc788e7ec94a6216628cc43d595e12d0..9ac801dcfb81fb2c8eb5b5aea323e07d5808f646 100644 (file)
@@ -242,7 +242,7 @@ void HYDROData_DTM::CreateProfilesFromDTM (const HYDROData_SequenceOfObjects& In
                                            TopoDS_Shape& OutOutlet,
                                            bool Create3dPres,
                                            bool Create2dPres,
-                                           std::set<int> InvInd)
+                                           std::set<int>& InvInd)
 {
 
   int aLower = InpProfiles.Lower(), anUpper = InpProfiles.Upper();
@@ -341,7 +341,7 @@ void HYDROData_DTM::CreateProfiles(const std::vector<Handle_HYDROData_Profile>&
                                    TopoDS_Shape& OutOutlet,
                                    bool Create3dPres,
                                    bool Create2dPres,
-                                   std::set<int> InvInd)
+                                   std::set<int>& InvInd)
 {
   if (theProfiles.empty())
     return;
@@ -774,7 +774,7 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_DTM::Interpolate
     AltitudePoints& theLeft,
     AltitudePoints& theRight,
     std::vector<AltitudePoints>& theMainProfiles,
-    std::set<int> invalInd)
+    std::set<int>& invalInd)
 {
   AltitudePoints points;
   size_t n = theProfiles.size();
index 0dc1a89191f7627b285e4272a43f9278a84de0f4..4835cef14578d30dc088a1b6ebe8acdbfca3a4d6 100644 (file)
@@ -149,7 +149,7 @@ protected:
                                      AltitudePoints& theLeft,
                                      AltitudePoints& theRight,
                                      std::vector<AltitudePoints>& theMainProfiles,
-                                     std::set<int> invalInd );
+                                     std::set<int>& invalInd );
 
   static void PointToWire(const AltitudePoints& pnts, TopoDS_Wire& W );
 
@@ -174,7 +174,7 @@ protected:
                              TopoDS_Shape& OutOutlet,
                              bool Create3dPres,
                              bool Create2dPres,
-                             std::set<int> InvInd );
+                             std::set<int>& InvInd );
 
   static void Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF );
     
@@ -187,18 +187,18 @@ protected:
 public:
 
   HYDRODATA_EXPORT static void CreateProfilesFromDTM ( const HYDROData_SequenceOfObjects& InpProfiles,
-                                      double ddz,
-                                      double step, 
-                                      AltitudePoints& points,
-                                      TopoDS_Shape& Out3dPres,
-                                      TopoDS_Shape& Out2dPres,
-                                      TopoDS_Shape& OutLeftB,
-                                      TopoDS_Shape& OutRightB,
-                                      TopoDS_Shape& OutInlet,
-                                      TopoDS_Shape& OutOutlet,
-                                      bool Create3dPres,
-                                      bool Create2dPres,
-                                      std::set<int> InvInd );
+                                                       double ddz,
+                                                       double step, 
+                                                       AltitudePoints& points,
+                                                       TopoDS_Shape& Out3dPres,
+                                                       TopoDS_Shape& Out2dPres,
+                                                       TopoDS_Shape& OutLeftB,
+                                                       TopoDS_Shape& OutRightB,
+                                                       TopoDS_Shape& OutInlet,
+                                                       TopoDS_Shape& OutOutlet,
+                                                       bool Create3dPres,
+                                                       bool Create2dPres,
+                                                       std::set<int>& InvInd );
 };
 
 
index b112dd34a5c3d2261b47df452e377369f3654e54..254cb7c3f06fcf8ffd786e76451a5ab4e0e02226 100644 (file)
@@ -63,6 +63,24 @@ HYDROGUI_ListModel::~HYDROGUI_ListModel()
 {
 }
 
+void HYDROGUI_ListModel::setBackgroundColor(int theInd, QColor theColor)
+{
+  myColoredRow[theInd] = theColor;
+}
+
+void HYDROGUI_ListModel::clearAllBackgroundColors()
+{
+  myColoredRow.clear();
+}
+
+QColor HYDROGUI_ListModel::getBackgroundColor(int theInd) const
+{
+  if (myColoredRow.count( theInd ))
+    return myColoredRow[theInd];
+  else
+    return QColor();
+}
+
 /**
 */
 QVariant HYDROGUI_ListModel::data( const QModelIndex &theIndex, int theRole ) const
@@ -82,6 +100,16 @@ QVariant HYDROGUI_ListModel::data( const QModelIndex &theIndex, int theRole ) co
         return QVariant();
     }
     break;
+  case Qt::BackgroundRole:
+    {
+      if( aColumn==0 && aRow >=0 && aRow < myObjects.count() && myColoredRow.contains(aRow))
+      {
+        QBrush aBackgr(myColoredRow[aRow]);
+        return aBackgr;
+      }
+      else
+        return QVariant();
+    }
 
   case Qt::DecorationRole:
     {
index adc0e42c1e55996eb0fc00674b9becedf024e66d..8216175af69f1cc770f1873003f0aac41c95791e 100644 (file)
@@ -23,6 +23,8 @@
 #include <HYDROData_Entity.h>
 #include <QAbstractListModel>
 #include <QPixmap>
+#include <QMap>
+#include <QColor>
 
 const int HYDROGUI_VisibleRole = Qt::UserRole + 1;
 const int HYDROGUI_EntryRole   = Qt::UserRole + 2;
@@ -75,6 +77,10 @@ public:
 
   void undoLastMove();
 
+  void setBackgroundColor(int theInd, const QColor theColor);
+  QColor getBackgroundColor(int theInd) const;
+  void clearAllBackgroundColors ();
+
 protected:
   bool isObjectVisible( int theIndex ) const;
   bool isDragAndDropAllowed( const QList<int>& theItems, const int theDropItem ) const;
@@ -84,6 +90,7 @@ private:
 
   Object2VisibleList myObjects, myPrevObjects;
   QPixmap myEmpty, myEye;
+  QMap<int, QColor> myColoredRow;
 
   bool myIsDecorationEnabled;
 };
index c17903a3b67f415d202c00af34d0df081614f63a..a6ef3229b156335e7ff510b9012524bdf408058c 100644 (file)
@@ -137,6 +137,31 @@ void HYDROGUI_OrderedListWidget::setObjects( const HYDROGUI_ListModel::Object2Vi
   }
 }
 
+void HYDROGUI_OrderedListWidget::setBackgroundColor (int theInd, QColor theColor)
+{
+  HYDROGUI_ListModel* aModel = getSourceModel();
+  if( aModel ) {
+    aModel->setBackgroundColor( theInd, theColor );
+  }
+}
+
+void HYDROGUI_OrderedListWidget::clearAllBackgroundColors ()
+{
+  HYDROGUI_ListModel* aModel = getSourceModel();
+  if( aModel ) {
+    aModel->clearAllBackgroundColors( );
+  }
+}
+
+
+ QColor HYDROGUI_OrderedListWidget::getBackgroundColor (int theInd) const
+ {
+   HYDROGUI_ListModel* aModel = getSourceModel();
+   if( aModel ) {
+     return aModel->getBackgroundColor( theInd );
+   }
+ }
+
 /**
   Returns the ordered list of objects.
   @return the list of objects
index d0ac12626a2134e7c6d19c12fe5a69c01395aef8..7b1feab744aa72fa372ea22fc7f0eb759f777d5a 100644 (file)
@@ -58,6 +58,10 @@ public:
   QStringList getSelectedNames() const;
   QStringList getAllNames() const;
 
+  void setBackgroundColor (int theInd, QColor theColor);
+  QColor getBackgroundColor (int theInd) const;
+  void clearAllBackgroundColors ();
+
   void undoLastMove();
 
 signals:
index 9693fd7fce569433979ccd759bb13af67aa045b1..06707d5f79bbca19d67c3c72f6b42d2a51f240f0 100644 (file)
@@ -57,13 +57,13 @@ HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QStrin
   myAxes = new QComboBox( aParamGroup );
   myAxes->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   myDDZ = new QDoubleSpinBox( aParamGroup );
-  myDDZ->setRange( 1E-2, 100 );
-  myDDZ->setSingleStep( 1E-2 );
+  myDDZ->setRange( 0.1, 100 );
+  myDDZ->setSingleStep( 0.1 );
   myDDZ->setValue( 0.1 );
   myDDZ->setDecimals( 2 );
   mySpatialStep = new QDoubleSpinBox( aParamGroup );
-  mySpatialStep->setRange( 1E-2, 100 );
-  mySpatialStep->setSingleStep( 1.0 );
+  mySpatialStep->setRange( 0.1, 100 );
+  mySpatialStep->setSingleStep( 0.1 );
   mySpatialStep->setValue( 1 );
   mySpatialStep->setDecimals( 2 );
 
@@ -247,3 +247,18 @@ double HYDROGUI_StreamDlg::getSpatialStep() const
   return mySpatialStep->value();
 }
 
+void HYDROGUI_StreamDlg::setBackgroundColorForProfileList (int theInd, QColor theColor)
+{
+  myProfiles->setBackgroundColor(theInd, theColor);
+}
+
+QColor HYDROGUI_StreamDlg::getBackgroundColorForProfileList (int theInd) const
+{
+  return myProfiles->getBackgroundColor(theInd);
+}
+
+void HYDROGUI_StreamDlg::clearAllBackgroundColorsForProfileList ()
+{
+  myProfiles->clearAllBackgroundColors();
+}
+
index 11a6fd906b11203b94a8521eb8910e44f294ac8a..2e4e4626d7459c5f7cd1558056fb1b0ffed56827 100644 (file)
@@ -56,6 +56,10 @@ public:
   void                       setSpatialStep( const double );
   double                     getSpatialStep() const;
 
+  void setBackgroundColorForProfileList (int theInd, QColor theColor);
+  QColor getBackgroundColorForProfileList (int theInd) const;
+  void clearAllBackgroundColorsForProfileList ();
+
 signals:
   void                       AddProfiles();
   void                       RemoveProfiles( const QStringList& );
index 2a1b43c936b4f18935e15d0cb75ce7e9dd71f929..ffbc32b0563152abb188e29754ffc7a801173aab 100755 (executable)
@@ -37,6 +37,7 @@
 
 #include <SUIT_MessageBox.h>
 #include <SUIT_Desktop.h>
+#include <QColor>
 
 #include <OCCViewer_ViewManager.h>
 #include <OCCViewer_ViewModel.h>
@@ -359,7 +360,9 @@ void HYDROGUI_StreamOp::createPreview()
   HYDROData_DTM::CreateProfilesFromDTM( aRefProfiles, ddz, ss, HYDROData_Bathymetry::AltitudePoints(), Out3dPres, Out2dPres, OutLeftB, OutRightB,
     OutInlet, OutOutlet, true, true, InvInd);
 
-  //TODO!! aPanel->my---;
+  aPanel->clearAllBackgroundColorsForProfileList();
+  for (std::set<int>::const_iterator it = InvInd.begin(); it != InvInd.end(); it++)
+    aPanel->setBackgroundColorForProfileList(*it, QColor(Qt::yellow));
 
   aPrsDef.myInlet = TopoDS::Wire(OutInlet);
   aPrsDef.myOutlet = TopoDS::Wire(OutOutlet);