]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
VISU 2008 - Introduction of the Feature Edges presentation mode
authorouv <ouv@opencascade.com>
Wed, 9 Jul 2008 10:49:11 +0000 (10:49 +0000)
committerouv <ouv@opencascade.com>
Wed, 9 Jul 2008 10:49:11 +0000 (10:49 +0000)
12 files changed:
resources/SalomeApp.xml
src/VISUGUI/Makefile.am
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_FeatureEdgesPanel.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_Panel.cxx
src/VISUGUI/VisuGUI_Panel.h
src/VISUGUI/VisuGUI_SelectionPanel.cxx
src/VISUGUI/VisuGUI_SelectionPanel.h
src/VISU_I/VISU_Mesh_i.cc

index 7bd7d5e5599cd00f641927be0d5567d9854deb29..670acb23290da5934432cd501dd41aa912baeac1 100644 (file)
     <parameter name="scalar_def_shrink"        value="false"/>
     <parameter name="represent_shading"        value="false"/>
     <parameter name="feature_edges_angle"      value="30.0"/>
-    <parameter name="feature_edges"            value="true"/>
-    <parameter name="boundary_edges"           value="false"/>
-    <parameter name="manifold_edges"           value="false"/>
-    <parameter name="non_manifold_edges"       value="false"/>
+    <parameter name="show_feature_edges"       value="true"/>
+    <parameter name="show_boundary_edges"      value="false"/>
+    <parameter name="show_manifold_edges"      value="false"/>
+    <parameter name="show_non_manifold_edges"  value="false"/>
     <parameter name="feature_edges_coloring"   value="false"/>
     <parameter name="scalar_bar_horizontal_height" value="0.05"/>
     <parameter name="scalar_bar_horizontal_width"  value="0.5" />
index d8166dd7dc2cd519a932fda16b1561ba38bbdb2f..50a9a6bb253e43b8a0eadb477b9d40730b69451b 100644 (file)
@@ -47,6 +47,7 @@ dist_libVISU_la_SOURCES= \
        VisuGUI_SelectionPrefDlg.cxx \
        VisuGUI_GaussPointsSelectionPane.cxx \
        VisuGUI_FindPane.cxx \
+       VisuGUI_FeatureEdgesPanel.cxx \
        VisuGUI_Tools.cxx \
        VisuGUI_ViewTools.cxx \
        VisuGUI_Selection.cxx \
@@ -92,6 +93,7 @@ MOC_FILES= \
        VisuGUI_SelectionPrefDlg_moc.cxx \
        VisuGUI_GaussPointsSelectionPane_moc.cxx \
        VisuGUI_FindPane_moc.cxx \
+       VisuGUI_FeatureEdgesPanel_moc.cxx \
        VisuGUI_NameDlg_moc.cxx \
        VisuGUI_FileDlg_moc.cxx \
        VisuGUI_CursorDlg_moc.cxx \
index bf70278954766728bd3bc22f4dcd8bc86b60cba3..3f3c64a2b221e91b51af3c9f175cc9d56f0155ef 100644 (file)
@@ -98,10 +98,6 @@ number of time stamps or number of components is not the same!</translation>
         </message>
         <message><source>VISU_3DCACHE_PREFERENCES</source><translation>3D Cache</translation></message>
         <message><source>VISU_ANIMATION_PREFERENCES</source><translation>Animation</translation></message>
-        <message>
-            <source>VISU_BOUNDARY_EDGES</source>
-            <translation>Boundary edges</translation>
-        </message>
         <message>
             <source>VISU_COLORS_AND_LABELS</source>
             <translation>Colors &amp;&amp; Labels</translation>
@@ -206,10 +202,6 @@ number of time stamps or number of components is not the same!</translation>
             <source>VISU_LOGARITHMIC_SCALING</source>
             <translation>Logarithmic scaling</translation>
         </message>
-        <message>
-            <source>VISU_MANIFOLD_EDGES</source>
-            <translation>Manifold edges</translation>
-        </message>
         <message>
             <source>VISU_MAX</source>
             <translation>Max:</translation>
@@ -258,10 +250,6 @@ number of time stamps or number of components is not the same!</translation>
             <source>VISU_NB_STEPS</source>
             <translation>Number of steps</translation>
         </message>
-        <message>
-            <source>VISU_NON_MANIFOLD_EDGES</source>
-            <translation>Non-manifold edges</translation>
-        </message>
         <message>
             <source>VISU_ORIENTATION</source>
             <translation>Orientation</translation>
@@ -314,6 +302,22 @@ number of time stamps or number of components is not the same!</translation>
             <source>VISU_SCALAR_RANGE</source>
             <translation>Scalar range</translation>
         </message>
+        <message>
+            <source>VISU_SHOW_BOUNDARY_EDGES</source>
+            <translation>Show boundary edges</translation>
+        </message>
+        <message>
+            <source>VISU_SHOW_FEATURE_EDGES</source>
+            <translation>Show feature edges</translation>
+        </message>
+        <message>
+            <source>VISU_SHOW_MANIFOLD_EDGES</source>
+            <translation>Show manifold edges</translation>
+        </message>
+        <message>
+            <source>VISU_SHOW_NON_MANIFOLD_EDGES</source>
+            <translation>Show non-manifold edges</translation>
+        </message>
         <message>
             <source>VISU_SHRINK</source>
             <translation>Shrink</translation>
@@ -1752,6 +1756,41 @@ Please, provide non-empty resulting presentation.</translation>
             <translation>Table</translation>
         </message>
     </context>
+    <context>
+        <name>VisuGUI_FeatureEdgesPanel</name>
+        <message>
+            <source>WINDOW_TITLE</source>
+            <translation>Feature edges</translation>
+        </message>
+        <message>
+            <source>FEATURE_EDGES_ANGLE</source>
+            <translation>Feature edges angle</translation>
+        </message>
+        <message>
+            <source>FEATURE_EDGES_COLORING</source>
+            <translation>Coloring</translation>
+        </message>
+        <message>
+            <source>FEATURE_EDGES_PROPERTIES</source>
+            <translation>Feature edges properties</translation>
+        </message>
+        <message>
+            <source>SHOW_BOUNDARY_EDGES</source>
+            <translation>Show boundary edges</translation>
+        </message>
+        <message>
+            <source>SHOW_FEATURE_EDGES</source>
+            <translation>Show feature edges</translation>
+        </message>
+        <message>
+            <source>SHOW_MANIFOLD_EDGES</source>
+            <translation>Show manifold edges</translation>
+        </message>
+        <message>
+            <source>SHOW_NON_MANIFOLD_EDGES</source>
+            <translation>Show non-manifold edges</translation>
+        </message>
+    </context>
     <context>
         <name>VisuGUI_FileDlg</name>
         <message>
index 7ba08d0a2e277afe288dc0240de71b5f16428953..6757875bb0cde96398be939b9d80e61bb2b6c483 100644 (file)
 #include "VisuGUI_Tools.h"
 
 #include "VisuGUI_SelectionPanel.h"
+#include "VisuGUI_FeatureEdgesPanel.h"
 #include "VisuGUI_NameDlg.h"
 #include "VisuGUI_CursorDlg.h"
 #include "VisuGUI_Selection.h"
@@ -174,7 +175,6 @@ VisuGUI
 ::VisuGUI():
   SalomeApp_Module( "VISU" ),
   myDisplayer( 0 ),
-  mySelectionPanel( 0 ),
   mySlider( NULL ),
   mySweep( NULL )
 {
@@ -1794,10 +1794,17 @@ VisuGUI
 {
   if (GetActiveViewWindow<SVTK_ViewWindow>(this))
   {
-    if( mySelectionPanel->isVisible() )
-      mySelectionPanel->hide();
-    else
-      mySelectionPanel->show();
+    if( myPanels.find( SelectionPanelId ) != myPanels.end() )
+    {
+      if( VisuGUI_SelectionPanel* aSelectionPanel =
+         dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
+      {
+       if( aSelectionPanel->isVisible() )
+         aSelectionPanel->hide();
+       else
+         aSelectionPanel->show();
+      }
+    }
   }
   else
     SUIT_MessageBox::warning(GetDesktop(this),
@@ -1819,8 +1826,12 @@ VisuGUI
     QAction* aRefAction = action( anId );
     if( anAction != aRefAction )
       aRefAction->setChecked( false );
-    else
-      mySelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
+    else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
+    {
+      if( VisuGUI_SelectionPanel* aSelectionPanel =
+         dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
+       aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
+    }
   }
 }
 
@@ -1991,8 +2002,7 @@ VisuGUI
   createMenus();
   createToolBars();
   createPopupMenus();
-
-  createSelectionPanel();
+  createPanels();
 
   // tmp
   action( VISU_ACTOR_SELECTION )->setChecked( true );
@@ -2745,14 +2755,20 @@ VisuGUI
   }
 }
 
-void VisuGUI::createSelectionPanel()
+void VisuGUI::createPanels()
 {
-  mySelectionPanel = new VisuGUI_SelectionPanel( this );
-  mySelectionPanel->hide();
+  myPanels.insert( SelectionPanelId,    new VisuGUI_SelectionPanel( this ) );
+  myPanels.insert( FeatureEdgesPanelId, new VisuGUI_FeatureEdgesPanel( this ) );
 
-  connect( mySelectionPanel, SIGNAL( selectionModeChanged( int ) ), this, SLOT( OnSwitchSelectionMode( int ) ) );
-
-  GetDesktop(this)->addDockWidget( Qt::RightDockWidgetArea, mySelectionPanel );
+  QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
+  for( ; it != itEnd; ++it )
+  {
+    if( VisuGUI_Panel* aPanel = it.value() )
+    {
+      aPanel->hide();
+      GetDesktop(this)->addDockWidget( Qt::RightDockWidgetArea, aPanel );
+    }
+  }
 }
 
 //***************************************************************************
@@ -2970,7 +2986,12 @@ VisuGUI
   setMenuShown( false );
   setToolShown( false );
 
-  mySelectionPanel->hide();
+  QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
+  for( ; it != itEnd; ++it )
+  {
+    if( VisuGUI_Panel* aPanel = it.value() )
+      aPanel->hide();
+  }
 
   // Unset actions accelerator keys
   action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey);
@@ -3442,14 +3463,14 @@ void VisuGUI::createPreferences()
 
   int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
                                             LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
-  setPreferenceProperty( featureEdgesAnglePref, "step", 1.0 );
+  setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
   setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
   setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
 
-  addPreference( tr( "VISU_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges" );
-  addPreference( tr( "VISU_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "boundary_edges" );
-  addPreference( tr( "VISU_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "manifold_edges" );
-  addPreference( tr( "VISU_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "non_manifold_edges" );
+  addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
+  addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
+  addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
+  addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
   addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
 }
 
index 9d9e6ac399509e4ff826b9c935cd40d6073510bd..1ce6b8d1281f30b392d9b952ce831db875f041d0 100644 (file)
 #ifndef VisuGUI_HeaderFile
 #define VisuGUI_HeaderFile
 
-#include <map>
-#include <set>
+#include <SalomeApp_Module.h>
 
-#include "SalomeApp_Module.h"
+#include <SVTK_ViewWindow.h>
+#include <VISU_Prs3d_i.hh>
 
-#include "SALOME_ListIO.hxx"
-#include "VISU_Prs3d_i.hh"
-#include "SVTK_ViewWindow.h"
+#include "VisuGUI_Panel.h"
 
+#include <map>
+#include <set>
 
 class SUIT_ViewManager;
-class SVTK_ViewWindow;
-class VisuGUI_SelectionPanel;
 class VisuGUI_Slider;
 class VisuGUI_Sweep;
 
@@ -58,7 +56,10 @@ class VisuGUI: public SalomeApp_Module
   Q_OBJECT;
 
 public:
+  enum PanelId { SelectionPanelId = 0,
+                FeatureEdgesPanelId };
 
+public:
   VisuGUI();
   virtual ~VisuGUI();
 
@@ -196,11 +197,10 @@ private:
   void createMenus();
   void createToolBars();
   void createPopupMenus();
-
-  void createSelectionPanel();
+  void createPanels();
 
 private:
-  VisuGUI_SelectionPanel* mySelectionPanel;
+  QMap< PanelId, VisuGUI_Panel* > myPanels;
   VisuGUI_Slider*         mySlider;
   VisuGUI_Sweep*          mySweep; 
 
diff --git a/src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx b/src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx
new file mode 100644 (file)
index 0000000..ac23e2f
--- /dev/null
@@ -0,0 +1,215 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  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.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  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.com
+//
+//
+//  File   : VisuGUI_FeatureEdgesPanel.cxx
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#include "VisuGUI_FeatureEdgesPanel.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
+
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QKeyEvent>
+#include <QLabel>
+#include <QLayout>
+#include <QPushButton>
+
+#include <QtxDoubleSpinBox.h>
+
+#include <SUIT_MessageBox.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <SalomeApp_Application.h>
+
+#include <LightApp_SelectionMgr.h>
+
+VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, QWidget* theParent ) :
+  VisuGUI_Panel( tr( "WINDOW_TITLE" ), theModule, theParent, ApplyBtn | CloseBtn | HelpBtn ),
+  myActor( 0 )
+{
+  QVBoxLayout* aTopLayout = new QVBoxLayout( mainFrame() );
+  myGrp = new QGroupBox( tr( "FEATURE_EDGES_PROPERTIES" ), mainFrame() );
+
+  QGridLayout* aLayout = new QGridLayout( myGrp );
+  aLayout->setAlignment( Qt::AlignTop );
+
+  QLabel* anAngleLbl = new QLabel( tr( "FEATURE_EDGES_ANGLE" ), myGrp );
+  myAngleSpinBox = new QtxDoubleSpinBox( 0.0, 90.0, 10.0, myGrp );
+
+  myFeatureEdgesCB = new QCheckBox( tr( "SHOW_FEATURE_EDGES" ), myGrp );
+  myBoundaryEdgesCB = new QCheckBox( tr( "SHOW_BOUNDARY_EDGES" ), myGrp );
+  myManifoldEdgesCB = new QCheckBox( tr( "SHOW_MANIFOLD_EDGES" ), myGrp );
+  myNonManifoldEdgesCB = new QCheckBox( tr( "SHOW_NON_MANIFOLD_EDGES" ), myGrp );
+
+  myColoringCB = new QCheckBox( tr( "FEATURE_EDGES_COLORING" ), myGrp );
+
+  aLayout->addWidget( anAngleLbl, 0, 0 );
+  aLayout->addWidget( myAngleSpinBox, 0, 1 );
+  aLayout->addWidget( myFeatureEdgesCB, 1, 0, 1, 2 );
+  aLayout->addWidget( myBoundaryEdgesCB, 2, 0, 1, 2 );
+  aLayout->addWidget( myManifoldEdgesCB, 3, 0, 1, 2 );
+  aLayout->addWidget( myNonManifoldEdgesCB, 4, 0, 1, 2 );
+  aLayout->addWidget( myColoringCB, 5, 0, 1, 2 );
+
+  aTopLayout->addWidget( myGrp );
+
+  SalomeApp_Application* anApp =
+    dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+  LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
+  connect( aSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionEvent() ) );
+}
+
+VisuGUI_FeatureEdgesPanel::~VisuGUI_FeatureEdgesPanel()
+{
+}
+
+void VisuGUI_FeatureEdgesPanel::showEvent( QShowEvent* theEvent )
+{
+  onSelectionEvent();
+
+  VisuGUI_Panel::showEvent(theEvent);
+}
+
+VISU_Actor* VisuGUI_FeatureEdgesPanel::getSelectedActor() const
+{
+  SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>( myModule );
+  if( !aViewWindow )
+    return 0;
+
+  _PTR(SObject) aSObject;
+  VISU::Prs3d_i* aPrs3d = 0;
+  Handle(SALOME_InteractiveObject) anIO;
+
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( myModule );
+  if( aSelectionInfo.size() != 1 )
+    return 0;
+
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
+  aPrs3d = GetPrs3dFromBase( anObjectInfo.myBase );
+  if( !aPrs3d )
+    return 0;
+
+  anIO = aSelectionItem.myIO;
+  aSObject = anObjectInfo.mySObject;
+  
+  VISU_Actor* anActor =
+    VISU::FindActor( VISU::GetAppStudy( myModule ), aViewWindow, aSObject->GetID().c_str() );
+
+  return anActor;
+}
+
+void VisuGUI_FeatureEdgesPanel::onSelectionEvent()
+{
+  myActor = getSelectedActor();
+  bool anIsSelected = myActor && myActor->IsFeatureEdgesAllowed();
+
+  myGrp->setEnabled( anIsSelected );
+  myApply->setEnabled( anIsSelected );
+
+  if( !anIsSelected )
+    return;
+
+  if( !myActor->IsFeatureEdgesAllowed() )
+    return;
+
+  float anAngle = myActor->GetFeatureEdgesAngle();
+
+  bool anIsFeatureEdges = false,
+       anIsBoundaryEdges = false,
+       anIsManifoldEdges = false,
+       anIsNonManifoldEdges = false;
+  myActor->GetFeatureEdgesFlags( anIsFeatureEdges,
+                                anIsBoundaryEdges,
+                                anIsManifoldEdges,
+                                anIsNonManifoldEdges );
+
+  float aColoring = myActor->GetFeatureEdgesColoring();
+
+  myAngleSpinBox->setValue( anAngle );
+  myFeatureEdgesCB->setChecked( anIsFeatureEdges );
+  myBoundaryEdgesCB->setChecked( anIsBoundaryEdges );
+  myManifoldEdgesCB->setChecked( anIsManifoldEdges );
+  myNonManifoldEdgesCB->setChecked( anIsNonManifoldEdges );
+  myColoringCB->setChecked( aColoring );
+}
+
+void VisuGUI_FeatureEdgesPanel::onApply()
+{
+  if( myActor )
+  {
+    myActor->SetFeatureEdgesAngle( myAngleSpinBox->value() );
+    myActor->SetFeatureEdgesFlags( myFeatureEdgesCB->isChecked(),
+                                  myBoundaryEdgesCB->isChecked(),
+                                  myManifoldEdgesCB->isChecked(),
+                                  myNonManifoldEdgesCB->isChecked() );
+    myActor->SetFeatureEdgesColoring( myColoringCB->isChecked() );
+    myActor->Update();
+  }
+
+  VisuGUI_Panel::onApply();
+}
+
+void VisuGUI_FeatureEdgesPanel::onClose()
+{
+  close();
+  VisuGUI_Panel::onClose();
+}
+
+void VisuGUI_FeatureEdgesPanel::onHelp()
+{
+  QString aHelpFileName = "feature_edges_page.html";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app)
+    app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName);
+  else {
+    QString platform;
+#ifdef WIN32
+    platform = "winapplication";
+#else
+    platform = "application";
+#endif
+    SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
+                             QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) );
+  }
+
+  VisuGUI_Panel::onHelp();
+}
+
+void VisuGUI_FeatureEdgesPanel::keyPressEvent( QKeyEvent* e )
+{
+  VisuGUI_Panel::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+
+  if ( e->key() == Qt::Key_F1 )
+    {
+      e->accept();
+      onHelp();
+    }
+}
diff --git a/src/VISUGUI/VisuGUI_FeatureEdgesPanel.h b/src/VISUGUI/VisuGUI_FeatureEdgesPanel.h
new file mode 100644 (file)
index 0000000..649c8ad
--- /dev/null
@@ -0,0 +1,74 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  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. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  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.com
+//
+//
+//  File   : VisuGUI_FeatureEdgesPanel.h
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#ifndef VISUGUI_FEATUREEDGESPANEL_H
+#define VISUGUI_FEATUREEDGESPANEL_H
+
+#include <VisuGUI_Panel.h>
+
+class QCheckBox;
+class QGroupBox;
+
+class QtxDoubleSpinBox;
+
+class VISU_Actor;
+
+class VisuGUI_FeatureEdgesPanel: public VisuGUI_Panel
+{
+  Q_OBJECT
+
+public:
+  VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, QWidget* theParent = 0 );
+  virtual ~VisuGUI_FeatureEdgesPanel ();
+
+protected:
+  virtual void              keyPressEvent( QKeyEvent* theEvent );
+  virtual void              showEvent( QShowEvent* theEvent );
+
+private slots:
+  virtual void              onApply();
+  virtual void              onClose();
+  virtual void              onHelp();
+
+  void                      onSelectionEvent();
+
+private:
+  VISU_Actor*               getSelectedActor() const;
+
+private:
+  QGroupBox*                myGrp;
+
+  QtxDoubleSpinBox*         myAngleSpinBox;
+  QCheckBox*                myFeatureEdgesCB;
+  QCheckBox*                myBoundaryEdgesCB;
+  QCheckBox*                myManifoldEdgesCB;
+  QCheckBox*                myNonManifoldEdgesCB;
+  QCheckBox*                myColoringCB;
+
+  VISU_Actor*               myActor;
+};
+
+#endif
index fb846ba940bbfc2b0c6b4c2b596446433f147d5e..6e0b55bb262ae02eb6c6225e20314b90d8d3550b 100755 (executable)
@@ -25,6 +25,8 @@
 //  Module : VISU
 
 #include "VisuGUI_Panel.h"
+
+#include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
 
 #include "SUIT_ResourceMgr.h"
@@ -79,9 +81,11 @@ public:
   \param theParent parent widget
 */
 VisuGUI_Panel::VisuGUI_Panel( const QString& theName, 
+                             const VisuGUI* theModule, 
                              QWidget* theParent,
                              const int theBtns  )
   : QtxDockWidget( theName, theParent ),
+    myModule( theModule ),
     myOK( 0 ),
     myApply( 0 ),
     myClose( 0 ),
@@ -105,7 +109,6 @@ VisuGUI_Panel::VisuGUI_Panel( const QString& theName,
   // Create buttons
   QWidget* aBtnWg = new QWidget( aGrp );
   QHBoxLayout* aBtnWgLayout = new QHBoxLayout( aBtnWg );
-  //aBtnWgLayout->setSpacing( 5 );
 
   aBtnWgLayout->addStretch();
 
index 989cd5234dd6ac58aeb9df113f923febca777c4b..bd513ab5b2541c85e10889a024c84edd3a4809fe 100755 (executable)
@@ -33,6 +33,8 @@ class QFrame;
 class QScrollArea;
 class QPushButton;
 
+class VisuGUI;
+
 class VisuGUI_Panel : public QtxDockWidget
 {
   Q_OBJECT
@@ -48,7 +50,10 @@ public:
   };
 
 public:
-  VisuGUI_Panel( const QString& theName, QWidget* theParent, const int theBtns = AllBtn ); 
+  VisuGUI_Panel( const QString& theName,
+                const VisuGUI* theModule,
+                QWidget* theParent,
+                const int theBtns = AllBtn ); 
   virtual ~VisuGUI_Panel();
 
   virtual bool              isValid( QString& theMessage );
@@ -71,6 +76,8 @@ protected:
   QPushButton*              myApply;
   QPushButton*              myClose;
   QPushButton*              myHelp;
+
+  const VisuGUI*            myModule;
 };
 
 #endif
index e4cc403d1e1ef0bbf0c6a962fe4c48358e254cd7..0a750c340df485c957cb3056cfd5a81470318b46 100644 (file)
@@ -122,10 +122,8 @@ public:
   }
 };
 
-VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModule, QWidget* theParent ) :
-  VisuGUI_Panel( tr("WINDOW_TITLE" ), theParent, CloseBtn | HelpBtn ),
-  myModule( theModule ),
-  mySelectionMgr( 0 ),
+VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const VisuGUI* theModule, QWidget* theParent ) :
+  VisuGUI_Panel( tr("WINDOW_TITLE" ), theModule, theParent, CloseBtn | HelpBtn ),
   myPreferencesDlg( 0 )
 {
   QVBoxLayout* TopLayout = new QVBoxLayout ( mainFrame() );
@@ -304,10 +302,12 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul
 
   TopLayout->addWidget( aPrefBtn );
 
-  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
-    (SUIT_Session::session()->activeApplication());
-  mySelectionMgr = anApp->selectionMgr();
-  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionEvent()));
+  SalomeApp_Application* anApp =
+    dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+  LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
+  connect( aSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionEvent() ) );
+
+  connect( this, SIGNAL( selectionModeChanged( int ) ), myModule, SLOT( OnSwitchSelectionMode( int ) ) );
 
   myFl = false;
 
index 870597acb5e81ca81d2d93383ab6a619e6e190e1..b4db3d621157184125eb2fd3411a8470cbada7a2 100644 (file)
 
 #include <VisuGUI_Panel.h>
 
-#include <vtkSmartPointer.h>
-
 class QLabel;
 class QLineEdit;
 class QTableWidget;
 class QTabWidget;
 
-class LightApp_SelectionMgr;
-class SalomeApp_Application;
-class SalomeApp_Module;
-class SVTK_RenderWindowInteractor;
-
 class VisuGUI_GaussPointsSelectionPane;
 class VisuGUI_FindPane;
 class VisuGUI_SelectionPrefDlg;
@@ -52,16 +45,14 @@ class VisuGUI_SelectionPanel: public VisuGUI_Panel
   Q_OBJECT
 
 public:
-  VisuGUI_SelectionPanel( const SalomeApp_Module* theModule, QWidget* theParent = 0 );
+  VisuGUI_SelectionPanel( const VisuGUI* theModule, QWidget* theParent = 0 );
   virtual ~VisuGUI_SelectionPanel ();
 
 public:
   void                      setSelectionMode( int theId );
 
-private:
-  void                      keyPressEvent( QKeyEvent* theEvent );
-
 protected:
+  virtual void              keyPressEvent( QKeyEvent* theEvent );
   virtual void              showEvent( QShowEvent* theEvent );
   virtual void              closeEvent( QCloseEvent* theEvent );
 
@@ -116,8 +107,6 @@ private:
 
   VisuGUI_SelectionPrefDlg* myPreferencesDlg;
 
-  const SalomeApp_Module*   myModule;
-  LightApp_SelectionMgr*    mySelectionMgr;
   bool                      myFl;
 };
 
index 088a3acf494d49cbc4549a65f846c526fe5a6e18..c0032f675f45b6bb27064860c363f666947bdf4c 100644 (file)
@@ -510,6 +510,14 @@ VISU::Mesh_i
     SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
     bool toShrink  = aResourceMgr->booleanValue("VISU", "mesh_shrink", false);
     if (toShrink) anActor->SetShrink();
+
+    anActor->SetFeatureEdgesAngle( aResourceMgr->doubleValue("VISU", "feature_edges_angle", 0.0) );
+    anActor->SetFeatureEdgesFlags( aResourceMgr->booleanValue("VISU", "show_feature_edges", false),
+                                  aResourceMgr->booleanValue("VISU", "show_boundary_edges", false),
+                                  aResourceMgr->booleanValue("VISU", "show_manifold_edges", false),
+                                  aResourceMgr->booleanValue("VISU", "show_non_manifold_edges", false) );
+    anActor->SetFeatureEdgesColoring( aResourceMgr->booleanValue("VISU", "feature_edges_coloring", false) );
+
     UpdateActor(anActor);
   }catch (...) {
     anActor->Delete();
@@ -531,15 +539,7 @@ VISU::Mesh_i
     anActor->GetSurfaceProperty()->SetColor(myCellColor.R, myCellColor.G, myCellColor.B);
     anActor->GetEdgeProperty()->SetColor(myLinkColor.R, myLinkColor.G, myLinkColor.B);
     anActor->GetNodeProperty()->SetColor(myNodeColor.R, myNodeColor.G, myNodeColor.B);
-
-    SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
-    anActor->SetFeatureEdgesEnabled( myPresentType == VISU::FEATURE_EDGES );
-    anActor->SetFeatureEdgesAngle( aResourceMgr->doubleValue("VISU", "feature_edges_angle", 0.0) );
-    anActor->SetFeatureEdgesFlags( aResourceMgr->booleanValue("VISU", "feature_edges", false),
-                                  aResourceMgr->booleanValue("VISU", "boundary_edges", false),
-                                  aResourceMgr->booleanValue("VISU", "manifold_edges", false),
-                                  aResourceMgr->booleanValue("VISU", "non_manifold_edges", false) );
-    anActor->SetFeatureEdgesColoring( aResourceMgr->booleanValue("VISU", "feature_edges_coloring", false) );
+    anActor->SetFeatureEdgesEnabled(myPresentType == VISU::FEATURE_EDGES);
   }
 }