#include <vtkCellType.h>
+#ifdef WNT
+#include <float.h>
+#define isnan _isnan
+#endif
+
using MED::TInt;
using MED::TFloat;
using MED::EBooleen;
for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
const vtkFloatingPointType& aVal = aMValueSlice[iGauss];
- aMin = std::min(aMin,aVal);
- aMax = std::max(aMax,aVal);
+ aMin = isnan(aVal) ? aVal : std::min(aMin,aVal);
+ aMax = isnan(aVal) ? aVal : std::max(aMax,aVal);
if(isAverageByGaussPoints){
anAverageValue += aVal;
}
aValue += aVal*aVal;
}
aValue = sqrt(aValue);
- aMin = std::min(aMin,aValue);
- aMax = std::max(aMax,aValue);
+ aMin = isnan(aValue) ? aValue : std::min(aMin,aValue);
+ aMax = isnan(aValue) ? aValue : std::max(aMax,aValue);
// additional calculation for each group, to which the element belongs
VISU::TNames::const_iterator aGroupIter = aGroupNames.begin();
#include "VISU_PipeLine.hxx"
+#include "SVTK_Actor.h"
#include "SVTK_Event.h"
#include "VTKViewer_FramedTextActor.h"
{
Superclass::SetVisibility( theMode );
myValLabels->SetVisibility( myIsValLabeled && theMode );
+
+ // Moved from VISU_GaussPtsAct::SetVisibility() (due to IPAL21159)
+ Highlight(isHighlighted());
}
//----------------------------------------------------------------------------
//! Gets know whether the actor should be displayed or not
vtkFloatingPointType aDollyWas = anInteractor->GetDolly();
int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
+ double aPosition[3];
+ GetPosition( aPosition );
+ for( int i = 0; i < 3; i++ )
+ aFlyToCoord[i] += aPosition[i];
+
anInteractor->SetDolly(0.0);
anInteractor->SetNumberOfFlyFrames(aPickingSettings->GetStepNumber());
anInteractor->FlyTo(aRenderer, aFlyToCoord);
void VISU_Actor::SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode )
{
-
+ switch(theMode) {
+ case VISU_Actor::eArcs:
+ myPreHighlightActor->SetQuadraticArcMode(true);
+ myHighlightActor->SetQuadraticArcMode(true);
+ break;
+ case VISU_Actor::eLines:
+ myPreHighlightActor->SetQuadraticArcMode(false);
+ myHighlightActor->SetQuadraticArcMode(false);
+ break;
+ default:
+ break;
+ }
}
Superclass::SetVisibility(theMode);
myDeviceActor->SetVisibility(GetVisibility()); // VSV
myScalarBarCtrl->SetVisibility(theMode);
- Highlight(isHighlighted());
}
int
void VISU_MeshAct::SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode )
{
+ Superclass::SetQuadratic2DRepresentation( theMode );
switch(theMode) {
case VISU_Actor::eArcs:
mySurfaceActor->SetQuadraticArcMode(true);
{
myBarVisibility = theMode;
if(myScalarBar)
- myScalarBar->SetVisibility(myBarVisibility);
+ myScalarBar->SetVisibility(myBarVisibility && GetVisibility());
}
void VISU_ScalarMapAct::SetQuadratic2DRepresentation( VISU_Actor::EQuadratic2DRepresentation theMode )
{
+ Superclass::SetQuadratic2DRepresentation( theMode );
switch(theMode) {
case VISU_Actor::eArcs:
mySurfaceActor->SetQuadraticArcMode(true);
VISU_ColoredPL
::SetScalarRange( vtkFloatingPointType theRange[2] )
{
+ if (isnan(theRange[0]) || isnan(theRange[1]))
+ throw std::runtime_error("NAN values in the presentation");
+
if ( theRange[0] > theRange[1] )
return;
myExtractor->GetOutput()->GetScalarRange( theRange );
if (isnan(theRange[0]) || isnan(theRange[1]))
- throw std::runtime_error("Arithmetic exception detected");
+ throw std::runtime_error("NAN values in the presentation");
}
void
VISU_CutLinesPL
::Update()
{
+ vtkDataSet* aMergedInput = GetMergedInput();
+ if(VISU::IsQuadraticData(aMergedInput)) // Bug 0020123, note 0005343
+ throw std::runtime_error("Impossible to build presentation");
+
ClearAppendPolyData(myAppendPolyData);
SetPartPosition(1);
VISU_CutPlanesPL
::Update()
{
+ vtkDataSet* aMergedInput = GetMergedInput();
+ if(VISU::IsQuadraticData(aMergedInput)) // Bug 0020123, note 0005343
+ throw std::runtime_error("Impossible to build presentation");
+
ClearAppendPolyData(myAppendPolyData);
if(!myVectorialField || !IsDeformed()){
- SetMergeFilterInput(GetMergedInput(),GetMergedInput());
+ SetMergeFilterInput(aMergedInput,aMergedInput);
}
- if(VISU::IsDataOnCells(GetMergedInput()))
+ if(VISU::IsDataOnCells(aMergedInput))
GetMapper()->SetScalarModeToUseCellData();
else
GetMapper()->SetScalarModeToUsePointData();
VISU_DeformedShapeAndScalarMapPL
::SetScalarRange(vtkFloatingPointType theRange[2])
{
+ if (isnan(theRange[0]) || isnan(theRange[1]))
+ throw std::runtime_error("NAN values in the presentation");
+
if(VISU::CheckIsSameRange(theRange, GetScalarRange()))
return;
myScalarsExtractor->GetUnstructuredGridOutput()->GetScalarRange(theRange);
if (isnan(theRange[0]) || isnan(theRange[1]))
- throw std::runtime_error("Arithmetic exception detected");
+ throw std::runtime_error("NAN values in the presentation");
}
return;
this->PointSpriteClamp = theClamp;
+ this->Modified();
}
//-----------------------------------------------------------------------------
return;
this->AverageCellSize = theSize;
+ this->Modified();
}
//-----------------------------------------------------------------------------
return;
this->PointSpriteSize = theSize;
+ this->Modified();
}
//-----------------------------------------------------------------------------
return;
this->PointSpriteMinSize = theMinSize;
+ this->Modified();
}
//-----------------------------------------------------------------------------
return;
this->PointSpriteMaxSize = theMaxSize;
+ this->Modified();
}
//-----------------------------------------------------------------------------
return;
this->PointSpriteMagnification = theMagnification;
+ this->Modified();
}
//-----------------------------------------------------------------------------
return;
this->PointSpriteAlphaThreshold = theAlphaThreshold;
+ this->Modified();
}
//-----------------------------------------------------------------------------
#include "VISU_OpenGLPointSpriteMapper.hxx"
+#include <vtkCell.h>
#include <vtkDataSetMapper.h>
#include <vtkPolyDataMapper.h>
}
+ //----------------------------------------------------------------------------
+ bool
+ IsQuadraticData(vtkDataSet* theDataSet)
+ {
+ for(int i = 0, n = theDataSet->GetNumberOfCells(); i < n; i++)
+ if(vtkCell* aCell = theDataSet->GetCell(i))
+ if(!aCell->IsLinear())
+ return true;
+ return false;
+ }
+
+
//----------------------------------------------------------------------------
}
vtkFloatingPointType theDirection[3],
vtkFloatingPointType thePos[3],
vtkFloatingPointType& theDist);
+
+
+ //----------------------------------------------------------------------------
+ bool VISU_PIPELINE_EXPORT
+ IsQuadraticData(vtkDataSet* theDataSet);
}
#endif
VISU_Plot3DPL
::Update()
{
+ vtkDataSet* aMergedInput = GetMergedInput();
+ if(VISU::IsQuadraticData(aMergedInput)) // Bug 0020123, note 0005343
+ throw std::runtime_error("Impossible to build presentation");
+
vtkFloatingPointType aPlaneNormal[3];
vtkFloatingPointType anOrigin[3];
GetBasePlane( anOrigin, aPlaneNormal );
vtkPolyData* aPolyData = 0;
vtkCutter *aCutPlane = 0;
- vtkDataSet* aDataSet = GetMergedInput();
if ( !IsPlanarInput() )
{
aCutPlane = vtkCutter::New();
- aCutPlane->SetInput(aDataSet);
+ aCutPlane->SetInput(aMergedInput);
vtkPlane *aPlane = vtkPlane::New();
aPlane->SetOrigin(anOrigin);
}
if ( !aPolyData || aPolyData->GetNumberOfCells() == 0 ) {
- myGeometryFilter->SetInput(aDataSet);
+ myGeometryFilter->SetInput(aMergedInput);
aPolyData = myGeometryFilter->GetOutput();
aPolyData->Update();
}
<translation>Cosinusoidal ( (1 - cos(t))/2 )</translation>
</message>
<message>
- <source>VISU_CUTLINE_PREF</source>
- <translation>CutLine preferences</translation>
+ <source>VISU_CUT_LINES_PREF</source>
+ <translation>Cut Lines preferences</translation>
</message>
<message>
<source>VISU_CUT_LINES</source>
<source>DLG_TITLE</source>
<translation>Deformed Shape and Scalar Map</translation>
</message>
+ <message>
+ <source>ERR_SCALAR_DATA_INCONSISTENT</source>
+ <translation>Scalar data on the selected field is inconsistent.
+Please select another field.</translation>
+ </message>
<message>
<source>FIELD_ITEM</source>
<translation>Scalar Field:</translation>
aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
- aStr == "VISU::TMESH" || aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
+ aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
{
_PTR(GenericAttribute) anAttr;
if (aSObject->FindAttribute(anAttr, "AttributeName")) {
tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
this, SLOT(OnSwitchSelectionMode()));
- // Defenition of the actions for the "Navigation" tool bar
+ // Definition of the actions for the "Navigation" tool bar
registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
" or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})"
- " or ( ((type='VISU::TTABLE' and nbChildren>0) or"
- " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent;
+ " or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
+ " (type='VISU::TCURVE')))) ) or" + aComponent;
QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
QString aScalarBarShowRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and ( isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and (not isScalarBarVisible) )";
void VisuGUI::createPanels()
{
- myPanels.insert( SelectionPanelId, new VisuGUI_SelectionPanel( this ) );
- myPanels.insert( FeatureEdgesPanelId, new VisuGUI_FeatureEdgesPanel( this ) );
- myPanels.insert( ClippingPlanesPanelId, new VisuGUI_ClippingPanel( this ) );
-
- 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 );
- }
+ myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this );
+ myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this );
+ myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
+
+ VisuGUI_Panel* aPanel;
+ foreach( aPanel, myPanels ) {
+ getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
+ aPanel->setVisible( false );
}
}
setMenuShown( false );
setToolShown( false );
- 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); // Import: CTRL + Key_I
setPreferenceProperty( bhh, "max", 100 );
// TAB: "CutLines"
- int cutLineTab = addPreference( tr( "CutLines" ) );
+ int cutLineTab = addPreference( tr( "VISU_CUT_LINES" ) );
// group: "CutLines preferences"
- int cutLineGr = addPreference( tr( "VISU_CUTLINE_PREF" ), cutLineTab );
+ int cutLineGr = addPreference( tr( "VISU_CUT_LINES_PREF" ), cutLineTab );
setPreferenceProperty( cutLineGr, "columns", 1 );
addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
int addVtkFontPref( const QString& label, const int pId, const QString& param, const bool useSize );
private:
- QMap< PanelId, VisuGUI_Panel* > myPanels;
- VisuGUI_Slider* mySlider;
- VisuGUI_Sweep* mySweep;
+ QMap<int,VisuGUI_Panel*> myPanels;
+ VisuGUI_Slider* mySlider;
+ VisuGUI_Sweep* mySweep;
- LightApp_Displayer* myDisplayer;
- VISU::TViewToPrs3d myScalarBarsMap;
+ LightApp_Displayer* myDisplayer;
+ VISU::TViewToPrs3d myScalarBarsMap;
};
#endif
myBuildFieldsButton->setEnabled( false );
myBuildFieldsButton->setFixedSize( 30, 30 );
aPal = myBuildFieldsButton->palette();
- aPal.setColor( myBuildFieldsButton->backgroundRole(), Qt::red );
+ aPal.setColor( myBuildFieldsButton->backgroundRole(), myBuildFieldsCheckBox->isChecked() ? Qt::red : Qt::gray );
myBuildFieldsButton->setPalette( aPal );
connect( myBuildFieldsCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) );
myBuildMinMaxButton->setEnabled( false );
myBuildMinMaxButton->setFixedSize( 30, 30 );
aPal = myBuildMinMaxButton->palette();
- aPal.setColor( myBuildMinMaxButton->backgroundRole(), Qt::red );
+ aPal.setColor( myBuildMinMaxButton->backgroundRole(), myBuildMinMaxCheckBox->isChecked() ? Qt::red : Qt::gray );
myBuildMinMaxButton->setPalette( aPal );
connect( myBuildMinMaxCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) );
myBuildGroupsButton->setEnabled( false );
myBuildGroupsButton->setFixedSize( 30, 30 );
aPal = myBuildGroupsButton->palette();
- aPal.setColor( myBuildGroupsButton->backgroundRole(), Qt::red );
+ aPal.setColor( myBuildGroupsButton->backgroundRole(), myBuildGroupsCheckBox->isChecked() ? Qt::red : Qt::gray );
myBuildGroupsButton->setPalette( aPal );
connect( myBuildGroupsCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) );
//****************************************************************
//****************************************************************
//****************************************************************
-VisuGUI_ClippingPanel::VisuGUI_ClippingPanel(VisuGUI* theModule)
- : VisuGUI_Panel(tr("TITLE"), theModule, VISU::GetDesktop(theModule), ApplyBtn | HelpBtn ),
- myModule(theModule),
+VisuGUI_ClippingPanel::VisuGUI_ClippingPanel( VisuGUI* theModule, QWidget* theParent )
+ : VisuGUI_Panel( tr( "TITLE" ), theModule, theParent, ApplyBtn | HelpBtn ),
myPlaneDlg(0),
myViewWindow(0),
myIsApplied(true)
{
+ setWindowTitle( tr( "TITLE" ) );
+ setObjectName( tr( "TITLE" ) );
+
QVBoxLayout* aMainLayout = new QVBoxLayout(mainFrame());
// List of presentations
{
Q_OBJECT
public:
- VisuGUI_ClippingPanel(VisuGUI* theModule);
+ VisuGUI_ClippingPanel(VisuGUI* theModule, QWidget* theParent = 0);
~VisuGUI_ClippingPanel();
void init();
QStringList getPrsList(_PTR(Study) theStudy, _PTR(SObject) theObject);
VISU::Prs3d_i* getPrs(QString theEntry);
- VisuGUI* myModule;
-
QListWidget* myPrsList;
QTableWidget* myPlanesList;
: VisuGUI_ScalarBarBaseDlg(theModule),
myIsAnimation(false),
myUpdateScalars(true),
+ myIsScalarFieldValid(true),
myVisuGUI(theModule)
{
setWindowTitle(tr("DLG_TITLE"));
GroupButtonsLayout->setSpacing(6);
GroupButtonsLayout->setMargin(11);
- QPushButton* buttonOk = new QPushButton (tr("&OK"), GroupButtons);
- buttonOk->setAutoDefault(true);
- buttonOk->setDefault(true);
+ myButtonOk = new QPushButton (tr("&OK"), GroupButtons);
+ myButtonOk->setAutoDefault(true);
+ myButtonOk->setDefault(true);
QPushButton* buttonCancel = new QPushButton (tr("&Cancel") , GroupButtons);
buttonCancel->setAutoDefault(true);
QPushButton* buttonHelp = new QPushButton (tr("&Help") , GroupButtons);
buttonHelp->setAutoDefault(true);
- GroupButtonsLayout->addWidget(buttonOk);
+ GroupButtonsLayout->addWidget(myButtonOk);
GroupButtonsLayout->addSpacing(10);
GroupButtonsLayout->addStretch();
GroupButtonsLayout->addWidget(buttonCancel);
TopLayout->addWidget(GroupButtons);
// signals and slots connections
- connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(myButtonOk, SIGNAL(clicked()), this, SLOT(accept()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
connect(myFieldsCombo, SIGNAL(activated(int)), this, SLOT(onFieldChanged(int)));
{
QApplication::setOverrideCursor(Qt::WaitCursor);
- if( save_scalar_pane )
+ if( save_scalar_pane && IsScalarFieldValid() )
GetScalarPane()->storeToPrsObject(myPrsCopy);
QString aFieldName;
VISU::Entity anEntity = getCurrentScalarEntity();
- myPrsCopy->SetScalarField(anEntity,
- aFieldName.toLatin1().constData(),
- theIter);
-
- if( save_scalar_pane )
- UpdateScalarField();
+ try {
+ myPrsCopy->SetScalarField(anEntity,
+ aFieldName.toLatin1().constData(),
+ theIter);
+ if( save_scalar_pane )
+ UpdateScalarField();
+ myIsScalarFieldValid = true;
+ } catch( std::exception& exc ) {
+ INFOS( exc.what() );
+ SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), tr( "ERR_SCALAR_DATA_INCONSISTENT" ) );
+ myIsScalarFieldValid = false;
+ }
+ updateControls();
QApplication::restoreOverrideCursor();
}
void VisuGUI_DeformedShapeAndScalarMapDlg::onFieldChanged(int){
AddAllTimes(myFieldsCombo->currentText());
SetScalarField();
- UpdateScalarField();
+ //UpdateScalarField(); // it is called from SetScalarField() method
}
void VisuGUI_DeformedShapeAndScalarMapDlg::onTimeStampChanged(int){
SetScalarField();
- UpdateScalarField();
+ //UpdateScalarField(); // it is called from SetScalarField() method
}
void VisuGUI_DeformedShapeAndScalarMapDlg::UpdateScalarField(){
}
return aTime;
}
+
+void VisuGUI_DeformedShapeAndScalarMapDlg::updateControls()
+{
+ bool isScalarFieldValid = IsScalarFieldValid();
+ myTabBox->setTabEnabled( 1, isScalarFieldValid ); // "Scalar Bar" tab
+ myTabBox->setTabEnabled( 2, isScalarFieldValid ); // "Input" tab
+ myTimeStampsCombo->setEnabled( isScalarFieldValid );
+ myButtonOk->setEnabled( isScalarFieldValid );
+}
VISU::Entity getCurrentScalarEntity();
void SetScalarField(int theIter,QString theFieldName=QString(""), const bool = true );
+ bool IsScalarFieldValid() const { return myIsScalarFieldValid; }
+
protected:
virtual QString GetContextHelpFilePath();
VisuGUI_InputPane* myInputPane;
QComboBox *myFieldsCombo;
QComboBox *myTimeStampsCombo;
+ QPushButton* myButtonOk;
typedef std::map<int, QString> TTimeStampNumber2Time; // Times map definition (iteration time, real value of time)
typedef std::map<QString, TTimeStampNumber2Time> TFieldName2TimeStamps; // Field name and enity to Times
_PTR(SObject) mySelectionObj;
SALOME::GenericObjPtr<VISU::DeformedShapeAndScalarMap_i> myPrsCopy;
SalomeApp_Module* myVisuGUI;
+
+ bool myIsScalarFieldValid;
protected:
void UpdateScalarField();
QString GetFloatValueOfTimeStamp(VISU::Entity theEntity,
const std::string& theFieldName,
int theTimeStampNumber);
+ void updateControls();
};
#endif // VISUGUI_DEFORMEDSHAPEDLS_H
#include <LightApp_SelectionMgr.h>
-VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, QWidget* theParent ) :
+VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( VisuGUI* theModule, QWidget* theParent ) :
VisuGUI_Panel( tr( "WINDOW_TITLE" ), theModule, theParent, ApplyBtn | CloseBtn | HelpBtn ),
myActor( 0 )
{
+ setWindowTitle( tr( "WINDOW_TITLE" ) );
+ setObjectName( tr( "WINDOW_TITLE" ) );
+
QVBoxLayout* aTopLayout = new QVBoxLayout( mainFrame() );
myGrp = new QGroupBox( tr( "FEATURE_EDGES_PROPERTIES" ), mainFrame() );
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() ) );
+ connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
}
VisuGUI_FeatureEdgesPanel::~VisuGUI_FeatureEdgesPanel()
anIsManifoldEdges,
anIsNonManifoldEdges );
- float aColoring = myActor->GetFeatureEdgesColoring();
+ //float aColoring = myActor->GetFeatureEdgesColoring();
myAngleSpinBox->setValue( anAngle );
myFeatureEdgesCB->setChecked( anIsFeatureEdges );
void VisuGUI_FeatureEdgesPanel::onClose()
{
- close();
+ // hide();
VisuGUI_Panel::onClose();
}
onHelp();
}
}
+
+void VisuGUI_FeatureEdgesPanel::onModuleActivated()
+{
+ disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
+ connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
+ VisuGUI_Panel::onModuleActivated();
+}
+
+void VisuGUI_FeatureEdgesPanel::onModuleDeactivated()
+{
+ disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
+ VisuGUI_Panel::onModuleDeactivated();
+}
Q_OBJECT
public:
- VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, QWidget* theParent = 0 );
+ VisuGUI_FeatureEdgesPanel( VisuGUI* theModule, QWidget* theParent = 0 );
virtual ~VisuGUI_FeatureEdgesPanel ();
protected:
virtual void keyPressEvent( QKeyEvent* theEvent );
virtual void showEvent( QShowEvent* theEvent );
+protected slots:
+ virtual void onModuleActivated();
+ virtual void onModuleDeactivated();
+
private slots:
virtual void onApply();
virtual void onClose();
\brief Frame inserted in viewport with redefined sizeHint method
in order to avoid unreasonable increasing of viewport size
*/
-class VisuGUI_Panel::MainFrame : public QFrame
+class VisuGUI_Panel::MainFrame : public QWidget
{
public:
/*!
\param theParent parent widget
*/
MainFrame( QWidget* theParent = 0 )
- : QFrame( theParent )
+ : QWidget( theParent )
{
}
/*!
\brief Constructor creates panels look and feel
- \param theName name of the panel
+ \param theName panel title
+ \param theModule parent VISU GUI module
\param theParent parent widget
+ \param theBtns panel buttons
*/
-VisuGUI_Panel::VisuGUI_Panel( const QString& theName,
- const VisuGUI* theModule,
- QWidget* theParent,
- const int theBtns )
- : QtxDockWidget( theName, theParent ),
+VisuGUI_Panel::VisuGUI_Panel( const QString& theName,
+ VisuGUI* theModule,
+ QWidget* theParent,
+ const int theBtns )
+ : QtxDockWidget( true, theParent ),
myModule( theModule ),
myOK( 0 ),
myApply( 0 ),
myClose( 0 ),
myHelp( 0 )
{
+ setObjectName( theName );
+
QWidget* aGrp = new QWidget( this );
setWidget( aGrp );
// Create scroll view
myView = new QScrollArea( aGrp );
+ myView->setFrameStyle( QFrame::Plain | QFrame::NoFrame );
// Create main frame
myMainFrame = new MainFrame( myView );
- myMainFrame->setFrameStyle( QFrame::Plain | QFrame::NoFrame );
myView->setWidget( myMainFrame );
myView->setAlignment( Qt::AlignCenter );
myView->setMinimumWidth( myMainFrame->sizeHint().width() + 22 );
// Create buttons
- QWidget* aBtnWg = new QWidget( aGrp );
- QHBoxLayout* aBtnWgLayout = new QHBoxLayout( aBtnWg );
+ QHBoxLayout* aBtnWgLayout = new QHBoxLayout;
+ aBtnWgLayout->setMargin( 0 );
aBtnWgLayout->addStretch();
if( theBtns & OKBtn )
{
- myOK = new QPushButton( tr( "BUT_OK" ), aBtnWg );
+ myOK = new QPushButton( tr( "BUT_OK" ), aGrp );
aBtnWgLayout->addWidget( myOK );
connect( myOK, SIGNAL( clicked() ), SLOT( onOK() ) );
}
if( theBtns & ApplyBtn )
{
- myApply = new QPushButton( tr( "BUT_APPLY" ), aBtnWg );
+ myApply = new QPushButton( tr( "BUT_APPLY" ), aGrp );
aBtnWgLayout->addWidget( myApply );
connect( myApply, SIGNAL( clicked() ), SLOT( onApply() ) );
}
if( theBtns & CloseBtn )
{
- myClose = new QPushButton( tr( "BUT_CLOSE" ), aBtnWg );
+ myClose = new QPushButton( tr( "BUT_CLOSE" ), aGrp );
aBtnWgLayout->addWidget( myClose );
connect( myClose, SIGNAL( clicked() ), SLOT( onClose() ) );
}
if( theBtns & HelpBtn )
{
- myHelp = new QPushButton( tr( "BUT_HELP" ), aBtnWg );
+ myHelp = new QPushButton( tr( "BUT_HELP" ), aGrp );
aBtnWgLayout->addWidget( myHelp );
connect( myHelp, SIGNAL( clicked() ), SLOT( onHelp() ) );
}
// fill layout
QVBoxLayout* aLay = new QVBoxLayout( aGrp );
- aLay->setContentsMargins( 0, 0, 0, 0 );
+ aLay->setMargin( 2 );
aLay->addWidget( myView, 1 );
- aLay->addWidget( aBtnWg );
+ aLay->addLayout( aBtnWgLayout );
+
+ connect( theModule, SIGNAL( moduleDeactivated() ), SLOT( onModuleDeactivated() ) );
+ connect( theModule, SIGNAL( moduleActivated() ), SLOT( onModuleActivated() ) );
}
/*!
{
if ( myClose )
myClose->setFocus();
+ hide();
}
/*!
panels should use it as parent
\return QFrame* object
*/
-QFrame* VisuGUI_Panel::mainFrame()
+QWidget* VisuGUI_Panel::mainFrame()
{
return myMainFrame;
}
+
+void VisuGUI_Panel::onModuleActivated()
+{
+ widget()->setHidden( false );
+}
+
+void VisuGUI_Panel::onModuleDeactivated()
+{
+ widget()->setHidden( true );
+}
#include <QtxDockWidget.h>
-class QFrame;
class QScrollArea;
class QPushButton;
public:
VisuGUI_Panel( const QString& theName,
- const VisuGUI* theModule,
- QWidget* theParent,
- const int theBtns = AllBtn );
+ VisuGUI* theModule,
+ QWidget* theParent = 0,
+ const int theBtns = AllBtn );
virtual ~VisuGUI_Panel();
virtual bool isValid( QString& theMessage );
virtual void onClose();
virtual void onHelp();
+ virtual void onModuleActivated();
+ virtual void onModuleDeactivated();
+
protected:
- QFrame* mainFrame();
+ QWidget* mainFrame();
protected:
QScrollArea* myView;
- QFrame* myMainFrame;
+ QWidget* myMainFrame;
QPushButton* myOK;
QPushButton* myApply;
QPushButton* myClose;
QPushButton* myHelp;
- const VisuGUI* myModule;
+ VisuGUI* myModule;
};
#endif
}
};
-VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const VisuGUI* theModule, QWidget* theParent ) :
- VisuGUI_Panel( tr("WINDOW_TITLE" ), theModule, theParent, CloseBtn | HelpBtn ),
+VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( VisuGUI* theModule, QWidget* theParent ) :
+ VisuGUI_Panel( tr( "WINDOW_TITLE" ), theModule, theParent, CloseBtn | HelpBtn ),
myPreferencesDlg( 0 )
{
+ setWindowTitle( tr( "WINDOW_TITLE" ) );
+ setObjectName( tr( "WINDOW_TITLE" ) );
+
QVBoxLayout* TopLayout = new QVBoxLayout ( mainFrame() );
QWidget* aNamePane = new QWidget (mainFrame());
TopLayout->addWidget( aPrefBtn );
- SalomeApp_Application* anApp =
- dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
- LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
- connect( aSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionEvent() ) );
+ connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
connect( this, SIGNAL( selectionModeChanged( int ) ), myModule, SLOT( OnSwitchSelectionMode( int ) ) );
void VisuGUI_SelectionPanel::closeEvent( QCloseEvent* theEvent )
{
- onClose();
+ //onClose();
VisuGUI_Panel::closeEvent(theEvent);
}
case GaussPointSelection:
break;
default:
- close();
+ hide();
return;
}
void VisuGUI_SelectionPanel::onClose()
{
- close();
+ //hide();
VisuGUI_Panel::onClose();
}
onHelp();
}
}
+
+void VisuGUI_SelectionPanel::onModuleActivated()
+{
+ disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
+ connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
+ VisuGUI_Panel::onModuleActivated();
+}
+
+void VisuGUI_SelectionPanel::onModuleDeactivated()
+{
+ disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onSelectionEvent() ) );
+ VisuGUI_Panel::onModuleDeactivated();
+}
enum ColumnId { Cell = 0, Point, X, Y, Z, I, J, K, Scalar, Vector };
public:
- VisuGUI_SelectionPanel( const VisuGUI* theModule, QWidget* theParent = 0 );
+ VisuGUI_SelectionPanel( VisuGUI* theModule, QWidget* theParent = 0 );
virtual ~VisuGUI_SelectionPanel ();
public:
void setSelectionMode( int theId );
+protected slots:
+ virtual void onModuleActivated();
+ virtual void onModuleDeactivated();
+
protected:
virtual void keyPressEvent( QKeyEvent* theEvent );
virtual void showEvent( QShowEvent* theEvent );
//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onBackPressed()
{
- //stopAnimation();
+ stopAnimation();
myAnimator->prevFrame();
}
//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onForvardPressed()
{
+ stopAnimation();
myAnimator->nextFrame();
}
//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onLastPressed()
{
+ stopAnimation();
myAnimator->lastFrame();
}
//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onFirstPressed()
{
+ stopAnimation();
myAnimator->firstFrame();
}
SUIT_Desktop*
GetDesktop(const CAM_Module* theModule)
{
- return theModule->application()->desktop();
+ return theModule && theModule->application() ? theModule->application()->desktop() : 0;
}
//------------------------------------------------------------
LightApp_SelectionMgr*
GetSelectionMgr(const SalomeApp_Module* theModule)
{
- return theModule->getApp()->selectionMgr();
+ return theModule && theModule->getApp() ? theModule->getApp()->selectionMgr() : 0;
}
//------------------------------------------------------------
SalomeApp_Study*
GetAppStudy(const CAM_Module* theModule)
{
- return
- dynamic_cast<SalomeApp_Study*>(theModule->application()->activeStudy());
+ return theModule && theModule->application() ?
+ dynamic_cast<SalomeApp_Study*>(theModule->application()->activeStudy()) : 0;
}
//------------------------------------------------------------
_PTR(Study)
GetCStudy(const SalomeApp_Study* theStudy)
{
- return theStudy->studyDS();
+ return theStudy ? theStudy->studyDS() : _PTR(Study)();
}
//------------------------------------------------------------
bool
IsStudyLocked( _PTR(Study) theStudy )
{
- if( theStudy )
- return theStudy->GetProperties()->IsLocked();
- return true;
+ return theStudy ? theStudy->GetProperties()->IsLocked() : true;
}
//------------------------------------------------------------
TSelectionInfo aSelectionInfo;
const SalomeApp_Study* aStudy = GetAppStudy(theModule);
LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
- SALOME_ListIO aListIO;
- aSelectionMgr->selectedObjects(aListIO);
- SALOME_ListIteratorOfListIO anIter(aListIO);
- while(anIter.More())
- {
- Handle(SALOME_InteractiveObject) anIO = anIter.Value();
- if(anIO->hasEntry())
+ if ( aStudy && aSelectionMgr ) {
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ SALOME_ListIteratorOfListIO anIter(aListIO);
+ while(anIter.More())
{
- TObjectInfo anObjectInfo = GetObjectByEntry(aStudy, anIO->getEntry());
- if(anObjectInfo.mySObject){
- TSelectionItem aSelectionItem;
- aSelectionItem.myObjectInfo = anObjectInfo;
- aSelectionItem.myIO = anIO;
- aSelectionInfo.push_back(aSelectionItem);
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if(anIO->hasEntry())
+ {
+ TObjectInfo anObjectInfo = GetObjectByEntry(aStudy, anIO->getEntry());
+ if(anObjectInfo.mySObject){
+ TSelectionItem aSelectionItem;
+ aSelectionItem.myObjectInfo = anObjectInfo;
+ aSelectionItem.myIO = anIO;
+ aSelectionInfo.push_back(aSelectionItem);
+ }
}
+ anIter.Next(); // MULTIPR fixed
}
- anIter.Next(); // MULTIPR fixed
}
return aSelectionInfo;
}
myColor.blue() / 255.0);
}
- anActor->SetBarVisibility(myShowBar);
+ anActor->SetBarVisibility(myShowBar && GetIsColored());
if( GetSpecificPL()->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere )
theActor->SetRepresentation( VTK_POINTS );
if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<anActor);
anActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]);
anActor->ShallowCopyPL(GetPipeLine());
+ anActor->highlight(anActor->isHighlighted());
}
}