Salome HOME
patch for install error on Linux
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_LandCoverMapPrs.cxx
index 6f654a6d1888563bfb0dad24030c19489d644d02..196bd70ded7ab773c1078b792ca147b3efd2644f 100644 (file)
@@ -28,7 +28,7 @@
 #include <QColor>
 #include <QString>
 
-const Quantity_Color EDGES_COLOR = Quantity_NOC_WHITE;
+const Quantity_Color EDGES_COLOR = Quantity_NOC_SLATEGRAY;
 const int HILIGHT_ISO_NB = 10;
 
 IMPLEMENT_STANDARD_HANDLE( HYDROGUI_LandCoverMapPrs, AIS_ColoredShape )
@@ -59,9 +59,15 @@ void HYDROGUI_LandCoverMapPrs::SetLandCoverMap( const Handle(HYDROData_LandCover
 
 void HYDROGUI_LandCoverMapPrs::UpdateColors()
 {
-  Set( myLCMap->GetShape() );
   SetMaterial( Graphic3d_NOM_PLASTIC );
-  HYDROData_LandCoverMap::Iterator anIt( myLCMap );
+  if( myLCMap.IsNull() )
+  {
+    Set( TopoDS_Shape() );
+    return;
+  }
+  
+  Set( myLCMap->GetShape() );
+  HYDROData_LandCoverMap::Explorer anIt( myLCMap );
   for( ; anIt.More(); anIt.Next() )
   {
     TopoDS_Face aFace = anIt.Face();
@@ -69,7 +75,8 @@ void HYDROGUI_LandCoverMapPrs::UpdateColors()
     Quantity_Color aColor = GetColor( aStricklerType );
     SetCustomColor( aFace, aColor );
     SetCustomWidth( aFace, 1.0 );
-  }
+  } 
+  SetTransparency( myLCMap->GetTransparency() );
 }
 
 Handle(Aspect_ColorScale) HYDROGUI_LandCoverMapPrs::GetColorScale() const
@@ -116,24 +123,12 @@ Quantity_Color HYDROGUI_LandCoverMapPrs::GetColor( const QString& theStricklerTy
       return Quantity_Color();
   }
 
-  if( !myTable.IsNull() && myTable->HasType( theStricklerType ) )
-  {
-    QColor aColor = myTable->GetColor( theStricklerType );
-    return HYDROData_Tool::toOccColor( aColor );
-  }
-
-  HYDROData_Iterator anIt( HYDROData_Document::Document( myLCMap->Label() ), KIND_STRICKLER_TABLE );
-  for( ; anIt.More(); anIt.Next() )
-  {
-    Handle(HYDROData_StricklerTable) aTable = Handle(HYDROData_StricklerTable)::DownCast( anIt.Current() );
-    if( aTable->HasType( theStricklerType ) )
-    {
-      QColor aColor = aTable->GetColor( theStricklerType );
-      return HYDROData_Tool::toOccColor( aColor );
-    }
-  }
+  QColor aColor = HYDROData_Document::Document( myLCMap->Label())->GetAssociatedColor(theStricklerType, myTable);
 
-  return Quantity_Color();
+  if (aColor.isValid())
+    return HYDROData_Tool::toOccColor(aColor);
+  else
+    return Quantity_Color();
 }
 
 void HYDROGUI_LandCoverMapPrs::Compute( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,