Salome HOME
Merging with WPdev
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_1.cxx
index 5f317478c4d7cc7cd18d7edae40d080812345a60..94c92abfc2b8f69d2ca66a6a52d4a3748b693f1d 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 #include "GeometryGUI.h"
 #include "GEOMToolsGUI_TransparencyDlg.h"
 #include "GEOMToolsGUI_NbIsosDlg.h"        // Method ISOS adjustement
-#include "GEOMToolsGUI_NameDlg.h"
 
 #include "GEOM_Actor.h"
 #include "GEOMBase.h"
 
-#include <SALOME_ListIO.hxx>
-#include <SALOME_ListIteratorOfListIO.hxx>
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include <SVTK_ViewModel.h>
+#include <SVTK_ViewWindow.h>
+#include <SVTK_View.h>
 
-#include <VTKViewer_ViewModel.h>
 #include <OCCViewer_ViewModel.h>
 #include <OCCViewer_ViewWindow.h>
 
-#include <SVTK_ViewWindow.h>
-#include <SVTK_RenderWindowInteractor.h>
-
 #include <SUIT_ViewManager.h>
 #include <SUIT_Application.h>
 #include <SUIT_Desktop.h>
 #include <SUIT_MessageBox.h>
 
 #include <SalomeApp_Application.h>
-#include <SalomeApp_SelectionMgr.h>
 #include <SalomeApp_Study.h>
 #include <SalomeApp_Module.h>
 
+#include <LightApp_SelectionMgr.h>
+#include <LightApp_NameDlg.h>
+
 #include "SALOMEDSClient.hxx"
 
 #include "utilities.h"
@@ -70,6 +71,8 @@
 #include <AIS_ListOfInteractive.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 #include <Prs3d_IsoAspect.hxx>
+#include <Prs3d_PointAspect.hxx>
+#include <Graphic3d_AspectMarker3d.hxx>
 
 // VTK Includes
 #include <vtkBMPReader.h>
@@ -100,7 +103,7 @@ void GEOMToolsGUI::OnSettingsColor()
   if( aDialogColor.isValid() )
   {
     QString type = desk->activeWindow()->getViewManager()->getType();
-    if( type != OCCViewer_Viewer::Type() && type != VTKViewer_Viewer::Type() )
+    if( type != OCCViewer_Viewer::Type() && type != SVTK_Viewer::Type() )
       MESSAGE("Settings Color is not supported for current Viewer");
 
     resMgr->setValue( "Geometry", "SettingsShadingColor", aDialogColor );
@@ -170,7 +173,7 @@ void GEOMToolsGUI::OnRename()
   SALOME_ListIO selected;
   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
   if ( app ) {
-    SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr();
+    LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
     SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
     if ( aSelMgr && appStudy ) {
       aSelMgr->selectedObjects( selected );
@@ -195,7 +198,7 @@ void GEOMToolsGUI::OnRename()
            if( obj->FindAttribute(anAttr, "AttributeName") ) {
              _PTR(AttributeName) aName (anAttr);
 
-             QString newName = GEOMToolsGUI_NameDlg::getName( app->desktop(), aName->Value().c_str() );
+             QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() );
              if ( !newName.isEmpty() ) {
                aName->SetValue( newName.latin1() ); // rename the SObject
                IObject->setName( newName.latin1() );// rename the InteractiveObject
@@ -207,6 +210,8 @@ void GEOMToolsGUI::OnRename()
       }
     }
   }
+  
+  app->updateActions(); //SRN: To update a Save button in the toolbar
 }
 
 void GEOMToolsGUI::OnCheckGeometry()
@@ -223,24 +228,24 @@ void GEOMToolsGUI::OnColor()
   SALOME_ListIO selected;
   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
   if ( app ) {
-    SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr();
+    LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
     if ( aSelMgr ) {
       aSelMgr->selectedObjects( selected );
       if ( !selected.IsEmpty() ) {
        SUIT_ViewWindow* window = app->desktop()->activeWindow();
        bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
-       bool isVTK = ( window && window->getViewManager()->getType() == VTKViewer_Viewer::Type() );
+       bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
        if ( isVTK ) {
          SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
          if ( !vtkVW )
            return;
-         SVTK_RenderWindowInteractor* rwi = vtkVW->getRWInteractor();
-         QColor initcolor = rwi->GetColor( selected.First()  );
+         SVTK_View* aView = vtkVW->getView();
+         QColor initcolor = aView->GetColor( selected.First()  );
          QColor c = QColorDialog::getColor( QColor(), app->desktop() );
          if ( c.isValid() ) {
            SUIT_OverrideCursor();
            for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
-             rwi->SetColor( It.Value(), c );
+             aView->SetColor( It.Value(), c );
            }
          }
        } // if ( isVTK )
@@ -257,6 +262,18 @@ void GEOMToolsGUI::OnColor()
              for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
                io = GEOMBase::GetAIS( It.Value(), true );
                if ( !io.IsNull() ) {
+                 // Set color for a point
+                 OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
+                 Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+                 Handle(AIS_Drawer) aCurDrawer = io->Attributes();
+                 Handle(Prs3d_PointAspect) aCurPointAspect =  aCurDrawer->PointAspect();
+                 Quantity_Color aCurColor;
+                 Standard_Real aCurScale;
+                 Aspect_TypeOfMarker aCurTypeOfMarker;
+                 aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale );
+                 aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aColor, aCurScale) );
+                 ic->SetLocalAttributes(io, aCurDrawer);
+                 
                  io->SetColor( aColor );
                  if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) )
                    Handle(GEOM_AISShape)::DownCast( io )->SetShadingColor( aColor );
@@ -270,6 +287,8 @@ void GEOMToolsGUI::OnColor()
       } // if ( selection not empty )
     }
   }
+  
+  app->updateActions(); //SRN: To update a Save button in the toolbar
 }
 
 void GEOMToolsGUI::OnTransparency()