msgid "VisuGUI_GaussPointsDlg::&OK"
msgstr ""
+msgid "VisuGUI_GaussPointsDlg::WARNING"
+msgstr "Warning"
+
msgid "VisuGUI_GaussPointsDlg::DLG_TITLE"
msgstr "Gauss Points"
#include <qvalidator.h>
#include <qcolordialog.h>
+#include <vtkPolyData.h>
+#include <vtkDataSet.h>
+#include <vtkSphereSource.h>
+
using namespace std;
VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent, bool SetPref):
VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool SetPref):
QDialog(VISU::GetDesktop(theModule),
"VisuGUI_GaussPointsDlg", true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+ myPrs(NULL)
{
setName("VisuGUI_ScalarBarDlg");
setCaption(SetPref ? tr("DLG_PREF_TITLE") : tr("DLG_PROP_TITLE"));
myPrimitiveBox->setAlphaTexture( thePrs->GetAlphaTexture() );
myPrimitiveBox->setAlphaThreshold( thePrs->GetAlphaThreshold() );
myPrimitiveBox->setResolution( thePrs->GetResolution() );
- myPrimitiveBox->setFaceLimit( 500 );
+ myPrimitiveBox->setFaceLimit( thePrs->GetFaceLimit() );
mySizeBox->setType( isResults || isDeformed ? VVTK_SizeBox::Results : VVTK_SizeBox::Geometry );
mySizeBox->setGeomSize( thePrs->GetGeomSize() );
mySizeBox->setColor( thePrs->GetColor() );
myScalarPane->initFromPrsObject(thePrs);
+
+ myPrs = thePrs;
}
int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::GaussPoints_i* thePrs )
thePrs->SetAlphaThreshold( myPrimitiveBox->getAlphaThreshold() );
thePrs->SetResolution( myPrimitiveBox->getResolution() );
+ thePrs->SetFaceLimit( myPrimitiveBox->getFaceLimit() );
bool isColored = !myGeometryButton->isChecked();
if( isColored )
void VisuGUI_GaussPointsDlg::accept()
{
+ if( myPrs && myPrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere )
+ {
+ int aNumberOfFaces = myPrimitiveBox->getFaceNumber();
+ int aNumberOfPoints = ( (vtkPolyData*)myPrs->GetGaussPointsPL()->GetInput() )->GetNumberOfCells();
+
+ if( aNumberOfFaces * aNumberOfPoints > myPrimitiveBox->getFaceLimit() )
+ {
+ QString aWarning = "The number of faces needed to perform the 'Geometrical Sphere' primitive\n";
+ aWarning.append( "presentation might be too important to ensure an acceptable frame rate.\n\n" );
+ aWarning.append( "Can you please confirm that you want to continue anyway?" );
+ if( SUIT_MessageBox::warn2( this, tr( "Warning" ), aWarning, tr( "&OK" ), tr( "&Cancel" ), 0, 1, 1 ) == 1 )
+ return;
+ }
+
+ /*
+ float aMemory = 50.0 * 1024.0 * (float)aNumberOfFaces * (float)aNumberOfPoints;
+
+ cout << aNumberOfFaces << endl;
+ cout << aNumberOfPoints << endl;
+ cout << aMemory << endl;
+
+ vtkSphereSource* aSphere = vtkSphereSource::New();
+ aSphere->SetThetaResolution( myPrimitiveBox->getResolution() );
+ aSphere->SetPhiResolution( myPrimitiveBox->getResolution() );
+ aSphere->GetOutput()->Update();
+ aSphere->GetOutput()->GetActualMemorySize();
+
+ aMemory = aSphere->GetOutput()->GetActualMemorySize() * 1024.0 * (float)aNumberOfPoints;
+
+ if( VISU_PipeLine::CheckAvailableMemory( aMemory ) == 0 )
+ {
+ SUIT_MessageBox::error1( this, "caption", "text", "ok" );
+ return 0;
+ }
+ */
+ }
+
//if( myScalarPane->check() )
QDialog::accept();
}
void accept();
private:
+ VISU::GaussPoints_i* myPrs;
VisuGUI_GaussScalarBarPane* myScalarPane;
QRadioButton* myResultsButton;
myColor(Qt::blue),
myIsActiveLocalScalarBar(true),
myIsDispGlobalScalarBar(true),
- mySpacing(0.01)
+ mySpacing(0.01),
+ myFaceLimit(50000)
{
if(MYDEBUG) MESSAGE("GaussPoints_i::GaussPoints_i - this = "<<this);
}
myIsColored(true),
myColor(Qt::blue),
myIsActiveLocalScalarBar(true),
- myIsDispGlobalScalarBar(true)
+ myIsDispGlobalScalarBar(true),
+ myFaceLimit(50000)
{
if(MYDEBUG) MESSAGE("GaussPoints_i::GaussPoints_i - this = "<<this);
}
int aResolution = aResourceMgr->integerValue( "VISU", "geom_sphere_resolution", GetResolution() );
SetResolution( aResolution );
+ int aFaceLimit = aResourceMgr->integerValue( "VISU", "geom_sphere_face_limit", GetFaceLimit() );
+ SetFaceLimit( aFaceLimit );
+
QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp";
aMainTexture = aResourceMgr->stringValue( "VISU", "point_sprite_main_texture", aMainTexture );
SetIsDeformed(Storable::FindValue(theMap,"myIsDeformed").toInt());
SetScaleFactor(Storable::FindValue(theMap,"myScaleFactor").toDouble());
+ SetFaceLimit(Storable::FindValue(theMap,"myFaceLimit").toInt());
+
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, "myIsDeformed", GetIsDeformed() );
Storable::DataToStream( theStr, "myScaleFactor", GetScaleFactor() );
+ Storable::DataToStream( theStr, "myFaceLimit", GetFaceLimit() );
+
Storable::DataToStream( theStr, "myIsColored", GetIsColored() );
QColor aColor = GetColor();
Storable::DataToStream( theStr, "myColor.R", aColor.red() );
VISU_GaussPointsPL*
GetGaussPointsPL();
+ int
+ GetFaceLimit() { return myFaceLimit; }
+
+ void
+ SetFaceLimit( int theFaceLimit ) { myFaceLimit = theFaceLimit; }
+
bool
GetIsDeformed();
bool myIsActiveLocalScalarBar;
QColor myColor;
float mySpacing;
+ int myFaceLimit;
QString myMainTexture;
QString myAlphaTexture;
connect(myStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
mySegmentationCursorDlg->SetWidgetCtrl( theRenderer->GetWidgetCtrl() );
+ mySegmentationCursorDlg->SetInteractor( theInteractor );
connect( theInteractor, SIGNAL( selectionChanged() ), SLOT( OnSelectionChanged() ) );
myPickingDlg->SetInteractor( theInteractor );
// Notification ( Geometrical Sphere )
myFaceLimitLabel = new QLabel( tr( "FACE_LIMIT" ), this );
- myFaceLimitSpinBox = new QtxIntSpinBox( 10, 10000, 10, this );
+ myFaceLimitSpinBox = new QtxIntSpinBox( 10, 1000000, 10, this );
myFaceLimitSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
aLayout->addWidget( myFaceLimitLabel, 3, 0 );
int VVTK_PrimitiveBox::getFaceNumber() const
{
- return myFaceNumberLineEdit->text().toInt();
+ int aResolution = getResolution();
+ return 2 * aResolution * ( aResolution - 2 );
+ //return myFaceNumberLineEdit->text().toInt();
}
void VVTK_PrimitiveBox::setFaceNumber( int theFaceNumber )
#include "VISU_GaussPointsPL.hxx"
#include "VISU_OpenGLPointSpriteMapper.hxx"
+#include "SUIT_MessageBox.h"
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
+#include "SVTK_RenderWindowInteractor.h"
+
#include <vtkActorCollection.h>
#include <vtkCallbackCommand.h>
#include <vtkObjectFactory.h>
myInsideCursorSettings( VISU_InsideCursorSettings::New() ),
myOutsideCursorSettings( VISU_OutsideCursorSettings::New() ),
myIsPlaneSegmentation( true ),
- myWidgetCtrl(NULL)
+ myWidgetCtrl(NULL),
+ myInteractor(NULL)
{
myPriority = 0.0;
myEventCallbackCommand->Delete();
anIncrement = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_increment", anIncrement );
this->setIncrement( anIncrement );
+ myInsidePrimitiveBox->setFaceLimit( 50000 );
+
ApplyInsideGaussPoints();
}
aColor = aResourceMgr->colorValue( "VISU", "outside_point_sprite_color", aColor );
myOutsideSizeBox->setColor( aColor );
+ myOutsidePrimitiveBox->setFaceLimit( 50000 );
+
ApplyOutsideGaussPoints();
}
ApplySegmentationCursor();
else
{
- ApplyInsideGaussPoints();
- ApplyOutsideGaussPoints();
+ QString aWarning = "The number of faces needed to perform the 'Geometrical Sphere' primitive\n";
+ aWarning.append( "presentation might be too important to ensure an acceptable frame rate.\n\n" );
+ aWarning.append( "Can you please confirm that you want to continue anyway?" );
+ bool toApply = CheckNumberOfFaces() ||
+ SUIT_MessageBox::warn2( this, tr( "Warning" ), aWarning,
+ tr( "&OK" ), tr( "&Cancel" ), 0, 1, 1 ) == 0;
+
+ if( toApply )
+ {
+ ApplyInsideGaussPoints();
+ ApplyOutsideGaussPoints();
+ }
}
}
QDialog::done( r );
}
+
+bool VVTK_SegmentationCursorDlg::CheckNumberOfFaces()
+{
+ if( !myInteractor )
+ return false;
+
+ vtkRenderer* aRenderer = myInteractor->getRenderer();
+
+ if( !aRenderer )
+ return false;
+
+ int aNumberOfPoints = 0;
+
+ vtkActor* anActor;
+ vtkActorCollection* anActColl = aRenderer->GetActors();
+ for( anActColl->InitTraversal(); ( anActor = anActColl->GetNextActor() ) != NULL; )
+ {
+ if( VISU_GaussPtsAct1* aGaussActor = VISU_GaussPtsAct1::SafeDownCast( anActor ) )
+ aNumberOfPoints += aGaussActor->GetInput()->GetNumberOfCells();
+ }
+ return !( myInsidePrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere &&
+ aNumberOfPoints * myInsidePrimitiveBox->getFaceNumber() * 2 > myInsidePrimitiveBox->getFaceLimit() ||
+ myOutsidePrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere &&
+ aNumberOfPoints * myOutsidePrimitiveBox->getFaceNumber() > myOutsidePrimitiveBox->getFaceLimit() );
+}
class VVTK_PrimitiveBox;
class VVTK_SizeBox;
+class SVTK_RenderWindowInteractor;
+
namespace VISU
{
typedef vtkSmartPointer<vtkImageData> TTextureValue;
vtkSmartPointer<vtkCallbackCommand> GetEventCallbackCommand() { return myEventCallbackCommand; }
+ void SetInteractor( SVTK_RenderWindowInteractor* theInteractor ) { myInteractor = theInteractor; }
+
public:
float getMagnification() const;
void setMagnification( float );
void ApplyInsideGaussPoints();
void ApplyOutsideGaussPoints();
+ bool CheckNumberOfFaces();
+
VISU::TTextureValue
MakeImageData( bool theInside,
const QString& theMainTexture,
void scgClose();
private:
+ SVTK_RenderWindowInteractor* myInteractor;
+
QTabWidget* myTabBox;
// Segmentation cursor