<li>\b Properties</li>
-\image html viewing13.png
<ul>
<li>\b Opacity - allows to set the value of opacity of the
presentation between 0 (transparent) and 100 (opaque).
transparent mode when opacity level is lower that 100% (note that
they become invisible when the level is equal 0%).
</li>
+
+\image html viewing13.png
+
<li><b>Line Width</b> - allows to set the width of lines representing
edges of the presentation between 1 (thin) and 100 (thick).</li>
+
+\image html line_width.png
+
+<li><b>Shrink Factor</b> - allows to set the shrink factor of the presentation
+to be used in \b Shrink mode. Possible values are ranged between 20 and
+100, default value is 80.</li>
+
+\image html shrink_factor.png
+
<li><b>Edge Color</b> - allows to set the color of lines representing
edges of the presentation displayed in Surfaceframe mode.</li>
</ul>
<parameter name="mesh_shrink" value="false"/>
<parameter name="scalar_map_represent" value="2"/>
<parameter name="scalar_map_shrink" value="false"/>
+ <parameter name="shrink_factor" value="80"/>
<parameter name="iso_surfaces_represent" value="2"/>
<parameter name="cut_planes_represent" value="2"/>
<parameter name="cut_lines_represent" value="1"/>
VisuGUI_SetupPlot2dDlg.h \
VisuGUI_BuildProgressDlg.h \
VisuGUI_TransparencyDlg.h \
+ VisuGUI_ShrinkFactorDlg.h \
VisuGUI_Timer.h \
VisuGUI_Slider.h \
VisuGUI_InputPane.h \
VisuGUI_BuildProgressDlg.cxx \
VisuGUI_Table3dDlg.cxx \
VisuGUI_TransparencyDlg.cxx \
+ VisuGUI_ShrinkFactorDlg.cxx \
VisuGUI_Timer.cxx \
VisuGUI_Slider.cxx \
VisuGUI_Sweep.cxx \
VisuGUI_BuildProgressDlg_moc.cxx \
VisuGUI_Table3dDlg_moc.cxx \
VisuGUI_TransparencyDlg_moc.cxx \
+ VisuGUI_ShrinkFactorDlg_moc.cxx \
VisuGUI_Slider_moc.cxx \
VisuGUI_Sweep_moc.cxx \
VisuGUI_InputPane_moc.cxx \
<source>MAX_ARC_ANGLE</source>
<translation>Maximum angle</translation>
</message>
+ <message>
+ <source>VISU_SHRINK_FACTOR</source>
+ <translation>Shrink Factor</translation>
+ </message>
<message>
<source>VISU_USE_SHADING</source>
<translation>Use Shading</translation>
<source>MEN_LINE_WIDTH</source>
<translation>Line Width</translation>
</message>
+ <message>
+ <source>MEN_SHRINK_FACTOR</source>
+ <translation>Shrink Factor</translation>
+ </message>
<message>
<source>MEN_MERGE_SCALAR_BARS</source>
<translation>Merge Scalar Range</translation>
<translation>Color</translation>
</message>
</context>
+ <context>
+ <name>VisuGUI_ShrinkFactorDlg</name>
+ <message>
+ <source>SHRINKFACTOR_TITLE</source>
+ <translation>Change Shrink Factor</translation>
+ </message>
+ <message>
+ <source>SHRINKFACTOR_VALUE</source>
+ <translation>Shrink Factor:</translation>
+ </message>
+ </context>
</TS>
#include "VisuGUI_Displayer.h"
#include "VisuGUI_BuildProgressDlg.h"
#include "VisuGUI_TransparencyDlg.h"
+#include "VisuGUI_ShrinkFactorDlg.h"
#include "VisuGUI_CacheDlg.h"
#include "VisuGUI_Table3dDlg.h"
#include "VisuGUI_ClippingPanel.h"
delete CursorDlg;
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnChangeShrinkFactor()
+{
+ VisuGUI_ShrinkFactorDlg* aDialog = new VisuGUI_ShrinkFactorDlg( this );
+ aDialog->show();
+}
+
//----------------------------------------------------------------------------
void
VisuGUI
tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
this, SLOT(OnChangeLines()));
+ createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(),
+ tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false,
+ this, SLOT(OnChangeShrinkFactor()));
+
createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
tr("MEN_EDIT_PRS"), "", 0, aParent, false,
// "Properties" submenu
parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
- mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
- mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
- mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
- mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
- mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
+ mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
+ mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
+ mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
+ mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
+ mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
+ mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor
mgr->insert( separator(), -1, -1, -1 );
"or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
+ mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
// rename command
QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
setPreferenceProperty( maxAngle, "min", 1 );
setPreferenceProperty( maxAngle, "max", 90 );
+ int shrFac = addPreference( tr( "VISU_SHRINK_FACTOR" ), representGr, LightApp_Preferences::IntSpin, "VISU", "shrink_factor" );
+ setPreferenceProperty( shrFac, "min", 20 );
+ setPreferenceProperty( shrFac, "max", 100 );
+ sp = addPreference( "", representGr, LightApp_Preferences::Space );
+ setPreferenceProperty( sp, "hstretch", 0 );
+ setPreferenceProperty( sp, "vstretch", 0 );
addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
addPreference( "", representGr, LightApp_Preferences::Space );
-
addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
sp = addPreference( "", representGr, LightApp_Preferences::Space );
setPreferenceProperty( sp, "hstretch", 0 );
void OnChangeWireframeColor();
void OnChangeOpacity();
void OnChangeLines();
+ void OnChangeShrinkFactor();
void OnShowTable();
void OnShowTablePlot();
#define VISU_EDGE_COLOR 4059
#define VISU_OPACITY 4060
#define VISU_LINE_WIDTH 4061
+#define VISU_SHRINK_FACTOR 40629
#define VISU_EDIT_SCALARMAP 40620
#define VISU_EDIT_DEFORMEDSHAPE 40621
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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_ShrinkFactorDlg.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
+#include "VisuGUI_ShrinkFactorDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_ViewTools.h"
+#include "VisuGUI_Tools.h"
+#include "VISU_Actor.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SALOME_InteractiveObject.hxx"
+
+#include "LightApp_Study.h"
+#include "LightApp_SelectionMgr.h"
+#include "LightApp_Application.h"
+
+#include "SVTK_ViewWindow.h"
+
+// QT Includes
+#include <QLabel>
+#include <QPushButton>
+#include <QSpinBox>
+#include <QLayout>
+#include <QGroupBox>
+#include <QKeyEvent>
+
+const int DEFAULT_SHRINK = 80;
+
+//=================================================================================
+// class : VisuGUI_ShrinkFactorDlg()
+// purpose :
+//
+//=================================================================================
+VisuGUI_ShrinkFactorDlg::VisuGUI_ShrinkFactorDlg( VisuGUI* theModule, bool modal )
+ : QDialog( VISU::GetDesktop( theModule ), Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+ myModule(theModule),
+ mySelectionMgr( VISU::GetSelectionMgr( theModule ) ),
+ myViewWindow( VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule) )
+{
+ setModal( modal );
+ setAttribute( Qt::WA_DeleteOnClose );
+
+ setWindowTitle( tr( "SHRINKFACTOR_TITLE" ) );
+ setSizeGripEnabled( true );
+ QVBoxLayout* topLayout = new QVBoxLayout( this );
+ topLayout->setSpacing( 6 );
+ topLayout->setMargin( 11 );
+
+ /*************************************************************************/
+ GroupC1 = new QGroupBox( this );
+ QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1 );
+ GroupC1Layout->setSpacing( 6 );
+ GroupC1Layout->setMargin( 11 );
+
+ ValueLab = new QLabel( tr( "SHRINKFACTOR_VALUE" ), GroupC1 );
+ ValueSpin = new QSpinBox( GroupC1 );
+ ValueSpin->setRange( 20, 100 );
+ ValueSpin->setSingleStep( 10 );
+ ValueSpin->setMinimumWidth( 70 );
+
+ GroupC1Layout->addWidget( ValueLab );
+ GroupC1Layout->addWidget( ValueSpin );
+
+ /*************************************************************************/
+ QGroupBox* GroupButtons = new QGroupBox( this );
+ QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ buttonOk = new QPushButton( tr( "BUT_CLOSE" ), GroupButtons );
+ buttonOk->setAutoDefault( true );
+ buttonOk->setDefault( true );
+
+ buttonHelp = new QPushButton( tr( "BUT_HELP" ), GroupButtons);
+ buttonHelp->setAutoDefault( true );
+
+ GroupButtonsLayout->addWidget( buttonOk );
+ GroupButtonsLayout->addSpacing( 10 );
+ GroupButtonsLayout->addStretch();
+ GroupButtonsLayout->addWidget( buttonHelp );
+
+ topLayout->addWidget( GroupC1 );
+ topLayout->addWidget( GroupButtons );
+
+ // Initial state
+ onSelectionChanged();
+
+ // signals and slots connections : after ValueHasChanged()
+ connect(buttonOk, SIGNAL( clicked() ), this, SLOT( close() ) );
+ connect(buttonHelp, SIGNAL( clicked() ), this, SLOT( help() ) );
+ connect(ValueSpin, SIGNAL( valueChanged( int ) ), this, SLOT( setShrinkFactor() ) );
+ connect(mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
+}
+
+//=================================================================================
+// function : ~VisuGUI_ShrinkFactorDlg()
+// purpose :
+//=================================================================================
+VisuGUI_ShrinkFactorDlg::~VisuGUI_ShrinkFactorDlg()
+{
+}
+
+//=======================================================================
+// function : help()
+// purpose :
+//=======================================================================
+void VisuGUI_ShrinkFactorDlg::help()
+{
+ QString aHelpFileName = "viewing_3d_presentations_page.html#width_shrink_factor_anchor";
+ LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+ if (app) {
+ VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
+ app->onHelpContextModule( aVisuGUI ? app->moduleName( aVisuGUI->moduleName() ) : QString(""), aHelpFileName );
+ }
+ else {
+ QString platform;
+#ifdef WIN32
+ platform = "winapplication";
+#else
+ platform = "application";
+#endif
+ SUIT_MessageBox::warning( this,
+ tr( "WRN_WARNING" ),
+ tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
+ arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( aHelpFileName ),
+ tr( "BUT_OK" ) );
+ }
+}
+
+//=================================================================================
+// function : setShrinkFactor()
+// purpose : Called when value of spin box is changed
+// : or the first time as initilisation
+//=================================================================================
+void VisuGUI_ShrinkFactorDlg::setShrinkFactor()
+{
+ if ( myViewWindow ) {
+ SUIT_OverrideCursor wc;
+ float shrink = ValueSpin->value() / 100.;
+
+ SALOME_ListIO aList;
+ mySelectionMgr->selectedObjects( aList );
+
+ SALOME_ListIteratorOfListIO anIter( aList );
+ for ( ; anIter.More(); anIter.Next() ) {
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ VISU_Actor* anActor = VISU::FindActor( VISU::GetAppStudy( myModule ), myViewWindow, anIO->getEntry() );
+ if ( anActor && anActor->IsShrunkable() )
+ anActor->SetShrinkFactor( shrink );
+ }
+ myViewWindow->Repaint();
+ }
+}
+
+//=================================================================================
+// function : onSelectionChanged()
+// purpose : Called when selection is changed
+//=================================================================================
+void VisuGUI_ShrinkFactorDlg::onSelectionChanged()
+{
+ bool shrinkable = false;
+ if ( myViewWindow ) {
+ int shrink = DEFAULT_SHRINK;
+
+ SALOME_ListIO aList;
+ mySelectionMgr->selectedObjects( aList );
+
+ if ( aList.Extent() == 1 ) {
+ Handle(SALOME_InteractiveObject) FirstIOS = aList.First();
+ if ( !FirstIOS.IsNull() ) {
+ VISU_Actor* anActor = VISU::FindActor( VISU::GetAppStudy( myModule ), myViewWindow, FirstIOS->getEntry() );
+ if ( anActor ) {
+ shrinkable = anActor->IsShrunkable();
+ if ( shrinkable )
+ shrink = int( anActor->GetShrinkFactor() * 100. + 0.5 );
+ }
+ }
+ }
+ else if ( aList.Extent() > 1 ) {
+ SALOME_ListIteratorOfListIO It( aList );
+ int setShr = -1;
+ for ( ; It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject) IO = It.Value();
+ if (!IO.IsNull()) {
+ VISU_Actor* anActor = VISU::FindActor( VISU::GetAppStudy( myModule ), myViewWindow, IO->getEntry() );
+ if ( anActor ) {
+ bool lshrinkable = anActor->IsShrunkable();
+ shrinkable = shrinkable || lshrinkable;
+ if ( lshrinkable ) {
+ int shr = int( anActor->GetShrinkFactor() * 100. + 0.5 );
+ if ( setShr < 0 )
+ setShr = shr;
+ else if ( setShr != shr ) {
+ setShr = DEFAULT_SHRINK;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if ( setShr >= 0 )
+ shrink = setShr;
+ }
+ ValueSpin->blockSignals( true );
+ ValueSpin->setValue( shrink );
+ ValueSpin->blockSignals( false );
+ }
+ GroupC1->setEnabled( shrinkable );
+}
+
+//=================================================================================
+// function : keyPressEvent()
+// purpose :
+//=================================================================================
+void VisuGUI_ShrinkFactorDlg::keyPressEvent( QKeyEvent* e )
+{
+ QDialog::keyPressEvent( e );
+ if ( e->isAccepted() )
+ return;
+
+ if ( e->key() == Qt::Key_F1 ) {
+ e->accept();
+ help();
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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_ShrinkFactorDlg.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
+#ifndef VISUGUI_SHRINKFACTORDLG_H
+#define VISUGUI_SHRINKFACTORDLG_H
+
+// QT Includes
+#include <QDialog>
+
+class QLabel;
+class QPushButton;
+class QSpinBox;
+class QGroupBox;
+class LightApp_SelectionMgr;
+class SalomeApp_Module;
+class SVTK_Selector;
+class SVTK_ViewWindow;
+class VisuGUI;
+
+//=================================================================================
+// class : VisuGUI_ShrinkFactorDlg
+// purpose :
+//=================================================================================
+class VisuGUI_ShrinkFactorDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_ShrinkFactorDlg( VisuGUI* = 0,
+ bool modal = false );
+
+ ~VisuGUI_ShrinkFactorDlg();
+
+private:
+ void keyPressEvent( QKeyEvent* );
+
+private :
+ LightApp_SelectionMgr* mySelectionMgr;
+ SVTK_ViewWindow* myViewWindow;
+ const SalomeApp_Module* myModule;
+
+ QGroupBox* GroupC1;
+ QPushButton* buttonOk;
+ QPushButton* buttonHelp;
+ QLabel* ValueLab;
+ QSpinBox* ValueSpin;
+
+public slots:
+ void help();
+ void setShrinkFactor();
+ void onSelectionChanged();
+};
+
+#endif // VISUGUI_SHRINKFACTORDLG_H
#include "VISU_Actor.h"
#include "SALOME_Event.h"
+#include "SUIT_ResourceMgr.h"
#include <vtkActorCollection.h>
#include <vtkUnstructuredGrid.h>
::CreateActor(VISU_Actor* theActor)
{
try{
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
Handle(SALOME_InteractiveObject) anIO = GetIO();
if(!anIO.IsNull() && anIO->hasEntry()){
theActor->setIO(anIO);
CheckDataSet();
theActor->SetPrs3d(this);
- theActor->SetShrinkFactor();
+ theActor->SetShrinkFactor(aResourceMgr->integerValue("VISU", "shrink_factor", 80)/100.);
theActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]);
theActor->SetPipeLine(GetActorPipeLine());
if(theActor->GetPipeLine() != GetPipeLine()){