From: ouv Date: Wed, 30 Nov 2005 13:55:07 +0000 (+0000) Subject: Geometrical Sphere. X-Git-Tag: TG-D5-38-2003_D2005-20-12~93 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=82d81bffc75d933e887af0bd7529f2375f12b8ad;p=modules%2Fvisu.git Geometrical Sphere. --- diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 45f6e29f..79fae715 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -40,6 +40,8 @@ #include #include #include +#include +#include //---------------------------------------------------------------------------- vtkStandardNewMacro(VISU_GaussPointsPL); @@ -49,14 +51,8 @@ VISU_GaussPointsPL ::VISU_GaussPointsPL(): myIsDeformed(false), myScaleFactor(0.0), - myPrimitiveType(0), - myClamp(200.0), - mySize(10), - myMinSize(3), - myMaxSize(33), - myMagnification(100), - myMagnificationIncrement(2), - myAlphaThreshold(0.1) + myResolution( 8 ), + myMagnificationIncrement(2) { myExtractGeometry->SetExtractInside(0); @@ -69,6 +65,9 @@ VISU_GaussPointsPL myWarpVector = vtkWarpVector::New(); myCellDataToPointData = vtkCellDataToPointData::New(); myCellDataToPointData->SetPassCellData(true); + + myGlyph = vtkGlyph3D::New(); + mySphereSource = vtkSphereSource::New(); } void @@ -92,6 +91,7 @@ VISU_GaussPointsPL SetMagnification(aPipeLine->GetMagnification()); SetMagnificationIncrement(aPipeLine->GetMagnificationIncrement()); SetAlphaThreshold(aPipeLine->GetAlphaThreshold()); + SetResolution(aPipeLine->GetResolution()); SetIsDeformed( aPipeLine->GetIsDeformed() ); SetScale( aPipeLine->GetScale() ); @@ -133,17 +133,31 @@ VISU_GaussPointsPL myCellDataToPointData->SetInput( myFieldTransform->GetUnstructuredGridOutput() ); + // Deformed Shape if( myIsDeformed ) { myWarpVector->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() ); myGeomFilter->SetInput( myWarpVector->GetOutput() ); } else - { myGeomFilter->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() ); - } - myPSMapper->SetInput( myGeomFilter->GetOutput() ); + // Geometrical Sphere + if( GetPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere ) + { + myGlyph->SetInput( myGeomFilter->GetOutput() ); + myGlyph->SetScaleModeToScaleByScalar(); + myGlyph->SetColorModeToColorByScalar(); + //myGlyph->SetScaleFactor( 5 ); + myGlyph->ClampingOn(); + + mySphereSource->SetRadius( GetMagnification() * GetAverageCellSize() / 2. ); + myGlyph->SetSource( mySphereSource->GetOutput() ); + + myPSMapper->SetInput( myGlyph->GetOutput() ); + } + else + myPSMapper->SetInput( myGeomFilter->GetOutput() ); VISU_ScalarMapPL::Init(); @@ -177,11 +191,10 @@ VISU_GaussPointsPL GetSourceRange(mySourceScalarRange); myDeltaScalarRange = mySourceScalarRange[1] - mySourceScalarRange[0]; + SetAverageCellSize( VISU_DeformedShapePL::GetScaleFactor( GetParentMesh() ) ); + vtkMapper* aMapper = GetMapper(); vtkDataSet* aDataSet = aMapper->GetInput(); - //vtkDataSet* aDataSet = GetParentMesh(); - myAverageCellSize = VISU_DeformedShapePL::GetScaleFactor(aDataSet); - vtkCellData* aCellData = aDataSet->GetCellData(); myScalarArray = aCellData->GetScalars(); @@ -209,6 +222,11 @@ VISU_GaussPointsPL myWarpVector->Delete(); myCellDataToPointData->Delete(); + + myGlyph->UnRegisterAllOutputs(); + myGlyph->Delete(); + + mySphereSource->Delete(); } //---------------------------------------------------------------------------- @@ -284,12 +302,18 @@ void VISU_GaussPointsPL ::SetPrimitiveType(int thePrimitiveType) { - myPrimitiveType = thePrimitiveType; - myPSMapper->SetPointSpritePrimitiveType( thePrimitiveType ); - + myPSMapper->SetPrimitiveType( thePrimitiveType ); Modified(); } +//---------------------------------------------------------------------------- +int +VISU_GaussPointsPL +::GetPrimitiveType() +{ + return myPSMapper->GetPrimitiveType(); +} + //---------------------------------------------------------------------------- float VISU_GaussPointsPL @@ -303,56 +327,105 @@ void VISU_GaussPointsPL ::SetClamp(float theClamp) { - myClamp = theClamp; myPSMapper->SetPointSpriteClamp( theClamp ); - Modified(); } +//---------------------------------------------------------------------------- +float +VISU_GaussPointsPL +::GetClamp() +{ + return myPSMapper->GetPointSpriteClamp(); +} + //---------------------------------------------------------------------------- void VISU_GaussPointsPL ::SetSize(float theSize) { - mySize = theSize; - myPSMapper->SetPointSpriteSize( 1000.0 * myAverageCellSize * mySize / 100.0 ); - + myPSMapper->SetPointSpriteSize( theSize ); Modified(); } +//---------------------------------------------------------------------------- +float +VISU_GaussPointsPL +::GetSize() +{ + return myPSMapper->GetPointSpriteSize(); +} + //---------------------------------------------------------------------------- void VISU_GaussPointsPL -::SetMinSize(float theMinSize) +::UpdateGlyphRange() { - myMinSize = theMinSize; - myPSMapper->SetPointSpriteMinSize( 1000.0 * myAverageCellSize * myMinSize / 100.0 ); + float aScalarRange[2]; + GetSourceRange( aScalarRange ); + + float aMinSize = GetMinSize(); + float aMaxSize = GetMaxSize(); + float aRange = ( aScalarRange[1] - aScalarRange[0] ) / ( aMaxSize - aMinSize ); + float aMinRange = aScalarRange[0] - aMinSize * aRange; + float aMaxRange = aMinRange + aRange; + + myGlyph->SetRange( aMinRange, aMaxRange ); +} +//---------------------------------------------------------------------------- +void +VISU_GaussPointsPL +::SetMinSize(float theMinSize) +{ + myPSMapper->SetPointSpriteMinSize( theMinSize ); + UpdateGlyphRange(); Modified(); } +//---------------------------------------------------------------------------- +float +VISU_GaussPointsPL +::GetMinSize() +{ + return myPSMapper->GetPointSpriteMinSize(); +} + //---------------------------------------------------------------------------- void VISU_GaussPointsPL ::SetMaxSize(float theMaxSize) { - myMaxSize = theMaxSize; - myPSMapper->SetPointSpriteMaxSize( 1000.0 * myAverageCellSize * myMaxSize / 100.0 ); - + myPSMapper->SetPointSpriteMaxSize( theMaxSize ); + UpdateGlyphRange(); Modified(); } +//---------------------------------------------------------------------------- +float +VISU_GaussPointsPL +::GetMaxSize() +{ + return myPSMapper->GetPointSpriteMaxSize(); +} + //---------------------------------------------------------------------------- void VISU_GaussPointsPL ::SetMagnification(float theMagnification) { - myMagnification = theMagnification; - myPSMapper->SetPointSpriteMagnification( theMagnification / 100.0 ); - + myPSMapper->SetPointSpriteMagnification( theMagnification ); Modified(); } +//---------------------------------------------------------------------------- +float +VISU_GaussPointsPL +::GetMagnification() +{ + return myPSMapper->GetPointSpriteMagnification(); +} + //---------------------------------------------------------------------------- void VISU_GaussPointsPL @@ -366,12 +439,28 @@ void VISU_GaussPointsPL ::SetAlphaThreshold(float theAlphaThreshold) { - myAlphaThreshold = theAlphaThreshold; myPSMapper->SetPointSpriteAlphaThreshold( theAlphaThreshold ); - Modified(); } +//---------------------------------------------------------------------------- +float +VISU_GaussPointsPL +::GetAlphaThreshold() +{ + return myPSMapper->GetPointSpriteAlphaThreshold(); +} + +//---------------------------------------------------------------------------- +void +VISU_GaussPointsPL +::SetResolution(int theResolution) +{ + myResolution = theResolution; + mySphereSource->SetThetaResolution( myResolution ); + mySphereSource->SetPhiResolution( myResolution ); +} + //---------------------------------------------------------------------------- void VISU_GaussPointsPL @@ -386,8 +475,8 @@ float VISU_GaussPointsPL ::GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray) { - float aMaxSize = myAverageCellSize*myMaxSize/100.0; - float aMinSize = myAverageCellSize*myMinSize/100.0; + float aMaxSize = GetAverageCellSize() * GetMaxSize(); + float aMinSize = GetAverageCellSize() * GetMinSize(); float aDelta = aMaxSize - aMinSize; float aVal = theScalarArray->GetTuple1(theID); @@ -399,7 +488,7 @@ float VISU_GaussPointsPL ::GetMaxPointSize() { - return myAverageCellSize*myMaxSize/100.0; + return GetAverageCellSize() * GetMaxSize(); } //---------------------------------------------------------------------------- @@ -414,6 +503,23 @@ VISU_GaussPointsPL return GetPointSize(theID,aScalarArray); } +//---------------------------------------------------------------------------- +void +VISU_GaussPointsPL +::SetAverageCellSize(float theAverageCellSize) +{ + myPSMapper->SetAverageCellSize( theAverageCellSize ); + Modified(); +} + +//---------------------------------------------------------------------------- +float +VISU_GaussPointsPL +::GetAverageCellSize() +{ + return myPSMapper->GetAverageCellSize(); +} + //---------------------------------------------------------------------------- void VISU_GaussPointsPL diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index a3747abf..c3c5665f 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -37,6 +37,8 @@ class VTKViewer_PassThroughFilter; class VISU_OpenGLPointSpriteMapper; class vtkGeometryFilter; +class vtkGlyph3D; +class vtkSphereSource; class vtkDataArray; class vtkImageData; class vtkPointSet; @@ -131,11 +133,13 @@ public: void SetIsColored(bool theIsColored); + //! Set type of the primitives. void SetPrimitiveType(int thePrimitiveType); + //! Get type of the primitives. int - GetPrimitiveType() { return myPrimitiveType; } + GetPrimitiveType(); //! Get the maximum Point Sprite size, which is supported by hardware. float @@ -147,7 +151,7 @@ public: //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteClamp, float). float - GetClamp() { return myClamp; } + GetClamp(); //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteSize. void @@ -155,7 +159,7 @@ public: //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteSize, float). float - GetSize() { return mySize; } + GetSize(); //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize. void @@ -163,7 +167,7 @@ public: //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMinSize, float). float - GetMinSize() { return myMinSize; } + GetMinSize(); //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize. void @@ -171,7 +175,7 @@ public: //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMaxSize, float). float - GetMaxSize() { return myMaxSize; } + GetMaxSize(); //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification. void @@ -179,7 +183,7 @@ public: //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMagnification, float). float - GetMagnification() { return myMagnification; } + GetMagnification(); //! Set the increment of changing Magnification parameter. void @@ -195,7 +199,15 @@ public: //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteAlphaThreshold, float). float - GetAlphaThreshold() { return myAlphaThreshold; } + GetAlphaThreshold(); + + //! Set resolution of the Geometrical Sphere. + void + SetResolution(int theResolution); + + //! Get resolution of the Geometrical Sphere. + int + GetResolution() { return myResolution; } //! Method for changing the Magnification parameter. void @@ -213,6 +225,18 @@ public: float GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray); + //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkSetMacro(AverageCellSize, float). + void + SetAverageCellSize(float AverageCellSize); + + //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(AverageCellSize, float). + float + GetAverageCellSize(); + + //! Update scalar range of the glyph. + void + UpdateGlyphRange(); + //! Set image data for the Point Sprite texture. void SetImageData(vtkImageData* theImageData); @@ -236,33 +260,27 @@ public: virtual void SetMapScale( float theMapScale = 1.0 ); protected: - vtkPointSet* doHook(); - bool myIsDeformed; float myScaleFactor; vtkWarpVector *myWarpVector; vtkCellDataToPointData* myCellDataToPointData; - std::vector myPassFilter; + vtkGlyph3D* myGlyph; + vtkSphereSource* mySphereSource; + int myResolution; protected: VISU_OpenGLPointSpriteMapper* myPSMapper; - vtkGeometryFilter* myGeomFilter; VISU::PGaussPtsIDMapper myGaussPtsIDMapper; + vtkGeometryFilter* myGeomFilter; + vtkDataArray *myScalarArray; float mySourceScalarRange[2]; float myDeltaScalarRange; - float myAverageCellSize; int myPrimitiveType; - float myClamp; - float mySize; - float myMinSize; - float myMaxSize; - float myMagnification; float myMagnificationIncrement; - float myAlphaThreshold; }; #endif diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 0240d986..87ce9597 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -170,22 +170,23 @@ VISU_OpenGLPointSpriteMapper::VISU_OpenGLPointSpriteMapper() this->TotalCells = 0; this->ExtensionsInitialized = 0; this->DefaultPointSize = 20.0; + this->AverageCellSize = 0.0; this->UsePointSprites = true; this->UseTextures = true; this->UseShader = true; - this->PointSpriteMode = 0; + this->PrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; - this->PointSpritePrimitiveType = 0; + this->PointSpriteMode = 0; - this->PointSpriteClamp = 100.0; - this->PointSpriteSize = 30.0; - this->PointSpriteMinSize = 15.0; - this->PointSpriteMaxSize = 50.0; - this->PointSpriteMagnification = 1.0; + this->PointSpriteClamp = 256.0; + this->PointSpriteSize = 0.15; + this->PointSpriteMinSize = 0.3; + this->PointSpriteMaxSize = 0.33; + this->PointSpriteMagnification = 1.0; - this->PointSpriteAlphaThreshold = 0.1; + this->PointSpriteAlphaThreshold = 0.5; this->PointSpriteTexture = 0; this->UseOpenGLMapper = false; @@ -206,9 +207,10 @@ void VISU_OpenGLPointSpriteMapper::ShallowCopy( vtkAbstractMapper* mapper ) VISU_OpenGLPointSpriteMapper* m = VISU_OpenGLPointSpriteMapper::SafeDownCast(mapper); if( m != NULL ) { + this->SetPrimitiveType( m->GetPrimitiveType() ); + this->SetPointSpriteMode( m->GetPointSpriteMode() ); - this->SetPointSpritePrimitiveType( m->GetPointSpritePrimitiveType() ); this->SetPointSpriteClamp( m->GetPointSpriteClamp() ); this->SetPointSpriteSize( m->GetPointSpriteSize() ); this->SetPointSpriteMinSize( m->GetPointSpriteMinSize() ); @@ -306,18 +308,15 @@ void VISU_OpenGLPointSpriteMapper::SetShaderVariable( const char* variable, floa vglVertexAttrib1fARB( vglGetAttribLocationARB( this->VertexProgram, variable ), value ); } //----------------------------------------------------------------------------- -void VISU_OpenGLPointSpriteMapper::SetPointSpriteMode( int theMode ) +void VISU_OpenGLPointSpriteMapper::SetPrimitiveType( int thePrimitiveType ) { - //cout << "SetPointSpriteMode " << this << " " << aMode << endl; - - this->PointSpriteMode = theMode; - //this->SetShaderVariable( "mode", theMode ); + this->PrimitiveType = thePrimitiveType; this->Modified(); } //----------------------------------------------------------------------------- -void VISU_OpenGLPointSpriteMapper::SetPointSpritePrimitiveType( int thePrimitiveType ) +void VISU_OpenGLPointSpriteMapper::SetPointSpriteMode( int theMode ) { - this->PointSpritePrimitiveType = thePrimitiveType; + this->PointSpriteMode = theMode; this->Modified(); } //----------------------------------------------------------------------------- @@ -384,13 +383,16 @@ void VISU_OpenGLPointSpriteMapper::InitExtensions() // void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act) { - if( !this->ExtensionsInitialized && !this->UseOpenGLMapper ) + bool isUseThisMapper = !( this->UseOpenGLMapper || + this->PrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere ); + + if( !this->ExtensionsInitialized && isUseThisMapper ) { this->InitExtensions(); act->GetProperty()->SetPointSize( 10.0f ); } - if( this->UseOpenGLMapper ) + if( !isUseThisMapper ) { //cout << "Using OpenGLMapper" << endl; MAPPER_SUPERCLASS::RenderPiece( ren, act ); @@ -433,7 +435,7 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act) ren->GetRenderWindow()->MakeCurrent(); // Initializing the texture for Point Sprites - if( this->UseTextures && this->PointSpritePrimitiveType == 0 ) + if( this->UseTextures && this->PrimitiveType == VISU_OpenGLPointSpriteMapper::PointSprite ) this->InitTextures(); // @@ -732,7 +734,7 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *p, else size = this->PointSpriteSize; - aVertex[i].hue = this->PointSpriteMagnification * size; + aVertex[i].hue = 1000.0 * this->AverageCellSize * this->PointSpriteMagnification * size; } GLuint aBufferObjectID = 0; @@ -770,7 +772,7 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *p, int VISU_OpenGLPointSpriteMapper::Draw(vtkRenderer *aren, vtkActor *act) { - if( this->UseOpenGLMapper ) + if( this->UseOpenGLMapper || this->PrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere ) return MAPPER_SUPERCLASS::Draw( aren, act ); vtkOpenGLRenderer *ren = (vtkOpenGLRenderer *)aren; diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx index 87fe2d72..02bd4516 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx @@ -83,6 +83,8 @@ public: */ enum RenderModes { Accumulate = 0, Occlude }; + enum PrimitiveTypes { PointSprite = 0, OpenGLPoint, GeomSphere }; + static VISU_OpenGLPointSpriteMapper *New(); vtkTypeRevisionMacro(VISU_OpenGLPointSpriteMapper,MAPPER_SUPERCLASS); @@ -100,6 +102,12 @@ public: //! Get the initial point size to be used. vtkGetMacro(DefaultPointSize, float); + //! Set Average Cell Size. + vtkSetMacro(AverageCellSize, float); + + //! Get Average Cell Size. + vtkGetMacro(AverageCellSize, float); + //! Set the Render Mode for the mapper. vtkSetMacro(RenderMode, int); @@ -148,18 +156,20 @@ public: //! Get usage of vertex shader. vtkGetMacro(UseShader, bool); - // Description: - // Point Sprite drawing mode - // 0 - Results - different colors, different sizes - // 1 - Geometry - fixed color, fixed size - // 2 - Outside - different colors, fixed size + //! Point Sprite drawing mode + /*! + * 0 - Results - different colors, different sizes. + * 1 - Geometry - fixed color, fixed size. + * 2 - Outside - different colors, fixed size. + */ vtkGetMacro(PointSpriteMode, int); void SetPointSpriteMode( int ); - // Description: - // Point Sprite primitive type - vtkGetMacro(PointSpritePrimitiveType, int); - void SetPointSpritePrimitiveType( int ); + //! Get the Primitive type + vtkGetMacro(PrimitiveType, int); + + //! Set the Primitive type + void SetPrimitiveType( int ); //! Set Point Sprite Clamp. void SetPointSpriteClamp( float ); @@ -253,9 +263,10 @@ private: GLhandleARB VertexProgram; + int PrimitiveType; + int PointSpriteMode; - int PointSpritePrimitiveType; float PointSpriteClamp; float PointSpriteSize; float PointSpriteMinSize; @@ -265,6 +276,8 @@ private: GLuint PointSpriteTexture; float PointSpriteAlphaThreshold; + float AverageCellSize; + vtkSmartPointer ImageData; }; diff --git a/src/VISUGUI/VISUM_msg_en.po b/src/VISUGUI/VISUM_msg_en.po index 9cad7e96..654eaab5 100644 --- a/src/VISUGUI/VISUM_msg_en.po +++ b/src/VISUGUI/VISUM_msg_en.po @@ -55,6 +55,12 @@ msgstr "Alpha Channel Texture (16x16)" msgid "VisuGUI_Module::VISU_GAUSS_PREF_ALPHA_THRESHOLD" msgstr "Alpha Channel Threshold" +msgid "VisuGUI_Module::VISU_GAUSS_PREF_RESOLUTION" +msgstr "Resolution" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_FACE_LIMIT" +msgstr "Notify when number of faces exceeds" + msgid "VisuGUI_Module::VISU_GAUSS_PREF_SIZE_GROUP_TTL" msgstr "Size" @@ -388,6 +394,15 @@ msgstr "Alpha Channel Texture (16x16) : " msgid "VVTK_PrimitiveBox::ALPHA_THRESHOLD" msgstr "Alpha Channel Threshold : " +msgid "VVTK_PrimitiveBox::RESOLUTION" +msgstr "Resolution : " + +msgid "VVTK_PrimitiveBox::FACE_NUMBER" +msgstr "Number of faces : " + +msgid "VVTK_PrimitiveBox::FACE_LIMIT" +msgstr "Notify when number of faces exceeds : " + msgid "VVTK_SizeBox::SIZE_TITLE" msgstr "Size" diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 098f8bff..097ffdd6 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -611,6 +611,8 @@ void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::GaussPoints_i* thePrs ) myPrimitiveBox->setMainTexture( thePrs->GetMainTexture() ); myPrimitiveBox->setAlphaTexture( thePrs->GetAlphaTexture() ); myPrimitiveBox->setAlphaThreshold( thePrs->GetAlphaThreshold() ); + myPrimitiveBox->setResolution( thePrs->GetResolution() ); + myPrimitiveBox->setFaceLimit( 500 ); mySizeBox->setType( isResults || isDeformed ? VVTK_SizeBox::Results : VVTK_SizeBox::Geometry ); mySizeBox->setGeomSize( thePrs->GetGeomSize() ); @@ -642,6 +644,8 @@ int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::GaussPoints_i* thePrs ) thePrs->SetAlphaThreshold( myPrimitiveBox->getAlphaThreshold() ); + thePrs->SetResolution( myPrimitiveBox->getResolution() ); + bool isColored = !myGeometryButton->isChecked(); if( isColored ) { diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index efa772ca..18097a65 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -163,17 +163,17 @@ VISU::GaussPoints_i float aClamp = aResourceMgr->doubleValue( "VISU", "point_sprite_clamp", GetClamp() ); SetClamp( aClamp ); - float aMinSize = aResourceMgr->doubleValue( "VISU", "point_sprite_min_size", GetMinSize() ); - SetMinSize( aMinSize ); + int aMinSize = aResourceMgr->integerValue( "VISU", "point_sprite_min_size", ( int )( GetMinSize() * 100.0 ) ); + SetMinSize( aMinSize / 100.0 ); - float aMaxSize = aResourceMgr->doubleValue( "VISU", "point_sprite_max_size", GetMaxSize() ); - SetMaxSize( aMaxSize ); + int aMaxSize = aResourceMgr->integerValue( "VISU", "point_sprite_max_size", ( int )( GetMaxSize() * 100.0 ) ); + SetMaxSize( aMaxSize / 100.0 ); - float aGeomSize = aResourceMgr->doubleValue( "VISU", "point_sprite_size", GetGeomSize() ); - SetGeomSize( aGeomSize ); + int aGeomSize = aResourceMgr->integerValue( "VISU", "point_sprite_size", ( int )( GetGeomSize() * 100.0 ) ); + SetGeomSize( aGeomSize / 100.0 ); - float aMagnification = aResourceMgr->doubleValue( "VISU", "point_sprite_magnification", GetMagnification() ); - SetMagnification( aMagnification ); + int aMagnification = aResourceMgr->integerValue( "VISU", "point_sprite_magnification", ( int )( GetMagnification() * 100.0 ) ); + SetMagnification( aMagnification / 100.0 ); float anIncrement = aResourceMgr->doubleValue( "VISU", "point_sprite_increment", GetMagnificationIncrement() ); SetMagnificationIncrement( anIncrement ); @@ -187,6 +187,9 @@ VISU::GaussPoints_i float anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "point_sprite_alpha_threshold", GetAlphaThreshold() ); SetAlphaThreshold( anAlphaThreshold ); + int aResolution = aResourceMgr->integerValue( "VISU", "geom_sphere_resolution", GetResolution() ); + SetResolution( aResolution ); + QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp"; aMainTexture = aResourceMgr->stringValue( "VISU", "point_sprite_main_texture", aMainTexture ); @@ -234,6 +237,8 @@ VISU::GaussPoints_i SetTextures( Storable::FindValue(theMap,"myMainTexture"), Storable::FindValue(theMap,"myAlphaTexture") ); + SetResolution(Storable::FindValue(theMap,"myResolution").toInt()); + return this; } @@ -271,6 +276,8 @@ VISU::GaussPoints_i Storable::DataToStream( theStr, "myAlphaThreshold", GetAlphaThreshold() ); Storable::DataToStream( theStr, "myMainTexture", GetMainTexture() ); Storable::DataToStream( theStr, "myAlphaTexture", GetAlphaTexture() ); + + Storable::DataToStream( theStr, "myResolution", GetResolution() ); } @@ -371,6 +378,20 @@ VISU::GaussPoints_i return myGaussPointsPL->GetAlphaThreshold(); } +void +VISU::GaussPoints_i +::SetResolution( int theResolution ) +{ + myGaussPointsPL->SetResolution( theResolution ); +} + +int +VISU::GaussPoints_i +::GetResolution() +{ + return myGaussPointsPL->GetResolution(); +} + void VISU::GaussPoints_i ::SetPrimitiveType(int thePrimitiveType) @@ -538,7 +559,6 @@ VISU::GaussPoints_i try{ TSuperClass::CreateActor(theActor,theIO); theActor->GetPipeLine()->Delete(); - theActor->SetRepresentation(VTK_POINTS); UpdateActor(theActor); return true; }catch(...){ @@ -674,6 +694,11 @@ VISU::GaussPoints_i myColor.green() / 255.0, myColor.blue() / 255.0); } + + if( GetGaussPointsPL()->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere ) + theActor->SetRepresentation( VTK_POINTS ); + else + theActor->SetRepresentation( VTK_SURFACE ); } TSuperClass::UpdateActor(theActor); } diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index c6fe0cd9..14b0d10a 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -128,6 +128,14 @@ namespace VISU float GetAlphaThreshold(); + //! Redirect the request to VISU_GaussPointsPL::SetResolution. + void + SetResolution(int theResolution); + + //! Redirect the request to VISU_GaussPointsPL::GetResolution. + int + GetResolution(); + void SetPrimitiveType(int thePrimitiveType); diff --git a/src/VVTK/VVTK_PrimitiveBox.cxx b/src/VVTK/VVTK_PrimitiveBox.cxx index 8bb0b8ea..6170d09a 100644 --- a/src/VVTK/VVTK_PrimitiveBox.cxx +++ b/src/VVTK/VVTK_PrimitiveBox.cxx @@ -27,10 +27,13 @@ #include "VVTK_PrimitiveBox.h" +#include "VISU_OpenGLPointSpriteMapper.hxx" + #include "SUIT_ResourceMgr.h" #include "SUIT_Session.h" #include "QtxDblSpinBox.h" +#include "QtxIntSpinBox.h" #include #include @@ -59,7 +62,7 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : aLayout->setSpacing(6); aLayout->setMargin(11); - myPrimitiveType = VVTK_PrimitiveBox::PointSprite; + myPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; myMainTexture = aRootDir + "sprite_texture.bmp"; @@ -78,7 +81,7 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : aLayout->addMultiCellWidget( aPrimitiveTypeGroup, 0, 0, 0, 2 ); - // Clamp + // Clamp ( Point Sprite & OpenGL Point ) myClampLabel = new QLabel( tr( "CLAMP" ), this ); myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, this ); myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); @@ -86,7 +89,7 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : aLayout->addWidget( myClampLabel, 1, 0 ); aLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 ); - // Main Texture + // Main Texture ( Point Sprite ) myMainTextureLabel = new QLabel( tr( "MAIN_TEXTURE" ), this ); myMainTextureLineEdit = new QLineEdit( this ); myMainTextureButton = new QPushButton( this ); @@ -98,7 +101,7 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : aLayout->addWidget( myMainTextureLineEdit, 2, 1 ); aLayout->addWidget( myMainTextureButton, 2, 2 ); - // Alpha Texture + // Alpha Texture ( Point Sprite ) myAlphaTextureLabel = new QLabel( tr( "ALPHA_TEXTURE" ), this ); myAlphaTextureLineEdit = new QLineEdit( this ); myAlphaTextureButton = new QPushButton( this ); @@ -110,7 +113,7 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : aLayout->addWidget( myAlphaTextureLineEdit, 3, 1 ); aLayout->addWidget( myAlphaTextureButton, 3, 2 ); - // Alpha Threshold + // Alpha Threshold ( Point Sprite ) myAlphaThresholdLabel = new QLabel( tr( "ALPHA_THRESHOLD" ), this ); myAlphaThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, this ); myAlphaThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); @@ -118,6 +121,32 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : aLayout->addWidget( myAlphaThresholdLabel, 4, 0 ); aLayout->addMultiCellWidget( myAlphaThresholdSpinBox, 4, 4, 1, 2 ); + // Resolution ( Geometrical Sphere ) + myResolutionLabel = new QLabel( tr( "RESOLUTION" ), this ); + myResolutionSpinBox = new QtxIntSpinBox( 3, 100, 1, this ); + myResolutionSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + connect( myResolutionSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( onResolutionChanged( int ) ) ); + + aLayout->addWidget( myResolutionLabel, 1, 0 ); + aLayout->addMultiCellWidget( myResolutionSpinBox, 1, 1, 1, 2 ); + + // Number of faces ( Geometrical Sphere ) + myFaceNumberLabel = new QLabel( tr( "FACE_NUMBER" ), this ); + myFaceNumberLineEdit = new QLineEdit( this ); + myFaceNumberLineEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myFaceNumberLineEdit->setReadOnly( true ); + + aLayout->addWidget( myFaceNumberLabel, 2, 0 ); + aLayout->addMultiCellWidget( myFaceNumberLineEdit, 2, 2, 1, 2 ); + + // Notification ( Geometrical Sphere ) + myFaceLimitLabel = new QLabel( tr( "FACE_LIMIT" ), this ); + myFaceLimitSpinBox = new QtxIntSpinBox( 10, 10000, 10, this ); + myFaceLimitSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + aLayout->addWidget( myFaceLimitLabel, 3, 0 ); + aLayout->addMultiCellWidget( myFaceLimitSpinBox, 3, 3, 1, 2 ); + connect( myPointSpriteButton, SIGNAL( clicked() ), this, SLOT( onTogglePointSprite() ) ); connect( myOpenGLPointButton, SIGNAL( clicked() ), this, SLOT( onToggleOpenGLPoint() ) ); connect( myGeomSphereButton, SIGNAL( clicked() ), this, SLOT( onToggleGeomSphere() ) ); @@ -125,7 +154,7 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : void VVTK_PrimitiveBox::onTogglePointSprite() { - myPrimitiveType = VVTK_PrimitiveBox::PointSprite; + myPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; myClampLabel->show(); myClampSpinBox->show(); @@ -140,11 +169,20 @@ void VVTK_PrimitiveBox::onTogglePointSprite() myAlphaThresholdLabel->show(); myAlphaThresholdSpinBox->show(); + + myResolutionLabel->hide(); + myResolutionSpinBox->hide(); + + myFaceNumberLabel->hide(); + myFaceNumberLineEdit->hide(); + + myFaceLimitLabel->hide(); + myFaceLimitSpinBox->hide(); } void VVTK_PrimitiveBox::onToggleOpenGLPoint() { - myPrimitiveType = VVTK_PrimitiveBox::OpenGLPoint; + myPrimitiveType = VISU_OpenGLPointSpriteMapper::OpenGLPoint; myClampLabel->show(); myClampSpinBox->show(); @@ -159,11 +197,20 @@ void VVTK_PrimitiveBox::onToggleOpenGLPoint() myAlphaThresholdLabel->hide(); myAlphaThresholdSpinBox->hide(); + + myResolutionLabel->hide(); + myResolutionSpinBox->hide(); + + myFaceNumberLabel->hide(); + myFaceNumberLineEdit->hide(); + + myFaceLimitLabel->hide(); + myFaceLimitSpinBox->hide(); } void VVTK_PrimitiveBox::onToggleGeomSphere() { - myPrimitiveType = VVTK_PrimitiveBox::GeomSphere; + myPrimitiveType = VISU_OpenGLPointSpriteMapper::GeomSphere; myClampLabel->hide(); myClampSpinBox->hide(); @@ -178,6 +225,20 @@ void VVTK_PrimitiveBox::onToggleGeomSphere() myAlphaThresholdLabel->hide(); myAlphaThresholdSpinBox->hide(); + + myResolutionLabel->show(); + myResolutionSpinBox->show(); + + myFaceNumberLabel->show(); + myFaceNumberLineEdit->show(); + + myFaceLimitLabel->show(); + myFaceLimitSpinBox->show(); +} + +void VVTK_PrimitiveBox::onResolutionChanged( int theResolution ) +{ + setFaceNumber( 2 * theResolution * ( theResolution - 2 ) ); } void VVTK_PrimitiveBox::setPrimitiveType( int theType ) @@ -186,15 +247,15 @@ void VVTK_PrimitiveBox::setPrimitiveType( int theType ) switch( myPrimitiveType ) { - case VVTK_PrimitiveBox::PointSprite : + case VISU_OpenGLPointSpriteMapper::PointSprite : myPointSpriteButton->setChecked( true ); onTogglePointSprite(); break; - case VVTK_PrimitiveBox::OpenGLPoint : + case VISU_OpenGLPointSpriteMapper::OpenGLPoint : myOpenGLPointButton->setChecked( true ); onToggleOpenGLPoint(); break; - case VVTK_PrimitiveBox::GeomSphere : + case VISU_OpenGLPointSpriteMapper::GeomSphere : myGeomSphereButton->setChecked( true ); onToggleGeomSphere(); break; @@ -239,6 +300,36 @@ void VVTK_PrimitiveBox::setAlphaThreshold( float theAlphaThreshold ) myAlphaThresholdSpinBox->setValue( theAlphaThreshold ); } +int VVTK_PrimitiveBox::getResolution() const +{ + return myResolutionSpinBox->value(); +} + +void VVTK_PrimitiveBox::setResolution( int theResolution ) +{ + myResolutionSpinBox->setValue( theResolution ); +} + +int VVTK_PrimitiveBox::getFaceNumber() const +{ + return myFaceNumberLineEdit->text().toInt(); +} + +void VVTK_PrimitiveBox::setFaceNumber( int theFaceNumber ) +{ + myFaceNumberLineEdit->setText( QString::number( theFaceNumber ) ); +} + +int VVTK_PrimitiveBox::getFaceLimit() const +{ + return myFaceLimitSpinBox->value(); +} + +void VVTK_PrimitiveBox::setFaceLimit( int theFaceLimit ) +{ + myFaceLimitSpinBox->setValue( theFaceLimit ); +} + void VVTK_PrimitiveBox::onBrowseMainTexture() { QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; diff --git a/src/VVTK/VVTK_PrimitiveBox.h b/src/VVTK/VVTK_PrimitiveBox.h index 1c60329a..a6b8a0af 100644 --- a/src/VVTK/VVTK_PrimitiveBox.h +++ b/src/VVTK/VVTK_PrimitiveBox.h @@ -36,14 +36,12 @@ class QPushButton; class QRadioButton; class QtxDblSpinBox; +class QtxIntSpinBox; class VVTK_PrimitiveBox : public QGroupBox { Q_OBJECT -public: - enum { PointSprite = 0, OpenGLPoint, GeomSphere }; - public: VVTK_PrimitiveBox( QWidget* ); ~VVTK_PrimitiveBox() {} @@ -65,6 +63,15 @@ public: float getAlphaThreshold() const; void setAlphaThreshold( float ); + int getResolution() const; + void setResolution( int ); + + int getFaceNumber() const; + void setFaceNumber( int ); + + int getFaceLimit() const; + void setFaceLimit( int ); + protected slots: void onTogglePointSprite(); void onToggleOpenGLPoint(); @@ -73,6 +80,8 @@ protected slots: void onBrowseMainTexture(); void onBrowseAlphaTexture(); + void onResolutionChanged( int ); + private: int myPrimitiveType; @@ -96,6 +105,15 @@ private: QLabel* myAlphaThresholdLabel; QtxDblSpinBox* myAlphaThresholdSpinBox; + + QLabel* myResolutionLabel; + QtxIntSpinBox* myResolutionSpinBox; + + QLabel* myFaceNumberLabel; + QLineEdit* myFaceNumberLineEdit; + + QLabel* myFaceLimitLabel; + QtxIntSpinBox* myFaceLimitSpinBox; }; diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.cxx b/src/VVTK/VVTK_SegmentationCursorDlg.cxx index fcb7be80..1fa96fd2 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.cxx +++ b/src/VVTK/VVTK_SegmentationCursorDlg.cxx @@ -351,14 +351,14 @@ void VVTK_SegmentationCursorDlg::UpdateSegmentation() void VVTK_SegmentationCursorDlg::UpdateInsideGaussPoints() { - int aPrimitiveType = VVTK_PrimitiveBox::PointSprite; + int aPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; float aClamp = 200.0; QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp"; QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp"; float anAlphaThreshold = 0.1; int aMinSize = 3; int aMaxSize = 33; - float aMagnification = 100.0; + int aMagnification = 100; float anIncrement = 2.0; if( !myInsideCursorSettings->GetInitial() ) @@ -395,13 +395,13 @@ void VVTK_SegmentationCursorDlg::UpdateInsideGaussPoints() myInsidePrimitiveBox->setAlphaThreshold( anAlphaThreshold ); aMinSize = aResourceMgr->integerValue( "VISU", "inside_point_sprite_min_size", aMinSize ); - myInsideSizeBox->setMinSize( aMinSize ); + myInsideSizeBox->setMinSize( aMinSize / 100.0 ); aMaxSize = aResourceMgr->integerValue( "VISU", "inside_point_sprite_max_size", aMaxSize ); - myInsideSizeBox->setMaxSize( aMaxSize ); + myInsideSizeBox->setMaxSize( aMaxSize / 100.0 ); - aMagnification = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_magnification", aMagnification ); - myInsideSizeBox->setMagnification( aMagnification ); + aMagnification = aResourceMgr->integerValue( "VISU", "inside_point_sprite_magnification", aMagnification ); + myInsideSizeBox->setMagnification( aMagnification / 100.0 ); anIncrement = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_increment", anIncrement ); myInsideSizeBox->setIncrement( anIncrement ); @@ -412,7 +412,7 @@ void VVTK_SegmentationCursorDlg::UpdateInsideGaussPoints() void VVTK_SegmentationCursorDlg::UpdateOutsideGaussPoints() { float aClamp = 256.0; - int aPrimitiveType = VVTK_PrimitiveBox::PointSprite; + int aPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp"; QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp"; float anAlphaThreshold = 0.1; @@ -457,7 +457,7 @@ void VVTK_SegmentationCursorDlg::UpdateOutsideGaussPoints() myOutsidePrimitiveBox->setAlphaThreshold( anAlphaThreshold ); aSize = aResourceMgr->integerValue( "VISU", "outside_point_sprite_size", aSize ); - myOutsideSizeBox->setOutsideSize( aSize ); + myOutsideSizeBox->setOutsideSize( aSize / 100.0 ); aUniform = aResourceMgr->booleanValue( "VISU", "outside_point_sprite_uniform", aUniform ); myOutsideSizeBox->setUniform( aUniform ); diff --git a/src/VVTK/VVTK_SizeBox.cxx b/src/VVTK/VVTK_SizeBox.cxx index a6d545f7..227a3b96 100644 --- a/src/VVTK/VVTK_SizeBox.cxx +++ b/src/VVTK/VVTK_SizeBox.cxx @@ -31,6 +31,7 @@ #include "SUIT_Session.h" #include "QtxDblSpinBox.h" +#include "QtxIntSpinBox.h" #include #include @@ -65,7 +66,7 @@ VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : // Outside Size myOutsideSizeLabel = new QLabel( tr( "OUTSIDE_SIZE" ), SizeGroup ); - myOutsideSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); + myOutsideSizeSpinBox = new QtxIntSpinBox( 0, 100, 1, SizeGroup ); myOutsideSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SizeGroupLayout->addWidget( myOutsideSizeLabel, 0, 0 ); @@ -73,7 +74,7 @@ VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : // Geometry Size myGeomSizeLabel = new QLabel( tr( "GEOM_SIZE" ), SizeGroup ); - myGeomSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); + myGeomSizeSpinBox = new QtxIntSpinBox( 0, 100, 1, SizeGroup ); myGeomSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SizeGroupLayout->addWidget( myGeomSizeLabel, 0, 0 ); @@ -81,7 +82,7 @@ VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : // Min Size myMinSizeLabel = new QLabel( tr( "MIN_SIZE" ), SizeGroup ); - myMinSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); + myMinSizeSpinBox = new QtxIntSpinBox( 0, 100, 1, SizeGroup ); myMinSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SizeGroupLayout->addWidget( myMinSizeLabel, 1, 0 ); @@ -89,7 +90,7 @@ VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : // Max Size myMaxSizeLabel = new QLabel( tr( "MAX_SIZE" ), SizeGroup ); - myMaxSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); + myMaxSizeSpinBox = new QtxIntSpinBox( 0, 100, 1, SizeGroup ); myMaxSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SizeGroupLayout->addWidget( myMaxSizeLabel, 1, 2 ); @@ -97,7 +98,7 @@ VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : // Magnification myMagnificationLabel = new QLabel( tr( "MAGNIFICATION" ), SizeGroup ); - myMagnificationSpinBox = new QtxDblSpinBox( 10, 1000, 10, SizeGroup ); + myMagnificationSpinBox = new QtxIntSpinBox( 10, 1000, 10, SizeGroup ); myMagnificationSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); SizeGroupLayout->addWidget( myMagnificationLabel, 2, 0 ); @@ -220,52 +221,52 @@ void VVTK_SizeBox::setType( int theType ) float VVTK_SizeBox::getOutsideSize() const { - return myOutsideSizeSpinBox->value(); + return myOutsideSizeSpinBox->value() / 100.0; } void VVTK_SizeBox::setOutsideSize( float theOutsideSize ) { - myOutsideSizeSpinBox->setValue( theOutsideSize ); + myOutsideSizeSpinBox->setValue( theOutsideSize * 100.0 ); } float VVTK_SizeBox::getGeomSize() const { - return myGeomSizeSpinBox->value(); + return myGeomSizeSpinBox->value() / 100.0; } void VVTK_SizeBox::setGeomSize( float theGeomSize ) { - myGeomSizeSpinBox->setValue( theGeomSize ); + myGeomSizeSpinBox->setValue( theGeomSize * 100.0 ); } float VVTK_SizeBox::getMinSize() const { - return myMinSizeSpinBox->value(); + return myMinSizeSpinBox->value() / 100.0; } void VVTK_SizeBox::setMinSize( float theMinSize ) { - myMinSizeSpinBox->setValue( theMinSize ); + myMinSizeSpinBox->setValue( theMinSize * 100.0 ); } float VVTK_SizeBox::getMaxSize() const { - return myMaxSizeSpinBox->value(); + return myMaxSizeSpinBox->value() / 100.0; } void VVTK_SizeBox::setMaxSize( float theMaxSize ) { - myMaxSizeSpinBox->setValue( theMaxSize ); + myMaxSizeSpinBox->setValue( theMaxSize * 100.0 ); } float VVTK_SizeBox::getMagnification() const { - return myMagnificationSpinBox->value(); + return myMagnificationSpinBox->value() / 100.0; } void VVTK_SizeBox::setMagnification( float theMagnification ) { - myMagnificationSpinBox->setValue( theMagnification ); + myMagnificationSpinBox->setValue( theMagnification * 100.0 ); } float VVTK_SizeBox::getIncrement() const diff --git a/src/VVTK/VVTK_SizeBox.h b/src/VVTK/VVTK_SizeBox.h index 69a8d4a9..55067caa 100644 --- a/src/VVTK/VVTK_SizeBox.h +++ b/src/VVTK/VVTK_SizeBox.h @@ -37,6 +37,7 @@ class QCheckBox; class QGroupBox; class QtxDblSpinBox; +class QtxIntSpinBox; class VVTK_SizeBox : public QVBox { @@ -88,19 +89,19 @@ private: int myType; QLabel* myOutsideSizeLabel; - QtxDblSpinBox* myOutsideSizeSpinBox; + QtxIntSpinBox* myOutsideSizeSpinBox; QLabel* myGeomSizeLabel; - QtxDblSpinBox* myGeomSizeSpinBox; + QtxIntSpinBox* myGeomSizeSpinBox; QLabel* myMinSizeLabel; - QtxDblSpinBox* myMinSizeSpinBox; + QtxIntSpinBox* myMinSizeSpinBox; QLabel* myMaxSizeLabel; - QtxDblSpinBox* myMaxSizeSpinBox; + QtxIntSpinBox* myMaxSizeSpinBox; QLabel* myMagnificationLabel; - QtxDblSpinBox* myMagnificationSpinBox; + QtxIntSpinBox* myMagnificationSpinBox; QLabel* myIncrementLabel; QtxDblSpinBox* myIncrementSpinBox;