Salome HOME
LCM // Import/Export of SHP p.2
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_LandCoverMapPrs.cxx
index 7a005c24d78239fa2239ed0aa267268c984cffd7..6f654a6d1888563bfb0dad24030c19489d644d02 100644 (file)
 #include <HYDROData_Tool.h>
 #include <AIS_DisplayMode.hxx>
 #include <Prs3d_IsoAspect.hxx>
+#include <SelectMgr_SequenceOfOwner.hxx>
 #include <StdPrs_WFDeflectionShape.hxx>
+#include <StdSelect_BRepOwner.hxx>
 #include <TopoDS_Face.hxx>
 #include <QColor>
 #include <QString>
 
+const Quantity_Color EDGES_COLOR = Quantity_NOC_WHITE;
+const int HILIGHT_ISO_NB = 10;
+
 IMPLEMENT_STANDARD_HANDLE( HYDROGUI_LandCoverMapPrs, AIS_ColoredShape )
 IMPLEMENT_STANDARD_RTTIEXT( HYDROGUI_LandCoverMapPrs, AIS_ColoredShape )
 
@@ -33,6 +38,8 @@ HYDROGUI_LandCoverMapPrs::HYDROGUI_LandCoverMapPrs( const Handle(HYDROData_LandC
   : AIS_ColoredShape( theMap->GetShape() )
 {
   SetLandCoverMap( theMap );
+  SetAutoHilight( Standard_False );
+  SetHilightAttributes( EDGES_COLOR );
 }
 
 HYDROGUI_LandCoverMapPrs::~HYDROGUI_LandCoverMapPrs()
@@ -135,13 +142,11 @@ void HYDROGUI_LandCoverMapPrs::Compute( const Handle(PrsMgr_PresentationManager3
 {
   thePresentation->Clear();
 
-  Quantity_Color anEdgeColor = Quantity_NOC_WHITE;
-
   myDrawer->UIsoAspect()->SetNumber( 0 );
   myDrawer->VIsoAspect()->SetNumber( 0 );
-  myDrawer->LineAspect()->SetColor( anEdgeColor );
-  myDrawer->FaceBoundaryAspect()->SetColor( anEdgeColor );
-  myDrawer->FreeBoundaryAspect()->SetColor( anEdgeColor );
+  myDrawer->LineAspect()->SetColor( EDGES_COLOR );
+  myDrawer->FaceBoundaryAspect()->SetColor( EDGES_COLOR );
+  myDrawer->FreeBoundaryAspect()->SetColor( EDGES_COLOR );
 
   switch( theMode )
   {
@@ -155,3 +160,34 @@ void HYDROGUI_LandCoverMapPrs::Compute( const Handle(PrsMgr_PresentationManager3
     StdPrs_WFDeflectionShape::Add( thePresentation, Shape(), myDrawer );
 }
 
+void HYDROGUI_LandCoverMapPrs::HilightSelected( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+                                                const SelectMgr_SequenceOfOwner& theOwners )
+{
+  Handle(Prs3d_Presentation) aSelectPrs = GetSelectPresentation( thePresentationManager );
+
+  SetHilightAttributes( EDGES_COLOR );
+
+  for( int i=1, n=theOwners.Length(); i<=n; i++ )
+  {
+    Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast( theOwners.Value( i ) );
+    if( !anOwner.IsNull() )
+      StdPrs_WFDeflectionShape::Add( aSelectPrs, anOwner->Shape(), HilightAttributes() );
+  }
+
+  HilightAttributes()->UIsoAspect()->SetNumber( 0 );
+  HilightAttributes()->VIsoAspect()->SetNumber( 0 );
+
+  aSelectPrs->SetDisplayPriority( 9 );
+  aSelectPrs->Display();
+}
+
+void HYDROGUI_LandCoverMapPrs::SetHilightAttributes( const Quantity_Color& theEdgesColor )
+{
+  HilightAttributes()->UIsoAspect()->SetNumber( HILIGHT_ISO_NB );
+  HilightAttributes()->UIsoAspect()->SetColor( theEdgesColor );
+  HilightAttributes()->VIsoAspect()->SetNumber( HILIGHT_ISO_NB );
+  HilightAttributes()->VIsoAspect()->SetColor( theEdgesColor );
+  HilightAttributes()->LineAspect()->SetColor( theEdgesColor );
+  HilightAttributes()->FaceBoundaryAspect()->SetColor( theEdgesColor );
+  HilightAttributes()->FreeBoundaryAspect()->SetColor( theEdgesColor );
+}