#include "VISU_GaussPointsPL.hxx"
+#include "VISU_DeformedShapePL.hxx"
#include "VISU_PipeLineUtils.hxx"
#include "SALOME_ExtractGeometry.h"
#include "VISU_DeformedShapePL.hxx"
#include <vtkXMLImageDataReader.h>
#include <vtkGeometryFilter.h>
#include <vtkImageData.h>
+#include <vtkWarpVector.h>
//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_GaussPointsPL);
//----------------------------------------------------------------------------
VISU_GaussPointsPL
::VISU_GaussPointsPL():
+ myIsDeformed(false),
+ myScaleFactor(0.0),
myPrimitiveType(0),
myClamp(200.0),
mySize(10),
myPSMapper = VISU_OpenGLPointSpriteMapper::New();
myGeomFilter = vtkGeometryFilter::New();
+
+ myWarpVector = vtkWarpVector::New();
+ myCellDataToPointData = vtkCellDataToPointData::New();
}
void
SetMagnification(aPipeLine->GetMagnification());
SetMagnificationIncrement(aPipeLine->GetMagnificationIncrement());
SetAlphaThreshold(aPipeLine->GetAlphaThreshold());
+
+ SetIsDeformed( aPipeLine->GetIsDeformed() );
+ SetScale( aPipeLine->GetScale() );
}
Superclass::ShallowCopy(thePipeLine);
}
VISU_GaussPointsPL
::Build()
{
+ myPSMapper->SetColorModeToMapScalars();
+ myPSMapper->ScalarVisibilityOn();
+
myExtractor->SetInput( GetInput2() );
myFieldTransform->SetInput( myExtractor->GetOutput() );
- //myPSMapper->SetQuadraticPointDistanceAttenuation( 1.0, 20.0, 0.0 );
- //myPSMapper->SetImmediateModeRendering( 1 );
- myPSMapper->SetColorModeToMapScalars();
- myPSMapper->ScalarVisibilityOn();
+ if( myIsDeformed )
+ {
+ //cout << "DEFORMED SHAPE" << endl;
+
+ //myWarpVector->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
+ //myCellDataToPointData->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
+ //myWarpVector->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() );
+
+ VISU::CellDataToPoint( myWarpVector, myCellDataToPointData,
+ myFieldTransform->GetUnstructuredGridOutput(), myFieldTransform );
+
+ myGeomFilter->SetInput( myWarpVector->GetOutput() );
+ }
+ else
+ {
+ //cout << "RESULTS / GEOMETRY" << endl;
+ myGeomFilter->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
+ }
- myGeomFilter->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
myPSMapper->SetInput( myGeomFilter->GetOutput() );
SetSourceRange();
this->myGeomFilter->Delete();
this->myGeomFilter = NULL;
}
+
+ myWarpVector->UnRegisterAllOutputs();
+ myWarpVector->Delete();
+
+ myCellDataToPointData->UnRegisterAllOutputs();
+ myCellDataToPointData->Delete();
}
//----------------------------------------------------------------------------
return aCompositeImageData;
}
+
+void VISU_GaussPointsPL::SetScale( float theScale )
+{
+ myWarpVector->SetScaleFactor( theScale );
+ myScaleFactor = theScale;
+ Modified();
+}
+
+float VISU_GaussPointsPL::GetScale()
+{
+ if( !myScaleFactor )
+ myScaleFactor = VISU_DeformedShapePL::GetScaleFactor( GetMapper()->GetInput() );
+
+ return myScaleFactor;
+}
+
+vtkPointSet* VISU_GaussPointsPL::doHook()
+{
+ VISU::CellDataToPoint( myWarpVector, myCellDataToPointData, GetInput2(), myFieldTransform );
+ return myWarpVector->GetOutput();
+}
+
+void VISU_GaussPointsPL::SetMapScale( float theMapScale )
+{
+ VISU_ScalarMapPL::SetMapScale( theMapScale );
+
+ myWarpVector->SetScaleFactor( myScaleFactor * theMapScale );
+ Modified();
+}
#include "VISU_ScalarMapPL.hxx"
#include "VISU_Convertor.hxx"
+#include "VTKViewer_PassThroughFilter.h"
+
+#include <vector>
+
class VISU_OpenGLPointSpriteMapper;
class vtkGeometryFilter;
class vtkDataArray;
class vtkImageData;
+class vtkPointSet;
+
+class vtkCellDataToPointData;
+class vtkWarpVector;
+class SALOME_Transform;
class VISU_GaussPointsPL : public VISU_ScalarMapPL
{
MakeTexture( const char* theMainTexture,
const char* theAlphaTexture );
+public:
+ virtual void SetIsDeformed( bool theIsDeformed ) { myIsDeformed = theIsDeformed; }
+ virtual bool GetIsDeformed() const { return myIsDeformed; }
+
+ virtual void SetScale( float theScale );
+ virtual float GetScale();
+ virtual void SetMapScale( float theMapScale = 1.0 );
+
+protected:
+ vtkPointSet* doHook();
+
+ bool myIsDeformed;
+ float myScaleFactor;
+ vtkWarpVector *myWarpVector;
+ vtkCellDataToPointData* myCellDataToPointData;
+
+ std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
+
protected:
VISU_OpenGLPointSpriteMapper* myPSMapper;
vtkGeometryFilter* myGeomFilter;
msgid "VisuGUI_Module::VISU_GAUSS_PREF_COLOR"
msgstr "Color"
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_DEFORMED_SHAPE_GROUP_TTL"
+msgstr "Deformed Shape"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_SCALE_FACTOR"
+msgstr "Scale factor"
+
msgid "VisuGUI_Module::VISU_GAUSS_SCALAR_BAR_PREF_TAB_TTL"
msgstr "Gauss Points Scalar Bar"
msgid "VisuGUI_GaussPointsDlg::GEOMETRY"
msgstr "Geometry"
+msgid "VisuGUI_GaussPointsDlg::DEFORMED_SHAPE"
+msgstr "Deformed Shape"
+
+msgid "VisuGUI_GaussPointsDlg::DEFORMED_SHAPE_TITLE"
+msgstr "Deformed Shape"
+
+msgid "VisuGUI_GaussPointsDlg::SCALE_FACTOR"
+msgstr "Scale Factor :"
+
msgid "VisuGUI_GaussScalarBarPane::ACTIVE_BAR_GRP"
msgstr "Active bar"
#include "SPlot2d_ViewModel.h"
#include "VisuGUI_SetupPlot2dDlg.h"
#include "Plot2d_SetupCurveDlg.h"
+#include "Plot2d_ViewManager.h"
#include "OB_Browser.h"
aTimer.Start();
if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
- CheckLock(GetCStudy(GetAppStudy(this)));
+ if ( CheckLock(GetCStudy(GetAppStudy(this))) )
+ return;
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
QStringList aFilter;
{
if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
_PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
- CheckLock(aStudy);
+ if ( CheckLock(aStudy) )
+ return;
SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
OnImportTableFromFile()
{
if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
- CheckLock(GetCStudy(GetAppStudy(this)));
+ if ( CheckLock(GetCStudy(GetAppStudy(this))) )
+ return;
QStringList aFilter;
aFilter.append( tr("FLT_TABLE_FILES") );
VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
if(aPrsObject){
if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
- UpdateViewer( this, aPrsObject );
+ //UpdateViewer( this, aPrsObject );
+ displayer()->Display( anIO->getEntry() );
+
SVTK_ViewWindow* vw = GetViewWindow( this, /*create=*/true );
if ( vw ) {
vw->highlight(anIO, 1);
VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
if(aCurve){
if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
- PlotCurve( this, aCurve, VISU::eDisplay );
+ //PlotCurve( this, aCurve, VISU::eDisplay );
+ displayer()->Display( anIO->getEntry() );
continue;
}
// is it Container ?
VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
if(aContainer){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
- PlotContainer( this, aContainer, VISU::eDisplay );
+ //PlotContainer( this, aContainer, VISU::eDisplay );
+ displayer()->Display( anIO->getEntry() );
continue;
}
// is it Table ?
VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
if(aTable){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
- PlotTable( this, aTable, VISU::eDisplay );
+ //PlotTable( this, aTable, VISU::eDisplay );
+ displayer()->Display( anIO->getEntry() );
continue;
}
}
VisuGUI::
OnEraseAll()
{
+ startOperation( myEraseAll );
if (SVTK_ViewWindow* vw = GetViewWindow()) {
vw->unHighlightAll();
if (vtkRenderer *aRen = vw->getRenderer()) {
// rename the study object
aName->SetValue(Name.latin1()); // rename the SObject
anIO->setName(Name.latin1()); // rename the InteractiveObject
+
+ ViewManagerList pvm_list;
+ getApp()->viewManagers( SPlot2d_Viewer::Type(), pvm_list );
+ for( SUIT_ViewManager* mgr = pvm_list.first(); mgr; mgr = pvm_list.next() )
+ {
+ Plot2d_ViewManager* pvm = dynamic_cast<Plot2d_ViewManager*>( mgr );
+ if( pvm )
+ {
+ SPlot2d_Viewer* pv = dynamic_cast<SPlot2d_Viewer*>( pvm->getViewModel() );
+ if( pv )
+ pv->renameAll( anIO, Name.latin1() );
+ }
+ }
+
UpdateObjBrowser(this, false);
QApplication::restoreOverrideCursor();
action( VISU_DELETE_OBJS )->addTo(theMenu);
}
+ // Check if some curves selected (for bug PAL10611)
+ bool isCurves = false;
+ SALOME_ListIteratorOfListIO It1 (aListIO);
+ for (; It1.More() && !isCurves; It1.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It1.Value();
+
+ if (!anIO.IsNull() && anIO->hasEntry()) {
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
+ _PTR(GenericAttribute) anAttr;
+ if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
+ _PTR(AttributeComment) aComment (anAttr);
+ string aComm = aComment->Value();
+ QString strIn (aComm.c_str());
+ VISU::Storable::TRestoringMap pMap;
+ VISU::Storable::StrToMap(strIn, pMap);
+ bool isExist;
+ VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
+ if (isExist && aType == VISU::TCURVE) {
+ isCurves = true;
+ }
+ }
+ }
+ }
+ if (isCurves) {
+ action( myDisplay )->removeFrom(theMenu);
+ action( myErase )->removeFrom(theMenu);
+ action( myDisplayOnly )->removeFrom(theMenu);
+ action( myEraseAll )->removeFrom(theMenu);
+ }
+
// Check single selection
if (aListIO.Extent() != 1) return;
LightApp_Displayer* VisuGUI::displayer()
{
if( !myDisplayer )
- myDisplayer = new VisuGUI_Displayer( dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() ) );
+ myDisplayer = new VisuGUI_Displayer( getApp() );
return myDisplayer;
}
//
//
//
-// File : VisuGUI_MagnitudeDlg.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
+// File : VisuGUI_GaussPointsDlg.cxx
+// Author : Oleg UVAROV
// Module : VISU
#include "VisuGUI_GaussPointsDlg.h"
// Presentation
- QButtonGroup* PrsGroup = new QButtonGroup( 2, Qt::Horizontal, tr( "PRS_TITLE" ), this, "PrimitiveTypeGroup" );
+ QButtonGroup* PrsGroup = new QButtonGroup( 3, Qt::Horizontal, tr( "PRS_TITLE" ), this, "PrimitiveTypeGroup" );
PrsGroup->setRadioButtonExclusive( true );
PrsGroup->layout()->setMargin( 11 );
PrsGroup->layout()->setSpacing(6);
myResultsButton = new QRadioButton( tr( "RESULTS" ), PrsGroup );
myGeometryButton = new QRadioButton( tr( "GEOMETRY" ), PrsGroup );
+ myDefShapeButton = new QRadioButton( tr( "DEFORMED_SHAPE" ), PrsGroup );
QTabWidget* aTabBox = new QTabWidget (this);
// Size
mySizeBox = new VVTK_SizeBox( aBox );
- connect( myResultsButton, SIGNAL( clicked() ), mySizeBox, SLOT( onToggleResults() ) );
- connect( myGeometryButton, SIGNAL( clicked() ), mySizeBox, SLOT( onToggleGeometry() ) );
+ // Deformed Shape
+ myDefShapeBox = new QGroupBox( tr( "DEFORMED_SHAPE_TITLE" ), aBox );
+ myDefShapeBox->setColumnLayout(0, Qt::Vertical );
+ myDefShapeBox->layout()->setSpacing( 0 );
+ myDefShapeBox->layout()->setMargin( 0 );
+ QGridLayout* aDefShapeLayout = new QGridLayout( myDefShapeBox->layout() );
+ aDefShapeLayout->setAlignment(Qt::AlignTop);
+ aDefShapeLayout->setSpacing(6);
+ aDefShapeLayout->setMargin(11);
+
+ QLabel* aScaleLabel = new QLabel( tr( "SCALE_FACTOR" ), myDefShapeBox );
+ myScaleSpinBox = new QtxDblSpinBox( 0.0, 10.0, 0.1, myDefShapeBox );
+
+ aDefShapeLayout->addWidget( aScaleLabel, 0, 0 );
+ aDefShapeLayout->addWidget( myScaleSpinBox, 0, 1 );
+
+ // Scalar Bar pane
myScalarPane = new VisuGUI_GaussScalarBarPane(this, SetPref);
myScalarPane->setMargin(5);
+ connect( myResultsButton, SIGNAL( clicked() ), mySizeBox, SLOT( onToggleResults() ) );
+ connect( myResultsButton, SIGNAL( toggled( bool ) ), myScalarPane, SLOT( setEnabled( bool ) ) );
+ connect( myGeometryButton, SIGNAL( clicked() ), mySizeBox, SLOT( onToggleGeometry() ) );
+ connect( myDefShapeButton, SIGNAL( toggled( bool ) ), this, SLOT( onToggleDefShape( bool ) ) );
+ connect( myDefShapeButton, SIGNAL( toggled( bool ) ), myScalarPane, SLOT( setEnabled( bool ) ) );
+
aTabBox->addTab(aBox, tr("GAUSS_POINTS_TAB"));
aTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::GaussPoints_i* thePrs )
{
+ bool isDeformed = thePrs->GetIsDeformed();
+ myScaleSpinBox->setValue( thePrs->GetScaleFactor() );
+ myDefShapeButton->setChecked( isDeformed );
+ onToggleDefShape( isDeformed );
+
bool isResults = thePrs->GetIsColored();
- myResultsButton->setChecked( isResults );
- myGeometryButton->setChecked( !isResults );
+ myResultsButton->setChecked( isResults && !isDeformed );
+ myGeometryButton->setChecked( !isResults && !isDeformed );
myPrimitiveBox->setPrimitiveType( thePrs->GetPrimitiveType() );
myPrimitiveBox->setClampMaximum( thePrs->GetMaximumSupportedSize() );
myPrimitiveBox->setAlphaTexture( thePrs->GetAlphaTexture() );
myPrimitiveBox->setAlphaThreshold( thePrs->GetAlphaThreshold() );
- mySizeBox->setType( isResults ? VVTK_SizeBox::Results : VVTK_SizeBox::Geometry );
+ mySizeBox->setType( isResults || isDeformed ? VVTK_SizeBox::Results : VVTK_SizeBox::Geometry );
mySizeBox->setGeomSize( thePrs->GetGeomSize() );
mySizeBox->setMinSize( thePrs->GetMinSize() );
mySizeBox->setMaxSize( thePrs->GetMaxSize() );
int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::GaussPoints_i* thePrs )
{
+ thePrs->SetIsDeformed( myDefShapeButton->isChecked() );
+ thePrs->SetScaleFactor( myScaleSpinBox->value() );
+
thePrs->SetPrimitiveType( myPrimitiveBox->getPrimitiveType() );
thePrs->SetClamp( myPrimitiveBox->getClamp() );
thePrs->SetAlphaThreshold( myPrimitiveBox->getAlphaThreshold() );
-
- bool isResults = myResultsButton->isChecked();
- if( isResults )
+ bool isColored = !myGeometryButton->isChecked();
+ if( isColored )
{
thePrs->SetIsColored( true );
thePrs->SetMinSize( mySizeBox->getMinSize() );
return myScalarPane->storeToPrsObject(thePrs);
}
+void VisuGUI_GaussPointsDlg::onToggleDefShape( bool on )
+{
+ if( on )//myDefShapeButton->isChecked() )
+ {
+ myDefShapeBox->show();
+ mySizeBox->setType( VVTK_SizeBox::Results );
+ }
+ else
+ myDefShapeBox->hide();
+}
+
void VisuGUI_GaussPointsDlg::accept()
{
//if( myScalarPane->check() )
//
//
//
-// File : VisuGUI_MagnitudeDlg.h
-// Author : Laurent CORNABE & Hubert ROLLAND
+// File : VisuGUI_GaussPointsDlg.h
+// Author : Oleg UVAROV
// Module : VISU
-// $Header$
#ifndef VISUGUI_GAUSSPOINTSDLS_H
#define VISUGUI_GAUSSPOINTSDLS_H
int storeToPrsObject(VISU::GaussPoints_i* thePrs);
protected slots:
+ void onToggleDefShape( bool );
+
void accept();
private:
QRadioButton* myResultsButton;
QRadioButton* myGeometryButton;
+ QRadioButton* myDefShapeButton;
VVTK_PrimitiveBox* myPrimitiveBox;
VVTK_SizeBox* mySizeBox;
+
+ QGroupBox* myDefShapeBox;
+ QtxDblSpinBox* myScaleSpinBox;
};
#endif // VISUGUI_GAUSSPOINTSDLS_H
float aSpacing = aResourceMgr->doubleValue( "VISU", "scalar_bar_spacing", GetSpacing() );
SetSpacing( aSpacing );
+ float aScaleFactor = aResourceMgr->doubleValue( "VISU", "deformed_shape_scale_factor", GetScaleFactor() );
+ SetScaleFactor( aScaleFactor );
+
int aPrimitiveType = aResourceMgr->integerValue( "VISU", "point_sprite_primitive_type", GetPrimitiveType() );
SetPrimitiveType( aPrimitiveType );
SetMagnification(Storable::FindValue(theMap,"myMagnification").toDouble());
SetMagnificationIncrement(Storable::FindValue(theMap,"myMagnificationIncrement").toDouble());
+ SetIsDeformed(Storable::FindValue(theMap,"myIsDeformed").toInt());
+ SetScaleFactor(Storable::FindValue(theMap,"myScaleFactor").toDouble());
+
SetIsColored(Storable::FindValue(theMap,"myIsColored").toInt());
int aRed = Storable::FindValue(theMap,"myColor.R").toInt();
int aGreen = Storable::FindValue(theMap,"myColor.G").toInt();
Storable::DataToStream( theStr, "myMagnification", GetMagnification() );
Storable::DataToStream( theStr, "myMagnificationIncrement", GetMagnificationIncrement() );
+ Storable::DataToStream( theStr, "myIsDeformed", GetIsDeformed() );
+ Storable::DataToStream( theStr, "myScaleFactor", GetScaleFactor() );
+
Storable::DataToStream( theStr, "myIsColored", GetIsColored() );
QColor aColor = GetColor();
Storable::DataToStream( theStr, "myColor.R", aColor.red() );
return myGaussPointsPL;
}
+void
+VISU::GaussPoints_i
+::SetIsDeformed( bool theIsDeformed )
+{
+ myGaussPointsPL->SetIsDeformed( theIsDeformed );
+}
+
+bool
+VISU::GaussPoints_i
+::GetIsDeformed()
+{
+ return myGaussPointsPL->GetIsDeformed();
+}
+
+void
+VISU::GaussPoints_i
+::SetScaleFactor( float theScaleFactor )
+{
+ myGaussPointsPL->SetScale( theScaleFactor );
+}
+
+float
+VISU::GaussPoints_i
+::GetScaleFactor()
+{
+ return myGaussPointsPL->GetScale();
+}
+
void
VISU::GaussPoints_i
::SetIsColored( bool theIsColored )
VISU_GaussPointsPL*
GetGaussPointsPL();
+ bool
+ GetIsDeformed();
+
+ void
+ SetIsDeformed( bool theIsDeformed );
+
+ float
+ GetScaleFactor();
+
+ void
+ SetScaleFactor( float theScaleFactor );
+
QColor
GetColor() { return myColor; }
VISU_GaussPointsPL *myGaussPointsPL;
+ //bool myIsDeformed;
+ //float myScaleFactor;
+
bool myIsColored;
bool myIsDispGlobalScalarBar;
bool myIsActiveLocalScalarBar;